Ngoding Ngebut dengan Flutter Hyper Extension

Ilham Maulana 

Jakarta, 31 Maret 2023

Clone Github

git clone

Install Extension

Struktur Folder

jalankan aplikasi

flutter run -d windows

image_asset

text15

              Image.asset(
                "assets/icon/icon.png",
                width: 120.0,
                height: 120.0,
                fit: BoxFit.fill,
              ),
              const Text(
                "SIRUP MOBILE",
                style: TextStyle(
                  fontSize: 15.0,
                  fontWeight: FontWeight.bold,
                ),
              ),
  Future delayPage() async {
    await Future.delayed(const Duration(seconds: 3), () {
      Get.offAll(const LoginView());
    });
  }

SplashController  ctrl + shift + c

SplashView  ctrl + shift + v

q_textfield

import 'package:flutter/material.dart';
import 'package:sirup_mobile/core.dart';

class LoginView extends StatefulWidget {
  const LoginView({Key? key}) : super(key: key);

  Widget build(context, LoginController controller) {
    controller.view = this;

    final formKey = GlobalKey<FormState>();

    return Scaffold(
      body: Form(
        key: formKey,
        child: Center(
          child: Container(
            margin: const EdgeInsets.all(10),
            padding: const EdgeInsets.all(10.0),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                Image.asset(
                  "assets/icon/icon.png",
                  width: 120.0,
                  height: 120.0,
                  fit: BoxFit.fill,
                ),
                const Text(
                  "SIRUP MOBILE",
                  style: TextStyle(
                    fontSize: 15.0,
                    fontWeight: FontWeight.bold,
                  ),
                ),
                QTextField(
                  label: "Username",
                  // hint: "Username",
                  validator: Validator.required,
                  // value: "John Doe",
                  onChanged: (value) {
                    controller.username = value;
                  },
                ),
                QTextField(
                  label: "Password",
                  // hint: "Your password",
                  obscure: true,
                  validator: Validator.required,
                  suffixIcon: Icons.password,
                  // value: "123456",
                  onChanged: (value) {
                    controller.password = value;
                  },
                ),
                controller.isLoading
                    ? const CircularProgressIndicator()
                    : Container(
                        height: 64,
                        width: MediaQuery.of(context).size.width,
                        padding: const EdgeInsets.all(12.0),
                        child: ElevatedButton(
                          style: ElevatedButton.styleFrom(
                            backgroundColor: Colors.blueGrey,
                          ),
                          onPressed: () {
                            if (formKey.currentState!.validate()) {
                              controller.doLogin();
                            } else {
                              snackbarIconDanger(message: 'not valid');
                            }
                          },
                          child: const Text("Login"),
                        ),
                      ),
              ],
            ),
          ),
        ),
      ),
    );
  }

  @override
  State<LoginView> createState() => LoginController();
}
import 'package:flutter/material.dart';
import '../../../../core.dart';

class LoginController extends State<LoginView> implements MvcController {
  static late LoginController instance;
  late LoginView view;

  String username = '';
  String password = '';
  bool isLoading = false;

  Future<void> doLogin() async {
    isLoading = true;
    update();
    if (username == 'admin' && password == 'admin') {
      await Future.delayed(const Duration(seconds: 1), () {
        snackbarIconSoftPrimary(message: 'login success');
        Get.offAll(const HomeView());
      });
    } else {
      snackbarIconSoftDanger(message: 'username or password not found');
    }
    isLoading = false;
    update();
  }

  @override
  void initState() {
    instance = this;
    super.initState();
  }

  @override
  void dispose() => super.dispose();

  @override
  Widget build(BuildContext context) => widget.build(context, this);
}
  Future delayPage() async {
    await Future.delayed(const Duration(seconds: 3), () {
      Get.offAll(const LoginView());
    });
  }

LoginController  ctrl + shift + c

Loginview  ctrl + shift + v

q_password

button_f

scaffold_drawer

import 'package:flutter/material.dart';
import 'package:sirup_mobile/core.dart';

class HomeView extends StatefulWidget {
  const HomeView({Key? key}) : super(key: key);

