Browse Source

Wrap photo_view inside PhotoViewGestureDetectorScope to improve zoom

Neeraj Gupta 3 years ago
parent
commit
53fdc04a08
1 changed files with 11 additions and 8 deletions
  1. 11 8
      lib/ui/zoomable_image.dart

+ 11 - 8
lib/ui/zoomable_image.dart

@@ -70,15 +70,18 @@ class _ZoomableImageState extends State<ZoomableImage>
     Widget content;
     Widget content;
 
 
     if (_imageProvider != null) {
     if (_imageProvider != null) {
-      content = PhotoView(
-        imageProvider: _imageProvider,
-        scaleStateChangedCallback: _scaleStateChangedCallback,
-        minScale: PhotoViewComputedScale.contained,
-        gaplessPlayback: true,
-        heroAttributes: PhotoViewHeroAttributes(
-          tag: widget.tagPrefix + _photo.tag(),
+      content = PhotoViewGestureDetectorScope(
+        axis: Axis.vertical,
+        child: PhotoView(
+          imageProvider: _imageProvider,
+          scaleStateChangedCallback: _scaleStateChangedCallback,
+          minScale: PhotoViewComputedScale.contained,
+          gaplessPlayback: true,
+          heroAttributes: PhotoViewHeroAttributes(
+            tag: widget.tagPrefix + _photo.tag(),
+          ),
+          backgroundDecoration: widget.backgroundDecoration,
         ),
         ),
-        backgroundDecoration: widget.backgroundDecoration,
       );
       );
     } else {
     } else {
       content = loadWidget;
       content = loadWidget;