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

[ScrollablePositionedList] PageStorage cast bug #514

Open
SoftWyer opened this issue Jan 26, 2024 · 0 comments
Open

[ScrollablePositionedList] PageStorage cast bug #514

SoftWyer opened this issue Jan 26, 2024 · 0 comments

Comments

@SoftWyer
Copy link

SoftWyer commented Jan 26, 2024

Problem description

The ScrollablePositionedList stores its scroll offset as an ItemPosition in PageStorage. However, mixing this widget with other scrollable widgets can cause a cast issue as other scrollables use a pixel offset (double) not an ItemPosition.

Steps to reproduce

Create an app that uses the ScrollablePositionedList in portrait mode but another type of list in landscape mode and rotate the device. A cast error will be shown as the different lists try to read PageStorage and cast it to different Types.

Note: This may be exacerbated by a context related bug in the app implementing the lists, but it's still a potential issue in the implementation of the scrollable list widget.

Expected behaviour

No cast exception on rotation.

Actual behaviour

Cast exception on rotation

Environment

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.16.9, on Microsoft Windows [Version 10.0.22631.3085], locale en-GB)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.4)
[√] Android Studio (version 2023.1)
[√] Connected device (4 available)
[√] Network resources

• No issues found!

Additional details

A fix for this issue can be seen in this commit. The fix is to use the identifier parameter when reading and writing state to/from the PageStorageBucket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant