-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Auto-Scrollbars on Desktop are disabled #523
Description
By default on desktop, scrollbars are applied by the ScrollBehavior. This has been disabled in the gallery app. All vertical scrollables in the gallery need to be audited before enabling this feature.
Any that are vertical without a specified scroll controller automatically attach to the primary scroll controller. This causes issues when interacting with scrollbars because they are all trying to use the same scroll controller. To audit, the main vertical scrollable on a given page should use the primary scroll controller, any others should set primary: false
. They will each get their own unique scroll controller for use with the scrollbar then.
Previous Context:
Running the gallery app on desktop produces an error related to the scrollbars that are being automatically applied by ScrollBehavior.buildScrollbar.
Some discussion: https://discord.com/channels/608014603317936148/608021234516754444/854798350246215751
Change that appears to have introduced the error: flutter/flutter#81278
Stack trace:
An Observatory debugger and profiler on macOS is available at: http://127.0.0.1:55818/-9YpxMWB5N8=/
══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════════════════════════════════════════════════════
The following assertion was thrown during a scheduler callback:
The provided ScrollController is currently attached to more than one ScrollPosition.
The Scrollbar requires a single ScrollPosition in order to be painted.
When the scrollbar is interactive, the associated Scrollable widgets must have unique
ScrollControllers. The provided ScrollController must be unique to a Scrollable widget.
When the exception was thrown, this was the stack:
#0 RawScrollbarState._checkForValidScrollPosition.<anonymous closure> (package:flutter/src/widgets/scrollbar.dart:1101:9)
#1 RawScrollbarState._checkForValidScrollPosition (package:flutter/src/widgets/scrollbar.dart:1125:6)
#2 RawScrollbarState._maybeTriggerScrollbar.<anonymous closure> (package:flutter/src/widgets/scrollbar.dart:1042:9)
#3 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1143:15)
#4 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1088:9)
#5 SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:863:7)
(elided 11 frames from class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)
════════════════════════════════════════════════════════════════════════════════════════════════════
Another exception was thrown: The provided ScrollController is currently attached to more than one ScrollPosition.
The Flutter DevTools debugger and profiler on macOS is available at: http://127.0.0.1:9101?uri=http%3A%2F%2F127.0.0.1%3A55818%2F-9YpxMWB5N8%3D%2F