From db6ead0247f3970336a86b9c6320015c975ea5df Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Wed, 18 May 2022 15:38:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/view_widget/new_coupon_widget.dart | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/view_widget/new_coupon_widget.dart b/lib/view_widget/new_coupon_widget.dart index b80b0bdc..03a08cad 100644 --- a/lib/view_widget/new_coupon_widget.dart +++ b/lib/view_widget/new_coupon_widget.dart @@ -18,6 +18,17 @@ class NewCouponWidget extends StatelessWidget { return buildCoupon(context); } + String getCouponStoreName(){ + String couponStoreName = coupon.tenantName; + if(coupon?.storeList != null && coupon.storeId != "0"){ + coupon.storeList.forEach((element) { + if(element.id == coupon.storeId) + couponStoreName = element.storeName; + }); + } + return couponStoreName; + } + Widget buildCoupon(BuildContext context) { // if(coupon != null) { // coupon.isEx = fa; @@ -92,9 +103,7 @@ class NewCouponWidget extends StatelessWidget { width: 8.w, ), Expanded( - child: Text( - (coupon.storeId != "0" && coupon?.storeList != null && coupon.storeList.isNotEmpty && coupon.storeList.firstWhere((x) => x.id == coupon.storeId)!=null ? - coupon.storeList.firstWhere((x) => x.id == coupon.storeId).storeName : coupon.tenantName), + child: Text(getCouponStoreName(), overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 16.sp,