mod: 图片填充尺寸

This commit is contained in:
guozhigq
2023-04-19 10:22:53 +08:00
parent 385cc4dad9
commit 06494b100e

View File

@ -10,10 +10,9 @@ class NetworkImgLayer extends StatelessWidget {
final String? type; final String? type;
final Duration? fadeOutDuration; final Duration? fadeOutDuration;
final Duration? fadeInDuration; final Duration? fadeInDuration;
var onTap;
NetworkImgLayer( const NetworkImgLayer({
{Key? key, Key? key,
this.src, this.src,
required this.width, required this.width,
required this.height, required this.height,
@ -22,8 +21,7 @@ class NetworkImgLayer extends StatelessWidget {
this.type, this.type,
this.fadeOutDuration, this.fadeOutDuration,
this.fadeInDuration, this.fadeInDuration,
this.onTap}) }) : super(key: key);
: super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -34,11 +32,15 @@ class NetworkImgLayer extends StatelessWidget {
imageUrl: src!, imageUrl: src!,
width: width ?? double.infinity, width: width ?? double.infinity,
height: height ?? double.infinity, height: height ?? double.infinity,
maxWidthDiskCache: (cacheW ?? width!).toInt(), maxWidthDiskCache:
maxHeightDiskCache: (cacheH ?? height!).toInt(), ((cacheW ?? width!) * MediaQuery.of(context).devicePixelRatio)
memCacheWidth: (cacheW ?? width!).toInt(), .toInt(),
memCacheHeight: (cacheH ?? height!).toInt(), // maxHeightDiskCache: (cacheH ?? height!).toInt(),
fit: BoxFit.cover, memCacheWidth:
((cacheW ?? width!) * MediaQuery.of(context).devicePixelRatio)
.toInt(),
// memCacheHeight: (cacheH ?? height!).toInt(),
fit: BoxFit.fitWidth,
fadeOutDuration: fadeOutDuration:
fadeOutDuration ?? const Duration(milliseconds: 200), fadeOutDuration ?? const Duration(milliseconds: 200),
fadeInDuration: fadeInDuration: