Tkko / Flutter_dismissible_page

Flutter page widget that is dismissed by swipe gestures, with Hero style animations, Inspired by Facebook and Instagram stories.
https://pub.dev/packages/dismissible_page
MIT License
151 stars 39 forks source link

Prevent dragging programatically #28

Open simplenotezy opened 1 year ago

simplenotezy commented 1 year ago

It would be cool with a way to programatically set whether or not dragging was disabled, e.g. adding the option to pass an async callback function that determines whether or not dragging is disabled, or by adding some kind of controller.

The reason is with only having it as a property is it will cause all childs to re-render.

We have a scenario where when keyboard is visible we want to disable dragging, and when we do this, a re-render is triggered causing the keyboard (for some reason) to loose it's focus

brvm commented 1 year ago

@simplenotezy why don't you wrap the DismissiblePage in a StreamBuilder and alter the DismissiblePageDismissDirection to be none when the keyboard is visible?

Using a StreamBuilder you can alter the DismissiblePageDismissDirection without all the children being rerendered.