import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Mint Retail'),
),
drawer: CustomDrawer(),
body: Center(
child: Text('Home Page Content'),
),
),
);
}
}
class CustomDrawer extends StatefulWidget {
@override
_CustomDrawerState createState() => _CustomDrawerState();
}
class _CustomDrawerState extends State<CustomDrawer> {
bool isHistoryExpanded = false;
@override
Widget build(BuildContext context) {
return Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: <Widget>[
DrawerHeader(
decoration: BoxDecoration(
color: Colors.blue,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CircleAvatar(
backgroundColor: Colors.white,
child: Icon(Icons.store),
),
SizedBox(height: 10),
Text(
'Mint Retail',
style: TextStyle(
color: Colors.white,
fontSize: 24,
),
),
Text(
'Testing Mint Retail',
style: TextStyle(
color: Colors.white,
),
),
],
),
),
ListTile(
leading: Icon(Icons.home),
title: Text('Home'),
onTap: () {
Navigator.pop(context);
},
),
ListTile(
leading: Icon(Icons.shopping_cart),
title: Text('Produk'),
onTap: () {
Navigator.pop(context);
},
),
ListTile(
leading: Icon(Icons.category),
title: Text('Kategori'),
onTap: () {
Navigator.pop(context);
},
),
ExpansionTile(
leading: Icon(Icons.history),
title: Text('History'),
children: <Widget>[
ListTile(
leading: Icon(Icons.history),
title: Text('History'),
onTap: () {
Navigator.pop(context);
},
),
ListTile(
leading: Icon(Icons.assessment),
title: Text('Summary'),
onTap: () {
Navigator.pop(context);
},
),
],
onExpansionChanged: (bool expanded) {
setState(() {
isHistoryExpanded = expanded;
});
},
),
ListTile(
leading: Icon(Icons.person),
title: Text('Profile'),
onTap: () {
Navigator.pop(context);
},
),
Divider(),
ListTile(
leading: Icon(Icons.logout),
title: Text('Logout'),
onTap: () {
// Aksi logout
Navigator.pop(context);
},
),
],
),
);
}
}