소스 검색

[new]优化会员页显示

zk 3 달 전
부모
커밋
1f0000056b
3개의 변경된 파일126개의 추가작업 그리고 103개의 파일을 삭제
  1. 11 3
      lib/data/repositories/member_repository.dart
  2. 0 1
      lib/module/member/activity/member_activity_controller.dart
  3. 115 99
      lib/module/member/member_page.dart

+ 11 - 3
lib/data/repositories/member_repository.dart

@@ -37,6 +37,7 @@ class MemberRepository {
   //最后选中的支付方式
   PayItemBean? lastSelectedPayItem;
   Timer? _timer;
+  bool _isActivityCountdownRunning = true;
 
   MemberRepository(this.atmobApi, this.accountRepository);
 
@@ -45,18 +46,24 @@ class MemberRepository {
   }
 
   void setLastSelectedMember(GoodsBean goodsBean, PayItemBean payItemBean) {
+    if (_isActivityCountdownRunning == false) {
+      return;
+    }
     lastSelectedGoods.value = goodsBean;
     lastSelectedPayItem = payItemBean;
+    startActivityCountdown();
   }
 
   void startActivityCountdown() {
-    _timer?.cancel();
-    activityDuration.value = Duration(minutes: 15);
+    if (_timer != null) {
+      return;
+    }
+    _isActivityCountdownRunning = true;
+    activityDuration.value = Duration(seconds: 20);
     _timer = Timer.periodic(const Duration(seconds: 1), (_) {
       final time = activityDuration.value;
       if (time != null) {
         if (time.inSeconds <= 1) {
-          _timer?.cancel();
           clearLastSelectedMember();
         } else {
           activityDuration.value = Duration(seconds: time.inSeconds - 1);
@@ -70,6 +77,7 @@ class MemberRepository {
     lastSelectedPayItem = null;
     activityDuration.value = null;
     _timer?.cancel();
+    _isActivityCountdownRunning = false;
   }
 
   Future<void> memberTrial() {

+ 0 - 1
lib/module/member/activity/member_activity_controller.dart

@@ -87,7 +87,6 @@ class MemberActivityController extends BaseController {
       if (goodsList.isNotEmpty && payItemList.isNotEmpty) {
         memberRepository.setLastSelectedMember(
             goodsList.first, payItemList.first);
-        memberRepository.startActivityCountdown();
       }
     }).catchError((error) {
       ErrorHandler.toastError(error);

+ 115 - 99
lib/module/member/member_page.dart

@@ -416,112 +416,128 @@ class MemberPage extends BasePage<MemberController> {
 
       return Align(
           alignment: Alignment.bottomCenter,
-          child: Container(
-            margin: EdgeInsets.only(bottom: 15.w, left: 12.w, right: 12.w),
-            child: Stack(
-              children: [
-                Container(
-                  width: 336.w,
-                  height: 47.w,
+          child: Stack(
+            children: [
+              IgnorePointer(
+                ignoring: true, // 不处理事件
+                child: Container(
+                  height: 190.w + MediaQuery.of(Get.context!).padding.bottom,
                   decoration: BoxDecoration(
-                      borderRadius: BorderRadius.only(
-                        topLeft: Radius.circular(30.w),
-                        topRight: Radius.circular(30.w),
-                      ),
-                      color: '#FFFED8'.color),
-                  child: Align(
-                    alignment: Alignment(0.0, -0.75),
-                    child: Row(
-                      mainAxisAlignment: MainAxisAlignment.center,
-                      children: [
-                        Text(
-                          StringName.memberActivityCountdown,
-                          style: TextStyle(
-                              fontSize: 11.sp, color: '#FF5656'.color),
-                        ),
-                        SizedBox(width: 4.w),
-                        Obx(() {
-                          return ActivityCountdownTextView(
-                              timeItemHeight: 15.w,
-                              contentPadding: EdgeInsets.zero,
-                              timeItemWidth: 16.w,
-                              textStyle: TextStyle(
-                                  fontSize: 10.sp, color: Colors.white),
-                              duration: controller.activityDuration ??
-                                  Duration(seconds: 0),
-                              separator: buildCountdownSeparator(),
-                              timeBgBoxDecoration: BoxDecoration(
-                                color: '#FF5656'.color,
-                                borderRadius: BorderRadius.circular(3.w),
-                              ));
-                        }),
-                        SizedBox(width: 4.w),
-                        Text(
-                          StringName.memberActivitySpeciallyPreferential,
-                          style: TextStyle(
-                              fontSize: 10.sp, color: '#FF5656'.color),
-                        )
+                    gradient: LinearGradient(
+                      begin: Alignment.bottomCenter,
+                      end: Alignment.topCenter,
+                      colors: [
+                        Colors.white,
+                        "#00FFFFFF".color,
                       ],
+                      stops: [0.4368, 1.0],
                     ),
                   ),
                 ),
-                GestureDetector(
-                  onTap: controller.onBuyClick,
-                  child: Container(
-                    margin: EdgeInsets.only(top: 24.w),
-                    height: 50.w,
-                    width: 336.w,
-                    child: ShimmerEffect(
-                      image: Assets.images.imgMemberBtnShadow.provider(),
-                      shimmerWidthFactor: 0.244047619047619,
-                      duration: Duration(milliseconds: 3000),
-                      delay: Duration(milliseconds: 800),
-                      child: Container(
-                        height: 50.w,
-                        width: 336.w,
-                        alignment: Alignment.center,
-                        decoration: BoxDecoration(
-                            image: DecorationImage(
-                                image: Assets.images.iconMemberSettlementBg
-                                    .provider(),
-                                fit: BoxFit.fill)),
-                        child: Text(
-                          StringName.memberVipUnlock,
-                          style: TextStyle(
-                              fontSize: 18.sp,
-                              color: '#FFF8EF'.color,
-                              fontWeight: FontWeight.bold),
-                        ),
+              ),
+              Positioned(
+                left: 0,
+                right: 0,
+                bottom: MediaQuery.of(Get.context!).padding.bottom,
+                child: IntrinsicHeight(
+                  child: Column(
+                    children: [
+                      Stack(
+                        children: [
+                          Container(
+                            width: 336.w,
+                            height: 47.w,
+                            decoration: BoxDecoration(
+                                borderRadius: BorderRadius.only(
+                                  topLeft: Radius.circular(30.w),
+                                  topRight: Radius.circular(30.w),
+                                ),
+                                color: '#FFFED8'.color),
+                            child: Align(
+                              alignment: Alignment(0.0, -0.75),
+                              child: Row(
+                                mainAxisAlignment: MainAxisAlignment.center,
+                                children: [
+                                  Text(
+                                    StringName.memberActivityCountdown,
+                                    style: TextStyle(
+                                        fontSize: 11.sp,
+                                        color: '#FF5656'.color),
+                                  ),
+                                  SizedBox(width: 4.w),
+                                  Obx(() {
+                                    return ActivityCountdownTextView(
+                                        timeItemHeight: 15.w,
+                                        contentPadding: EdgeInsets.zero,
+                                        timeItemWidth: 16.w,
+                                        textStyle: TextStyle(
+                                            fontSize: 10.sp,
+                                            color: Colors.white),
+                                        duration: controller.activityDuration ??
+                                            Duration(seconds: 0),
+                                        separator: buildCountdownSeparator(),
+                                        timeBgBoxDecoration: BoxDecoration(
+                                          color: '#FF5656'.color,
+                                          borderRadius:
+                                              BorderRadius.circular(3.w),
+                                        ));
+                                  }),
+                                  SizedBox(width: 4.w),
+                                  Text(
+                                    StringName
+                                        .memberActivitySpeciallyPreferential,
+                                    style: TextStyle(
+                                        fontSize: 10.sp,
+                                        color: '#FF5656'.color),
+                                  )
+                                ],
+                              ),
+                            ),
+                          ),
+                          GestureDetector(
+                            onTap: controller.onBuyClick,
+                            child: Container(
+                              margin: EdgeInsets.only(top: 24.w),
+                              height: 50.w,
+                              width: 336.w,
+                              child: ShimmerEffect(
+                                image:
+                                    Assets.images.imgMemberBtnShadow.provider(),
+                                shimmerWidthFactor: 0.244047619047619,
+                                duration: Duration(milliseconds: 3000),
+                                delay: Duration(milliseconds: 800),
+                                child: Container(
+                                  height: 50.w,
+                                  width: 336.w,
+                                  alignment: Alignment.center,
+                                  decoration: BoxDecoration(
+                                      image: DecorationImage(
+                                          image: Assets
+                                              .images.iconMemberSettlementBg
+                                              .provider(),
+                                          fit: BoxFit.fill)),
+                                  child: Text(
+                                    StringName.memberVipUnlock,
+                                    style: TextStyle(
+                                        fontSize: 18.sp,
+                                        color: '#FFF8EF'.color,
+                                        fontWeight: FontWeight.bold),
+                                  ),
+                                ),
+                              ),
+                            ),
+                          )
+                        ],
                       ),
-                    ),
+                      SizedBox(height: 8.w),
+                      buildPrivacyPolicyView(),
+                      SizedBox(height: 12.w),
+                    ],
                   ),
-                )
-              ],
-            ),
-          )
-
-          // Container(
-          //   color: ColorName.white,
-          //   padding:
-          //       EdgeInsets.only(left: 12.w, right: 12.w, bottom: 12.w, top: 8.w),
-          //   child: 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: Stack(
-          //       children: [
-          //         Assets.images.imgMemberBtnShadow.image(height: double.infinity)
-          //       ],
-          //     ),
-          //   ),
-          // ),
-          );
+                ),
+              )
+            ],
+          ));
     });
   }