diff --git a/lib/order/exchange_history_page.dart b/lib/order/exchange_history_page.dart index 7152a573..0ab8cdbc 100644 --- a/lib/order/exchange_history_page.dart +++ b/lib/order/exchange_history_page.dart @@ -7,6 +7,7 @@ import 'package:huixiang/retrofit/data/exchange_order.dart'; import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/icon_text.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_footer.dart'; @@ -323,15 +324,13 @@ class _ExchangeHistoryList extends State { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Image.network( + MImage( (exchangeOrder != null && exchangeOrder.creditOrderDetailList != null) ? exchangeOrder.creditOrderDetailList[0].goodsMainImg : "", - errorBuilder: (context, error, stackTrace) { - return Image.asset("assets/image/default_1.png", - fit: BoxFit.cover); - }, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", width: 66, height: 66, fit: BoxFit.cover, diff --git a/lib/order/exchange_order_page.dart b/lib/order/exchange_order_page.dart index 85ce601b..d06bb26d 100644 --- a/lib/order/exchange_order_page.dart +++ b/lib/order/exchange_order_page.dart @@ -262,12 +262,20 @@ class _ExchangeOrderPage extends State { crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.max, children: [ - Image.network( - widget.arguments["image"], - fit: BoxFit.cover, - width: 80, - height: 80, - ), + if (widget.arguments["image"] != null) + Image.network( + widget.arguments["image"], + fit: BoxFit.cover, + width: 80, + height: 80, + ) + else + Image.asset( + "assets/image/default_1.png", + fit: BoxFit.cover, + width: 80, + height: 80, + ), Expanded( child: Container( height: 80.h, diff --git a/lib/order/logistics_information_page.dart b/lib/order/logistics_information_page.dart index 68e004be..12f5f239 100644 --- a/lib/order/logistics_information_page.dart +++ b/lib/order/logistics_information_page.dart @@ -165,12 +165,20 @@ class _LogisticsInformationPage extends State { Stack( alignment: Alignment.bottomCenter, children: [ - Image.network( - widget.arguments["skuImg"] ?? "assets/image/default_1.png", - width: 95.w, - height: 95.h, - fit: BoxFit.cover, - ), + if (widget.arguments["skuImg"] != null) + Image.network( + widget.arguments["skuImg"], + width: 95.w, + height: 95.h, + fit: BoxFit.cover, + ) + else + Image.asset( + "assets/image/default_1.png", + width: 95.w, + height: 95.h, + fit: BoxFit.cover, + ), Container( padding: EdgeInsets.only( left: 32.w, right: 32.w, top: 5.h, bottom: 5.h), diff --git a/lib/view_widget/custom_image.dart b/lib/view_widget/custom_image.dart index 11afd9cb..362919b4 100644 --- a/lib/view_widget/custom_image.dart +++ b/lib/view_widget/custom_image.dart @@ -36,6 +36,12 @@ class MImage extends StatelessWidget { "x${constraints.constrainHeight() * scaleIndex}/format/webp/blur/1x0/quality/75"; } print("imageUrl: $imageUrl"); + if (imageUrl == null || imageUrl == "") { + return Image.asset( + "assets/image/default_2_1.png", + fit: fit, + ); + } return CachedNetworkImage( imageUrl: imageUrl, cacheManager: DefaultCacheManager(),