Repository navigation
PageView with SelectionArea scrolls even with NeverScrollablePhysics and throws an Exception #140654
Copy link
Copy link
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: error messageError messages from the Flutter frameworkError messages from the Flutter frameworkf: selectionSelectableRegion, SelectionArea, SelectionContainer, Selectable, and related APIsSelectableRegion, SelectionArea, SelectionContainer, Selectable, and related APIsfound in release: 3.16Found to occur in 3.16Found to occur in 3.16found in release: 3.18Found to occur in 3.18Found to occur in 3.18frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Description
(Similar to #136331)
Steps to reproduce
- Create a SelectionArea
- The child component must be a PageView, physics: NeverScrollableScrollPhysics
- Inside the PageView add at least two other widgets
- The best way to reproduce the exception is to use a DataTable for the first widget (see code snippet). It could also be reproduced without, but then sporadically, in this case I could not recognize a pattern.
- (The bug that despite the NeverScrollableScrollPhysics the page can be scrolled by selecting and dragging is almost always possible (see video))
- Only valid for the code example: Select something in the DataTable and drag it outside the browser window. The PageView will now move to the next page. Release the mouse pointer outside the browser window, hover over the TextWidget on Page2 and select it. Now the error should be thrown.
- Additional information: In another code, the error was already thrown as soon as the mouse pointer went beyond the browser window. So I didn't have to select something from page 2 first. Unfortunately I can't reproduce this behavior well because it is a very large project.
Expected results
- If the scroll physics is set to NeverScrollableScrollPhysics, the PageView should not be navigable by drag and pull.
- No exception should be thrown.
Actual results
- Despite the fact that the scroll physics is set to NeverScrollableScrollPhysics, the PageView can be navigated by drag and pull.
- The same exception is thrown again and again.
Code sample
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
2023-12-27.12-09-09.mp4
Logs
Logs
Error: Assertion failed: file:///D:/Installationsdatei/flutter/packages/flutter/lib/src/widgets/scrollable_helpers.dart:237:7
globalRect.size.width >= _dragTargetRelatedToScrollOrigin.size.width &&
globalRect.size.height >= _dragTargetRelatedToScrollOrigin.size.height
"Drag target size is larger than scrollable size, which may cause bouncing"
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 294:3 throw_
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 35:3 assertFailed
packages/flutter/src/widgets/scrollable_helpers.dart 238:73 _scroll
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 127:5 _async
packages/flutter/src/widgets/scrollable_helpers.dart 230:23 [_scroll]
packages/flutter/src/widgets/scrollable_helpers.dart 222:5 startAutoScrollIfNecessary
packages/flutter/src/widgets/scrollable.dart 1235:7 handleSelectionEdgeUpdate
packages/flutter/src/widgets/selectable_region.dart 2298:18 dispatchSelectionEvent
packages/flutter/src/widgets/selection_container.dart 183:19 dispatchSelectionEvent
packages/flutter/src/widgets/scrollable.dart 1482:17 ensureChildUpdated
packages/flutter/src/widgets/scrollable.dart 1442:9 dispatchSelectionEventToChild
packages/flutter/src/widgets/selectable_region.dart 2461:33 [_adjustSelection]
packages/flutter/src/widgets/selectable_region.dart 2281:85 handleSelectionEdgeUpdate
packages/flutter/src/widgets/scrollable.dart 1225:42 handleSelectionEdgeUpdate
packages/flutter/src/widgets/selectable_region.dart 2298:18 dispatchSelectionEvent
packages/flutter/src/widgets/selection_container.dart 183:19 dispatchSelectionEvent
packages/flutter/src/widgets/selectable_region.dart 2346:22 dispatchSelectionEventToChild
packages/flutter/src/widgets/selectable_region.dart 1576:18 dispatchSelectionEventToChild
packages/flutter/src/widgets/selectable_region.dart 2461:33 [_adjustSelection]
packages/flutter/src/widgets/selectable_region.dart 2281:85 handleSelectionEdgeUpdate
packages/flutter/src/widgets/selectable_region.dart 1545:18 handleSelectionEdgeUpdate
packages/flutter/src/widgets/selectable_region.dart 2298:18 dispatchSelectionEvent
packages/flutter/src/widgets/selection_container.dart 183:19 dispatchSelectionEvent
packages/flutter/src/widgets/selectable_region.dart 1002:20 [_selectStartTo]
packages/flutter/src/widgets/selectable_region.dart 1021:5 [_collapseSelectionAt]
packages/flutter/src/widgets/selectable_region.dart 512:13 [_startNewMouseSelectionGesture]
packages/flutter/src/gestures/tap_and_drag.dart 1179:41 <fn>
packages/flutter/src/gestures/recognizer.dart 275:24 invokeCallback
packages/flutter/src/gestures/tap_and_drag.dart 1179:7 [_checkTapDown]
packages/flutter/src/gestures/tap_and_drag.dart 982:7 acceptGesture
packages/flutter/src/gestures/arena.dart 281:11 [_resolveInFavorOf]
packages/flutter/src/gestures/arena.dart 239:9 [_resolve]
packages/flutter/src/gestures/arena.dart 53:5 resolve
packages/flutter/src/gestures/recognizer.dart 375:12 resolve
packages/flutter/src/gestures/tap_and_drag.dart 1161:9 [_checkDrag]
packages/flutter/src/gestures/tap_and_drag.dart 1074:11 handleEvent
packages/flutter/src/gestures/pointer_router.dart 98:7 [_dispatch]
packages/flutter/src/gestures/pointer_router.dart 143:9 <fn>
dart-sdk/lib/_internal/js_dev_runtime/private/linked_hash_map.dart 21:7 forEach
packages/flutter/src/gestures/pointer_router.dart 141:17 [_dispatchEventToRoutes]
packages/flutter/src/gestures/pointer_router.dart 127:7 route
packages/flutter/src/gestures/binding.dart 488:5 handleEvent
packages/flutter/src/gestures/binding.dart 468:14 dispatchEvent
packages/flutter/src/rendering/binding.dart 439:11 dispatchEvent
packages/flutter/src/gestures/binding.dart 413:7 [_handlePointerEventImmediately]
packages/flutter/src/gestures/binding.dart 376:5 handlePointerEvent
packages/flutter/src/gestures/binding.dart 323:7 [_flushPointerEventQueue]
packages/flutter/src/gestures/binding.dart 292:9 [_handlePointerDataPacket]
lib/_engine/engine/platform_dispatcher.dart 1289:5 invoke1
lib/_engine/engine/platform_dispatcher.dart 273:5 invokeOnPointerDataPacket
lib/_engine/engine/pointer_binding.dart 168:30 [_onPointerData]
lib/_engine/engine/pointer_binding.dart 768:16 <fn>
lib/_engine/engine/pointer_binding.dart 720:7 <fn>
lib/_engine/engine/pointer_binding.dart 317:9 loggedHandler
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 574:37 _checkAndCall
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 579:39 dcallFlutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.16.5, on Microsoft Windows [Version 10.0.22621.2861], locale de-DE)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
X cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
[!] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.3)
X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components:
MSVC v142 - VS 2019 C++ x64/x86 build tools
- If there are multiple build tool versions available, install the latest
C++ CMake tools for Windows
Windows 10 SDK
[√] Android Studio (version 2022.1)
[√] IntelliJ IDEA Community Edition (version 2023.3)
[√] IntelliJ IDEA Ultimate Edition (version 2023.3)
[√] Connected device (3 available)
[√] Network resources
! Doctor found issues in 2 categories.Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: error messageError messages from the Flutter frameworkError messages from the Flutter frameworkf: selectionSelectableRegion, SelectionArea, SelectionContainer, Selectable, and related APIsSelectableRegion, SelectionArea, SelectionContainer, Selectable, and related APIsfound in release: 3.16Found to occur in 3.16Found to occur in 3.16found in release: 3.18Found to occur in 3.18Found to occur in 3.18frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Type
Projects
- StatusShow more project fieldsDone
Activity
[-]Flutter Web: Exception and buggy behavior when using a PageView with a SelectionArea. (Similar to #136331)[/-][+]\Exception and buggy behavior when using a PageView with a SelectionArea. (Similar to #136331)[/+][-]\Exception and buggy behavior when using a PageView with a SelectionArea. (Similar to #136331)[/-][+]Exception and buggy behavior when using a PageView with a SelectionArea. (Similar to #136331)[/+]danagbemava-nc commentedon Dec 28, 2023
Reproducible using the code sample provided. (Pasted below for easy access). This is not only on flutter web, it reproduced on macOS as well.
code sample
flutter doctor -v
matheust3 commentedon Nov 28, 2024
Logs
Flutter doctor -v
1 remaining item
Renzo-Olivares commentedon Feb 4, 2026
From my investigation part of the issue here is that
EdgeDraggingAutoScrollerused byScrollable's selection delegate for edge scrolling does not consider theScrollable's scroll physics so it always scrolls even when explicitly setting never scrollable physics, similarly I also do not think it respects theScrollBehavior(members such as dragDevices).EdgeDraggingAutoScrollershould consider this information from the scrollable it is attached to fix this issue.The specific assertion being hit was introduced in #112816.
I'm not actively working on this but hope this information is helpful. Also happy to review any pull requests fixing this.
[-]Exception and buggy behavior when using a PageView with a SelectionArea. (Similar to #136331)[/-][+]Exception and buggy behavior when using a PageView with a SelectionArea[/+][-]Exception and buggy behavior when using a PageView with a SelectionArea[/-][+]`PageView` with `SelectionArea` scrolls even with `NeverScrollablePhysics` and throws an Exception[/+]Make EdgeDraggingAutoScroller respect ScrollPhysics (flutter#186541)
Make EdgeDraggingAutoScroller respect ScrollPhysics (flutter#186541)
Make EdgeDraggingAutoScroller respect ScrollPhysics (flutter#186541)
github-actions commentedon Jul 14, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.