You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
Problem description
The
ScrollablePositionedList
stores its scroll offset as anItemPosition
inPageStorage
. However, mixing this widget with other scrollable widgets can cause a cast issue as other scrollables use a pixel offset (double
) not anItemPosition
.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 readPageStorage
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
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 thePageStorageBucket
.The text was updated successfully, but these errors were encountered: