Fix drag selection stopping when scrolling beyond visible items #735
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Drag-to-select stops working when scrolling to the second page because gesture detectors were attached per-item in
SliverChildBuilderDelegate, only receiving events for mounted items.Changes
Moved gesture detection from per-item to scroll view level
CustomScrollViewwith a singleGestureDetectorhandling all drag/pan/longpress eventssliverGridbuilder (~75 lines)Refactored coordinate calculation in
AssetGridDragSelectionCoordinator_calculateIndexFromPosition()to compute grid indices from global screen coordinatesonSelectionStart()to acceptBoxConstraintsinstead ofindex/assetparameters, calculating them from positiononSelectionUpdate()to reuse shared position calculation (~80 lines of duplication removed)How it works
The position-to-index calculation accounts for grid parameters (count, spacing), scroll offset, reverted layouts, and special items, working independently of item mounting state.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://storage.googleapis.com/flutter_infra_release/flutter/a5cb96369ef86c7e85abf5d662a1ca5d89775053/dart-sdk-linux-x64.zip/usr/bin/curl curl --retry 3 --continue-at - --location --output /tmp/flutter/bin/cache/dart-sdk-linux-x64.zip REDACTED(http block)/usr/bin/curl curl --retry 3 --continue-at - --location --output /tmp/flutter_test/flutter_sdk/bin/cache/dart-sdk-linux-x64.zip REDACTED(http block)/usr/bin/curl curl --retry 3 --location --output /tmp/flutter_test/flutter_sdk/bin/cache/dart-sdk-linux-x64.zip REDACTED ndor/bin/git(http block)https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.24.5-stable.tar.xz/usr/bin/wget wget -q REDACTED -O flutter.tar.xz(http block)https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.27.1-stable.tar.xz/usr/bin/curl curl -L REDACTED --output flutter.tar.xz --progress-bar(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.