Conversation
lib/main.dart
Outdated
| // ScrollBehavior. This overrides that. All vertical scrollables in | ||
| // the gallery need to be audited before enabling this feature, | ||
| // see https://github.com/flutter/gallery/issues/523 | ||
| scrollBehavior: const MaterialScrollBehavior().copyWith(scrollbars: false), |
There was a problem hiding this comment.
FWIW, this problem also exists in the legacy Flutter gallery.
I'm missing some context here to really understand why this is the right fix. In particular, why do certain scrollables need to set primary or not, when it used to "just work" that they didn't.
There was a problem hiding this comment.
FWIW, this problem also exists in the legacy Flutter gallery.
Yeah, I need to track that down too.
why do certain scrollables need to set primary or not, when it used to "just work" that they didn't.
Vertical scrollables automatically attach to the primary scroll controller if they aren't given a scroll controller. The auto-scrollbar stuff is new, and the gallery will need to be updated for it. It 'just worked' before because there wasn't a widget in the tree enforcing that a certain scroll controller only has one position attached. Since the ScrollBehavior on desktop is adding scrollbars now, the gallery crashes because the when the user tries to interact with the scrollbar, the scrollbar tries to use the scroll controller to change the position. Since more than one position is attached, it breaks.
There is a migration guide here: https://flutter.dev/docs/release/breaking-changes/default-desktop-scrollbars
I am also updating the assertion in the framework because I do think it is a little too aggressive right now.
See #523
On desktop, scrollbars are applied automatically by the scroll behavior. Currently, most vertical scroll views in the gallery app are all using the same primary scroll controller. This causes a crash when users try to interact with the scrollbars. This change will disable the automatic scrollbars to eliminate the crash while we audit and fix up all of the scrollables in the gallery that are using the same scroll controller.