/DrawerWithIconsListTile.dart Secret
Created
April 21, 2022 03:48
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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