From 6310a4ffaffaa1871432bf9bed3b6182d1f3ac2a Mon Sep 17 00:00:00 2001 From: dom Date: Fri, 15 May 2026 19:53:52 +0800 Subject: [PATCH] image anim patch Signed-off-by: dom --- lib/common/widgets/image_viewer/image.dart | 4 +--- lib/scripts/image_anim.patch | 13 +++++++++++++ lib/scripts/{image.patch => image_cache.patch} | 0 lib/scripts/patch.ps1 | 6 ++++-- 4 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 lib/scripts/image_anim.patch rename lib/scripts/{image.patch => image_cache.patch} (100%) diff --git a/lib/common/widgets/image_viewer/image.dart b/lib/common/widgets/image_viewer/image.dart index 61a5e0fc2..c0c981bf4 100644 --- a/lib/common/widgets/image_viewer/image.dart +++ b/lib/common/widgets/image_viewer/image.dart @@ -390,9 +390,7 @@ class _ImageState extends State with WidgetsBindingObserver { void didChangeDependencies() { _resolveImage(); - _isPaused = - !TickerMode.valuesOf(context).enabled || - (MediaQuery.maybeDisableAnimationsOf(context) ?? false); + _isPaused = !TickerMode.valuesOf(context).enabled; if (_isPaused && _frameNumber != null) { _stopListeningToStream(keepStreamAlive: true); diff --git a/lib/scripts/image_anim.patch b/lib/scripts/image_anim.patch new file mode 100644 index 000000000..a60005d0b --- /dev/null +++ b/lib/scripts/image_anim.patch @@ -0,0 +1,13 @@ +diff --git a/packages/flutter/lib/src/widgets/image.dart b/packages/flutter/lib/src/widgets/image.dart +index 30429ea5e02..b58f4343440 100644 +--- a/packages/flutter/lib/src/widgets/image.dart ++++ b/packages/flutter/lib/src/widgets/image.dart +@@ -1148,7 +1148,7 @@ class _ImageState extends State with WidgetsBindingObserver { + _updateInvertColors(); + _resolveImage(); + +- _isPaused = !TickerMode.of(context) || (MediaQuery.maybeDisableAnimationsOf(context) ?? false); ++ _isPaused = !TickerMode.of(context); + + if (_isPaused && _frameNumber != null) { + _stopListeningToStream(keepStreamAlive: true); diff --git a/lib/scripts/image.patch b/lib/scripts/image_cache.patch similarity index 100% rename from lib/scripts/image.patch rename to lib/scripts/image_cache.patch diff --git a/lib/scripts/patch.ps1 b/lib/scripts/patch.ps1 index 5a75d81cb..dac494d1c 100644 --- a/lib/scripts/patch.ps1 +++ b/lib/scripts/patch.ps1 @@ -22,7 +22,9 @@ $PaddingPatch = "lib/scripts/padding.patch" # https://github.com/flutter/flutter/issues/56239 # ref https://github.com/flutter/flutter/pull/184549 -$ImagePatch = "lib/scripts/image.patch" +$ImageCachePatch = "lib/scripts/image_cache.patch" + +$ImageAnimPatch = "lib/scripts/image_anim.patch" # TODO: remove # https://github.com/flutter/flutter/issues/90223 @@ -37,7 +39,7 @@ Set-Location $env:FLUTTER_ROOT $picks = @() $reverts = @() $patches = @($ModalBarrierPatch, $TextSelectionPatch, $MouseCursorPatch, - $NavigationBarPatch, $PaddingPatch, $ImagePatch) + $NavigationBarPatch, $PaddingPatch, $ImageCachePatch, $ImageAnimPatch) switch ($platform.ToLower()) { "android" {