瀏覽代碼

Update the tag used for heroes

Vishnu Mohandas 5 年之前
父節點
當前提交
63f90ca519
共有 2 個文件被更改,包括 6 次插入3 次删除
  1. 4 1
      lib/ui/gallery.dart
  2. 2 2
      lib/ui/zoomable_image.dart

+ 4 - 1
lib/ui/gallery.dart

@@ -130,7 +130,10 @@ class _GalleryState extends State<Gallery> {
   Widget _buildPhoto(BuildContext context, Photo photo) {
   Widget _buildPhoto(BuildContext context, Photo photo) {
     Widget thumbnail;
     Widget thumbnail;
     if (_openedPhoto == null || _openedPhoto == photo) {
     if (_openedPhoto == null || _openedPhoto == photo) {
-      thumbnail = Hero(tag: photo.hashCode, child: ThumbnailWidget(photo));
+      thumbnail = Hero(
+        tag: photo.generatedId.toString(),
+        child: ThumbnailWidget(photo),
+      );
     } else {
     } else {
       thumbnail = ThumbnailWidget(photo);
       thumbnail = ThumbnailWidget(photo);
     }
     }

+ 2 - 2
lib/ui/zoomable_image.dart

@@ -100,8 +100,8 @@ class _ZoomableImageState extends State<ZoomableImage>
         minScale: PhotoViewComputedScale.contained,
         minScale: PhotoViewComputedScale.contained,
         gaplessPlayback: true,
         gaplessPlayback: true,
         heroAttributes: PhotoViewHeroAttributes(
         heroAttributes: PhotoViewHeroAttributes(
-            tag: widget.photo.localId ??
-                "uploaded_" + widget.photo.uploadedFileId.toString()),
+          tag: widget.photo.generatedId.toString(),
+        ),
       );
       );
     } else {
     } else {
       return loadWidget;
       return loadWidget;