Selaa lähdekoodia

[new]优化会员页滚动区域问题

zk 5 kuukautta sitten
vanhempi
commit
d7c795fbbd
1 muutettua tiedostoa jossa 199 lisäystä ja 170 poistoa
  1. 199 170
      lib/module/member/member_page.dart

+ 199 - 170
lib/module/member/member_page.dart

@@ -68,88 +68,93 @@ class MemberPage extends BasePage<MemberController> {
         controller.onPopBack();
       },
       child: Stack(
-        children: [
-          SingleChildScrollView(
-            physics: const ClampingScrollPhysics(),
-            controller: controller.scrollController,
-            child: Stack(
+        children: [buildScrollView(), buildHeadBar(),
+          buildMemberBottomView()
+        ],
+      ),
+    );
+  }
+
+  Widget buildScrollView() {
+    return SingleChildScrollView(
+        physics: const ClampingScrollPhysics(),
+        controller: controller.scrollController,
+        child: Stack(
+          children: [
+            MemberHeaderCycleWidget(),
+            Column(
               children: [
-                MemberHeaderCycleWidget(),
-                Column(
-                  children: [
-                    SizedBox(height: 249.w + MediaQuery.of(Get.context!).padding.top - 24.w),
-                    Container(
-                      decoration: BoxDecoration(
-                        color: ColorName.white,
-                        borderRadius: BorderRadius.only(
-                            topLeft: Radius.circular(20.w),
-                            topRight: Radius.circular(20.w)),
-                        boxShadow: [
-                          BoxShadow(
-                            color: Color.fromRGBO(0, 63, 127, 0.10),
-                            blurRadius: 28.6,
-                            offset: Offset(0, -20),
-                          ),
-                        ],
+                SizedBox(
+                    height:
+                        249.w + MediaQuery.of(Get.context!).padding.top - 24.w),
+                Container(
+                  decoration: BoxDecoration(
+                    color: ColorName.white,
+                    borderRadius: BorderRadius.only(
+                        topLeft: Radius.circular(20.w),
+                        topRight: Radius.circular(20.w)),
+                    boxShadow: [
+                      BoxShadow(
+                        color: Color.fromRGBO(0, 63, 127, 0.10),
+                        blurRadius: 28.6,
+                        offset: Offset(0, -20),
                       ),
-                      child: Stack(
-                        children: [
-                          Container(
-                            decoration: BoxDecoration(
-                                borderRadius: BorderRadius.only(
-                                    topLeft: Radius.circular(20.w),
-                                    topRight: Radius.circular(20.w)),
-                                image: DecorationImage(
-                                  image: Assets.images.iconMemberVipMiddleBg.provider(),
-                                )
-                            ),
-                            width: double.infinity,
-                            height: 174,
-                          ),
-                          Container(
-                            //width: double.infinity,
-                            decoration: BoxDecoration(
-                                borderRadius: BorderRadius.only(
-                                    topLeft: Radius.circular(20.w),
-                                    topRight: Radius.circular(20.w)),
-                            ),
-                            child: Column(
-                              crossAxisAlignment: CrossAxisAlignment.start,
-                              children: [
-                                SizedBox(height: 15.w),
-                                buildUserInfoView(),
-                                SizedBox(height: 23.w),
-                                buildGoodsList(),
-                                SizedBox(height: 12.w),
-                                buildPayWayView(),
-                                SizedBox(height: 12.w),
-                                Padding(
-                                  padding: EdgeInsets.only(left: 16.w),
-                                  child: Text(StringName.memberUserEvaluate,
-                                      style: TextStyle(
-                                          fontSize: 16.sp,
-                                          color: ColorName.black,
-                                          fontWeight: FontWeight.bold)),
-                                ),
-                                //SizedBox(height: 8.w),
-                                buildUserEvaluateList(),
-                                SizedBox(height: 190.w + MediaQuery.of(Get.context!).padding.bottom)
-                              ],
+                    ],
+                  ),
+                  child: Stack(
+                    children: [
+                      Container(
+                        decoration: BoxDecoration(
+                            borderRadius: BorderRadius.only(
+                                topLeft: Radius.circular(20.w),
+                                topRight: Radius.circular(20.w)),
+                            image: DecorationImage(
+                              image: Assets.images.iconMemberVipMiddleBg
+                                  .provider(),
+                            )),
+                        width: double.infinity,
+                        height: 174,
+                      ),
+                      Container(
+                        //width: double.infinity,
+                        decoration: BoxDecoration(
+                          borderRadius: BorderRadius.only(
+                              topLeft: Radius.circular(20.w),
+                              topRight: Radius.circular(20.w)),
+                        ),
+                        child: Column(
+                          crossAxisAlignment: CrossAxisAlignment.start,
+                          children: [
+                            SizedBox(height: 15.w),
+                            buildUserInfoView(),
+                            SizedBox(height: 23.w),
+                            buildGoodsList(),
+                            SizedBox(height: 12.w),
+                            buildPayWayView(),
+                            SizedBox(height: 12.w),
+                            Padding(
+                              padding: EdgeInsets.only(left: 16.w),
+                              child: Text(StringName.memberUserEvaluate,
+                                  style: TextStyle(
+                                      fontSize: 16.sp,
+                                      color: ColorName.black,
+                                      fontWeight: FontWeight.bold)),
                             ),
-                          ),
-                        ],
+                            //SizedBox(height: 8.w),
+                            buildUserEvaluateList(),
+                            SizedBox(
+                                height: 190.w +
+                                    MediaQuery.of(Get.context!).padding.bottom)
+                          ],
+                        ),
                       ),
-                    )
-                  ],
-                ),
+                    ],
+                  ),
+                )
               ],
-            )
-          ),
-          buildHeadBar(),
-          buildMemberBottomView()
-        ],
-      ),
-    );
+            ),
+          ],
+        ));
   }
 
   Widget buildGoodsList() {
@@ -371,107 +376,131 @@ class MemberPage extends BasePage<MemberController> {
 
   Widget buildMemberBottomView() {
     return Obx(() {
-      return Visibility(
-        visible: controller.memberStatusInfo == null ||
-            controller.memberStatusInfo?.permanent == false,
-        child: Align(
-          alignment: Alignment.bottomCenter,
-          child: Container(//top: 98.w,
-            alignment: Alignment.bottomCenter,
-            height: 190.w + MediaQuery.of(Get.context!).padding.bottom,
-            padding: EdgeInsets.only(
-                left: 12.w, right: 12.w, bottom: 17.w + MediaQuery.of(Get.context!).padding.bottom),
-            decoration: BoxDecoration(
-              gradient: LinearGradient(
-                begin: Alignment.bottomCenter, // 0deg 相当于从底部开始
-                end: Alignment.topCenter,
-                colors: [
-                  Colors.white, // #FFF
-                  "#00FFFFFF".color,
-                ],
-                stops: [0.4368, 1.0], // 对应 43.68% 和 100%
+      if (controller.memberStatusInfo != null &&
+          controller.memberStatusInfo?.permanent == true) {
+        return SizedBox(); // 不显示
+      }
+
+      return Align(
+        alignment: Alignment.bottomCenter,
+        child: Stack(
+          children: [
+            // 渐变遮罩层(透明可穿透)
+            IgnorePointer(
+              ignoring: true, // 不处理事件
+              child: Container(
+                height: 190.w + MediaQuery.of(Get.context!).padding.bottom,
+                decoration: BoxDecoration(
+                  gradient: LinearGradient(
+                    begin: Alignment.bottomCenter,
+                    end: Alignment.topCenter,
+                    colors: [
+                      Colors.white,
+                      "#00FFFFFF".color,
+                    ],
+                    stops: [0.4368, 1.0],
+                  ),
+                ),
               ),
             ),
-            child: Column(
-              mainAxisAlignment: MainAxisAlignment.end,
-              children: [
-                Container(
-                  width: double.infinity,  // 设置容器宽度
-                  height: 50.w, // 设置容器高度
-                  padding: EdgeInsets.only(left: 20.w),
-                  decoration: BoxDecoration(
-                    image: DecorationImage(
-                      image: Assets.images.iconMemberSettlementBg.provider(),
-                      fit: BoxFit.fill,
-                    ),
-                  ),
-                  // 实现内阴影效果
-                  child: Row(
-                    children: [
-                      Transform.translate(
-                        offset: Offset(0, 3), // 向下偏移4像素
-                        child: Text('¥',
+
+            // 按钮区域(可点击)
+            Positioned(
+              bottom: 0,
+              left: 0,
+              right: 0,
+              child: Container(
+                height: 190.w + MediaQuery.of(Get.context!).padding.bottom,
+                padding: EdgeInsets.only(
+                    left: 12.w,
+                    right: 12.w,
+                    bottom: 17.w + MediaQuery.of(Get.context!).padding.bottom),
+                alignment: Alignment.bottomCenter,
+                child: Column(
+                  mainAxisAlignment: MainAxisAlignment.end,
+                  children: [
+                    // bottom 按钮和价格栏
+                    Container(
+                      width: double.infinity,
+                      height: 50.w,
+                      padding: EdgeInsets.only(left: 20.w),
+                      decoration: BoxDecoration(
+                        image: DecorationImage(
+                          image:
+                              Assets.images.iconMemberSettlementBg.provider(),
+                          fit: BoxFit.fill,
+                        ),
+                      ),
+                      child: Row(
+                        children: [
+                          Transform.translate(
+                            offset: Offset(0, 3),
+                            child: Text('¥',
+                                style: TextStyle(
+                                    fontSize: 14.sp,
+                                    color: '#FFF8EF'.color,
+                                    fontWeight: FontWeight.bold)),
+                          ),
+                          SizedBox(width: 3.w),
+                          Text(
+                            controller.selectedGoods?.amount.divideBy100() ??
+                                '--',
                             style: TextStyle(
-                                fontSize: 14.sp,
+                                fontSize: 24.sp,
                                 color: '#FFF8EF'.color,
-                                fontWeight: FontWeight.bold)),
-                      ),
-                      SizedBox(width: 3.w,),
-                      Text(
-                        controller.selectedGoods?.amount.divideBy100() ?? '--',
-                        style: TextStyle(
-                            fontSize: 24.sp,
-                            color: '#FFF8EF'.color,
-                            fontWeight: FontWeight.bold),
-                      ),
-                      SizedBox(width: 3.w,),
-                      Text("/",
-                        style: TextStyle(
-                            fontSize: 12.sp,
-                            fontWeight: FontWeight.w400,
-                            color: "#FFF8EF".color),),
-                      Text('原价${controller.selectedGoods?.originalAmount.divideBy100()}',
-                          style: TextStyle(
-                              decoration: TextDecoration.lineThrough,
-                              decorationColor: Colors.white,
-                              decorationThickness: 1.0,
-                              fontSize: 12.sp,
-                              fontWeight: FontWeight.w400,
-                              color: "#FFF8EF".color)),
-                      Spacer(),
-                      GestureDetector(
-                        onTap: controller.onBuyClick,
-                        child: Container(
-                          decoration: BoxDecoration(
-                              image: DecorationImage(
-                                image: Assets.images.iconMemberSettlementConfirm.provider(),
-                                fit: BoxFit.fill,
-                              )
+                                fontWeight: FontWeight.bold),
+                          ),
+                          SizedBox(width: 3.w),
+                          Text(
+                            "/",
+                            style: TextStyle(
+                                fontSize: 12.sp,
+                                fontWeight: FontWeight.w400,
+                                color: "#FFF8EF".color),
                           ),
-                          // width: 164.w,
-                          // height: 44.w,
-                          padding: EdgeInsets.only(left: 64.w,right: 29.w),
-                          child: Center(
-                            child: Text(
-                              controller.memberStatusInfo?.expired == false
-                                  ? StringName.memberVipRenew
-                                  : StringName.memberVipUnlock,
+                          Text(
+                              '原价${controller.selectedGoods?.originalAmount.divideBy100()}',
                               style: TextStyle(
-                                  fontSize: 18.sp,
-                                  color: "#9B3800".color,
-                                  fontWeight: FontWeight.bold),
+                                  decoration: TextDecoration.lineThrough,
+                                  decorationColor: Colors.white,
+                                  decorationThickness: 1.0,
+                                  fontSize: 12.sp,
+                                  fontWeight: FontWeight.w400,
+                                  color: "#FFF8EF".color)),
+                          Spacer(),
+                          GestureDetector(
+                            onTap: controller.onBuyClick,
+                            child: Container(
+                              decoration: BoxDecoration(
+                                  image: DecorationImage(
+                                image: Assets.images.iconMemberSettlementConfirm
+                                    .provider(),
+                                fit: BoxFit.fill,
+                              )),
+                              padding: EdgeInsets.only(left: 64.w, right: 29.w),
+                              child: Center(
+                                child: Text(
+                                  controller.memberStatusInfo?.expired == false
+                                      ? StringName.memberVipRenew
+                                      : StringName.memberVipUnlock,
+                                  style: TextStyle(
+                                      fontSize: 18.sp,
+                                      color: "#9B3800".color,
+                                      fontWeight: FontWeight.bold),
+                                ),
+                              ),
                             ),
-                          ),
-                        ),
-                      )
-                    ],
-                  ),
+                          )
+                        ],
+                      ),
+                    ),
+                    SizedBox(height: 8.w),
+                    buildPrivacyPolicyView(),
+                  ],
                 ),
-                SizedBox(height: 8.w,),
-                buildPrivacyPolicyView(),
-              ],
-            ),
-          ),
+              ),
+            )
+          ],
         ),
       );
     });