How to open drawer on button click in Flutter?

This Article is posted by seven.srikanth at 5/23/2020 7:33:14 PM



Usually, there will be an Icon button added to appbar when you add a drawer to the scaffold.
But when you have a custom appbar and you may need to add the button with on tap and below is the ontap code that helps you to open the Drawer.

             Scaffold.of(context).openDrawer();
In my case, I added this button to an InkWell like below. 

InkWell( onTap: (){ Scaffold.of(context).openDrawer(); }, child: Icon( Icons.menu, size: appBarMenuIconSize, ), ),
Hope this helps.  
Thanks,
Srikanth

Tags:








0 Comments
Login to comment.
Recent Comments

Be the first to Comment. You can ask a Query or Share your toughts or Just say thanks.


© 2018 - Fluttercentral | Email to me - seven.srikanth@gmail.com