rIIh / expandable-bottom-bar

Expandable bottom app bar widget for Flutter SDK
MIT License
108 stars 27 forks source link

close programical bottom-bar #6

Closed pishguy closed 5 years ago

pishguy commented 5 years ago

how can i close programical

Tyxz commented 5 years ago

With the controller:

BottomBarController controller = BottomBarController(...);
BottomExpandableAppBar(
  controller: controller,
);
controller.close(); // Close sheet
controller.swap(); // Open sheet if closed before and closes it if it was opened

Probably, also possible with the default controller:

BottomBarController.of(context).close();

The documentation is a little bit lacking, but the code is clean and simple. You can see all possible methods there: Controller


  //close the panel
  void close() {
    _animationController.fling(velocity: -1.0);
  }

  void swap() {
    if (_animationController.value == 1)
      close();
    else if (_animationController.value == 0) open();
  }

  //open the panel
  void open() {
    _animationController.fling(velocity: 1.0);
}