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

innerDrawerCallback parameter -> which side #56

Open noobloser opened 3 years ago

noobloser commented 3 years ago

The passing value for innerDrawerCallBack does not define rn which side of the drawer is opened. It would be great to get ahold of this information somehow. (I saw one issue here, where someone requested the extension of the GlobalKey to not only change the state, but also get the value, which sounds nice imo :D)

EbramTawfik commented 3 years ago

@noobloser did you find a workaround to find which side called the callback? I found workaround: 1- onDragUpdate will set which direction. 2- innerDrawerCallback will set open or close

      onDragUpdate: (value, direction) {
        _direction = direction;
      },
      innerDrawerCallback: (isOpen) {
        if (onChange != null) {
          onChange(isOpen, _direction);
        }
      },
noobloser commented 3 years ago

@EbramTawfik I did not work on it any further till now, as my application has more major problems rn :/

Also if I remember that correctly, I used onDragUpdate before, but it fires based on the swipe direction, so it does not fire, when I use my own button to open the drawer. (correct me if I'm wrong)

But based on your approach, I could set the _direction in onDragUpdate, as well as in the buttons onPressed Callback, which would be a working approach (even though it is kind of hacky)

EbramTawfik commented 3 years ago

@noobloser it fires on both swipe and toggle from the button. But I will try again to confirm.