Skip to content

Instantly share code, notes, and snippets.

@Nikhil725051
Created April 21, 2022 03:48
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Nikhil725051/f6c2249a97aff21b721880bb8d56ad99 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
void main()
{
runApp(MyApp());
}
class MyApp extends StatelessWidget
{
@override
Widget build(BuildContext context)
{
return MaterialApp(
home: MyHomePage()
);
}
}
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Drawer with icons"), backgroundColor: Colors.deepPurple,),
body: const Center(
child: Text('Flutter Drawer with icons'),
),
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: Icon(Icons.mark_email_read_outlined,size: 50,)
),
ListTile(
leading: Icon(Icons.email),
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(
leading: Icon(Icons.send),
title: const Text('Sent'),
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