🐛 Fix image rendering

This commit is contained in:
2025-09-07 14:20:00 +08:00
parent 3a17837cc6
commit ef2c14daa2

View File

@@ -31,31 +31,35 @@ class UniversalImage extends StatelessWidget {
height != null ? (height! * devicePixelRatio).round() : null; height != null ? (height! * devicePixelRatio).round() : null;
} }
return Stack( return SizedBox(
fit: StackFit.expand, width: width,
children: [ height: height,
if (blurHash != null) BlurHash(hash: blurHash!), child: Stack(
CachedNetworkImage( fit: StackFit.expand,
imageUrl: uri, children: [
fit: fit, if (blurHash != null) BlurHash(hash: blurHash!),
width: width, CachedNetworkImage(
height: height, imageUrl: uri,
memCacheHeight: cacheHeight, fit: fit,
memCacheWidth: cacheWidth, width: width,
progressIndicatorBuilder: (context, url, progress) { height: height,
return Center( memCacheHeight: cacheHeight,
child: CircularProgressIndicator(value: progress.progress), memCacheWidth: cacheWidth,
); progressIndicatorBuilder: (context, url, progress) {
}, return Center(
errorWidget: (context, url, error) { child: CircularProgressIndicator(value: progress.progress),
return Image.asset( );
'assets/images/media-offline.jpg', },
fit: BoxFit.cover, errorWidget: (context, url, error) {
key: Key('image-broke-$uri'), return Image.asset(
); 'assets/images/media-offline.jpg',
}, fit: BoxFit.cover,
), key: Key('image-broke-$uri'),
], );
},
),
],
),
); );
} }
} }