Creating a navigation drawer in a Flutter app is essential for apps that require side-menu navigation for multiple pages. Flutter, being a powerful UI toolkit by Google, provides a built-in Drawer
widget to help developers add a customizable sidebar easily.

In this article, you’ll learn how to create a basic navigation drawer in Flutter, integrate it with multiple pages, and apply styling for a better user experience.
What is a Navigation Drawer?
A navigation drawer is a sliding panel that appears from the left edge of the screen, commonly used to show app sections like Home, Settings, Profile, etc. It’s useful for apps with complex navigation.
Step-by-Step Guide to Implement Drawer:
1. Set Up Your Flutter App
Make sure you’ve installed Flutter and set up your development environment. You can check the official installation guide here.
2. Sample Flutter Code for Navigation Drawer:
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends <a href="https://aliendro.id/create-ui-with-statelesswidget-in-dart/">StatelessWidget</a> {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: '<a href="https://aliendro.id/bottomnavigationbar-tutorial-in-dart/">Flutter Navigation</a> Drawer',
home: HomeScreen(),
);
}
}
class HomeScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Navigation Drawer Example'),
),
drawer: Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: <Widget>[
DrawerHeader(
decoration: BoxDecoration(color: Colors.blue),
child: Text(
'Drawer Header',
style: TextStyle(color: Colors.white, fontSize: 24),
),
),
ListTile(
leading: Icon(Icons.home),
title: Text('Home'),
onTap: () {
Navigator.pop(context);
},
),
ListTile(
leading: Icon(Icons.settings),
title: Text('Settings'),
onTap: () {
Navigator.pop(context);
},
),
],
),
),
body: Center(
child: Text('Swipe from the left to see the drawer.'),
),
);
}
}
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends <a href="https://aliendro.id/create-ui-with-statelesswidget-in-dart/">StatelessWidget</a> {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: '<a href="https://aliendro.id/bottomnavigationbar-tutorial-in-dart/">Flutter Navigation</a> Drawer',
home: HomeScreen(),
);
}
}
class HomeScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Navigation Drawer Example'),
),
drawer: Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: <Widget>[
DrawerHeader(
decoration: BoxDecoration(color: Colors.blue),
child: Text(
'Drawer Header',
style: TextStyle(color: Colors.white, fontSize: 24),
),
),
ListTile(
leading: Icon(Icons.home),
title: Text('Home'),
onTap: () {
Navigator.pop(context);
},
),
ListTile(
leading: Icon(Icons.settings),
title: Text('Settings'),
onTap: () {
Navigator.pop(context);
},
),
],
),
),
body: Center(
child: Text('Swipe from the left to see the drawer.'),
),
);
}
}
import 'package:flutter/material.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Navigation Drawer', home: HomeScreen(), ); } } class HomeScreen extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Navigation Drawer Example'), ), drawer: Drawer( child: ListView( padding: EdgeInsets.zero, children: <Widget>[ DrawerHeader( decoration: BoxDecoration(color: Colors.blue), child: Text( 'Drawer Header', style: TextStyle(color: Colors.white, fontSize: 24), ), ), ListTile( leading: Icon(Icons.home), title: Text('Home'), onTap: () { Navigator.pop(context); }, ), ListTile( leading: Icon(Icons.settings), title: Text('Settings'), onTap: () { Navigator.pop(context); }, ), ], ), ), body: Center( child: Text('Swipe from the left to see the drawer.'), ), ); } }
Key Features of This Drawer:
- Simple and clean layout
- Integrated with
Scaffold
for automatic drawer handling - Customizable
DrawerHeader
and menu items
Tips for Better UX:
- Use icons and labels clearly
- Highlight active page
- Add logout or settings at the bottom for better navigation hierarchy