@@ -28,7 +28,6 @@ import 'framework.dart';
2828import 'gesture_detector.dart' ;
2929import 'media_query.dart' ;
3030import 'notification_listener.dart' ;
31- import 'page_view.dart' ;
3231import 'restoration.dart' ;
3332import 'restoration_properties.dart' ;
3433import 'scroll_activity.dart' ;
@@ -1278,7 +1277,6 @@ class _ScrollableSelectionContainerDelegate extends MultiSelectableSelectionCont
12781277 event = SelectionEdgeUpdateEvent .forEnd (
12791278 globalPosition: endOffset,
12801279 granularity: event.granularity,
1281- deviceKind: event.deviceKind,
12821280 );
12831281 } else {
12841282 _currentDragStartRelatedToOrigin = _inferPositionRelatedToOrigin (event.globalPosition);
@@ -1289,7 +1287,6 @@ class _ScrollableSelectionContainerDelegate extends MultiSelectableSelectionCont
12891287 event = SelectionEdgeUpdateEvent .forStart (
12901288 globalPosition: startOffset,
12911289 granularity: event.granularity,
1292- deviceKind: event.deviceKind,
12931290 );
12941291 }
12951292 final SelectionResult result = super .handleSelectionEdgeUpdate (event);
@@ -1302,20 +1299,9 @@ class _ScrollableSelectionContainerDelegate extends MultiSelectableSelectionCont
13021299 return result;
13031300 }
13041301 if (_selectionStartsInScrollable) {
1305- // Don't let a selection drag flip a PageView or TabBarView to the next
1306- // page when it wouldn't accept a plain drag from this device (a mouse, on
1307- // desktop and web). Otherwise the page animates over and snaps back mid
1308- // selection. Other scrollables like ListView still auto scroll so mouse
1309- // "select to scroll" keeps working. A null device kind means we don't
1310- // know, so leave the behavior as it was.
1311- //
1312- // Note this is a different case from the shouldAcceptUserOffset check in
1313- // EdgeDraggingAutoScroller; page physics accept user offset, so that
1314- // check never catches this.
1315- final PointerDeviceKind ? deviceKind = event.deviceKind;
1316- if (deviceKind != null &&
1317- _scrollableSnapsToPages &&
1318- ! state._configuration.dragDevices.contains (deviceKind)) {
1302+ // A paged scrollable (PageView or TabBarView) would flip pages instead of
1303+ // revealing more content, so never edge scroll it while selecting.
1304+ if (state.resolvedPhysics? .snapsToPages ?? false ) {
13191305 _autoScroller.stopAutoScroll ();
13201306 return result;
13211307 }
@@ -1327,21 +1313,6 @@ class _ScrollableSelectionContainerDelegate extends MultiSelectableSelectionCont
13271313 return result;
13281314 }
13291315
1330- // Whether this scrollable snaps to pages, like a PageView or TabBarView.
1331- // Page physics can be wrapped by other physics, so check the whole chain.
1332- bool get _scrollableSnapsToPages {
1333- for (
1334- ScrollPhysics ? physics = state.resolvedPhysics;
1335- physics != null ;
1336- physics = physics.parent
1337- ) {
1338- if (physics is PageScrollPhysics ) {
1339- return true ;
1340- }
1341- }
1342- return false ;
1343- }
1344-
13451316 Offset _inferPositionRelatedToOrigin (Offset globalPosition) {
13461317 final box = state.context.findRenderObject ()! as RenderBox ;
13471318 final Offset localPosition = box.globalToLocal (globalPosition);
0 commit comments