From 06494b100e3cd3d4ec30eaf95818a88dbacff658 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Wed, 19 Apr 2023 10:22:53 +0800 Subject: [PATCH] =?UTF-8?q?mod:=20=E5=9B=BE=E7=89=87=E5=A1=AB=E5=85=85?= =?UTF-8?q?=E5=B0=BA=E5=AF=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/common/widgets/network_img_layer.dart | 38 ++++++++++++----------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/lib/common/widgets/network_img_layer.dart b/lib/common/widgets/network_img_layer.dart index 02cf33b5..53a4973f 100644 --- a/lib/common/widgets/network_img_layer.dart +++ b/lib/common/widgets/network_img_layer.dart @@ -10,20 +10,18 @@ class NetworkImgLayer extends StatelessWidget { final String? type; final Duration? fadeOutDuration; final Duration? fadeInDuration; - var onTap; - NetworkImgLayer( - {Key? key, - this.src, - required this.width, - required this.height, - this.cacheW, - this.cacheH, - this.type, - this.fadeOutDuration, - this.fadeInDuration, - this.onTap}) - : super(key: key); + const NetworkImgLayer({ + Key? key, + this.src, + required this.width, + required this.height, + this.cacheW, + this.cacheH, + this.type, + this.fadeOutDuration, + this.fadeInDuration, + }) : super(key: key); @override Widget build(BuildContext context) { @@ -34,11 +32,15 @@ class NetworkImgLayer extends StatelessWidget { imageUrl: src!, width: width ?? double.infinity, height: height ?? double.infinity, - maxWidthDiskCache: (cacheW ?? width!).toInt(), - maxHeightDiskCache: (cacheH ?? height!).toInt(), - memCacheWidth: (cacheW ?? width!).toInt(), - memCacheHeight: (cacheH ?? height!).toInt(), - fit: BoxFit.cover, + maxWidthDiskCache: + ((cacheW ?? width!) * MediaQuery.of(context).devicePixelRatio) + .toInt(), + // maxHeightDiskCache: (cacheH ?? height!).toInt(), + memCacheWidth: + ((cacheW ?? width!) * MediaQuery.of(context).devicePixelRatio) + .toInt(), + // memCacheHeight: (cacheH ?? height!).toInt(), + fit: BoxFit.fitWidth, fadeOutDuration: fadeOutDuration ?? const Duration(milliseconds: 200), fadeInDuration: