浏览代码

Merge pull request #360 from ente-io/zoom_improvements

Zoom improvements
Neeraj Gupta 3 年之前
父节点
当前提交
7307383cea
共有 3 个文件被更改,包括 19 次插入12 次删除
  1. 5 3
      lib/ui/detail_page.dart
  2. 13 8
      lib/ui/zoomable_image.dart
  3. 1 1
      pubspec.yaml

+ 5 - 3
lib/ui/detail_page.dart

@@ -141,9 +141,11 @@ class _DetailPageState extends State<DetailPage> {
           autoPlay: !_hasPageChanged,
           autoPlay: !_hasPageChanged,
           tagPrefix: widget.config.tagPrefix,
           tagPrefix: widget.config.tagPrefix,
           shouldDisableScroll: (value) {
           shouldDisableScroll: (value) {
-            setState(() {
-              _shouldDisableScroll = value;
-            });
+            if (_shouldDisableScroll != value) {
+              setState(() {
+                _shouldDisableScroll = value;
+              });
+            }
           },
           },
           playbackCallback: (isPlaying) {
           playbackCallback: (isPlaying) {
             _shouldHideAppBar = isPlaying;
             _shouldHideAppBar = isPlaying;

+ 13 - 8
lib/ui/zoomable_image.dart

@@ -48,11 +48,13 @@ class _ZoomableImageState extends State<ZoomableImage>
   @override
   @override
   void initState() {
   void initState() {
     _photo = widget.photo;
     _photo = widget.photo;
+    debugPrint('initState for ${_photo.toString()}');
     _scaleStateChangedCallback = (value) {
     _scaleStateChangedCallback = (value) {
       if (widget.shouldDisableScroll != null) {
       if (widget.shouldDisableScroll != null) {
         widget.shouldDisableScroll(value != PhotoViewScaleState.initial);
         widget.shouldDisableScroll(value != PhotoViewScaleState.initial);
       }
       }
       _isZooming = value != PhotoViewScaleState.initial;
       _isZooming = value != PhotoViewScaleState.initial;
+      debugPrint("isZooming = $_isZooming, currentState $value");
       // _logger.info('is reakky zooming $_isZooming with state $value');
       // _logger.info('is reakky zooming $_isZooming with state $value');
     };
     };
     super.initState();
     super.initState();
@@ -68,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;

+ 1 - 1
pubspec.yaml

@@ -11,7 +11,7 @@ description: ente photos application
 # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
 # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
 # Read more about iOS versioning at
 # Read more about iOS versioning at
 # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
 # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
-version: 0.6.7+337
+version: 0.6.8+338
 
 
 environment:
 environment:
   sdk: ">=2.10.0 <3.0.0"
   sdk: ">=2.10.0 <3.0.0"