My FlutterMap
(flutter_map
), that responds to scale / pan / tap gestures
is the last element of a CustomScrollView
, that is itself one of the pages of a PageView
.
TL/DR: I want the map to always get the events.
As you see in the picture, Left-right touch events are consumed by PageView
to scroll the pages. Up-Down events are consumed by CustomScrollView
to scroll the slivers. So the map normally does not receive any events, or at random, some events ⚔️ win that arena battle and let the user interact with the map.
❙ ★ Opening new gesture arena.
❙ Adding: TapGestureRecognizer#df66a(debugOwner: GestureDetector, state: ready, button: 1)
❙ Adding: VerticalDragGestureRecognizer#2b952(start behavior: start)
❙ Adding: HorizontalDragGestureRecognizer#dbeae(start behavior: start)
❙ Closing with 3 members.
❙ Rejecting: TapGestureRecognizer#df66a(debugOwner: GestureDetector, state: possible, button: 1)
❙ Accepting: VerticalDragGestureRecognizer#2b952(start behavior: start)
❙ Self-declared winner: VerticalDragGestureRecognizer#2b952(start behavior: start)
The self-declared winners are nearly always the VerticalDrag
of the CustomScrollView
or the HorizontalDrag
of the PageView
.
So to solve it, I have read about RawGestureDetector
but I don´t know where to implement it or how: At root level, inside the map (not ideal as is a package), as parent of the map ... I have tried the latter, a RawGestureDetector that blocks HorizontalDrag
and it does block it, but by winning in the arena and preventing the child map from using that event for its PositionedTapDetector inside.
So to simplify, if what I want is that the map always wins, period, what is the best practice for that? on Android I´d just override onInterceptTouchEvent
in the map View
.