-
-
Notifications
You must be signed in to change notification settings - Fork 114
Description
#463 seems to be the change causing our use case to no longer work.
We have a GestureDetecture
with onPanStart
, onPanUpdate
, and onPanEnd
. Inside of this, we have a grid of DraggableWidget
children.
Expected Behavior
When dragging on top of an actual DraggableWidget
, it should consume the gesture and the parent GestureDetector
around the whole grid should not handle that gesture, and the item should be dragged.
When dragging outside of a DraggableWidget
(i.e. in our case in the space between items in the grid), the parent GestureDetector
should receive the gesture events.
(This worked in 0.8.24
)
Actual Behavior
As of #463, dragging anywhere in the entire grid gets handled by the parent GestureDetector
. This means no items are actually draggable
The only exception to this is when dragging very quickly, the DraggableWidget
actually works and drags (presumably because the mouse has already moved >4 pixels and immediately accepts the gesture, before the parent GestureDetector
gets a chance to accept it.
Workaround
A very hacky workaround is to replace the parent GestureDetector
with a RawGestureDetector
, and provide it a custom PanGestureRecognizer
like so:
class CustomPanGestureRecognizer extends PanGestureRecognizer {
@override
bool hasSufficientGlobalDistanceToAccept(
PointerDeviceKind pointerDeviceKind,
double? deviceTouchSlop,
) {
return globalDistanceMoved.abs() > 5;
}
}