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
{{ message }}
Repository navigation
Remove Primary Scroll Controller for Flutter Desktop apps #100264
For context, desktop apps frequently have multiple vertical scroll areas, e.g. desktop_photo_search has a sidebar and mainn content area, both of which scroll vertically.
So I think the primary scroll controller is only used in the framework to automatically support the iOS scroll to top function. If this is true, we can likely disable the PSC automatically attaching to every vertical scroll position on desktop...
I need to investigate if the PSC is relied upon for anything else that would make such a change a breaking one.
Unfortunately I do not think this will be ass straightforward as I had hoped. Couple of findings:
The PrimaryScrollController is also used in the NestedScrollView in order to have the inner scroll view inherit the scroll controller that it manipulates to keep the 2 positions in sync.
So we would have to find a way around this or it would break the NestedScrollView for desktop applications.
Default keyboard scroll actions on desktop actually rely on the PrimaryScrollController to work. A PSC is created for each route, and when the user taps the arrow keys, if the current focus is not enclosed by a scrollable, it looks up the PSC as a fallback to automatically have keyboard scrolling shortcuts work.
In this case, I think the same more than one position attached... issue actually applies to scroll actions too, if not I do not think the user would want multiple scroll views to move in response to a key stroke. If we disable the automatic attachment of PSC completely, the user would have to specify which scrollview they want to be the default for scroll actions by setting ScrollView.primary to true. I think this would be an ok trade-off but it is still one to consider carefully.
⭐ ➡️ I think for now, the best workaround is to set primary: false on ScrollViews that should not connect to the PSC. I think it is better than setting an individual scroll controller for each.
If anyone has thoughts on this, please do share. I am still investigating a few more options here.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
Piinks commentedon Mar 17, 2022
So I think the primary scroll controller is only used in the framework to automatically support the iOS scroll to top function. If this is true, we can likely disable the PSC automatically attaching to every vertical scroll position on desktop...
I need to investigate if the PSC is relied upon for anything else that would make such a change a breaking one.
Piinks commentedon Mar 29, 2022
Unfortunately I do not think this will be ass straightforward as I had hoped. Couple of findings:
more than one position attached...issue actually applies to scroll actions too, if not I do not think the user would want multiple scroll views to move in response to a key stroke. If we disable the automatic attachment of PSC completely, the user would have to specify which scrollview they want to be the default for scroll actions by setting ScrollView.primary to true. I think this would be an ok trade-off but it is still one to consider carefully.⭐ ➡️ I think for now, the best workaround is to set
primary: falseon ScrollViews that should not connect to the PSC. I think it is better than setting an individual scroll controller for each.If anyone has thoughts on this, please do share. I am still investigating a few more options here.
github-actions commentedon Jun 23, 2022
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.