From 50673be1f0d4c5856af29889d445d5a80c3c777b Mon Sep 17 00:00:00 2001 From: Ming Ming Date: Sun, 16 Oct 2022 23:22:27 +0800 Subject: [PATCH] Disable Hero animation as viewer size initially is 0 with partial files --- app/lib/widget/image_viewer.dart | 38 +++++++++++++---------------- app/lib/widget/photo_list_item.dart | 2 -- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/app/lib/widget/image_viewer.dart b/app/lib/widget/image_viewer.dart index 4c4950cc..c8267828 100644 --- a/app/lib/widget/image_viewer.dart +++ b/app/lib/widget/image_viewer.dart @@ -8,7 +8,6 @@ import 'package:nc_photos/api/api_util.dart' as api_util; import 'package:nc_photos/cache_manager_util.dart'; import 'package:nc_photos/entity/file_descriptor.dart'; import 'package:nc_photos/entity/local_file.dart'; -import 'package:nc_photos/flutter_util.dart' as flutter_util; import 'package:nc_photos/k.dart' as k; import 'package:nc_photos/mobile/android/content_uri_image_provider.dart'; import 'package:nc_photos/widget/cached_network_image_mod.dart' as mod; @@ -116,26 +115,23 @@ class _RemoteImageViewerState extends State { onHeightChanged: widget.onHeightChanged, onZoomStarted: widget.onZoomStarted, onZoomEnded: widget.onZoomEnded, - child: Hero( - tag: flutter_util.getImageHeroTag(widget.file), - child: mod.CachedNetworkImage( - cacheManager: LargeImageCacheManager.inst, - imageUrl: _getImageUrl(widget.account, widget.file), - httpHeaders: { - "Authorization": Api.getAuthorizationHeaderValue(widget.account), - }, - fit: BoxFit.contain, - fadeInDuration: const Duration(), - filterQuality: FilterQuality.high, - imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet, - imageBuilder: (context, child, imageProvider) { - WidgetsBinding.instance.addPostFrameCallback((_) { - _onItemLoaded(); - }); - const SizeChangedLayoutNotification().dispatch(context); - return child; - }, - ), + child: mod.CachedNetworkImage( + cacheManager: LargeImageCacheManager.inst, + imageUrl: _getImageUrl(widget.account, widget.file), + httpHeaders: { + "Authorization": Api.getAuthorizationHeaderValue(widget.account), + }, + fit: BoxFit.contain, + fadeInDuration: const Duration(), + filterQuality: FilterQuality.high, + imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet, + imageBuilder: (context, child, imageProvider) { + WidgetsBinding.instance.addPostFrameCallback((_) { + _onItemLoaded(); + }); + const SizeChangedLayoutNotification().dispatch(context); + return child; + }, ), ); diff --git a/app/lib/widget/photo_list_item.dart b/app/lib/widget/photo_list_item.dart index 11924994..09856790 100644 --- a/app/lib/widget/photo_list_item.dart +++ b/app/lib/widget/photo_list_item.dart @@ -9,7 +9,6 @@ import 'package:nc_photos/app_localizations.dart'; import 'package:nc_photos/cache_manager_util.dart'; import 'package:nc_photos/entity/file_descriptor.dart'; import 'package:nc_photos/entity/local_file.dart'; -import 'package:nc_photos/flutter_util.dart' as flutter_util; import 'package:nc_photos/k.dart' as k; import 'package:nc_photos/mobile/android/content_uri_image_provider.dart'; import 'package:nc_photos/theme.dart'; @@ -66,7 +65,6 @@ class PhotoListImageItem extends PhotoListFileItem { previewUrl: previewUrl, isGif: file.fdMime == "image/gif", isFavorite: shouldShowFavoriteBadge && file.fdIsFavorite == true, - heroKey: flutter_util.getImageHeroTag(file), ); final Account account;