-
Notifications
You must be signed in to change notification settings - Fork 577
Add ability to disable gesture detection #233
Description
Is your feature request related to a problem? Please describe.
I am using photo_view plugin to implement drawing on picture functionality. Use case: user zooms in to specific part of the image and draws something. There are 2 modes - navigate/zoom mode and edit picture mode. I am using PhotoView.customChild constructor. In edit mode child has its own gesture recognizer. Problem is, that in edit mode there are picture view and custom child gesture recognizers in the widgets tree and when the user starts drawing for some time child gesture recognizer does not get events. It starts getting events only when it wins in gesture arena.
Describe the solution you'd like
I want a property PhotoView.disableGestures witch when true removes PhotoView gesture recognizer from the widgets tree.
Describe alternatives you've considered
An alternative solution would be to allow child gesture detector always win. But it would be easier just not to add a gesture recognizer to the widget tree when it is not needed.
Additional context
I was testing reaction to gestures in the app when a child has its own ScaleGestureRecognizer. There is a log with debugPrintGestureArenaDiagnostics = true; Child gesture recognizer wins only after user draged significant distance in the screen. And that distance is lost (no line is drawed in edit mode).
I/flutter (16747): Gesture arena 5 ❙ ★ Opening new gesture arena.
I/flutter (16747): Gesture arena 5 ❙ Adding: ScaleGestureRecognizer#0499e(debugOwner: GestureDetector)
I/flutter (16747): Gesture arena 5 ❙ Adding: PhotoViewGestureRecognizer#f0408(debugOwner: PhotoViewGestureDetector)
I/flutter (16747): Gesture arena 5 ❙ Adding: DoubleTapGestureRecognizer#590d1(debugOwner: PhotoViewGestureDetector)
I/flutter (16747): Gesture arena 5 ❙ Closing with 3 members.
I/flutter (16747): Gesture arena 5 ❙ Rejecting: DoubleTapGestureRecognizer#590d1(debugOwner: PhotoViewGestureDetector)
I/flutter (16747): Gesture arena 5 ❙ Accepting: ScaleGestureRecognizer#0499e(debugOwner: GestureDetector)