From f14b499ffebbd11bf3f5d39293c0c37e1e4537a6 Mon Sep 17 00:00:00 2001 From: ashilkn Date: Fri, 8 Mar 2024 11:20:19 +0530 Subject: [PATCH] fix: auto scaling after image is fully loaded after double tapping twice --- mobile/lib/ui/viewer/file/zoomable_image.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mobile/lib/ui/viewer/file/zoomable_image.dart b/mobile/lib/ui/viewer/file/zoomable_image.dart index 1d9c9e223..b354e21eb 100644 --- a/mobile/lib/ui/viewer/file/zoomable_image.dart +++ b/mobile/lib/ui/viewer/file/zoomable_image.dart @@ -54,6 +54,7 @@ class _ZoomableImageState extends State ValueChanged? _scaleStateChangedCallback; bool _isZooming = false; PhotoViewController _photoViewController = PhotoViewController(); + late PhotoViewScaleStateController _scaleStateController; @override void initState() { @@ -68,6 +69,7 @@ class _ZoomableImageState extends State debugPrint("isZooming = $_isZooming, currentState $value"); // _logger.info('is reakky zooming $_isZooming with state $value'); }; + _scaleStateController = PhotoViewScaleStateController(); super.initState(); } @@ -92,6 +94,7 @@ class _ZoomableImageState extends State child: PhotoView( imageProvider: _imageProvider, controller: _photoViewController, + scaleStateController: _scaleStateController, scaleStateChangedCallback: _scaleStateChangedCallback, minScale: widget.shouldCover ? PhotoViewComputedScale.covered @@ -281,6 +284,7 @@ class _ZoomableImageState extends State initialPosition: newPosition, initialScale: scale, ); + _scaleStateController.scaleState = PhotoViewScaleState.zoomedIn; } final bool canUpdateMetadata = _photo.canEditMetaInfo; // forcefully get finalImageInfo is dimensions are not available in metadata