diff --git a/lib/shared/image_preview.dart b/lib/shared/image_preview.dart index ffcb16411..78a4d47bc 100644 --- a/lib/shared/image_preview.dart +++ b/lib/shared/image_preview.dart @@ -114,7 +114,8 @@ class _ImagePreviewState extends State { width: widget.width ?? MediaQuery.of(context).size.width - 24, fit: BoxFit.cover, cache: true, - clearMemoryCacheWhenDispose: true, + clearMemoryCacheWhenDispose: false, + cacheMaxAge: const Duration(minutes: 1), cacheWidth: ((MediaQuery.of(context).size.width - 24) * View.of(context).devicePixelRatio.ceil()).toInt(), loadStateChanged: (state) { if (state.extendedImageLoadState == LoadState.loading) { diff --git a/lib/shared/image_viewer.dart b/lib/shared/image_viewer.dart index b1cae3af7..d71f46af4 100644 --- a/lib/shared/image_viewer.dart +++ b/lib/shared/image_viewer.dart @@ -230,7 +230,8 @@ class _ImageViewerState extends State with TickerProviderStateMixin mode: ExtendedImageMode.gesture, extendedImageGestureKey: gestureKey, cache: true, - clearMemoryCacheWhenDispose: true, + clearMemoryCacheWhenDispose: false, + cacheMaxAge: const Duration(minutes: 1), initGestureConfigHandler: (ExtendedImageState state) { return GestureConfig( minScale: 0.8, diff --git a/lib/shared/media_view.dart b/lib/shared/media_view.dart index 1d8152db6..19357b152 100644 --- a/lib/shared/media_view.dart +++ b/lib/shared/media_view.dart @@ -218,7 +218,8 @@ class _MediaViewState extends State with SingleTickerProviderStateMix width: width, fit: widget.viewMode == ViewMode.compact ? BoxFit.cover : BoxFit.fitWidth, cache: true, - clearMemoryCacheWhenDispose: true, + clearMemoryCacheWhenDispose: false, + cacheMaxAge: const Duration(minutes: 1), cacheWidth: widget.viewMode == ViewMode.compact ? (75 * View.of(context).devicePixelRatio.ceil()) : ((MediaQuery.of(context).size.width - (widget.edgeToEdgeImages ? 0 : 24)) * View.of(context).devicePixelRatio.ceil()).toInt(), diff --git a/lib/shared/preview_image.dart b/lib/shared/preview_image.dart index c326bc1e3..98f31f3d0 100644 --- a/lib/shared/preview_image.dart +++ b/lib/shared/preview_image.dart @@ -57,7 +57,8 @@ class _PreviewImageState extends State with SingleTickerProviderSt width: width, fit: widget.viewMode == ViewMode.compact ? BoxFit.cover : BoxFit.fitWidth, cache: true, - clearMemoryCacheWhenDispose: true, + clearMemoryCacheWhenDispose: false, + cacheMaxAge: const Duration(minutes: 1), cacheWidth: widget.viewMode == ViewMode.compact ? (75 * View.of(context).devicePixelRatio.ceil()) : ((MediaQuery.of(context).size.width - 24) * View.of(context).devicePixelRatio.ceil()).toInt(), loadStateChanged: (ExtendedImageState state) { switch (state.extendedImageLoadState) {