diff --git a/lib/core/cache/image_cache.dart b/lib/core/cache/image_cache.dart index c9b178f5b2b37a7d1c93be6bd0d672970ec7c451..4af836ef63fae5c6daeadac78e841ed26b399d40 100644 --- a/lib/core/cache/image_cache.dart +++ b/lib/core/cache/image_cache.dart @@ -5,25 +5,25 @@ import 'package:photos/core/cache/lru_map.dart'; import 'package:photos/models/file.dart'; class FileLruCache { - static LRUMap _map = LRUMap(25); + static LRUMap _map = LRUMap(25); static dart.File get(File file) { - return _map.get(file.hashCode); + return _map.get(file.tag()); } static void put(File file, dart.File imageData) { - _map.put(file.hashCode, imageData); + _map.put(file.tag(), imageData); } } class BytesLruCache { - static LRUMap _map = LRUMap(25); + static LRUMap _map = LRUMap(25); static Uint8List get(File file) { - return _map.get(file.hashCode); + return _map.get(file.tag()); } static void put(File file, Uint8List imageData) { - _map.put(file.hashCode, imageData); + _map.put(file.tag(), imageData); } } diff --git a/lib/models/file.dart b/lib/models/file.dart index abb839cf945d1823b6b1cd95a080f75b878ad5ee..7572b494d11a42d870c3577e2d3387232338f8f3 100644 --- a/lib/models/file.dart +++ b/lib/models/file.dart @@ -129,10 +129,12 @@ class File { return generatedId.hashCode ^ uploadedFileId.hashCode ^ localId.hashCode; } - String heroTag() { + String tag() { return "local_" + localId.toString() + ":remote_" + - uploadedFileId.toString(); + uploadedFileId.toString() + + ":generated_" + + generatedId.toString(); } } diff --git a/lib/ui/gallery.dart b/lib/ui/gallery.dart index e952521e9d26ea87591e0638344d9172e8e48753..3ce210e56ae8b3a0be8c9667befa6f58cf461269 100644 --- a/lib/ui/gallery.dart +++ b/lib/ui/gallery.dart @@ -176,7 +176,7 @@ class _GalleryState extends State { : null, ), child: Hero( - tag: file.heroTag(), + tag: file.tag(), child: ThumbnailWidget(file), ), ), diff --git a/lib/ui/video_widget.dart b/lib/ui/video_widget.dart index 4ff49bc5ad3a0fa5ed72891e27e626cf663f9f27..f484530e53b64049941e4896cd5e55a47e5f244f 100644 --- a/lib/ui/video_widget.dart +++ b/lib/ui/video_widget.dart @@ -58,7 +58,7 @@ class _VideoWidgetState extends State { ? _getVideoPlayer() : _getLoadingWidget(); return Hero( - tag: widget.file.heroTag(), + tag: widget.file.tag(), child: content, ); } diff --git a/lib/ui/zoomable_image.dart b/lib/ui/zoomable_image.dart index 2727b13c55286725ef8fea96dd7436f838654f7c..e9eca3b17c28d66c3fbb8c8048e0244c8816f3e3 100644 --- a/lib/ui/zoomable_image.dart +++ b/lib/ui/zoomable_image.dart @@ -59,7 +59,7 @@ class _ZoomableImageState extends State minScale: PhotoViewComputedScale.contained, gaplessPlayback: true, heroAttributes: PhotoViewHeroAttributes( - tag: widget.photo.heroTag(), + tag: widget.photo.tag(), ), ); } else {