-
-
Save Nikhil725051/120c076a1211cc34692633aa17e4ad47 to your computer and use it in GitHub Desktop.
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(const MyApp()); | |
class MyApp extends StatelessWidget { | |
const MyApp({Key? key}) : super(key: key); | |
static const appTitle = 'Drawer with Icons'; | |
@override | |
Widget build(BuildContext context) { | |
return const MaterialApp( | |
title: appTitle, | |
home: MyHomePage(title: appTitle), | |
); | |
} | |
} | |
class MyHomePage extends StatelessWidget { | |
const MyHomePage({Key? key, required this.title}) : super(key: key); | |
final String title; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar(title: Text(title)), | |
body: const Center( | |
child: Text('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: [ | |
const DrawerHeader( | |
decoration: BoxDecoration( | |
color: Colors.blue, | |
), | |
child: Icon(Icons.mark_email_read_outlined,size: 50), | |
), | |
Container( | |
height: 50, | |
child: InkWell( | |
child: Padding( | |
padding: EdgeInsets.only(left:15), | |
child: Row( | |
children: <Widget>[ | |
Icon(Icons.email), | |
SizedBox(width:10), | |
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); | |
})), | |
Container( | |
height: 50, | |
child: InkWell( | |
child: Padding( | |
padding: EdgeInsets.only(left:15), | |
child: Row( | |
children: <Widget>[ | |
Icon(Icons.send), | |
SizedBox(width:10), | |
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