From e0ba54f23bfd3df94d6f806181a556c1378da73f Mon Sep 17 00:00:00 2001 From: Zhou Weidong <502333560@qq.com> Date: Fri, 23 Oct 2026 03:18:24 +0800 Subject: [PATCH] =?UTF-8?q?fix(cover):=20=E5=B0=81=E9=9D=A2=E5=8D=A0?= =?UTF-8?q?=E4=BD=8D=E6=94=B9=E4=B8=BA=E5=93=81=E7=89=8C=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/core/widgets/remote_image.dart | 37 +++++++++++++++++++----------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/lib/core/widgets/remote_image.dart b/lib/core/widgets/remote_image.dart index 9711f2b..967c8e1 100644 --- a/lib/core/widgets/remote_image.dart +++ b/lib/core/widgets/remote_image.dart @@ -31,34 +31,45 @@ class RemoteImage extends StatelessWidget { @override Widget build(BuildContext context) { final url = AppConfig.mediaUrl(path); - if (url.isEmpty) return _fallback(); + if (url.isEmpty) return _fallback(brand: showFallbackIcon); return Image.network( url, width: width, height: height, fit: fit, - errorBuilder: (_, _, _) => _fallback(), + gaplessPlayback: true, + errorBuilder: (_, _, _) => _fallback(brand: showFallbackIcon), frameBuilder: (context, child, frame, wasSynchronouslyLoaded) { if (wasSynchronouslyLoaded || frame != null) return child; - return _fallback(); + return _fallback(brand: showFallbackIcon); }, ); } - Widget _fallback() { + Widget _fallback({required bool brand}) { + final mark = brand + ? LayoutBuilder( + builder: (context, constraints) { + final width = constraints.maxWidth.isFinite + ? constraints.maxWidth + : 120.0; + return Center( + child: Image.asset( + 'assets/icon/splash_logo.png', + key: fallbackIconKey, + width: width * 0.72, + fit: BoxFit.contain, + ), + ); + }, + ) + : null; final fallback = Container( width: width, height: height, - color: fallbackColor, + color: brand ? AppColors.mediaBlack : fallbackColor, alignment: Alignment.center, - child: showFallbackIcon - ? Icon( - Icons.image_not_supported_outlined, - key: fallbackIconKey, - color: AppColors.muted, - size: 32, - ) - : null, + child: mark, ); final ratio = fallbackAspectRatio; if (ratio == null) return fallback;