Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve pageStorage behavior #66634

Closed
wants to merge 1 commit into from

Conversation

xu-baolin
Copy link
Member

@xu-baolin xu-baolin commented Sep 25, 2020

Description

Currently, PageStroage behavior weird and not developer-friendly when multiple scrollable widgets share only one [PageStorageKey]. See also #62332

A Solution

They are distinguished by adding depth information to the page storage identifier, and their data can be stored separately without interfering with each other

Related Issues

Fixes #62332
#63656

Tests

See files.

@flutter-dashboard flutter-dashboard bot added the framework flutter/packages/flutter repository. See also f: labels. label Sep 25, 2020
@goderbauer
Copy link
Member

Why can you not just use different PageStroage for the scrollable widgets?

@goderbauer goderbauer self-requested a review September 30, 2020 21:44
@xu-baolin
Copy link
Member Author

Why can you not just use different PageStroage for the scrollable widgets?

Yes, it was intended to be designed, but it is very unfriendly to developers.
See also #63634 #62332

@goderbauer
Copy link
Member

For this case, the right thing to do is to use different keys. Using the depth is also problematic when widgets are moved in the widget tree (e.g. via GlobalKeys).

@goderbauer goderbauer closed this Oct 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ListView with PageStorageKey with TextField inside not keeping scroll position
3 participants