Create Drawer With Title Header in Flutter

Edwin
Mar 13, 2022

--

Create Scaffold

At home class, create a scaffold widget and inside that widget add drawer.

Scaffold(
drawer: const CustomDrawer(),
body: ....
)

Create CustomDrawer

...
Widget build(BuildContext context) {
return Drawer(
child: ListView(
children: [
SizedBox(height: 80, child:
child: DrawerHeader(
child: Image.network("url", fit: BoxFit.contain),
),
),
ListTile(
onTap: () {}
horizontalTitleGap: 0.0,
leading: Icon(Icons.add, color: Colors.black, height: 16),
title: Text("Add New", style: TextStyle(color: Colors.black),),
),
const Divider(
height: 1,
thickness: 1,
),
const Padding(
padding: EdgeInsets.all(16.0),
child: Text('Header'),
),
ListTile(
onTap: () {}
horizontalTitleGap: 0.0,
leading: Icon(Icons.add, color: Colors.black, height: 16),
title: Text("Add New", style: TextStyle(color: Colors.black),),
),
]
),
);
}
...

Follow me @slimpotatoboy : Twitter, Instagram

--

--

Edwin
Edwin

Written by Edwin

I am a passionate Developer, been working in IT field for more than 4 years. Currently Documenting my journey in Youtube: @ EdwinOslenTV

No responses yet