Skip to content

Instantly share code, notes, and snippets.

@Nikhil725051
Created April 12, 2022 04:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nikhil725051/de2a876e17f4e003080c5e918e14ac7a to your computer and use it in GitHub Desktop.
Save Nikhil725051/de2a876e17f4e003080c5e918e14ac7a to your computer and use it in GitHub Desktop.
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Drawer Example"), backgroundColor: Colors.deepPurple,),
body: const Center(
child: Text('Flutter Drawer Example'),
),
drawer: Drawer(
// Add a ListView to the drawer.
child: ListView(
// Ensure that ListView doesn't have any padding.
// This line will Remove any padding from the ListView.
padding: EdgeInsets.zero,
children: [
DrawerHeader(
decoration: BoxDecoration(
color: Colors.deepPurple,
),
child: Image.asset("assets/images/mail.png")
),
ListTile(
title: const Text('Inbox'),
onTap: () {
// Here you can Update the state of the app,
//like, navigating to the screen the user has selected
// ...
// After User has selected the option,
// close the drawer
Navigator.pop(context);
},
),
ListTile(
title: const Text('Sent Messages'),
onTap: () {
// Here you can Update the state of the app,
//like, navigating to the screen the user has selected
// ...
// After User has selected the option,
// close the drawer
Navigator.pop(context);
},
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment