Add a Drawer to a screen:
In any apps that employ Material Design, We have two primary options for navigation: tabs and drawers. When there is insufficient space to support tabs, Drawers provide a handy alternative.
In Flutter, we can achieve this with
Drawer Widget in combination with a
Scaffold to create a layout with a Material Design Drawer!
Using Drawers in Flutter App:
- Create a
- Add a drawer
- Populate the drawer with items
- Close the drawer programmatically
To add a Drawer to our app, we’ll need to wrap it in a
Scaffold Widget. The Scaffold Widget provides a consistent visual structure to apps that follow the Material Design Guidelines.
Scaffold also supports special Material Design components, such as Drawers, AppBars, and SnackBars.
In below example code we are creating a
Scaffold with drawer.