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

Changing DismissiblePageDimissDirection resets scrollview position #30

Closed brvm closed 1 year ago

brvm commented 1 year ago

When using states to change the DimissiblePageDismissDirection with a CustomScrollView as child, change the direction to multi or down, resets the scrollposition to of the CustomScrollView to the top. This does not seem to happen when switching between horizontal and vertical.

To Reproduce Steps to reproduce the behavior:

  1. Create a DimissiblePage with a CustomScrollView as child
  2. Use a listener or event that calls setState() to change the DismissiblePageDismissDirection
  3. When switching to direction multi or down, the scroll position resets back to the top.
  4. No error is printed

DismissiblePage version: 1.0.0

Tkko commented 1 year ago

Hey @brvm, try to set CustomScrollView's key property:

key: PageStorageKey('scroll_key'),

brvm commented 1 year ago

@Tkko oh wow, that works, thanks! Solved! Didn't know about it's existence.