-
Notifications
You must be signed in to change notification settings - Fork 27.7k
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
SelectableText with NeverScrollableScrollPhysics needs unique PageStorageKey to not conflict with parent Scrollable #129117
Comments
Thanks for the detailed report. This is replicable on Android too, so doesn't look specific to iOS. stable, master flutter doctor -v
|
Hi @saibotma, this looks like based on the code in the OP this is working as expected.
In the code sample, NeverScrollableScrollPhysics is set on the SelectableText, not the ListView. So the physics you have applied only applies to SelectableText. To set scroll physics in a way that descendent scrollables will all uniformly adopt, use ScrollBehavior. I did notice looking at this that SelectableText does not inherit from ScrollBehavior, so I filed #129206 to follow up on that. It looks like there is more than one issue stated in the OP, can you share details of the other issue, just to be sure we are mixing them up? |
Hi @Piinks, thanks for the answer. I think that you've not understood my issue correctly, yet. The NeverScrollableScrollPhysics obviously should only apply to the SelectableText and they also do (you cannot scroll it with your finger). However when you take another close look at the video you will see that the SelectableText scrolls without user interaction, because (I assume) it tries to restore scroll state from PageStorage. |
Thank for providing more context! I am not sure what is happening here then... maybe @chunhtai or @Hangyujin have an idea? I think they are more familiar with SelectableText. |
I'm having a similar issue in Flutter Web and I can confirm that adding a Video demonstrationScreen.Recording.2023-09-18.at.11.45.22.mov |
Is there an existing issue for this?
Steps to reproduce
Expected results
NeverScrollableScrollPhysics
set.Actual results
ListView
.SelectableText
persisted to page storage.It works, when the
SelectableText
gets its own uniquePageStorageKey
, however this is not very obvious because:SelectableText
can actually scroll.NeverScrollableScrollPhysics
should have scrolling disabled.Code sample
Code sample
Screenshots or Video
Screenshots / Video demonstration
Screen.Recording.2023-06-19.at.14.56.24.mov
Logs
Logs
[Paste your logs here]
Flutter Doctor output
Doctor output
The text was updated successfully, but these errors were encountered: