From e22089ff5a77c6a0c004cf2374212d0cd84d9819 Mon Sep 17 00:00:00 2001 From: Muhammed Ayimen Date: Thu, 16 Nov 2023 10:26:14 +0900 Subject: [PATCH 1/2] 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 --- lib/ui/viewer/file/zoomable_image.dart | 27 ++++++++++++-------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/lib/ui/viewer/file/zoomable_image.dart b/lib/ui/viewer/file/zoomable_image.dart index 3bf00a95e..e16fcfe02 100644 --- a/lib/ui/viewer/file/zoomable_image.dart +++ b/lib/ui/viewer/file/zoomable_image.dart @@ -6,6 +6,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:logging/logging.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/constants.dart'; import 'package:photos/core/event_bus.dart'; @@ -89,21 +90,17 @@ class _ZoomableImageState extends State Widget content; 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 { content = const EnteLoadingWidget(); From d84eefa2ea29e8f8c74230acd7f52e85570bf130 Mon Sep 17 00:00:00 2001 From: Muhammed Ayimen Date: Thu, 16 Nov 2023 18:55:44 +0900 Subject: [PATCH 2/2] Added: Extra parameters to the photoViewGalleryPageOption widget --- lib/ui/viewer/file/zoomable_image.dart | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/ui/viewer/file/zoomable_image.dart b/lib/ui/viewer/file/zoomable_image.dart index e16fcfe02..961e79dc5 100644 --- a/lib/ui/viewer/file/zoomable_image.dart +++ b/lib/ui/viewer/file/zoomable_image.dart @@ -91,13 +91,19 @@ class _ZoomableImageState extends State if (_imageProvider != null) { content = PhotoViewGallery.builder( + gaplessPlayback: true, + scaleStateChangedCallback: _scaleStateChangedCallback, + backgroundDecoration: widget.backgroundDecoration as BoxDecoration?, builder: (context, index) { return PhotoViewGalleryPageOptions( imageProvider: _imageProvider!, - minScale: PhotoViewComputedScale.contained, + minScale: widget.shouldCover + ? PhotoViewComputedScale.covered + : PhotoViewComputedScale.contained, heroAttributes: PhotoViewHeroAttributes( tag: widget.tagPrefix! + _photo.tag, ), + controller: _photoViewController, ); }, itemCount: 1,