Repository navigation
fix(gestures): stop maps blocking parent scrolling when panning is disabled - #2298
Draft
richyo-codes wants to merge 1 commit into
Draft
richyo-codes wants to merge 1 commit into
richyo-codes wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
When a map is embedded in a scrolling page with panning disabled, a one-finger swipe over the map can leave both the map and the page stationary. The map’s scale recognizer claims the gesture even though drag and fling are disabled, preventing the parent scroll view from handling it.
This change lets the parent receive ordinary one-finger drags when the map has no enabled interaction that can use them. Pinch zoom, normal map dragging, cursor rotation, and double-tap-drag zoom remain available when enabled.
Reproduction
Place a
FlutterMapinside aSingleChildScrollViewwith enough content to scroll.Disable map dragging and fling:
Swipe upward over the map with one finger.
Before: The map can consume the swipe without moving, blocking page scrolling.
After: The page scrolls while the map center stays unchanged.
Implementation
The interaction flags already prevent map movement in the gesture callbacks, but those checks occur after gesture recognition. The scale recognizer now checks whether an enabled map interaction can use a one-pointer gesture before accepting it.
Validation
All five regression tests pass:
Analysis reports no errors or warnings with informational diagnostics nonfatal. The installed Flutter SDK emits existing Material import deprecation notices. Minimum-version CI has not been run locally.
Related Discussions
absorbPanEventsOnScrollablesflag. #1454onPanUpdateto detect pan events #1729