Dn-a / flutter_inner_drawer

Inner Drawer is an easy way to create an internal side section (left/right) where you can insert a list-menu or other.
https://pub.dartlang.org/packages/flutter_inner_drawer
MIT License
514 stars 129 forks source link

Hey! I just wanted to ask... How do you actually bring the drawer up by tapping on an icon? #65

Closed VaibhavKukreti-Kathud closed 2 years ago

VaibhavKukreti-Kathud commented 3 years ago

#

nivisi commented 3 years ago

As I understand, you want to have something like a menu icon in the app bar that would open the drawer on tap? If so, you need to:

Get a key inside your widget:

final _innerDrawerKey = GlobalKey<InnerDrawerState>();

Provide the key to your drawer:

InnerDrawer(
  key: _innerDrawerKey,
  rightChild: ...,
  scaffold: ...,
);

And in onPressed:

onPressed: () {
  _innerDrawerKey.currentState.toggle();
  // or _innerDrawerKey.currentState.open();
},
nivisi commented 3 years ago

@VaibhavKukreti-Kathud ping 😀

VaibhavKukreti-Kathud commented 2 years ago

Oh sorry didn't reply for a long time thanks for the reply :)