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,