From 5cbd22f7b05295ec88c29e4b2c43c9e2aed8c0b8 Mon Sep 17 00:00:00 2001 From: Renan Date: Mon, 23 Mar 2020 10:07:23 +0000 Subject: [PATCH] change to accept gesture (#266) --- lib/src/core/photo_view_gesture_detector.dart | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/src/core/photo_view_gesture_detector.dart b/lib/src/core/photo_view_gesture_detector.dart index 40489168..0477a1d9 100644 --- a/lib/src/core/photo_view_gesture_detector.dart +++ b/lib/src/core/photo_view_gesture_detector.dart @@ -54,7 +54,8 @@ class PhotoViewGestureDetector extends StatelessWidget { gestures[PhotoViewGestureRecognizer] = GestureRecognizerFactoryWithHandlers( - () => PhotoViewGestureRecognizer(hitDetector, this, axis), + () => PhotoViewGestureRecognizer( + hitDetector: hitDetector, debugOwner: this, validateAxis: axis), (PhotoViewGestureRecognizer instance) { instance ..onStart = onScaleStart @@ -80,11 +81,12 @@ class PhotoViewGestureDetector extends StatelessWidget { } class PhotoViewGestureRecognizer extends ScaleGestureRecognizer { - PhotoViewGestureRecognizer( + PhotoViewGestureRecognizer({ this.hitDetector, Object debugOwner, this.validateAxis, - ) : super(debugOwner: debugOwner); + PointerDeviceKind kind, + }) : super(debugOwner: debugOwner, kind: kind); final HitCornersDetector hitDetector; final Axis validateAxis; @@ -152,12 +154,12 @@ class PhotoViewGestureRecognizer extends ScaleGestureRecognizer { ? hitDetector.shouldMoveY(move) : hitDetector.shouldMoveX(move); if (shouldMove || _pointerLocations.keys.length > 1) { - resolve(GestureDisposition.accepted); + acceptGesture(event.pointer); } } } -/// An [InheritedWidget] responsible to give a axis aware scope to the internal[GestureRecognizer]. +/// An [InheritedWidget] responsible to give a axis aware scope to [PhotoViewGestureRecognizer]. /// /// When using this, PhotoView will test if the content zoomed has hit edge every time user pinches, /// if so, it will let parent gesture detectors win the gesture arena