diff --git a/lib/common/assets.dart b/lib/common/assets.dart index a75fac79e..23b5722fc 100644 --- a/lib/common/assets.dart +++ b/lib/common/assets.dart @@ -15,7 +15,6 @@ abstract final class Assets { static const trendingBanner = 'assets/images/trending_banner.png'; static const ai = 'assets/images/ai.png'; - // static const livingChart = 'assets/images/live.gif'; static const livingStatic = 'assets/images/live.png'; static const livingRect = 'assets/images/live/live.png'; static const livingBackground = 'assets/images/live/default_bg.webp'; diff --git a/lib/common/widgets/image/network_img_layer.dart b/lib/common/widgets/image/network_img_layer.dart index 02f32a89b..602eb4118 100644 --- a/lib/common/widgets/image/network_img_layer.dart +++ b/lib/common/widgets/image/network_img_layer.dart @@ -66,13 +66,7 @@ class NetworkImgLayer extends StatelessWidget { memCacheHeight = height; } return CachedNetworkImage( - imageUrl: ImageUtils.thumbnailUrl( - src, - maxQuality: quality, - suffix: src!.endsWith(ImageUtils.kSuffixGIF) - ? ImageUtils.kSuffixJPG - : ImageUtils.kSuffixWEBP, - ), + imageUrl: ImageUtils.thumbnailUrl(src, maxQuality: quality), width: width, height: height, memCacheWidth: memCacheWidth, diff --git a/lib/common/widgets/image_viewer/image.dart b/lib/common/widgets/image_viewer/image.dart index c0c981bf4..51e790dd6 100644 --- a/lib/common/widgets/image_viewer/image.dart +++ b/lib/common/widgets/image_viewer/image.dart @@ -10,7 +10,7 @@ import 'package:PiliPlus/common/widgets/gesture/image_horizontal_drag_gesture_re import 'package:PiliPlus/common/widgets/image_viewer/viewer.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart' show DoubleTapGestureRecognizer; -import 'package:flutter/material.dart'; +import 'package:flutter/material.dart' hide Image; import 'package:flutter/scheduler.dart'; import 'package:flutter/semantics.dart'; diff --git a/lib/plugin/pl_player/view/view.dart b/lib/plugin/pl_player/view/view.dart index 07d534162..6aad51ec1 100644 --- a/lib/plugin/pl_player/view/view.dart +++ b/lib/plugin/pl_player/view/view.dart @@ -1693,6 +1693,7 @@ class _PLVideoPlayerState extends State cacheHeight: 25, semanticLabel: "加载中", color: Colors.white, + isPaused: false, ), if (plPlayerController.isBuffering.value) Obx(() { diff --git a/lib/scripts/image_anim.patch b/lib/scripts/image_anim.patch index a60005d0b..35d2fa63e 100644 --- a/lib/scripts/image_anim.patch +++ b/lib/scripts/image_anim.patch @@ -1,13 +1,71 @@ diff --git a/packages/flutter/lib/src/widgets/image.dart b/packages/flutter/lib/src/widgets/image.dart -index 30429ea5e02..b58f4343440 100644 +index 30429ea5e02..79f727ab472 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 { +@@ -381,6 +381,7 @@ class Image extends StatefulWidget { + this.gaplessPlayback = false, + this.isAntiAlias = false, + this.filterQuality = FilterQuality.medium, ++ this.isPaused = true, + }); + + /// Creates a widget that displays an [ImageStream] obtained from the network. +@@ -471,6 +472,7 @@ class Image extends StatefulWidget { + Map? headers, + num? cacheWidth, + num? cacheHeight, ++ this.isPaused = true, + WebHtmlElementStrategy webHtmlElementStrategy = WebHtmlElementStrategy.never, + }) : image = ResizeImage.resizeIfNeeded( + cacheWidth, +@@ -540,6 +542,7 @@ class Image extends StatefulWidget { + this.filterQuality = FilterQuality.medium, + num? cacheWidth, + num? cacheHeight, ++ this.isPaused = true, + }) : // FileImage is not supported on Flutter Web therefore neither this method. + assert( + !kIsWeb, +@@ -703,6 +706,7 @@ class Image extends StatefulWidget { + this.filterQuality = FilterQuality.medium, + num? cacheWidth, + num? cacheHeight, ++ this.isPaused = true, + }) : image = ResizeImage.resizeIfNeeded( + cacheWidth, + cacheHeight, +@@ -765,6 +769,7 @@ class Image extends StatefulWidget { + this.filterQuality = FilterQuality.medium, + num? cacheWidth, + num? cacheHeight, ++ this.isPaused = true, + }) : image = ResizeImage.resizeIfNeeded( + cacheWidth, + cacheHeight, +@@ -1078,6 +1083,8 @@ class Image extends StatefulWidget { + /// Anti-aliasing alleviates the sawtooth artifact when the image is rotated. + final bool isAntiAlias; + ++ final bool isPaused; ++ + @override + State createState() => _ImageState(); + +@@ -1123,7 +1130,7 @@ class _ImageState extends State with WidgetsBindingObserver { + /// True when animations are disabled and the image should not update, such as + /// when [TickerMode] is disabled or [MediaQueryData.disableAnimations] is + /// true. +- bool _isPaused = false; ++ bool get _isPaused => widget.isPaused; + + @override + void initState() { +@@ -1148,8 +1155,6 @@ 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); + } else { diff --git a/lib/utils/image_utils.dart b/lib/utils/image_utils.dart index 282ff82ac..3c4ed41ef 100644 --- a/lib/utils/image_utils.dart +++ b/lib/utils/image_utils.dart @@ -265,7 +265,7 @@ abstract final class ImageUtils { caseSensitive: false, ); - static const kSuffixJPG = '.jpg'; + // static const kSuffixJPG = '.jpg'; static const kSuffixGIF = '.gif'; static const kSuffixWEBP = '.webp';