Преглед на файлове

Fixed: When we zoom the image, we will be able to slide to next or previous image without being zoomed out, which is similar to google files

Muhammed Ayimen преди 1 година
родител
ревизия
e22089ff5a
променени са 1 файла, в които са добавени 12 реда и са изтрити 15 реда
  1. 12 15
      lib/ui/viewer/file/zoomable_image.dart

+ 12 - 15
lib/ui/viewer/file/zoomable_image.dart

@@ -6,6 +6,7 @@ import 'package:flutter/material.dart';
 import 'package:flutter/widgets.dart';
 import 'package:flutter/widgets.dart';
 import 'package:logging/logging.dart';
 import 'package:logging/logging.dart';
 import 'package:photo_view/photo_view.dart';
 import 'package:photo_view/photo_view.dart';
+import "package:photo_view/photo_view_gallery.dart";
 import 'package:photos/core/cache/thumbnail_in_memory_cache.dart';
 import 'package:photos/core/cache/thumbnail_in_memory_cache.dart';
 import 'package:photos/core/constants.dart';
 import 'package:photos/core/constants.dart';
 import 'package:photos/core/event_bus.dart';
 import 'package:photos/core/event_bus.dart';
@@ -89,21 +90,17 @@ class _ZoomableImageState extends State<ZoomableImage>
     Widget content;
     Widget content;
 
 
     if (_imageProvider != null) {
     if (_imageProvider != null) {
-      content = PhotoViewGestureDetectorScope(
-        axis: Axis.vertical,
-        child: PhotoView(
-          imageProvider: _imageProvider,
-          controller: _photoViewController,
-          scaleStateChangedCallback: _scaleStateChangedCallback,
-          minScale: widget.shouldCover
-              ? PhotoViewComputedScale.covered
-              : PhotoViewComputedScale.contained,
-          gaplessPlayback: true,
-          heroAttributes: PhotoViewHeroAttributes(
-            tag: widget.tagPrefix! + _photo.tag,
-          ),
-          backgroundDecoration: widget.backgroundDecoration as BoxDecoration?,
-        ),
+      content = PhotoViewGallery.builder(
+        builder: (context, index) {
+          return PhotoViewGalleryPageOptions(
+            imageProvider: _imageProvider!,
+            minScale: PhotoViewComputedScale.contained,
+            heroAttributes: PhotoViewHeroAttributes(
+              tag: widget.tagPrefix! + _photo.tag,
+            ),
+          );
+        },
+        itemCount: 1,
       );
       );
     } else {
     } else {
       content = const EnteLoadingWidget();
       content = const EnteLoadingWidget();