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
154 stars 39 forks source link

Add callback to report on drag progress #10

Closed cachapa closed 2 years ago

cachapa commented 2 years ago

We're trying to fade out the page background (which is separate from the DismissiblePage widget) when the user starts dragging, but unfortunately there's no way to get the drag progress.

It would be nice if the drag progress could be reported via a callback, ideally with a value of 0.0-1.0, indicating how much the dismissible has been dragged compared to its total width/height.

Tkko commented 2 years ago

Sure, will do.

aytunch commented 2 years ago

Maybe exposing the Rect can be more useful than a double value for other use cases as well.

Tkko commented 2 years ago

Maybe exposing the Rect can be more useful than a double value for other use cases as well.

Could you elaborate more why Rect will be more useful? Any use case example.

aytunch commented 2 years ago

@Tkko The current screen being dismissed can be dismissed from all directions with your new addition to the package, thanks btw (towards bottom, left, right, top). Also the screen can get smaller while being dismissed. If we expose the dismissing screen's Rect, the first advantage that comes to my mind is we can know if the screen is being dismissed vertically or horizontally. With just a double between 0 and 1, let's say 0.5, we don't know if the screen's bottom or left half is being shown. I am positive that having more info coming from your API will be useful for us users in the long run. We can have a simple getter which gives the double value calculated easily from the visible Rect too..

Tkko commented 2 years ago

Convinced, Thanks.

Tkko commented 2 years ago

Hey guys, long time no see, check out the new version 0.7.3 onDragUpdate outputs DismissiblePageDragUpdateDetails

  final double overallDragValue;
  final double radius;
  final double opacity;
  final double scale;
  final Offset offset;