Prechádzať zdrojové kódy

Fix the hero animation for remote images

Vishnu Mohandas 5 rokov pred
rodič
commit
cd32098360
5 zmenil súbory, kde vykonal 26 pridanie a 5 odobranie
  1. 7 0
      lib/models/file.dart
  2. 1 1
      lib/ui/gallery.dart
  3. 1 1
      lib/ui/zoomable_image.dart
  4. 16 2
      pubspec.lock
  5. 1 1
      pubspec.yaml

+ 7 - 0
lib/models/file.dart

@@ -128,4 +128,11 @@ class File {
   int get hashCode {
     return generatedId.hashCode ^ uploadedFileId.hashCode ^ localId.hashCode;
   }
+
+  String heroTag() {
+    return "local_" +
+        localId.toString() +
+        ":remote_" +
+        uploadedFileId.toString();
+  }
 }

+ 1 - 1
lib/ui/gallery.dart

@@ -176,7 +176,7 @@ class _GalleryState extends State<Gallery> {
               : null,
         ),
         child: Hero(
-          tag: file.generatedId.toString(),
+          tag: file.heroTag(),
           child: ThumbnailWidget(file),
         ),
       ),

+ 1 - 1
lib/ui/zoomable_image.dart

@@ -59,7 +59,7 @@ class _ZoomableImageState extends State<ZoomableImage>
         minScale: PhotoViewComputedScale.contained,
         gaplessPlayback: true,
         heroAttributes: PhotoViewHeroAttributes(
-          tag: widget.photo.generatedId.toString(),
+          tag: widget.photo.heroTag(),
         ),
       );
     } else {

+ 16 - 2
pubspec.lock

@@ -35,7 +35,7 @@ packages:
       name: cached_network_image
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "2.2.0+1"
+    version: "2.3.0-rc"
   characters:
     dependency: transitive
     description:
@@ -181,6 +181,13 @@ packages:
     description: flutter
     source: sdk
     version: "0.0.0"
+  flutter_blurhash:
+    dependency: transitive
+    description:
+      name: flutter_blurhash
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "0.5.0"
   flutter_cache_manager:
     dependency: transitive
     description:
@@ -324,6 +331,13 @@ packages:
       url: "https://pub.dartlang.org"
     source: hosted
     version: "1.1.8"
+  octo_image:
+    dependency: transitive
+    description:
+      name: octo_image
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "0.2.1"
   open_iconic_flutter:
     dependency: transitive
     description:
@@ -639,4 +653,4 @@ packages:
     version: "2.2.1"
 sdks:
   dart: ">=2.9.0-14.0.dev <3.0.0"
-  flutter: ">=1.13.8 <2.0.0"
+  flutter: ">=1.19.0-2.0.pre <2.0.0"

+ 1 - 1
pubspec.yaml

@@ -53,7 +53,7 @@ dependencies:
   extended_image: ^0.9.0
   video_player: ^0.10.11+1
   chewie: ^0.9.10
-  cached_network_image: ^2.2.0+1
+  cached_network_image: ^2.3.0-beta
 
 dev_dependencies:
   flutter_test: