akshathjain / sliding_up_panel

A draggable Flutter widget that makes implementing a SlidingUpPanel much easier!
https://pub.dartlang.org/packages/sliding_up_panel
Other
1.38k stars 378 forks source link

[Feature Request] Add ChangeNotifier or Streams to be able to react to state changes #227

Open crtl opened 3 years ago

crtl commented 3 years ago

Thank you very much for the library it is a great help. Nonetheless its missing a ChangeNotfier or some other API to be able to listen to PanelController changes.

Currently the only way to do this is using onPanelOpened and onPanelClosed callbacks and manually manage its state by using a stream or setState:

SlidingUpPanel(
 onPanelOpened: () => setState(() {
   panelOpened = true;
 })
 onPanelClosed: () => setState(() {
   panelOpened = false;
 })

It would be easiert to do this over the controller so you have everyting in one place and can pass it around without managing state by yourself:

SlidingUpPanel(
  controller: panelController,
);

// ....

panelController.addListener(() {
});