Skip to content

Instantly share code, notes, and snippets.

@Nikhil725051
Created April 21, 2022 04:16
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/120c076a1211cc34692633aa17e4ad47 to your computer and use it in GitHub Desktop.
Save Nikhil725051/120c076a1211cc34692633aa17e4ad47 to your computer and use it in GitHub Desktop.
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