flutter_control_pad icon indicating copy to clipboard operation
flutter_control_pad copied to clipboard

Using Control inside of GestureDetector

Open mcgaryp opened this issue 4 years ago • 2 comments

I'v noticed that when using this widget inside of an other gesture detector the Gesture Manager Arena will choose the Horizontal or Vertical Gesture before the Pan gesture of the Joystick.

I did some digging, looks like a possible solution is to Build a CustomPanGestureRecognizer within a RawGestureDetector. I tried implementing this but was unsuccessful due to my lack of understanding off GestureDetection in flutter. Here is a starting point that might help you. I'd be very interested in seeing this through as it relies on a rather large project I am building.

The Joy Stick View is within a multipage application and I use Flutter Swiper to navigate between pages.

You can see from the log that the Pan is winner when the gesture is a Verical Direction, but when it is in a Horizontal Direction the Pan does not win.

Here is a log of the Arena Manager I/flutter (24667): Gesture arena 1271 ❙ ★ Opening new gesture arena. I/flutter (24667): Gesture arena 1271 ❙ Adding: PanGestureRecognizer#d3ee9(debugOwner: GestureDetector, start behavior: start) I/flutter (24667): Gesture arena 1271 ❙ Adding: HorizontalDragGestureRecognizer#1757e(start behavior: start) I/flutter (24667): Gesture arena 1271 ❙ Adding: TapGestureRecognizer#9cb38(debugOwner: GestureDetector, state: ready, button: 1) I/flutter (24667): Gesture arena 1271 ❙ Closing with 3 members. I/flutter (24667): Gesture arena 1271 ❙ Rejecting: TapGestureRecognizer#9cb38(debugOwner: GestureDetector, state: possible, button: 1) I/flutter (24667): Gesture arena 1271 ❙ Accepting: PanGestureRecognizer#d3ee9(debugOwner: GestureDetector, start behavior: start) I/flutter (24667): Gesture arena 1271 ❙ Self-declared winner: PanGestureRecognizer#d3ee9(debugOwner: GestureDetector, start behavior: start) D/ViewRootImpl@a3d787b[MainActivity](24667): ViewPostIme pointer 1 D/ViewRootImpl@a3d787b[MainActivity](24667): ViewPostIme pointer 0 I/flutter (24667): Gesture arena 1272 ❙ ★ Opening new gesture arena. I/flutter (24667): Gesture arena 1272 ❙ Adding: PanGestureRecognizer#d3ee9(debugOwner: GestureDetector, start behavior: start) I/flutter (24667): Gesture arena 1272 ❙ Adding: HorizontalDragGestureRecognizer#1757e(start behavior: start) I/flutter (24667): Gesture arena 1272 ❙ Adding: TapGestureRecognizer#9cb38(debugOwner: GestureDetector, state: ready, button: 1) I/flutter (24667): Gesture arena 1272 ❙ Closing with 3 members. I/flutter (24667): Gesture arena 1272 ❙ Rejecting: TapGestureRecognizer#9cb38(debugOwner: GestureDetector, state: possible, button: 1, sent tap down) I/flutter (24667): Gesture arena 1272 ❙ Accepting: HorizontalDragGestureRecognizer#1757e(start behavior: start) I/flutter (24667): Gesture arena 1272 ❙ Self-declared winner: HorizontalDragGestureRecognizer#1757e(start behavior: start)

mcgaryp avatar Jun 04 '20 20:06 mcgaryp

Hello, could you create a sample project where I can reproduce the issue?

Thanks

artur-ios-dev avatar Jun 04 '20 20:06 artur-ios-dev

I would believe that this could also happen with a list view or some other scrolling view as they also contain drag gestures

example.txt

mcgaryp avatar Jun 04 '20 21:06 mcgaryp