Kasir Grosir: starter Flutter POS (scaffold awal)
This commit is contained in:
46
lib/widgets/app_drawer.dart
Normal file
46
lib/widgets/app_drawer.dart
Normal file
@@ -0,0 +1,46 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'menu_tile.dart';
|
||||
|
||||
class AppDrawer extends StatelessWidget {
|
||||
const AppDrawer({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Drawer(
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
UserAccountsDrawerHeader(
|
||||
accountName: const Text('Toko UMKM'),
|
||||
accountEmail: const Text('user@contoh.com'),
|
||||
currentAccountPicture: const CircleAvatar(child: Text('TK')),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: const [
|
||||
MenuTile(icon: Icons.dashboard, title: 'Dashboard', route: '/dashboard'),
|
||||
MenuTile(icon: Icons.point_of_sale, title: 'POS', route: '/pos'),
|
||||
MenuTile(icon: Icons.inventory_2, title: 'Products', route: '/products'),
|
||||
MenuTile(icon: Icons.people, title: 'Customers', route: '/customers'),
|
||||
MenuTile(icon: Icons.local_shipping, title: 'Suppliers', route: '/suppliers'),
|
||||
MenuTile(icon: Icons.playlist_add_check, title: 'Purchase Orders', route: '/purchase_orders'),
|
||||
MenuTile(icon: Icons.money, title: 'Accounts Receivable', route: '/ar'),
|
||||
MenuTile(icon: Icons.warehouse, title: 'Inventory', route: '/inventory'),
|
||||
MenuTile(icon: Icons.bar_chart, title: 'Reports', route: '/reports'),
|
||||
MenuTile(icon: Icons.settings, title: 'Settings', route: '/settings'),
|
||||
MenuTile(icon: Icons.people_alt, title: 'Users', route: '/users'),
|
||||
MenuTile(icon: Icons.build, title: 'Utilities', route: '/utilities'),
|
||||
],
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.exit_to_app),
|
||||
title: const Text('Logout'),
|
||||
onTap: () {},
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
28
lib/widgets/menu_tile.dart
Normal file
28
lib/widgets/menu_tile.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MenuTile extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final String title;
|
||||
final String route;
|
||||
|
||||
const MenuTile({
|
||||
Key? key,
|
||||
required this.icon,
|
||||
required this.title,
|
||||
required this.route,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
leading: Icon(icon),
|
||||
title: Text(title),
|
||||
onTap: () {
|
||||
Navigator.pop(context); // close drawer
|
||||
if (ModalRoute.of(context)?.settings.name != route) {
|
||||
Navigator.pushNamed(context, route);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
34
lib/widgets/template_screen.dart
Normal file
34
lib/widgets/template_screen.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class TemplateScreen extends StatelessWidget {
|
||||
final String title;
|
||||
final Widget body;
|
||||
final List<Widget>? actions;
|
||||
final FloatingActionButton? fab;
|
||||
final Widget? drawer;
|
||||
|
||||
const TemplateScreen({
|
||||
Key? key,
|
||||
required this.title,
|
||||
required this.body,
|
||||
this.actions,
|
||||
this.fab,
|
||||
this.drawer,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(title),
|
||||
actions: actions,
|
||||
),
|
||||
drawer: drawer,
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: body,
|
||||
),
|
||||
floatingActionButton: fab,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user