diff --git a/mobile/lib/widgets/photo_view/src/core/photo_view_gesture_detector.dart b/mobile/lib/widgets/photo_view/src/core/photo_view_gesture_detector.dart index 6cbcec8d82a9e..c031f8cb54b34 100644 --- a/mobile/lib/widgets/photo_view/src/core/photo_view_gesture_detector.dart +++ b/mobile/lib/widgets/photo_view/src/core/photo_view_gesture_detector.dart @@ -81,29 +81,33 @@ class PhotoViewGestureDetector extends StatelessWidget { ); } - gestures[DoubleTapGestureRecognizer] = GestureRecognizerFactoryWithHandlers( - () => DoubleTapGestureRecognizer(debugOwner: this), - (DoubleTapGestureRecognizer instance) { - instance.onDoubleTap = onDoubleTap; - }, - ); + if (onDoubleTap != null) { + gestures[DoubleTapGestureRecognizer] = GestureRecognizerFactoryWithHandlers( + () => DoubleTapGestureRecognizer(debugOwner: this), + (DoubleTapGestureRecognizer instance) { + instance.onDoubleTap = onDoubleTap; + }, + ); + } - gestures[PhotoViewGestureRecognizer] = GestureRecognizerFactoryWithHandlers( - () => PhotoViewGestureRecognizer( - hitDetector: hitDetector, - debugOwner: this, - validateAxis: axis, - touchSlopFactor: touchSlopFactor, - ), - (PhotoViewGestureRecognizer instance) { - instance - ..dragStartBehavior = DragStartBehavior.start - ..onStart = onScaleStart - ..onUpdate = onScaleUpdate - ..onEnd = onScaleEnd - ..disableScaleGestures = disableScaleGestures; - }, - ); + if (!disableScaleGestures) { + gestures[PhotoViewGestureRecognizer] = GestureRecognizerFactoryWithHandlers( + () => PhotoViewGestureRecognizer( + hitDetector: hitDetector, + debugOwner: this, + validateAxis: axis, + touchSlopFactor: touchSlopFactor, + ), + (PhotoViewGestureRecognizer instance) { + instance + ..dragStartBehavior = DragStartBehavior.start + ..onStart = onScaleStart + ..onUpdate = onScaleUpdate + ..onEnd = onScaleEnd + ..disableScaleGestures = disableScaleGestures; + }, + ); + } gestures[LongPressGestureRecognizer] = GestureRecognizerFactoryWithHandlers( () => LongPressGestureRecognizer(debugOwner: this),