diff --git a/mobile/apps/photos/lib/ui/viewer/file/thumbnail_widget.dart b/mobile/apps/photos/lib/ui/viewer/file/thumbnail_widget.dart index 432dcae3c8..a8ebac8086 100644 --- a/mobile/apps/photos/lib/ui/viewer/file/thumbnail_widget.dart +++ b/mobile/apps/photos/lib/ui/viewer/file/thumbnail_widget.dart @@ -151,13 +151,7 @@ class _ThumbnailWidgetState extends State { Widget? image; if (_imageProvider != null) { image = Image( - image: optimizedImageHeight != null || optimizedImageWidth != null - ? ResizeImage( - _imageProvider!, - width: optimizedImageWidth, - height: optimizedImageHeight, - ) - : _imageProvider!, + image: _imageProvider!, fit: widget.fit, ); } @@ -251,7 +245,11 @@ class _ThumbnailWidgetState extends State { final cachedSmallThumbnail = ThumbnailInMemoryLruCache.get(widget.file, thumbnailSmallSize); if (cachedSmallThumbnail != null) { - _imageProvider = Image.memory(cachedSmallThumbnail).image; + _imageProvider = Image.memory( + cachedSmallThumbnail, + cacheHeight: optimizedImageHeight, + cacheWidth: optimizedImageWidth, + ).image; _hasLoadedThumbnail = true; } else { if (widget.diskLoadDeferDuration != null) { @@ -296,7 +294,11 @@ class _ThumbnailWidgetState extends State { } if (mounted) { - final imageProvider = Image.memory(thumbData).image; + final imageProvider = Image.memory( + thumbData, + cacheHeight: optimizedImageHeight, + cacheWidth: optimizedImageWidth, + ).image; _cacheAndRender(imageProvider); } ThumbnailInMemoryLruCache.put( @@ -381,10 +383,15 @@ class _ThumbnailWidgetState extends State { _isLoadingRemoteThumbnail = true; final cachedThumbnail = ThumbnailInMemoryLruCache.get(widget.file); if (cachedThumbnail != null) { - _imageProvider = Image.memory(cachedThumbnail).image; + _imageProvider = Image.memory( + cachedThumbnail, + cacheHeight: optimizedImageHeight, + cacheWidth: optimizedImageWidth, + ).image; _hasLoadedThumbnail = true; return; } + if (widget.serverLoadDeferDuration != null) { Future.delayed(widget.serverLoadDeferDuration!, () { if (mounted) { @@ -401,7 +408,11 @@ class _ThumbnailWidgetState extends State { try { final thumbnail = await getThumbnailFromServer(widget.file); if (mounted) { - final imageProvider = Image.memory(thumbnail).image; + final imageProvider = Image.memory( + thumbnail, + cacheHeight: optimizedImageHeight, + cacheWidth: optimizedImageWidth, + ).image; _cacheAndRender(imageProvider); } } catch (e) {