-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterf: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
Currently, because ScrollableState.setCanDrag doesn't check whether it complies with ScrollPhysics.shouldAcceptUserOffset, it's possible that user of ScrollableState doesn't check whether it can be set to true or false and thus ignores scroll physics by mistake - which is what happens to NestedScrollView, which forgets to do exactly this #45619
flutter/packages/flutter/lib/src/widgets/nested_scroll_view.dart
Lines 1619 to 1621 in ff15d04
| void updateCanDrag(double totalExtent) { | |
| context.setCanDrag(totalExtent > (viewportDimension - maxScrollExtent) || minScrollExtent != maxScrollExtent); | |
| } |
I propose that we force users of the ScrollableState to check the physics before they apply their own conditions with such assert (or something similar)
assert(
_physics == null || newCanDrag == _physics!.shouldAcceptUserOffset(position),
'When scrollable has physics, canDrag should be equal to shouldAcceptUserOffset result',
);cc @Hixie
red282, vladyslavlaba and jeduden
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterf: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version