From 03211c43f98ca32d66ea356ec48792b88d3b8e10 Mon Sep 17 00:00:00 2001 From: mertalev <101130780+mertalev@users.noreply.github.com> Date: Sat, 16 Nov 2024 23:34:48 -0500 Subject: [PATCH] increase delay for hero animation --- mobile/lib/pages/common/gallery_viewer.page.dart | 2 +- .../pages/common/native_video_viewer.page.dart | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/mobile/lib/pages/common/gallery_viewer.page.dart b/mobile/lib/pages/common/gallery_viewer.page.dart index 2c0021b024..aaa050f289 100644 --- a/mobile/lib/pages/common/gallery_viewer.page.dart +++ b/mobile/lib/pages/common/gallery_viewer.page.dart @@ -106,7 +106,7 @@ class GalleryViewerPage extends HookConsumerWidget { return null; }, - [], + const [], ); void showInfo() { diff --git a/mobile/lib/pages/common/native_video_viewer.page.dart b/mobile/lib/pages/common/native_video_viewer.page.dart index a50d8c399f..887f7c807c 100644 --- a/mobile/lib/pages/common/native_video_viewer.page.dart +++ b/mobile/lib/pages/common/native_video_viewer.page.dart @@ -169,7 +169,7 @@ class NativeVideoViewerPage extends HookConsumerWidget { // if opening a remote video from a hero animation, delay initialization to avoid a stutter if (!asset.isLocal && isCurrent) { - await Future.delayed(const Duration(milliseconds: 150)); + await Future.delayed(const Duration(milliseconds: 200)); } videoSource.value = videoSourceRes; @@ -376,7 +376,6 @@ class NativeVideoViewerPage extends HookConsumerWidget { nc.onPlaybackStatusChanged.addListener(onPlaybackStatusChanged); nc.onPlaybackReady.addListener(onPlaybackReady); nc.onPlaybackEnded.addListener(onPlaybackEnded); - nc.loadVideoSource(videoSource.value!); controller.value = nc; @@ -429,12 +428,12 @@ class NativeVideoViewerPage extends HookConsumerWidget { WakelockPlus.disable(); }; }, - [], + const [], ); final video = aspectRatio.value != null ? Center( - key: ValueKey(asset.id), + key: ValueKey(asset), child: AspectRatio( key: ValueKey(asset), aspectRatio: aspectRatio.value!, @@ -452,11 +451,15 @@ class NativeVideoViewerPage extends HookConsumerWidget { children: [ // This remains under the video to avoid flickering // For motion videos, this is the image portion of the asset - image, + Center(key: ValueKey(asset.id), child: image), if (video != null) asset.isVideo ? video - : Visibility.maintain(visible: showMotionVideo, child: video), + : Visibility.maintain( + key: ValueKey(asset), + visible: showMotionVideo, + child: video, + ), if (showControls) const Center(child: CustomVideoPlayerControls()), ], );