make nav drawer flutter code example
Example 1: app drawer in flutter
class navigationDrawer extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: <Widget>[
createDrawerHeader(),
createDrawerBodyItem(
icon: Icons.home,text: 'Home'),
createDrawerBodyItem(
icon: Icons.account_circle,text: 'Profile'),
createDrawerBodyItem(
icon: Icons.event_note,text: 'Events'),
Divider(),
createDrawerBodyItem(
icon: Icons.notifications_active,text: 'Notifications'),
createDrawerBodyItem(
icon: Icons.contact_phone,text: 'Contact Info'),
ListTile(
title: Text('App version 1.0.0'),
onTap: () {},
),
],
),
);
}
}
Example 2: flutter navigation drawer
Widget _createHeader() { return DrawerHeader( margin: EdgeInsets.zero, padding: EdgeInsets.zero, decoration: BoxDecoration( image: DecorationImage( fit: BoxFit.fill, image: AssetImage('path/to/header_background.png'))), child: Stack(children: <Widget>[ Positioned( bottom: 12.0, left: 16.0, child: Text("Flutter Step-by-Step", style: TextStyle( color: Colors.white, fontSize: 20.0, fontWeight: FontWeight.w500))), ]));}