Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Auto-Scrollbars on Desktop are disabled #523

Closed
Piinks opened this issue Jun 16, 2021 · 6 comments · Fixed by #735
Closed

Auto-Scrollbars on Desktop are disabled #523

Piinks opened this issue Jun 16, 2021 · 6 comments · Fixed by #735
Labels
bug Something isn't working demo Building/fixing/updating a demo P2 Priority 2 - Should have

Comments

@Piinks
Copy link
Contributor

Piinks commented Jun 16, 2021

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
@Piinks Piinks added bug Something isn't working demo Building/fixing/updating a demo labels Jun 16, 2021
@Piinks Piinks self-assigned this Jun 16, 2021
@Piinks
Copy link
Contributor Author

Piinks commented Jun 16, 2021

Actually, maybe not. Still investigating.

One aspect of this issue is that it should be valid that a scrollbar is interactive, but just not interactive right now. For example, when the scrollbar is not visible and the scroll controller has more than one position attached (maybe we are in the middle of a transition between tabs and the PrimaryScrollController is attached to scroll views in both) , that should not throw an error because the user cannot interact with something they cannot see.

@Piinks
Copy link
Contributor Author

Piinks commented Jun 16, 2021

related: flutter/flutter#84735

@Piinks
Copy link
Contributor Author

Piinks commented Jun 16, 2021

There are a lot of scrollables in the gallery app that are causing this type of crash. I am going to disable the auto-generated scrollbars so that this crash will be mitigated while we update the gallery app for this feature.

@Piinks
Copy link
Contributor Author

Piinks commented Jun 16, 2021

Related: #53

@Piinks Piinks changed the title Auto-Scrollbars are conflicting with shared PrimaryScrollController Auto-Scrollbars on Desktop are disabled Jun 16, 2021
@Piinks
Copy link
Contributor Author

Piinks commented Jun 24, 2021

I am not going to be actively working on this migration right now, so I am going to un-assign myself. If any one else would like to take this on in the meantime, feel free to reach out. I am happy to provide guidance.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working demo Building/fixing/updating a demo P2 Priority 2 - Should have
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants