Drawers in Flutter
Let’s see how to make drawers in flutter. (Code is in bottom)
For drawer we need a hamburger icon in app bar( Not necessary but it looks if we have hamburger icon and app bar).
We all know that SCAFFOLD widget provides all basic things required for app’s ui. One of those is Drawer. So let’s have scaffold with appbar and drawer in it.
We will initiate Stateful class with scaffold, appbar , drawer in it.
App will look like this. It has a drawer and appbar. Let’s put some widgets in drawer.
Add ListView in drawer widget. Then add a DrawerHeader (widget provided by flutter) and two list tiles with title as item1 and item2 .
Code will look like this
And app will look like this
This is it. We made a drawer with some widgets into it. Let me know if anyone want advanced version of Drawer.
Connect with me on: Github Twitter LinkedIn Instagram Youtube Patreon
#HappyCoding #flutter #drawer #menu #tutorial