opt static thumbnail gif

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-05-17 20:59:52 +08:00
parent eb11971c66
commit 4f35962127
6 changed files with 66 additions and 14 deletions

View File

@@ -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';

View File

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

View File

@@ -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';

View File

@@ -1693,6 +1693,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
cacheHeight: 25,
semanticLabel: "加载中",
color: Colors.white,
isPaused: false,
),
if (plPlayerController.isBuffering.value)
Obx(() {

View File

@@ -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<Image> 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<String, String>? 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<Image> createState() => _ImageState();
@@ -1123,7 +1130,7 @@ class _ImageState extends State<Image> 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<Image> with WidgetsBindingObserver {
_updateInvertColors();
_resolveImage();
- _isPaused = !TickerMode.of(context) || (MediaQuery.maybeDisableAnimationsOf(context) ?? false);
+ _isPaused = !TickerMode.of(context);
-
if (_isPaused && _frameNumber != null) {
_stopListeningToStream(keepStreamAlive: true);
} else {

View File

@@ -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';