From 44d49b967123a3ecc60e4bb1e3fa7503351e9a2a Mon Sep 17 00:00:00 2001 From: shenlong <139912620+shenlong-tanwen@users.noreply.github.com> Date: Thu, 29 May 2025 20:05:36 +0530 Subject: [PATCH] fix(mobile): double swipe (#18749) debug: double swipe issue Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> --- mobile/lib/pages/common/gallery_viewer.page.dart | 7 ++++--- .../photo_view/src/core/photo_view_hit_corners.dart | 5 ++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mobile/lib/pages/common/gallery_viewer.page.dart b/mobile/lib/pages/common/gallery_viewer.page.dart index 420b699730e..bdde338cb36 100644 --- a/mobile/lib/pages/common/gallery_viewer.page.dart +++ b/mobile/lib/pages/common/gallery_viewer.page.dart @@ -223,7 +223,8 @@ class GalleryViewerPage extends HookConsumerWidget { heroAttributes: _getHeroAttributes(asset), filterQuality: FilterQuality.high, tightMode: true, - minScale: PhotoViewComputedScale.contained, + initialScale: PhotoViewComputedScale.contained * 0.99, + minScale: PhotoViewComputedScale.contained * 0.99, errorBuilder: (context, error, stackTrace) => ImmichImage( asset, fit: BoxFit.contain, @@ -238,9 +239,9 @@ class GalleryViewerPage extends HookConsumerWidget { onDragUpdate: (_, details, __) => handleSwipeUpDown(details), heroAttributes: _getHeroAttributes(asset), filterQuality: FilterQuality.high, - initialScale: 1.0, + initialScale: PhotoViewComputedScale.contained * 0.99, maxScale: 1.0, - minScale: 1.0, + minScale: PhotoViewComputedScale.contained * 0.99, basePosition: Alignment.center, child: SizedBox( width: context.width, diff --git a/mobile/lib/widgets/photo_view/src/core/photo_view_hit_corners.dart b/mobile/lib/widgets/photo_view/src/core/photo_view_hit_corners.dart index 54a1029f298..b12b9a76349 100644 --- a/mobile/lib/widgets/photo_view/src/core/photo_view_hit_corners.dart +++ b/mobile/lib/widgets/photo_view/src/core/photo_view_hit_corners.dart @@ -1,5 +1,4 @@ import 'package:flutter/widgets.dart'; - import 'package:immich_mobile/widgets/photo_view/src/controller/photo_view_controller_delegate.dart' show PhotoViewControllerDelegate; @@ -7,7 +6,7 @@ mixin HitCornersDetector on PhotoViewControllerDelegate { HitCorners _hitCornersX() { final double childWidth = scaleBoundaries.childSize.width * scale; final double screenWidth = scaleBoundaries.outerSize.width; - if (screenWidth >= childWidth) { + if (screenWidth - childWidth > -0.001) { return const HitCorners(true, true); } final x = -position.dx; @@ -18,7 +17,7 @@ mixin HitCornersDetector on PhotoViewControllerDelegate { HitCorners _hitCornersY() { final double childHeight = scaleBoundaries.childSize.height * scale; final double screenHeight = scaleBoundaries.outerSize.height; - if (screenHeight >= childHeight) { + if (screenHeight - childHeight > -0.001) { return const HitCorners(true, true); } final y = -position.dy;