  Widget build(context, HomeController controller) {
    controller.view = this;

    return Scaffold(
      appBar: AppBar(
        title: const Text(
          "SIRUP MOBILE",
          style: TextStyle(
            fontSize: 12.0,
          ),
        ),
      ),
      drawer: Drawer(
        child: ListView(
          children: [
            UserAccountsDrawerHeader(
              accountName: const Text("Ilham Maulana"),
              accountEmail: const Text("flutter.id"),
              currentAccountPicture: const CircleAvatar(
                backgroundImage: NetworkImage(
                    "https://images.unsplash.com/photo-1600486913747-55e5470d6f40?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1170&q=80"),
              ),
              decoration: BoxDecoration(
                color: Colors.blueGrey[900],
              ),
            ),
            ListTile(
              leading: const Icon(Icons.home),
              title: const Text("Home"),
              onTap: () {},
            ),
            ListTile(
              leading: const Icon(Icons.code),
              title: const Text("Profile"),
              onTap: () {
                Get.to(const ProfileView());
              },
            ),
            ListTile(
              leading: const Icon(
                Icons.logout,
              ),
              title: const Text("Logout"),
              onTap: () {
                Get.offAll(const LoginView());
              },
            )
          ],
        ),
      ),
    );
  }

  @override
  State<HomeView> createState() => HomeController();
}

HomeController  ctrl + shift + c

Homeview  ctrl + shift + v

scaffold_image

import 'package:flutter/material.dart';
import 'package:sirup_mobile/core.dart';
import '../controller/profile_controller.dart';

class ProfileView extends StatefulWidget {
  const ProfileView({Key? key}) : super(key: key);

  Widget build(context, ProfileController controller) {
    controller.view = this;

    return Scaffold(
      extendBody: true,
      extendBodyBehindAppBar: true,
      appBar: AppBar(
        backgroundColor: Colors.transparent,
        elevation: 0.0,
        title: const Text("Dashboard"),
        actions: const [],
      ),
      body: SingleChildScrollView(
        child: Column(
          children: [
            Container(
              height: 180.0,
              width: MediaQuery.of(context).size.width,
              decoration: const BoxDecoration(
                image: DecorationImage(
                  image: NetworkImage(
                    "https://images.unsplash.com/photo-1540959733332-eab4deabeeaf?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1194&q=80",
                  ),
                  fit: BoxFit.cover,
                ),
              ),
              child: Container(
                decoration: const BoxDecoration(
                  color: Colors.black45,
                ),
                child: Stack(
                  children: const [
                    Align(
                      alignment: Alignment.bottomCenter,
                      child: Padding(
                        padding: EdgeInsets.all(12.0),
                        child: CircleAvatar(
                          radius: 36.0,
                          backgroundImage: NetworkImage(
                            "https://i.ibb.co/PGv8ZzG/me.jpg",
                          ),
                        ),
                      ),
                    ),
                  ],
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }

  @override
  State<ProfileView> createState() => ProfileController();
}

ProfileController  ctrl + shift + c

ProfileView  ctrl + shift + v

list_builder

import 'package:flutter/material.dart';
import 'package:sirup_mobile/core.dart';
import '../controller/list_karyawan_controller.dart';

class ListKaryawanView extends StatefulWidget {
  const ListKaryawanView({Key? key}) : super(key: key);

  Widget build(context, ListKaryawanController controller) {
    controller.view = this;

    return Scaffold(
      appBar: AppBar(
        title: const Text("ListKaryawan"),
        actions: const [],
      ),
      body: ListView.builder(
        itemCount: 3,
        physics: const ScrollPhysics(),
        itemBuilder: (BuildContext context, int index) {
          return Card(
            child: ListTile(
              leading: CircleAvatar(
                backgroundColor: Colors.grey[200],
                backgroundImage: const NetworkImage(
                  "https://i.ibb.co/QrTHd59/woman.jpg",
                ),
              ),
              title: const Text("Jessica Doe"),
              subtitle: const Text("Programmer"),
            ),
          );
        },
      ),
    );
  }

  @override
  State<ListKaryawanView> createState() => ListKaryawanController();
}

ListkaryawanController  ctrl + shift + c

ListKaryawanView  ctrl + shift + v

ngebut-flutter

By Maulana Ilham

ngebut-flutter

Ngoding ngebut dengan flutter hyper extension

  • 176