Explorar o código

[feat]星座恋爱分析,封装报告列表、报告生成中、分析中等组件

hezihao hai 8 meses
pai
achega
011afc8626

BIN=BIN
assets/images/icon_vip_crown.webp


BIN=BIN
assets/images/icon_zodiac_love_analyse_report_unlock_placeholder.webp


+ 1 - 0
assets/string/base/string.xml

@@ -475,6 +475,7 @@
     <string name="permission_authorize_fail">授权失败</string>
 
     <string name="zodiac_love_intimacy">星座恋爱分析</string>
+    <string name="zodiac_love_intimacy_vip_unlock_tip">VIP免费看下周星座关系分析</string>
     <string name="zodiac_love_intimacy_today_tab">今日指数</string>
     <string name="zodiac_love_intimacy_future_week_tab">未来一周</string>
 </resources>

+ 7 - 0
lib/data/repository/zodiac_love_intimacy_repository.dart

@@ -20,4 +20,11 @@ class ZodiacLoveIntimacyRepository {
         .getZodiacLoveIntimacyToday(AppBaseRequest())
         .then(HttpHandler.handle(true));
   }
+
+  /// 星座恋爱分析-获取未来一周分析
+  Future<ZodiacLoveIntimacyResponse> getZodiacLoveIntimacyFutureWeek() async {
+    return await atmobApi
+        .getZodiacLoveIntimacyFutureWeek(AppBaseRequest())
+        .then(HttpHandler.handle(true));
+  }
 }

+ 12 - 8
lib/di/get_it.config.dart

