From 1414a2590fe8e94bc299940d41a1f7f7aa1cbe75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E8=90=8C?= <494089941@qq.com> Date: Tue, 17 May 2022 16:43:25 +0800 Subject: [PATCH] add image urlwithHost params --- lib/ui/market/order/order_card.dart | 2 +- lib/widget/bee_image_network.dart | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/ui/market/order/order_card.dart b/lib/ui/market/order/order_card.dart index 066f721b..8d3ea58a 100644 --- a/lib/ui/market/order/order_card.dart +++ b/lib/ui/market/order/order_card.dart @@ -575,7 +575,7 @@ class _OrderCardState extends State { borderRadius: BorderRadius.circular(16.w), ), child: BeeImageNetwork( - urls: [model.mainPhoto ?? ''], + urlsWithHost: [model.mainPhoto ?? ''], height: 188.w, width: 188.w, ), diff --git a/lib/widget/bee_image_network.dart b/lib/widget/bee_image_network.dart index d795078b..2f295646 100644 --- a/lib/widget/bee_image_network.dart +++ b/lib/widget/bee_image_network.dart @@ -12,6 +12,7 @@ class BeeImageNetwork extends StatelessWidget { final double? width; final double? height; final BoxFit? fit; + final List? urlsWithHost; const BeeImageNetwork( {Key? key, @@ -19,17 +20,22 @@ class BeeImageNetwork extends StatelessWidget { this.width, this.height, this.urls, - this.fit = BoxFit.cover}) - : assert(imgs != null || urls != null), + this.fit = BoxFit.cover, + this.urlsWithHost}) + : assert(imgs != null || urls != null || urlsWithHost != null), super(key: key); + String get imgUrl => urlsWithHost == null + ? imgs == null + ? SAASAPI.image(urls!.isEmpty ? '' : urls!.first) + : SAASAPI.image(ImgModel.first(imgs)) + : urlsWithHost!.first; + @override Widget build(BuildContext context) { return FadeInImage.assetNetwork( placeholder: Assets.images.placeholder.path, - image: imgs == null - ? SAASAPI.image(urls!.isEmpty ? '' : urls!.first) - : SAASAPI.image(ImgModel.first(imgs)), + image: imgUrl, imageErrorBuilder: (context, obj, stackTrace) { return Image.asset( Assets.images.placeholder.path,