Browse Source

[feat]更换爱心动画的图片,商品最多人购买自动缩小字体

云天逵 7 months ago
parent
commit
625e556b30

BIN
assets/images/bg_heart_fill.png


+ 6 - 3
lib/module/keyboard_manage/keyboard_manage_controller.dart

@@ -425,7 +425,10 @@ class KeyboardManageController extends BaseController
       currentKeyboardInfo.value.intimacy = currentIntimacy;
       keyboardRepository
           .updateKeyboardInfo(keyboardId: keyboardId, intimacy: currentIntimacy)
-          .then((_) => ToastUtil.show(StringName.keyboardSaveSuccess))
+          .then((_) async {
+             ToastUtil.show(StringName.keyboardSaveSuccess);
+             await keyboardRepository.refreshData();
+          })
           .catchError((error) {
             if (error is ServerErrorException) {
               ErrorHandler.toastError(error);
@@ -444,10 +447,10 @@ class KeyboardManageController extends BaseController
             keyboardId: keyboardId,
             characterIds: characterIds,
           )
-          .then((_) {
+          .then((_) async {
             onUpdateSuccess();
             ToastUtil.show(StringName.keyboardSaveSuccess);
-
+            await keyboardRepository.refreshData();
           })
           .catchError((error) {
             if (error is ServerErrorException) {

+ 4 - 3
lib/module/store/new_discount/new_discount_page.dart

@@ -1,6 +1,7 @@
 import 'package:flutter/src/widgets/framework.dart';
 import 'package:flutter_screenutil/flutter_screenutil.dart';
 import 'package:keyboard/base/base_page.dart';
+import 'package:keyboard/data/bean/goods_info.dart';
 import 'package:keyboard/module/store/new_discount/new_discount_controller.dart';
 import 'package:flutter/material.dart';
 import 'package:carousel_slider/carousel_slider.dart';
@@ -401,7 +402,7 @@ class NewDiscountPage extends BasePage<NewDiscountController> {
     );
   }
 
-  Widget _buildGoodsItem(item, bool isSelected) {
+  Widget _buildGoodsItem(GoodsInfo item, bool isSelected) {
     return Container(
       height: 70.w,
       width: 328.w,
@@ -464,7 +465,7 @@ class NewDiscountPage extends BasePage<NewDiscountController> {
                   ),
 
                   SizedBox(width: 4.5.w),
-                  if (item.mostDesc?.isNotEmpty == true)
+                  if (item.timeLimitDesc?.isNotEmpty == true)
                     Container(
                       padding: EdgeInsets.symmetric(
                         horizontal: 4.w,
@@ -489,7 +490,7 @@ class NewDiscountPage extends BasePage<NewDiscountController> {
                         ),
                       ),
                       child: Text(
-                        item.mostDesc!,
+                        item.timeLimitDesc!,
                         style: TextStyle(
                           color: Colors.white,
                           fontSize: 12.sp,

+ 1 - 1
lib/module/store/store_controller.dart

@@ -467,7 +467,7 @@ class StoreController extends BaseController implements PaymentStatusCallback {
     _storeDataFuture?.cancel();
     paymentStatusManager.unregisterPaymentSuccessCallback(this);
 
-    if (memberStatusInfo != null && memberStatusInfo!.isMember) {
+    if (memberStatusInfo != null && memberStatusInfo!.isMember&&isLogin) {
       return;
     }
     DiscountTicketDialog.show(

+ 150 - 139
lib/module/store/store_page.dart

@@ -1,3 +1,4 @@
+import 'package:auto_size_text/auto_size_text.dart';
 import 'package:carousel_slider/carousel_slider.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter_screenutil/flutter_screenutil.dart';
@@ -83,13 +84,13 @@ class StorePage extends BasePage<StoreController> {
                     SizedBox(width: 8.w),
                     controller.isLogin
                         ? Assets.images.iconMineUserLogged.image(
-                      width: 28.w,
-                      height: 28.w,
-                    )
+                          width: 28.w,
+                          height: 28.w,
+                        )
                         : Assets.images.iconMineUserNoLogin.image(
-                      width: 28.w,
-                      height: 28.w,
-                    ),
+                          width: 28.w,
+                          height: 28.w,
+                        ),
                   ],
                 ),
               );
@@ -162,7 +163,10 @@ class StorePage extends BasePage<StoreController> {
 
     // 登录但不是会员
     return [
-      TextSpan(text: controller.userInfo?.name ?? controller.getUserName(), style: _vipTextStyle(isHighlight: true)),
+      TextSpan(
+        text: controller.userInfo?.name ?? controller.getUserName(),
+        style: _vipTextStyle(isHighlight: true),
+      ),
       TextSpan(text: StringName.memberCardNoVipDesc, style: _vipTextStyle()),
     ];
   }
@@ -204,17 +208,17 @@ class StorePage extends BasePage<StoreController> {
           Obx(() {
             return Column(
               children:
-              controller.filteredGoodsList.map((item) {
-                return Obx(() {
-                  return GestureDetector(
-                    onTap: () => controller.onGoodsItemClick(item),
-                    child: _buildGoodsItem(
-                      item,
-                      controller.selectedGoodsInfoItem?.id == item.id,
-                    ),
-                  );
-                });
-              }).toList(),
+                  controller.filteredGoodsList.map((item) {
+                    return Obx(() {
+                      return GestureDetector(
+                        onTap: () => controller.onGoodsItemClick(item),
+                        child: _buildGoodsItem(
+                          item,
+                          controller.selectedGoodsInfoItem?.id == item.id,
+                        ),
+                      );
+                    });
+                  }).toList(),
             );
           }),
           _buildPayWayCard(),
@@ -286,9 +290,9 @@ class StorePage extends BasePage<StoreController> {
           begin: Alignment(0.77, -0.00),
           end: Alignment(0.77, 1.00),
           colors:
-          isSelected
-              ? [const Color(0xFFFF9416), const Color(0xFFFF7813)]
-              : [const Color(0xFFFEE057), const Color(0xFFFFC400)],
+              isSelected
+                  ? [const Color(0xFFFF9416), const Color(0xFFFF7813)]
+                  : [const Color(0xFFFEE057), const Color(0xFFFFC400)],
         ),
         shape: RoundedRectangleBorder(
           borderRadius: BorderRadius.circular(10.r),
@@ -301,16 +305,16 @@ class StorePage extends BasePage<StoreController> {
             height: 70.h,
             decoration: ShapeDecoration(
               gradient:
-              isSelected
-                  ? LinearGradient(
-                begin: Alignment(-0.06, 0.50),
-                end: Alignment(1.14, 0.50),
-                colors: [
-                  const Color(0xFFFFF895),
-                  const Color(0xFFFFE941),
-                ],
-              )
-                  : null,
+                  isSelected
+                      ? LinearGradient(
+                        begin: Alignment(-0.06, 0.50),
+                        end: Alignment(1.14, 0.50),
+                        colors: [
+                          const Color(0xFFFFF895),
+                          const Color(0xFFFFE941),
+                        ],
+                      )
+                      : null,
               color: isSelected ? null : const Color(0xFFFFFDEE),
               shape: RoundedRectangleBorder(
                 side: BorderSide(width: 1, color: const Color(0xFFFEE86B)),
@@ -355,19 +359,26 @@ class StorePage extends BasePage<StoreController> {
                           ),
                           if (item.mostDesc?.isNotEmpty == true)
                             Container(
+                              constraints: BoxConstraints(
+                                minHeight: 20.w,
+                                maxHeight: 20.w,
+                                minWidth: 40.w,
+                                maxWidth: 120.w,
+                              ),
                               padding: EdgeInsets.only(
                                 left: 16.w,
                                 top: 2.h,
                                 bottom: 2.h,
+                                right: 4.w,
                               ),
                               decoration: BoxDecoration(
                                 image: DecorationImage(
                                   image: Assets.images.iconStoreMost.provider(),
-                                  fit: BoxFit.cover,
+                                  fit: BoxFit.fill,
                                   alignment: Alignment.bottomLeft,
                                 ),
                               ),
-                              child: Text(
+                              child: AutoSizeText(
                                 item.mostDesc!,
                                 style: TextStyle(
                                   color: Colors.white,
@@ -375,6 +386,12 @@ class StorePage extends BasePage<StoreController> {
                                   fontWeight: FontWeight.w500,
                                   letterSpacing: -0.60,
                                 ),
+                                maxLines: 1,
+                                overflow: TextOverflow.ellipsis,
+                                minFontSize: 8,
+
+                                // 最小字体
+                                stepGranularity: 0.5, // 缩小步长,越小越丝滑
                               ),
                             ),
                         ],
@@ -398,25 +415,25 @@ class StorePage extends BasePage<StoreController> {
                 Text(
                   item.name,
                   style:
-                  isSelected
-                      ? Styles.getTextStyleFFECBBW500(15.sp)
-                      : Styles.getTextStyleFF663300W500(15.sp),
+                      isSelected
+                          ? Styles.getTextStyleFFECBBW500(15.sp)
+                          : Styles.getTextStyleFF663300W500(15.sp),
                 ),
                 Container(
                   padding: EdgeInsets.symmetric(horizontal: 8.w),
                   decoration: ShapeDecoration(
                     color: isSelected ? const Color(0xFFFFECBB) : null,
                     gradient:
-                    isSelected
-                        ? null
-                        : LinearGradient(
-                      begin: Alignment(0.77, -0.00),
-                      end: Alignment(0.77, 1.00),
-                      colors: [
-                        const Color(0xFFFF9416),
-                        const Color(0xFFFF7813),
-                      ],
-                    ),
+                        isSelected
+                            ? null
+                            : LinearGradient(
+                              begin: Alignment(0.77, -0.00),
+                              end: Alignment(0.77, 1.00),
+                              colors: [
+                                const Color(0xFFFF9416),
+                                const Color(0xFFFF7813),
+                              ],
+                            ),
                     shape: RoundedRectangleBorder(
                       borderRadius: BorderRadius.circular(
                         isSelected ? 17.r : 10.r,
@@ -427,9 +444,9 @@ class StorePage extends BasePage<StoreController> {
                     '¥${item.amountText}',
                     textAlign: TextAlign.center,
                     style:
-                    isSelected
-                        ? Styles.getTextStyleFF7F14W500(12.sp)
-                        : Styles.getTextStyleWhiteW500(12.sp),
+                        isSelected
+                            ? Styles.getTextStyleFF7F14W500(12.sp)
+                            : Styles.getTextStyleWhiteW500(12.sp),
                   ),
                 ),
               ],
@@ -503,12 +520,12 @@ class StorePage extends BasePage<StoreController> {
             ),
 
             items:
-            controller.bannerList.map((item) {
-              return item.banner.image(
-                width: double.infinity,
-                fit: BoxFit.cover,
-              );
-            }).toList(),
+                controller.bannerList.map((item) {
+                  return item.banner.image(
+                    width: double.infinity,
+                    fit: BoxFit.cover,
+                  );
+                }).toList(),
           ),
           Positioned(bottom: 0, left: 0, right: 0, child: _buildIndicator()),
         ],
@@ -530,61 +547,57 @@ class StorePage extends BasePage<StoreController> {
       child: Row(
         mainAxisAlignment: MainAxisAlignment.spaceAround,
         children:
-        controller.bannerList
-            .asMap()
-            .entries
-            .map((entry) {
-          return Obx(() {
-            final isSelectedBanner =
-                controller.currentBannerIndex == entry.key;
-            return Row(
-              mainAxisAlignment: MainAxisAlignment.spaceAround,
-              children: [
-                GestureDetector(
-                  onTap:
-                      () =>
-                      controller.carouselSliderController
-                          .animateToPage(entry.key),
-                  child: SizedBox(
-                    width: 100.w,
-                    child: Stack(
-                      alignment: Alignment.center,
-                      clipBehavior: Clip.none,
-                      children: [
-                        if (isSelectedBanner)
-                          Positioned(
-                            top: -8.h,
-                            child: controller
-                                .bannerList[entry.key]
-                                .indicatorImg
-                                .image(
-                              width: 100.w,
-                              height: 40.h,
-                              fit: BoxFit.fill,
-                            ),
-                          )
-                        else
-                          Text(
-                            controller.bannerList[entry.key].unSelectedDesc,
-                            style: Styles.getTextStyleWhiteW400(14.sp),
-                          ),
-                      ],
-                    ),
-                  ),
-                ),
-                if (entry.key != controller.bannerList.length - 1)
-                  Padding(
-                    padding: EdgeInsets.only(left: 4.w),
-                    child: Assets.images.iconStoreDivider.image(
-                      width: 2.w,
-                      height: 17.h,
-                      fit: BoxFit.fill,
+            controller.bannerList.asMap().entries.map((entry) {
+              return Obx(() {
+                final isSelectedBanner =
+                    controller.currentBannerIndex == entry.key;
+                return Row(
+                  mainAxisAlignment: MainAxisAlignment.spaceAround,
+                  children: [
+                    GestureDetector(
+                      onTap:
+                          () => controller.carouselSliderController
+                              .animateToPage(entry.key),
+                      child: SizedBox(
+                        width: 100.w,
+                        child: Stack(
+                          alignment: Alignment.center,
+                          clipBehavior: Clip.none,
+                          children: [
+                            if (isSelectedBanner)
+                              Positioned(
+                                top: -8.h,
+                                child: controller
+                                    .bannerList[entry.key]
+                                    .indicatorImg
+                                    .image(
+                                      width: 100.w,
+                                      height: 40.h,
+                                      fit: BoxFit.fill,
+                                    ),
+                              )
+                            else
+                              Text(
+                                controller.bannerList[entry.key].unSelectedDesc,
+                                style: Styles.getTextStyleWhiteW400(14.sp),
+                              ),
+                          ],
+                        ),
+                      ),
                     ),
-                  ),
-              ],
-            );
-          });
-        }).toList(),
+                    if (entry.key != controller.bannerList.length - 1)
+                      Padding(
+                        padding: EdgeInsets.only(left: 4.w),
+                        child: Assets.images.iconStoreDivider.image(
+                          width: 2.w,
+                          height: 17.h,
+                          fit: BoxFit.fill,
+                        ),
+                      ),
+                  ],
+                );
+              });
+            }).toList(),
       ),
     );
   }
@@ -652,9 +665,9 @@ class StorePage extends BasePage<StoreController> {
                         ),
                         child: Column(
                           children:
-                          controller.userReviewsList.map((item) {
-                            return _buildReviewsItem(item);
-                          }).toList(),
+                              controller.userReviewsList.map((item) {
+                                return _buildReviewsItem(item);
+                              }).toList(),
                         ),
                       ),
                     ],
@@ -732,11 +745,11 @@ class StorePage extends BasePage<StoreController> {
           SizedBox(height: 8.h),
           Text(
             "1. 本产品为互联网技术服务虚拟产品,会员购买成功立即生效,一经开通不支持退款。\n"
-                "2. 本产品为付费会员制产品,会员费用是指开通平台所有功能使用权限的基础费用。开通权限后,部分功能可能会免费(具体以实际展示情况为准)使用,部分功能需消耗一定的虚拟币(金币)方可使用。\n"
-                "3. 各种功能的金币消耗可参考虚拟币规则(金币中心)。\n"
-                "4. 开通会员后,若赠送虚拟币(金币)消耗完毕,可单独购买金币。\n"
-                "5. 根据业务情况,我方有权调整不同功能的虚拟币消耗价格,价格会在最新的金币中心展示。\n"
-                "6. 请在购买前仔细阅读《会员服务协议》和购买须知,确定您同意所有条款后继续操作。",
+            "2. 本产品为付费会员制产品,会员费用是指开通平台所有功能使用权限的基础费用。开通权限后,部分功能可能会免费(具体以实际展示情况为准)使用,部分功能需消耗一定的虚拟币(金币)方可使用。\n"
+            "3. 各种功能的金币消耗可参考虚拟币规则(金币中心)。\n"
+            "4. 开通会员后,若赠送虚拟币(金币)消耗完毕,可单独购买金币。\n"
+            "5. 根据业务情况,我方有权调整不同功能的虚拟币消耗价格,价格会在最新的金币中心展示。\n"
+            "6. 请在购买前仔细阅读《会员服务协议》和购买须知,确定您同意所有条款后继续操作。",
             style: Styles.getTextStyle99673300W400(10.sp),
           ),
           SizedBox(height: 120.h),
@@ -807,27 +820,27 @@ class StorePage extends BasePage<StoreController> {
                     controller.isAgree.value = !controller.isAgree.value;
                   },
                   child:
-                  controller.isAgree.value
-                      ? Assets.images.iconStoreAgreePrivacy.image(
-                    width: 16.w,
-                    height: 16.w,
-                  )
-                      : SizedBox(
-                    child: Container(
-                      padding: EdgeInsets.all(1.w),
-                      width: 16.w,
-                      height: 16.w,
-                      child: Container(
-                        decoration: BoxDecoration(
-                          shape: BoxShape.circle,
-                          border: Border.all(
-                            color: Colors.black.withAlpha(153),
-                            width: 1.w,
+                      controller.isAgree.value
+                          ? Assets.images.iconStoreAgreePrivacy.image(
+                            width: 16.w,
+                            height: 16.w,
+                          )
+                          : SizedBox(
+                            child: Container(
+                              padding: EdgeInsets.all(1.w),
+                              width: 16.w,
+                              height: 16.w,
+                              child: Container(
+                                decoration: BoxDecoration(
+                                  shape: BoxShape.circle,
+                                  border: Border.all(
+                                    color: Colors.black.withAlpha(153),
+                                    width: 1.w,
+                                  ),
+                                ),
+                              ),
+                            ),
                           ),
-                        ),
-                      ),
-                    ),
-                  ),
                 );
               }),
               Text.rich(
@@ -868,6 +881,4 @@ class StorePage extends BasePage<StoreController> {
       ),
     );
   }
-
-
 }