@@ -169,9 +169,6 @@ extension GetItInjectableX on _i174.GetIt {
     gh.factory<_i415.KeyboardMethodHandler>(
       () => _i415.KeyboardMethodHandler(),
     );
-    gh.factory<_i109.ZodiacLoveFutureWeekController>(
-      () => _i109.ZodiacLoveFutureWeekController(),
-    );
     gh.lazySingleton<_i495.WechatLoginService>(
       () => _i495.WechatLoginService(),
     );
@@ -297,11 +294,6 @@ extension GetItInjectableX on _i174.GetIt {
     gh.lazySingleton<_i779.PaymentStatusManager>(
       () => _i779.PaymentStatusManager(gh<_i987.StoreRepository>()),
     );
-    gh.factory<_i630.ZodiacLoveTodayController>(
-      () => _i630.ZodiacLoveTodayController(
-        gh<_i779.ZodiacLoveIntimacyRepository>(),
-      ),
-    );
     gh.factory<_i344.ProfileEditController>(
       () => _i344.ProfileEditController(
         gh<_i50.ConfigRepository>(),
@@ -346,6 +338,18 @@ extension GetItInjectableX on _i174.GetIt {
         gh<_i274.KeyboardRepository>(),
       ),
     );
+    gh.factory<_i109.ZodiacLoveFutureWeekController>(
+      () => _i109.ZodiacLoveFutureWeekController(
+        gh<_i779.ZodiacLoveIntimacyRepository>(),
+        gh<_i83.AccountRepository>(),
+      ),
+    );
+    gh.factory<_i630.ZodiacLoveTodayController>(
+      () => _i630.ZodiacLoveTodayController(
+        gh<_i779.ZodiacLoveIntimacyRepository>(),
+        gh<_i83.AccountRepository>(),
+      ),
+    );
     gh.factoryParam<
       _i991.CharacterAddTabController,
       _i497.KeyboardInfo,

+ 76 - 1
lib/module/zodiac_love_intimacy/future_week/zodiac_love_future_week_controller.dart

@@ -1,6 +1,81 @@
+import 'package:get/get_rx/src/rx_types/rx_types.dart';
 import 'package:injectable/injectable.dart';
 import 'package:keyboard/base/base_controller.dart';
 
+import '../../../data/api/response/zodiac_love_intimacy_response.dart';
+import '../../../data/bean/member_info.dart';
+import '../../../data/consts/error_code.dart';
+import '../../../data/repository/account_repository.dart';
+import '../../../data/repository/zodiac_love_intimacy_repository.dart';
+import '../../../dialog/login/login_dialog.dart';
+import '../../../resource/string.gen.dart';
+import '../../../utils/error_handler.dart';
+import '../../../utils/http_handler.dart';
+import '../../../utils/toast_util.dart';
+import '../../store/new_discount/new_discount_page.dart';
+
 /// 星座恋爱分析-未来一周Tab-Controller
 @injectable
-class ZodiacLoveFutureWeekController extends BaseController {}
+class ZodiacLoveFutureWeekController extends BaseController {
+  /// 星座恋爱分析的Repository
+  final ZodiacLoveIntimacyRepository zodiacLoveIntimacyRepository;
+
+  /// 用户信息
+  final AccountRepository accountRepository;
+
+  /// 分析列表
+  final Rxn<ZodiacLoveIntimacyResponse> zodiacLoveIntimacyResp =
+      Rxn<ZodiacLoveIntimacyResponse>();
+
+  /// 当前用户的会员信息
+  Rxn<MemberInfo> get memberInfo => accountRepository.memberStatusInfo;
+
+  /// 报告是否生成中
+  RxBool isReportCreating = false.obs;
+
+  ZodiacLoveFutureWeekController(
+    this.zodiacLoveIntimacyRepository,
+    this.accountRepository,
+  );
+
+  @override
+  void onInit() {
+    super.onInit();
+    _getZodiacLoveIntimacyFutureWeek();
+  }
+
+  /// 星座恋爱分析-获取未来一周分析
+  void _getZodiacLoveIntimacyFutureWeek() async {
+    // 生成中
+    isReportCreating.value = true;
+
+    try {
+      ZodiacLoveIntimacyResponse resp =
+          await zodiacLoveIntimacyRepository.getZodiacLoveIntimacyFutureWeek();
+      zodiacLoveIntimacyResp.value = resp;
+    } catch (error) {
+      if (error is ServerErrorException) {
+        // 未登录
+        if (error.code == ErrorCode.noLoginError) {
+          ToastUtil.show(StringName.accountNoLogin);
+          LoginDialog.show();
+        } else if (error.code == ErrorCode.noMember) {
+          // 需要VIP
+          ToastUtil.show(StringName.needVipTip);
+          NewDiscountPage.start();
+        }
+      } else {
+        ErrorHandler.toastError(error);
+      }
+    } finally {
+      // 生成结束
+      isReportCreating.value = false;
+    }
+  }
+
+  /// 点击解锁按钮
+  void clickUnlockBtn() {
+    // 跳转去会员活动页
+    NewDiscountPage.start();
+  }
+}

+ 11 - 1
lib/module/zodiac_love_intimacy/future_week/zodiac_love_future_week_view.dart

@@ -1,7 +1,9 @@
 import 'package:flutter/Material.dart';
+import 'package:get/get_state_manager/src/rx_flutter/rx_obx_widget.dart';
 import 'package:keyboard/module/zodiac_love_intimacy/future_week/zodiac_love_future_week_controller.dart';
 
 import '../../../base/base_view.dart';
+import '../widget/zodiac_love_intimacy_report.dart';
 
 /// 星座恋爱分析-未来一周Tab
 class ZodiacLoveFutureWeekView
@@ -15,6 +17,14 @@ class ZodiacLoveFutureWeekView
 
   @override
   Widget buildBody(BuildContext context) {
-    return Container(child: Center(child: Text("")));
+    return Obx(() {
+      return ZodiacLoveIntimacyReportWidget(
+        unlock: controller.memberInfo.value?.isMember ?? false,
+        reportResult: controller.zodiacLoveIntimacyResp.value,
+        clickUnlockBtnCallback: () {
+          controller.clickUnlockBtn();
+        },
+      );
+    });
   }
 }

+ 40 - 4
lib/module/zodiac_love_intimacy/tody/zodiac_love_today_controller.dart

@@ -1,10 +1,14 @@
 import 'package:get/get.dart';
 import 'package:injectable/injectable.dart';
 import 'package:keyboard/base/base_controller.dart';
+import 'package:keyboard/dialog/login/login_dialog.dart';
 import 'package:keyboard/resource/string.gen.dart';
 import 'package:keyboard/utils/error_handler.dart';
 
 import '../../../data/api/response/zodiac_love_intimacy_response.dart';
+import '../../../data/bean/member_info.dart';
+import '../../../data/consts/error_code.dart';
+import '../../../data/repository/account_repository.dart';
 import '../../../data/repository/zodiac_love_intimacy_repository.dart';
 import '../../../utils/http_handler.dart';
 import '../../../utils/toast_util.dart';
@@ -13,13 +17,26 @@ import '../../store/new_discount/new_discount_page.dart';
 /// 星座恋爱分析-今日Tab-Controller
 @injectable
 class ZodiacLoveTodayController extends BaseController {
+  /// 星座恋爱分析的Repository
   final ZodiacLoveIntimacyRepository zodiacLoveIntimacyRepository;
 
+  /// 用户信息
+  final AccountRepository accountRepository;
+
   /// 分析列表
   final Rxn<ZodiacLoveIntimacyResponse> zodiacLoveIntimacyResp =
       Rxn<ZodiacLoveIntimacyResponse>();
 
-  ZodiacLoveTodayController(this.zodiacLoveIntimacyRepository);
+  /// 当前用户的会员信息
+  Rxn<MemberInfo> get memberInfo => accountRepository.memberStatusInfo;
+
+  /// 报告是否生成中
+  RxBool isReportCreating = false.obs;
+
+  ZodiacLoveTodayController(
+    this.zodiacLoveIntimacyRepository,
+    this.accountRepository,
+  );
 
   @override
   void onInit() {
@@ -29,17 +46,36 @@ class ZodiacLoveTodayController extends BaseController {
 
   /// 星座恋爱分析-获取今日指数分析
   void _getZodiacLoveIntimacyToday() async {
+    // 生成中
+    isReportCreating.value = true;
+
     try {
       ZodiacLoveIntimacyResponse resp =
           await zodiacLoveIntimacyRepository.getZodiacLoveIntimacyToday();
       zodiacLoveIntimacyResp.value = resp;
     } catch (error) {
-      if (error is ServerErrorException && error.code == 1005) {
-        ToastUtil.show(StringName.needVipTip);
-        NewDiscountPage.start();
+      if (error is ServerErrorException) {
+        // 未登录
+        if (error.code == ErrorCode.noLoginError) {
+          ToastUtil.show(StringName.accountNoLogin);
+          LoginDialog.show();
+        } else if (error.code == ErrorCode.noMember) {
+          // 需要VIP
+          ToastUtil.show(StringName.needVipTip);
+          NewDiscountPage.start();
+        }
       } else {
         ErrorHandler.toastError(error);
       }
+    } finally {
+      // 生成结束
+      isReportCreating.value = false;
     }
   }
+
+  /// 点击解锁按钮
+  void clickUnlockBtn() {
+    // 跳转去会员活动页
+    NewDiscountPage.start();
+  }
 }

+ 10 - 83
lib/module/zodiac_love_intimacy/tody/zodiac_love_today_view.dart

@@ -1,12 +1,9 @@
-import 'package:cached_network_image/cached_network_image.dart';
 import 'package:flutter/Material.dart';
-import 'package:flutter_screenutil/flutter_screenutil.dart';
 import 'package:get/get_state_manager/src/rx_flutter/rx_obx_widget.dart';
 import 'package:keyboard/module/zodiac_love_intimacy/tody/zodiac_love_today_controller.dart';
 
 import '../../../base/base_view.dart';
-import '../../../data/bean/zodiac_love_intimacy_list.dart';
-import '../../../resource/colors.gen.dart';
+import '../widget/zodiac_love_intimacy_report.dart';
 
 /// 星座恋爱分析-今日Tab
 class ZodiacLoveTodayView extends BaseView<ZodiacLoveTodayController> {
@@ -19,84 +16,14 @@ class ZodiacLoveTodayView extends BaseView<ZodiacLoveTodayController> {
 
   @override
   Widget buildBody(BuildContext context) {
-    return Container(
-      padding: EdgeInsets.symmetric(vertical: 16.h),
-      child: Obx(() {
-        var list = controller.zodiacLoveIntimacyResp.value?.list ?? [];
-        return ListView.builder(
-          physics: const ClampingScrollPhysics(),
-          padding: EdgeInsets.zero,
-          itemCount: list.length,
-          itemBuilder: (BuildContext context, int index) {
-            ZodiacLoveIntimacyList itemData = list[index];
-            return _buildListItem(index, itemData);
-          },
-        );
-      }),
-    );
-  }
-
-  /// 列表条目
-  Widget _buildListItem(int index, ZodiacLoveIntimacyList itemData) {
-    return Container(
-      padding: EdgeInsets.all(16.w),
-      margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 16.h),
-      decoration: BoxDecoration(
-        color: ColorName.white,
-        borderRadius: BorderRadius.all(Radius.circular(16.r)),
-      ),
-      child: Column(
-        children: [
-          Row(
-            children: [
-              // 图标
-              CachedNetworkImage(
-                imageUrl: itemData.iconUrl,
-                height: 25.w,
-                width: 25.w,
-                fit: BoxFit.fill,
-              ),
-              SizedBox(width: 4.w),
-              // 标题
-              Stack(
-                // 不裁切子组件超出的区域
-                clipBehavior: Clip.none,
-                children: [
-                  // 横线
-                  Positioned(
-                    left: -16.w,
-                    right: 0,
-                    top: 10.h,
-                    child: Container(
-                      width: 2.w,
-                      height: 11.h,
-                      color: Color(0x21FF4BAE),
-                    ),
-                  ),
-                  Text(
-                    itemData.title,
-                    style: TextStyle(
-                      color: ColorName.black80,
-                      fontSize: 16.sp,
-                      fontWeight: FontWeight.w700,
-                    ),
-                  ),
-                ],
-              ),
-            ],
-          ),
-          SizedBox(height: 12.h),
-          // 内容
-          Text(
-            itemData.content,
-            style: TextStyle(
-              color: ColorName.black70,
-              fontSize: 13.sp,
-              fontWeight: FontWeight.w400,
-            ),
-          ),
-        ],
-      ),
-    );
+    return Obx(() {
+      return ZodiacLoveIntimacyReportWidget(
+        unlock: controller.memberInfo.value?.isMember ?? false,
+        reportResult: controller.zodiacLoveIntimacyResp.value,
+        clickUnlockBtnCallback: () {
+          controller.clickUnlockBtn();
+        },
+      );
+    });
   }
 }

+ 230 - 0
lib/module/zodiac_love_intimacy/widget/zodiac_love_intimacy_report.dart

@@ -0,0 +1,230 @@
+import 'package:cached_network_image/cached_network_image.dart';
+import 'package:flutter/Material.dart';
+import 'package:flutter/cupertino.dart';
+import 'package:flutter_screenutil/flutter_screenutil.dart';
+import '../../../data/api/response/zodiac_love_intimacy_response.dart';
+import '../../../data/bean/zodiac_love_intimacy_list.dart';
+import '../../../resource/assets.gen.dart';
+import '../../../resource/colors.gen.dart';
+import '../../../resource/string.gen.dart';
+import '../../../widget/gradient_btn.dart';
+import '../../intimacy_analyse/widget/creating_loading_widget.dart';
+
+/// 点击了解锁按钮时回调
+typedef ClickUnlockBtnCallback = void Function();
+
+/// 星座恋爱亲密报告
+class ZodiacLoveIntimacyReportWidget extends StatelessWidget {
+  /// 是否解锁
+  final bool unlock;
+
+  /// 报告结果
+  final ZodiacLoveIntimacyResponse? reportResult;
+
+  /// 是否报告生成中
+  final bool isReportCreating;
+
+  /// 点击解锁按钮时回调
+  final ClickUnlockBtnCallback clickUnlockBtnCallback;
+
+  const ZodiacLoveIntimacyReportWidget({
+    super.key,
+    this.unlock = false,
+    this.reportResult,
+    this.isReportCreating = false,
+    required this.clickUnlockBtnCallback,
+  });
+
+  @override
+  Widget build(BuildContext context) {
+    // 未解锁
+    if (!unlock) {
+      return LockReportWidget(clickUnlockBtnCallback: clickUnlockBtnCallback);
+    }
+    // 报告生成中
+    if (isReportCreating) {
+      return const CreatingReportWidget();
+    }
+    // 已有报告
+    return ExistReportWidget(reportResult: reportResult);
+  }
+}
+
+/// 未解锁时的组件
+class LockReportWidget extends StatelessWidget {
+  /// 点击解锁按钮时回调
+  final ClickUnlockBtnCallback clickUnlockBtnCallback;
+
+  const LockReportWidget({super.key, required this.clickUnlockBtnCallback});
+
+  @override
+  Widget build(BuildContext context) {
+    return Center(
+      child: Stack(
+        children: [
+          Column(
+            // 垂直水平都居中
+            mainAxisAlignment: MainAxisAlignment.center,
+            crossAxisAlignment: CrossAxisAlignment.center,
+            children: [
+              // 占位图
+              Assets.images.iconZodiacLoveAnalyseReportUnlockPlaceholder.image(
+                width: 328.w,
+                height: 436.h,
+              ),
+            ],
+          ),
+          // 解锁按钮
+          Positioned(
+            left: 0,
+            top: 147.h,
+            right: 0,
+            child: _buildUnlockBtn(context),
+          ),
+        ],
+      ),
+    );
+  }
+
+  /// 解锁按钮
+  Widget _buildUnlockBtn(BuildContext context) {
+    return Container(
+      margin: EdgeInsets.symmetric(horizontal: 30.w),
+      child: GradientTextBtn.withUnlock(
+        false,
+        // 皇冠图标
+        leftIcon: Assets.images.iconVipCrown.image(width: 15.w, height: 15.w),
+        leftIconMargin: EdgeInsets.only(right: 12.w),
+        text: StringName.zodiacLoveIntimacyVipUnlockTip,
+        // 渐变色
+        colors: [ColorName.purpleGradient3, ColorName.purpleGradient4],
+        radius: 24.r,
+        padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h),
+        onPressed: () {
+          clickUnlockBtnCallback();
+        },
+      ),
+    );
+  }
+}
+
+/// 报告生成中
+class CreatingReportWidget extends StatelessWidget {
+  const CreatingReportWidget({super.key});
+
+  @override
+  Widget build(BuildContext context) {
+    return Container(
+      padding: EdgeInsets.only(top: 33.h, bottom: 52.h),
+      decoration: ShapeDecoration(
+        color: ColorName.white,
+        shape: RoundedRectangleBorder(
+          borderRadius: BorderRadius.circular(30.r),
+        ),
+      ),
+      child: CreatingLoadingWidget(
+        tipTextWidget: Text(
+          StringName.intimacyAnalyseIng2,
+          style: TextStyle(
+            fontSize: 14.sp,
+            color: ColorName.black60,
+            fontWeight: FontWeight.w400,
+          ),
+        ),
+      ),
+    );
+  }
+}
+
+/// 已有报告组件
+class ExistReportWidget extends StatelessWidget {
+  /// 分析结果
+  final ZodiacLoveIntimacyResponse? reportResult;
+
+  const ExistReportWidget({super.key, this.reportResult});
+
+  @override
+  Widget build(BuildContext context) {
+    return Container(
+      padding: EdgeInsets.only(top: 16.h),
+      child: Builder(
+        builder: (BuildContext context) {
+          var list = reportResult?.list ?? [];
+          return ListView.builder(
+            physics: const ClampingScrollPhysics(),
+            padding: EdgeInsets.zero,
+            itemCount: list.length,
+            itemBuilder: (BuildContext context, int index) {
+              ZodiacLoveIntimacyList itemData = list[index];
+              return _buildListItem(index, itemData);
+            },
+          );
+        },
+      ),
+    );
+  }
+
+  /// 列表条目
+  Widget _buildListItem(int index, ZodiacLoveIntimacyList itemData) {
+    return Container(
+      padding: EdgeInsets.all(16.w),
+      margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 16.h),
+      decoration: BoxDecoration(
+        color: ColorName.white,
+        borderRadius: BorderRadius.all(Radius.circular(16.r)),
+      ),
+      child: Column(
+        children: [
+          Row(
+            children: [
+              // 图标
+              CachedNetworkImage(
+                imageUrl: itemData.iconUrl,
+                height: 25.w,
+                width: 25.w,
+                fit: BoxFit.fill,
+              ),
+              SizedBox(width: 4.w),
+              // 标题
+              Stack(
+                // 不裁切子组件超出的区域
+                clipBehavior: Clip.none,
+                children: [
+                  // 横线
+                  Positioned(
+                    left: -16.w,
+                    right: 0,
+                    top: 10.h,
+                    child: Container(
+                      width: 2.w,
+                      height: 11.h,
+                      color: Color(0x21FF4BAE),
+                    ),
+                  ),
+                  Text(
+                    itemData.title,
+                    style: TextStyle(
+                      color: ColorName.black80,
+                      fontSize: 16.sp,
+                      fontWeight: FontWeight.w700,
+                    ),
+                  ),
+                ],
+              ),
+            ],
+          ),
+          SizedBox(height: 12.h),
+          // 内容
+          Text(
+            itemData.content,
+            style: TextStyle(
+              color: ColorName.black70,
+              fontSize: 13.sp,
+              fontWeight: FontWeight.w400,
+            ),
+          ),
+        ],
+      ),
+    );
+  }
+}

+ 12 - 0
lib/resource/assets.gen.dart

@@ -1229,6 +1229,10 @@ class $AssetsImagesGen {
   AssetGenImage get iconUserInfoLogout =>
       const AssetGenImage('assets/images/icon_user_info_logout.webp');
 
+  /// File path: assets/images/icon_vip_crown.webp
+  AssetGenImage get iconVipCrown =>
+      const AssetGenImage('assets/images/icon_vip_crown.webp');
+
   /// File path: assets/images/icon_virgo.webp
   AssetGenImage get iconVirgo =>
       const AssetGenImage('assets/images/icon_virgo.webp');
@@ -1253,6 +1257,12 @@ class $AssetsImagesGen {
   AssetGenImage get iconWhiteBackArrow =>
       const AssetGenImage('assets/images/icon_white_back_arrow.webp');
 
+  /// File path: assets/images/icon_zodiac_love_analyse_report_unlock_placeholder.webp
+  AssetGenImage get iconZodiacLoveAnalyseReportUnlockPlaceholder =>
+      const AssetGenImage(
+        'assets/images/icon_zodiac_love_analyse_report_unlock_placeholder.webp',
+      );
+
   /// File path: assets/images/keyboard_tutorial_ios_step_1.webp
   AssetGenImage get keyboardTutorialIosStep1 =>
       const AssetGenImage('assets/images/keyboard_tutorial_ios_step_1.webp');
@@ -1550,12 +1560,14 @@ class $AssetsImagesGen {
     iconUploading,
     iconUserInfoArrowLeft,
     iconUserInfoLogout,
+    iconVipCrown,
     iconVirgo,
     iconWechat,
     iconWechatLogoBlack,
     iconWechatPayment,
     iconWechatScanPayment,
     iconWhiteBackArrow,
+    iconZodiacLoveAnalyseReportUnlockPlaceholder,
     keyboardTutorialIosStep1,
     keyboardTutorialIosStep2,
     zodiacLoveTabLeft1,

+ 2 - 0
lib/resource/string.gen.dart

@@ -352,6 +352,7 @@ class StringName {
   static final String permissionDialogAuthorize = 'permission_dialog_authorize'.tr; // 去开启
   static final String permissionAuthorizeFail = 'permission_authorize_fail'.tr; // 授权失败
   static final String zodiacLoveIntimacy = 'zodiac_love_intimacy'.tr; // 星座恋爱分析
+  static final String zodiacLoveIntimacyVipUnlockTip = 'zodiac_love_intimacy_vip_unlock_tip'.tr; // VIP免费看下周星座关系分析
   static final String zodiacLoveIntimacyTodayTab = 'zodiac_love_intimacy_today_tab'.tr; // 今日指数
   static final String zodiacLoveIntimacyFutureWeekTab = 'zodiac_love_intimacy_future_week_tab'.tr; // 未来一周
 }
@@ -709,6 +710,7 @@ class StringMultiSource {
       'permission_dialog_authorize': '去开启',
       'permission_authorize_fail': '授权失败',
       'zodiac_love_intimacy': '星座恋爱分析',
+      'zodiac_love_intimacy_vip_unlock_tip': 'VIP免费看下周星座关系分析',
       'zodiac_love_intimacy_today_tab': '今日指数',
       'zodiac_love_intimacy_future_week_tab': '未来一周',
     },

+ 34 - 15
lib/widget/gradient_btn.dart

@@ -111,6 +111,9 @@ class GradientTextBtn extends StatelessWidget {
   /// 文字左边的图标
   final Image? leftIcon;
 
+  /// 文字左边的图标的边距
+  final EdgeInsetsGeometry? leftIconMargin;
+
   /// 按钮文字
   final String text;
 
@@ -143,7 +146,10 @@ class GradientTextBtn extends StatelessWidget {
   /// [isUnlock] 是否已解锁
   static GradientTextBtn withUnlock(
     bool isUnlock, {
+    Image? leftIcon,
+    EdgeInsetsGeometry? leftIconMargin = const EdgeInsets.only(right: 4),
     String? text,
+    List<Color>? colors,
     Color? color,
     String? desc,
     double radius = 50,
@@ -155,28 +161,44 @@ class GradientTextBtn extends StatelessWidget {
       btnText = StringName.intimacyUnlockAnalyse;
     }
     // 解锁图标,非VIP会员时,才显示锁图标
-    Image? leftIcon;
     if (!isUnlock) {
-      leftIcon = Assets.images.iconIntimacyAnalyseUnlock.image(
+      leftIcon ??= Assets.images.iconIntimacyAnalyseUnlock.image(
         width: 22,
         height: 22,
       );
     }
-    return GradientTextBtn(
-      btnText,
-      desc: desc,
-      color: color ?? ColorName.colorBrand,
-      leftIcon: leftIcon,
-      radius: radius,
-      padding: padding,
-      onPressed: onPressed,
-    );
+    // 渐变色
+    if (colors != null) {
+      return GradientTextBtn(
+        btnText,
+        desc: desc,
+        colors: colors,
+        leftIcon: leftIcon,
+        leftIconMargin: leftIconMargin,
+        radius: radius,
+        padding: padding,
+        onPressed: onPressed,
+      );
+    } else {
+      // 纯色
+      return GradientTextBtn(
+        btnText,
+        desc: desc,
+        color: color ?? ColorName.colorBrand,
+        leftIcon: leftIcon,
+        leftIconMargin: leftIconMargin,
+        radius: radius,
+        padding: padding,
+        onPressed: onPressed,
+      );
+    }
   }
 
   const GradientTextBtn(
     this.text, {
     super.key,
     this.leftIcon,
+    this.leftIconMargin,
     this.desc,
     this.color,
     this.enable = true,
@@ -206,10 +228,7 @@ class GradientTextBtn extends StatelessWidget {
               // 左侧图标
               Visibility(
                 visible: leftIcon != null,
-                child: Container(
-                  margin: EdgeInsets.only(right: 4.w),
-                  child: leftIcon,
-                ),
+                child: Container(margin: leftIconMargin, child: leftIcon),
               ),
               // 文字
               Text(