Fix the hero animation for remote images

This commit is contained in:
Vishnu Mohandas 2020-06-24 00:27:22 +05:30
parent 56783b97d3
commit cd32098360
5 changed files with 26 additions and 5 deletions

View file

@ -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();
}
}

View file

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

View file

@ -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 {

View file

@ -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"

View file

@ -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: