From ef2c14daa2b0e36ad814d6b194a6a8e0b066c215 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 7 Sep 2025 14:20:00 +0800 Subject: [PATCH] :bug: Fix image rendering --- lib/widgets/content/image.dart | 54 ++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/lib/widgets/content/image.dart b/lib/widgets/content/image.dart index 55e3a1b7..bf17fb39 100644 --- a/lib/widgets/content/image.dart +++ b/lib/widgets/content/image.dart @@ -31,31 +31,35 @@ class UniversalImage extends StatelessWidget { height != null ? (height! * devicePixelRatio).round() : null; } - return Stack( - fit: StackFit.expand, - children: [ - if (blurHash != null) BlurHash(hash: blurHash!), - CachedNetworkImage( - imageUrl: uri, - fit: fit, - width: width, - height: height, - memCacheHeight: cacheHeight, - memCacheWidth: cacheWidth, - progressIndicatorBuilder: (context, url, progress) { - return Center( - child: CircularProgressIndicator(value: progress.progress), - ); - }, - errorWidget: (context, url, error) { - return Image.asset( - 'assets/images/media-offline.jpg', - fit: BoxFit.cover, - key: Key('image-broke-$uri'), - ); - }, - ), - ], + return SizedBox( + width: width, + height: height, + child: Stack( + fit: StackFit.expand, + children: [ + if (blurHash != null) BlurHash(hash: blurHash!), + CachedNetworkImage( + imageUrl: uri, + fit: fit, + width: width, + height: height, + memCacheHeight: cacheHeight, + memCacheWidth: cacheWidth, + progressIndicatorBuilder: (context, url, progress) { + return Center( + child: CircularProgressIndicator(value: progress.progress), + ); + }, + errorWidget: (context, url, error) { + return Image.asset( + 'assets/images/media-offline.jpg', + fit: BoxFit.cover, + key: Key('image-broke-$uri'), + ); + }, + ), + ], + ), ); } }