Explorar el Código

[fix]优化会员中心商品列表显示

zk hace 5 meses
padre
commit
c75bf900f6
Se han modificado 2 ficheros con 235 adiciones y 167 borrados
  1. BIN
      assets/images/icon_member_vip_middle_bg.webp
  2. 235 167
      lib/module/member/member_page.dart

BIN
assets/images/icon_member_vip_middle_bg.webp


+ 235 - 167
lib/module/member/member_page.dart

@@ -31,8 +31,10 @@ import 'member_header_cycle_widget.dart';
 enum MemberPageType {
   ///通用进入
   universalAccessEnter,
+
   ///倒计时试用完会员进入
   afeterTrialMemberEnter,
+
   ///加好友进入
   addFriendToEnter,
   //活动页
@@ -40,13 +42,13 @@ enum MemberPageType {
 }
 
 class MemberPage extends BasePage<MemberController> {
-
-  MemberPage({super.key,this.pageType});
+  MemberPage({super.key, this.pageType});
 
   late MemberPageType? pageType = MemberPageType.universalAccessEnter;
 
-  static void start({MemberPageType? enterTyp = MemberPageType.universalAccessEnter}) {
-    Get.toNamed(RoutePath.member,arguments: enterTyp);
+  static void start(
+      {MemberPageType? enterTyp = MemberPageType.universalAccessEnter}) {
+    Get.toNamed(RoutePath.member, arguments: enterTyp);
   }
 
   @override
@@ -61,7 +63,7 @@ class MemberPage extends BasePage<MemberController> {
 
   @override
   Widget buildBody(BuildContext context) {
-          return PopScope(
+    return PopScope(
       canPop: false,
       onPopInvokedWithResult: (bool didPop, dynamic result) async {
         if (didPop) {
@@ -70,9 +72,7 @@ class MemberPage extends BasePage<MemberController> {
         controller.onPopBack();
       },
       child: Stack(
-        children: [buildScrollView(), buildHeadBar(),
-          buildMemberBottomView()
-        ],
+        children: [buildScrollView(), buildHeadBar(), buildMemberBottomView()],
       ),
     );
   }
@@ -106,6 +106,8 @@ class MemberPage extends BasePage<MemberController> {
                   child: Stack(
                     children: [
                       Container(
+                        margin:
+                            EdgeInsets.only(left: 2.w, right: 2.w, top: 2.w),
                         decoration: BoxDecoration(
                             borderRadius: BorderRadius.only(
                                 topLeft: Radius.circular(20.w),
@@ -115,7 +117,7 @@ class MemberPage extends BasePage<MemberController> {
                                   .provider(),
                             )),
                         width: double.infinity,
-                        height: 174,
+                        height: 174.w,
                       ),
                       Container(
                         //width: double.infinity,
@@ -129,7 +131,7 @@ class MemberPage extends BasePage<MemberController> {
                           children: [
                             SizedBox(height: 15.w),
                             buildUserInfoView(),
-                            SizedBox(height: 23.w),
+                            SizedBox(height: 12.w),
                             buildGoodsList(),
                             SizedBox(height: 12.w),
                             buildPayWayView(),
@@ -191,17 +193,17 @@ class MemberPage extends BasePage<MemberController> {
           }
         }
 
-        widgets.add(Row(
-          mainAxisAlignment: MainAxisAlignment.spaceBetween,
-          children: rowItems,
+        widgets.add(Container(
+          margin: EdgeInsets.only(left: 16.w, right: 16.w),
+          child: Row(
+            mainAxisAlignment: MainAxisAlignment.spaceBetween,
+            children: rowItems,
+          ),
         ));
       }
 
-      return Container(
-        padding: EdgeInsets.symmetric(horizontal: 14.w),
-        child: Column(
-          children: widgets,
-        ),
+      return Column(
+        children: widgets,
       );
     });
   }
@@ -215,16 +217,21 @@ class MemberPage extends BasePage<MemberController> {
       },
       child: Container(
         height: 96.w,
+        margin: EdgeInsets.only(left: 12.w, right: 16.w),
         padding: EdgeInsets.only(left: 17.w),
         decoration: BoxDecoration(
           image: DecorationImage(
-              image: isSelected ? Assets.images.iconMemberSpecialProductsSelect.provider() : Assets.images.iconMemberSpecialProductsNormal.provider(),
-              fit: BoxFit.cover
+            image: isSelected
+                ? Assets.images.iconMemberSpecialProductsSelect.provider()
+                : Assets.images.iconMemberSpecialProductsNormal.provider(),
+            fit: BoxFit.fill,
           ),
         ),
         child: Column(
           children: [
-            SizedBox(height: 29.w,),
+            SizedBox(
+              height: 29.w,
+            ),
             Row(
               children: [
                 Column(
@@ -239,19 +246,15 @@ class MemberPage extends BasePage<MemberController> {
                             children: [
                               TextSpan(
                                   text: '¥',
-                                  style: TextStyle(
-                                      fontSize: 16.sp, height: 1)),
-                              TextSpan(
+                              style: TextStyle(fontSize: 16.sp, height: 1)),
+                          TextSpan(
                                   text: goodsInfo.amount.divideBy100(),
                                   style: TextStyle(
                                     fontSize: 28.sp,
                                     height: 1,
                                     //fontFamily: FontFamily.oppoSans
-                                  )
-                              )
-                            ]
-                        )
-                    ),
+                              ))
+                        ])),
                     Text('¥${goodsInfo.originalAmount.divideBy100()}',
                         style: TextStyle(
                             decoration: TextDecoration.lineThrough,
@@ -261,7 +264,9 @@ class MemberPage extends BasePage<MemberController> {
                             color: ColorName.black40))
                   ],
                 ),
-                SizedBox(width: 22.24.w,),
+                SizedBox(
+                  width: 22.24.w,
+                ),
                 Column(
                   crossAxisAlignment: CrossAxisAlignment.start,
                   children: [
@@ -278,7 +283,7 @@ class MemberPage extends BasePage<MemberController> {
                     Text(
                       goodsInfo.description ?? "",
                       style: TextStyle(
-                          fontSize: 11.sp ,
+                          fontSize: 11.sp,
                           color: "#9191BA".color,
                           fontWeight: FontWeight.bold),
                     ),
@@ -299,77 +304,96 @@ class MemberPage extends BasePage<MemberController> {
       onTap: () {
         controller.onGoodsItemClick(goodsInfo);
       },
-      child: Container(
+      child: SizedBox(
+        width: double.infinity,
         height: 62.w,
-        padding: EdgeInsets.only(left: 16.w,right: 12.w),
-        decoration: BoxDecoration(
-          image: DecorationImage(
-              image: isSelected ? Assets.images.iconMemberOrdinaryProductSelect.provider() : Assets.images.iconMemberOrdinaryProductNormal.provider(),
-              fit: BoxFit.cover
-          ),
-        ),
-        child: Column(
+        child: Stack(
           children: [
-            SizedBox(height: 15.w,),
-            Row(
-              mainAxisAlignment: MainAxisAlignment.spaceBetween,
-              children: [
-                Column(
-                  crossAxisAlignment: CrossAxisAlignment.start,
-                  children: [
-                    Text(
-                      goodsInfo.name,
-                      style: TextStyle(
-                          fontSize: 12.sp,
-                          color: "#333333".color,
-                          fontWeight: FontWeight.bold),
-                    ),
-                    //SizedBox(height: 6.w,),
-                    Text(
-                      goodsInfo.description ?? "",
-                      style: TextStyle(
-                          fontSize: 10.sp ,
-                          color: ColorName.black40,
-                          fontWeight: FontWeight.bold),
-                    ),
-                  ],
-                ),
-                //SizedBox(width: 22.24.w,),
-                Column(
-                  crossAxisAlignment: CrossAxisAlignment.end,
-                  children: [
-                    RichText(
-                        text: TextSpan(
+            Container(
+                width: double.infinity,
+                height: double.infinity,
+                decoration: BoxDecoration(
+                    gradient: LinearGradient(
+                        colors: ['#FFFFFF'.color, '#F3EAFF'.color],
+                        begin: Alignment.topLeft,
+                        end: Alignment.bottomRight,
+                        stops: const [0.4, 1.0]),
+                    borderRadius: BorderRadius.circular(12.w),
+                    border: Border.all(
+                      color: isSelected ? '#7A13C6'.color : '#F1E6FF'.color,
+                      width: isSelected ? 2.5.w : 1.w,
+                    ))),
+            Container(
+              padding: EdgeInsets.only(left: 16.w, right: 12.w),
+              child: Column(
+                children: [
+                  SizedBox(
+                    height: 15.w,
+                  ),
+                  Row(
+                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                    children: [
+                      Column(
+                        crossAxisAlignment: CrossAxisAlignment.start,
+                        children: [
+                          Text(
+                            goodsInfo.name,
                             style: TextStyle(
-                                color: isSelected
-                                    ? '#FF5656'.color
-                                    : "#323133".color,
+                                fontSize: 12.sp,
+                                color: "#333333".color,
                                 fontWeight: FontWeight.bold),
-                            children: [
-                              TextSpan(
-                                  text: '¥',
-                                  style: TextStyle(
-                                      color: isSelected? "#FF5656".color : ColorName.black80,
-                                      fontSize: 11.sp, height: 1)),
-                              TextSpan(
-                                  text: goodsInfo.amount.divideBy100(),
+                          ),
+                          //SizedBox(height: 6.w,),
+                          Text(
+                            goodsInfo.description ?? "",
+                            style: TextStyle(
+                                fontSize: 10.sp,
+                                color: ColorName.black40,
+                                fontWeight: FontWeight.bold),
+                          ),
+                        ],
+                      ),
+                      //SizedBox(width: 22.24.w,),
+                      Column(
+                        crossAxisAlignment: CrossAxisAlignment.end,
+                        children: [
+                          RichText(
+                              text: TextSpan(
                                   style: TextStyle(
-                                    fontSize: 20.sp,
-                                    height: 1,))
-                            ]
-                        )
-                    ),
-                    Text('¥${goodsInfo.originalAmount.divideBy100()}',
-                        style: TextStyle(
-                            decoration: TextDecoration.lineThrough,
-                            decorationColor: ColorName.black30,
-                            decorationThickness: 1.0,
-                            fontSize: 10.sp,
-                            color: ColorName.black30))
-                  ],
-                ),
-              ],
-            ),
+                                      color: isSelected
+                                          ? '#FF5656'.color
+                                          : "#323133".color,
+                                      fontWeight: FontWeight.bold),
+                                  children: [
+                                TextSpan(
+                                    text: '¥',
+                                    style: TextStyle(
+                                        color: isSelected
+                                            ? "#FF5656".color
+                                            : ColorName.black80,
+                                        fontSize: 11.sp,
+                                        height: 1)),
+                                TextSpan(
+                                    text: goodsInfo.amount.divideBy100(),
+                                    style: TextStyle(
+                                      fontSize: 20.sp,
+                                      height: 1,
+                                    ))
+                              ])),
+                          Text('¥${goodsInfo.originalAmount.divideBy100()}',
+                              style: TextStyle(
+                                  decoration: TextDecoration.lineThrough,
+                                  decorationColor: ColorName.black30,
+                                  decorationThickness: 1.0,
+                                  fontSize: 10.sp,
+                                  color: ColorName.black30))
+                        ],
+                      ),
+                    ],
+                  ),
+                ],
+              ),
+            )
           ],
         ),
       ),
@@ -512,8 +536,9 @@ class MemberPage extends BasePage<MemberController> {
     return Row(
       children: [
         SizedBox(width: 18.w),
-        controller.isLogin ?  ClipOval(
-          child: Container(
+        controller.isLogin
+            ? ClipOval(
+                child: Container(
             width: 32.w,
             height: 32.w,
             child: CachedNetworkImage(
@@ -521,7 +546,8 @@ class MemberPage extends BasePage<MemberController> {
               fit: BoxFit.cover,
             ),
           ),
-        ) : Assets.images.iconMemberAvatar.image(width: 32.w, height: 32.w),
+              )
+            : Assets.images.iconMemberAvatar.image(width: 32.w, height: 32.w),
         SizedBox(width: 7.w),
         Column(
           crossAxisAlignment: CrossAxisAlignment.start,
@@ -547,15 +573,16 @@ class MemberPage extends BasePage<MemberController> {
                 children: [
                   // 左侧内容:会员等级描述 + VIP卡片描述
                   Visibility(
-                    visible: MemberStatusInfo.getLevelDesc(controller.memberStatusInfo).isNotEmpty,
+                    visible: MemberStatusInfo.getLevelDesc(
+                            controller.memberStatusInfo)
+                        .isNotEmpty,
                     child: Text(
-                        MemberStatusInfo.getLevelDesc(controller.memberStatusInfo),
+                        MemberStatusInfo.getLevelDesc(
+                            controller.memberStatusInfo),
                         style: TextStyle(
                             fontSize: 11.sp,
                             fontWeight: FontWeight.w700,
-                            color: '#9144F8'.color
-                        )
-                    ),
+                            color: '#9144F8'.color)),
                   ),
                   buildMemberCardVipDesc(),
                   Spacer(),
@@ -581,7 +608,7 @@ class MemberPage extends BasePage<MemberController> {
     return Obx(() {
       String desc = '';
       if (!controller.isLogin) {
-        if ((controller.memberStatusInfo?.endTimestamp?? 0) > 0) {
+        if ((controller.memberStatusInfo?.endTimestamp ?? 0) > 0) {
           desc =
           '${DateUtil.fromMillisecondsSinceEpoch('yyyy-MM-dd', controller.memberStatusInfo?.endTimestamp ?? 0)} ${StringName.memberCardExpirationDesc}';
         } else {
@@ -598,32 +625,40 @@ class MemberPage extends BasePage<MemberController> {
             '${DateUtil.fromMillisecondsSinceEpoch('yyyy-MM-dd', controller.memberStatusInfo?.endTimestamp ?? 0)} ${StringName.memberCardExpirationDesc}';
       }
       return Text(desc,
-          style: TextStyle(fontSize: 11.sp, color: ColorName.black50,fontWeight: FontWeight.w400));
+          style: TextStyle(
+              fontSize: 11.sp,
+              color: ColorName.black50,
+              fontWeight: FontWeight.w400));
     });
   }
 
   Widget buildHeadBar() {
     return Column(
       children: [
-        SizedBox(height: MediaQuery.of(Get.context!).padding.top,),
+        SizedBox(
+          height: MediaQuery.of(Get.context!).padding.top,
+        ),
         Container(
           width: double.infinity,
           height: 56.w,
           child: Row(
             crossAxisAlignment: CrossAxisAlignment.center,
             children: [
-              SizedBox(width: 15.w,),
+              SizedBox(
+                width: 15.w,
+              ),
               GestureDetector(
                 onTap: () => controller.onPopBack(),
                 child: Assets.images.iconMemberVipBack
                     .image(width: 26.w, height: 26..w),
               ),
-              SizedBox(width: 10.w,),
+              SizedBox(
+                width: 10.w,
+              ),
               Container(
                   width: MediaQuery.of(Get.context!).size.width - 51.w,
                   padding: EdgeInsets.only(right: 12.w),
-                  child: buildVerticalSlideshowWidget()
-              ),
+                  child: buildVerticalSlideshowWidget()),
             ],
           ),
         )
@@ -632,53 +667,62 @@ class MemberPage extends BasePage<MemberController> {
   }
 
   Widget buildVerticalSlideshowWidget() {
-    return  Row(
+    return Row(
       children: [
-        Expanded(child: Center(
-          child: Container(
-            width: 192.w,
-            height: 26.w,
-            decoration: BoxDecoration(
-              color: ColorName.black40,
-              borderRadius: BorderRadius.circular(87.w),
+        Expanded(
+          child: Center(
+            child: Container(
+              width: 192.w,
+              height: 26.w,
+              decoration: BoxDecoration(
+                color: ColorName.black40,
+                borderRadius: BorderRadius.circular(87.w),
+              ),
+              child: Center(
+                  child: AnimatedSwitcherWidget(
+                      controller: controller.switcherController)),
             ),
-            child: Center(
-                child: AnimatedSwitcherWidget(
-                    controller: controller.switcherController)),
           ),
         ),
-        ),
-        if (Platform.isAndroid) SizedBox(width: 40.w,),
-        if (Platform.isIOS) Obx(() {
-          return Visibility(
-            visible: Platform.isIOS && controller.accountRepository.isLogin.value,
-              child: Row(
-                children: [
-                  SizedBox(width: 26.w,),
-                  GestureDetector(
-                    onTap: controller.clickRecoverSubscribe,
-                    child: Container(
-                      height: 26.w,
-                      decoration: BoxDecoration(
-                        color: ColorName.black40,
-                        borderRadius: BorderRadius.circular(26.w / 2.0),
-                      ),
-                      padding: EdgeInsets.symmetric(horizontal: 10.w),
-                      child: Row(
-                        children: [
-                          Assets.images.iconAppleRecoverSubscribe.image(width: 14.w,height: 14.w),
-                          Text(StringName.appleRecoverSubscribeTxt,
-                              style: TextStyle(
-                                  fontSize: 11.sp,
-                                  color: ColorName.white,
-                                  fontWeight: FontWeight.w500)),
-                        ],
-                      ),
+        if (Platform.isAndroid)
+          SizedBox(
+            width: 40.w,
+          ),
+        if (Platform.isIOS)
+          Obx(() {
+            return Visibility(
+                visible: Platform.isIOS &&
+                    controller.accountRepository.isLogin.value,
+                child: Row(
+                  children: [
+                    SizedBox(
+                      width: 26.w,
                     ),
-                  )
-                ],
-              ));
-        })
+                    GestureDetector(
+                      onTap: controller.clickRecoverSubscribe,
+                      child: Container(
+                        height: 26.w,
+                        decoration: BoxDecoration(
+                          color: ColorName.black40,
+                          borderRadius: BorderRadius.circular(26.w / 2.0),
+                        ),
+                        padding: EdgeInsets.symmetric(horizontal: 10.w),
+                        child: Row(
+                          children: [
+                            Assets.images.iconAppleRecoverSubscribe
+                                .image(width: 14.w, height: 14.w),
+                            Text(StringName.appleRecoverSubscribeTxt,
+                                style: TextStyle(
+                                    fontSize: 11.sp,
+                                    color: ColorName.white,
+                                    fontWeight: FontWeight.w500)),
+                          ],
+                        ),
+                      ),
+                    )
+                  ],
+                ));
+          })
       ],
     );
   }
@@ -751,22 +795,27 @@ class MemberPage extends BasePage<MemberController> {
         children: [
           for (int index = 0; index < controller.evaluateList.length; index++)
             buildUserEvaluateItem(controller.evaluateList.value[index],
-                index == controller.evaluateList.value.length - 1,index == 0)
+                index == controller.evaluateList.value.length - 1, index == 0)
         ],
       );
     });
   }
 
-  Widget buildUserEvaluateItem(GoodsEvaluateInfo item, bool isLast,bool isFirst) {
+  Widget buildUserEvaluateItem(
+      GoodsEvaluateInfo item, bool isLast, bool isFirst) {
     return Container(
       padding: EdgeInsets.symmetric(horizontal: 16.w),
       child: Column(
         crossAxisAlignment: CrossAxisAlignment.start,
         children: [
-          SizedBox(height: isFirst? 16.w : 20.w),
+          SizedBox(height: isFirst ? 16.w : 20.w),
           Row(
             children: [
-              CachedNetworkImage(imageUrl: item.avatar,width: 34.w, height: 34.w,),
+              CachedNetworkImage(
+                imageUrl: item.avatar,
+                width: 34.w,
+                height: 34.w,
+              ),
               SizedBox(width: 10.w),
               // 使用 Expanded 确保 Column 占据剩余宽度
               Expanded(
@@ -777,21 +826,31 @@ class MemberPage extends BasePage<MemberController> {
                       children: [
                         Text(
                           item.name,
-                          style: TextStyle(fontSize: 14.sp, color: "#333333".color, fontWeight: FontWeight.w400),
+                          style: TextStyle(
+                              fontSize: 14.sp,
+                              color: "#333333".color,
+                              fontWeight: FontWeight.w400),
                         ),
                         Spacer(),
-                        Assets.images.iconMemberCommentVerySatisfied.image(width: 16.w,height: 16.w),
+                        Assets.images.iconMemberCommentVerySatisfied
+                            .image(width: 16.w, height: 16.w),
                         SizedBox(width: 5.w),
                         Text(
                           item.description,
-                          style: TextStyle(fontSize: 11.sp, color: "#DC8514".color, fontWeight: FontWeight.w500),
+                          style: TextStyle(
+                              fontSize: 11.sp,
+                              color: "#DC8514".color,
+                              fontWeight: FontWeight.w500),
                         )
                       ],
                     ),
                     SizedBox(height: 5.w),
                     Text(
                       item.content,
-                      style: TextStyle(fontSize: 11.sp, color: '#333333'.color, fontWeight: FontWeight.w400),
+                      style: TextStyle(
+                          fontSize: 11.sp,
+                          color: '#333333'.color,
+                          fontWeight: FontWeight.w400),
                       maxLines: null, // 允许无限行数
                       softWrap: true, // 允许文本换行
                     )
@@ -823,8 +882,13 @@ class MemberPage extends BasePage<MemberController> {
             children: [
               SizedBox(height: 12.w),
               Text("支付方式",
-                  style: TextStyle(fontSize: 16.sp, color: ColorName.black,fontWeight: FontWeight.bold)),
-              SizedBox(height: 5.w,),
+                  style: TextStyle(
+                      fontSize: 16.sp,
+                      color: ColorName.black,
+                      fontWeight: FontWeight.bold)),
+              SizedBox(
+                height: 5.w,
+              ),
               for (PayItemBean item in controller.payItemList)
                 buildPayWayItem(item)
             ],
@@ -846,19 +910,23 @@ class MemberPage extends BasePage<MemberController> {
             children: [
               Image.asset(
                   getPaymentIconPath(
-                      payMethod:item.payMethod, payPlatform: item.payPlatform),
+                      payMethod: item.payMethod, payPlatform: item.payPlatform),
                   width: 20.w,
                   height: 20.w),
               SizedBox(width: 8.w),
               Text(item.title,
-                  style: TextStyle(fontSize: 12.sp, color: ColorName.black,fontWeight: FontWeight.w400)),
+                  style: TextStyle(
+                      fontSize: 12.sp,
+                      color: ColorName.black,
+                      fontWeight: FontWeight.w400)),
               Spacer(),
               Image.asset(
                   isSelected
                       ? Assets.images.iconCbSelected.path
                       : Assets.images.iconCbUnSelect.path,
                   width: 16.w,
-                  height: 16.w),],
+                  height: 16.w),
+            ],
           ),
         );
       }),