diff --git a/lib/core/cache/image_cache.dart b/lib/core/cache/image_cache.dart index c9b178f5b..4af836ef6 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 abb839cf9..7572b494d 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 e952521e9..3ce210e56 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 4ff49bc5a..f484530e5 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 2727b13c5..e9eca3b17 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 {