Ver código fonte

[feat]分析亲密度,调整亲密度头像,显示用户的头像和根据性别显示默认头像,尝试修复爱心位置不正确的问题

hezihao 7 meses atrás
pai
commit
73c2b3bc63

+ 8 - 11
assets/string/base/string.xml

@@ -16,7 +16,6 @@
     <string name="mine_account_no_login">游客,去登陆</string>
 
 
-
     <string name="direct_send">生成内容直接发送</string>
     <string name="direct_send_desc">内容生成后,点击发送按钮,直接发送</string>
     <string name="open_float">打开悬浮窗</string>
@@ -55,7 +54,9 @@
     <string name="login_other_login">其他登录方式</string>
     <string name="wechat">微信</string>
     <string name="login_delete_account">注销账号</string>
-    <string name="login_delete_account_desc">确认注销后您将失去以下权益 \n1.无法登录本账号 \n2.您的个人相关数据将被清空,人设设置与个人档案等相关数据将无法恢复。 \n3.会员在有效期内将放弃本账号所有权益</string>
+    <string name="login_delete_account_desc">确认注销后您将失去以下权益 \n1.无法登录本账号
+        \n2.您的个人相关数据将被清空,人设设置与个人档案等相关数据将无法恢复。 \n3.会员在有效期内将放弃本账号所有权益
+    </string>
     <string name="login_delete_account_confirm">确认注销</string>
     <string name="login_delete_account_cancel">再想想</string>
     <string name="user_info">用户信息</string>
@@ -63,7 +64,6 @@
     <string name="logout">退出登录</string>
 
 
-
     <!-- 反馈页面-->
     <string name="feedback_content_title">问题描述</string>
     <string name="feedback_content_hint">请描述您的问题或建议,或者您可以联系我们在线客服</string>
@@ -171,7 +171,6 @@
     <string name="text_span_service_terms">《服务条款》</string>
 
 
-
     <string name="member_continue_pay">继续支付</string>
     <string name="member_please_choice_goods">请选择支付商品</string>
     <string name="member_please_choice_payment">请选择支付方式</string>
@@ -286,6 +285,8 @@
 
     <string name="my_self">自己</string>
     <string name="and">与</string>
+    <!-- &符号 -->
+    <string name="and_symbol">&amp;</string>
 
     <string name="intimacy_relation">亲密关系</string>
     <string name="intimacy_value">情感亲密度</string>
@@ -314,7 +315,9 @@
     <string name="intimacy_analyse_get_reply">获取回复</string>
     <string name="intimacy_analyse_reply_tone">回复语气:</string>
 
-    <string name="intimacy_analyse_report_preview_bubble_text">报告还有2565字未显示,点击按钮查看完整报告</string>
+    <string name="intimacy_analyse_report_preview_bubble_text">
+        报告还有2565字未显示,点击按钮查看完整报告
+    </string>
 
     <string name="for_ta">对于TA</string>
     <string name="for_me">对于我</string>
@@ -389,10 +392,4 @@
     <string name="new_user_result_intimacy_desc">根据当前的亲密度,建议选择以下人设</string>
 
 
-
-
-
-
-
-
 </resources>

+ 27 - 11
lib/module/intimacy_analyse/analyse_report/intimacy_analyse_report_view.dart

@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
 import 'package:flutter_screenutil/flutter_screenutil.dart';
 import 'package:get/get.dart';
 import 'package:keyboard/base/base_view.dart';
+import 'package:keyboard/module/user_info/enums/gender_type.dart';
 import '../../../resource/assets.gen.dart';
 import '../../../resource/colors.gen.dart';
 import '../../../resource/string.gen.dart';
@@ -78,15 +79,29 @@ class IntimacyAnalyseReportView
 
   /// 亲密档案
   Widget _buildIntimacyArchives() {
-    return IntimacyUserWidget(
-      width: 200.w,
-      height: 100.h,
-      avatarSize: 96.0,
-      avatarUrl1: '',
-      avatarUrl2: '',
-      avatarBorderWidth: 3.0,
-      loveSize: 42.w,
-    );
+    return Obx(() {
+      // 当前用户的头像
+      String myAvatarUrl = controller.userInfo.value?.imageUrl ?? "";
+      // 对方用户的头像
+      String taAvatarUrl = controller.currentKeyboardInfo.value?.imageUrl ?? "";
+      GenderType? myGender = GenderType.fromType(
+        controller.userInfo.value?.gender,
+      );
+      GenderType? taGender = GenderType.fromType(
+        controller.currentKeyboardInfo.value?.gender,
+      );
+      return IntimacyUserWidget(
+        width: 200.w,
+        height: 100.h,
+        avatarSize: 96.0,
+        myAvatar: myAvatarUrl,
+        taAvatar: taAvatarUrl,
+        myGender: myGender,
+        taGender: taGender,
+        avatarBorderWidth: 3.0,
+        loveSize: 42.w,
+      );
+    });
   }
 
   /// 亲密档案切换布局
@@ -100,7 +115,8 @@ class IntimacyAnalyseReportView
           mainAxisAlignment: MainAxisAlignment.center,
           children: [
             Text(
-              "自己&${controller.currentKeyboardInfo.value?.name ?? ""}",
+              // 自己&对方的名称
+              "${StringName.mySelf}${StringName.andSymbol}${controller.currentKeyboardInfo.value?.name ?? ""}",
               style: TextStyle(
                 color: ColorName.black80,
                 fontSize: 13.sp,
@@ -174,7 +190,7 @@ class IntimacyAnalyseReportView
         margin: EdgeInsets.symmetric(horizontal: 16.w),
         width: double.maxFinite,
         child: GradientTextBtn.withUnlock(
-          controller.userInfo.value?.isMember ?? false,
+          controller.memberInfo.value?.isMember ?? false,
           text: StringName.intimacyAnalyseAnalysisNow,
           onPressed: () {
             controller.clickUnlockBtn(context);

+ 5 - 1
lib/module/intimacy_analyse/analyse_report/intimacy_analyse_report_view_controller.dart

@@ -4,6 +4,7 @@ import 'package:injectable/injectable.dart';
 import 'package:keyboard/base/base_controller.dart';
 import 'package:wechat_assets_picker/wechat_assets_picker.dart';
 import '../../../data/api/response/intimacy_analyze_config_response.dart';
+import '../../../data/api/response/user_info_response.dart';
 import '../../../data/bean/keyboard_info.dart';
 import '../../../data/bean/member_info.dart';
 import '../../../data/repository/account_repository.dart';
@@ -44,7 +45,10 @@ class IntimacyAnalyseReportController extends BaseController {
   RxString reportPreviewData = "".obs;
 
   /// 当前用户信息
-  Rxn<MemberInfo> get userInfo => accountRepository.memberStatusInfo;
+  Rxn<UserInfoResponse> get userInfo => accountRepository.userInfo;
+
+  /// 当前用户的会员
+  Rxn<MemberInfo> get memberInfo => accountRepository.memberStatusInfo;
 
   IntimacyAnalyseReportController(
     this.intimacyAnalyzeRepository,

+ 5 - 1
lib/module/intimacy_analyse/intimacy_analyse_upload/intimacy_analyse_upload_controller.dart

@@ -14,6 +14,7 @@ import 'package:keyboard/utils/upload/upload_scene_type.dart';
 import 'package:wechat_assets_picker/wechat_assets_picker.dart';
 import '../../../data/api/response/intimacy_analyze_config_response.dart';
 import '../../../data/api/response/intimacy_analyze_response.dart';
+import '../../../data/api/response/user_info_response.dart';
 import '../../../data/bean/ai_model.dart';
 import '../../../data/bean/keyboard_info.dart';
 import '../../../data/bean/member_info.dart';
@@ -79,7 +80,10 @@ class IntimacyAnalyseUploadController extends BaseController {
   RxBool isCanCustomDirection = false.obs;
 
   /// 当前用户信息
-  Rxn<MemberInfo> get userInfo => accountRepository.memberStatusInfo;
+  Rxn<UserInfoResponse> get userInfo => accountRepository.userInfo;
+
+  /// 当前用户的会员
+  Rxn<MemberInfo> get memberInfo => accountRepository.memberStatusInfo;
 
   /// 报告是否生成中
   Rx<bool> isResultGenerating = false.obs;

+ 185 - 152
lib/module/intimacy_analyse/intimacy_analyse_upload/intimacy_analyse_upload_page.dart

@@ -19,6 +19,7 @@ import '../../../utils/string_format_util.dart';
 import '../../../widget/actionbtn/action_btn.dart';
 import '../../../widget/gradient_btn.dart';
 import '../../../widget/gradient_text.dart';
+import '../../user_info/enums/gender_type.dart';
 import '../widget/intimacy_analyse_report_widget.dart';
 import '../widget/intimacy_user_widget.dart';
 import '../widget/option_select_widget.dart';
@@ -281,7 +282,7 @@ class IntimacyAnalyseUploadPage
           IntimacyAnalyseReportWidget(
             // 分析结果
             intimacyAnalyzeResult: controller.intimacyAnalyzeResult.value,
-            unlock: controller.userInfo.value?.isMember ?? false,
+            unlock: controller.memberInfo.value?.isMember ?? false,
             isReportCreating: controller.isResultGenerating.value,
           ),
         ],
@@ -291,65 +292,81 @@ class IntimacyAnalyseUploadPage
 
   /// 预测方向结果
   Widget _buildDirectionResult() {
-    return Expanded(
-      child: Container(
-        padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 10.w),
-        decoration: BoxDecoration(
-          color: ColorName.white,
-          borderRadius: BorderRadius.circular(14.r),
-        ),
-        child: Row(
-          children: [
-            Column(
-              crossAxisAlignment: CrossAxisAlignment.start,
-              children: [
-                // 标题
-                Text(
-                  StringName.intimacyAnalysePredictionDirection,
-                  style: TextStyle(
-                    color: ColorName.black47,
-                    fontSize: 12.sp,
-                    fontWeight: FontWeight.w400,
-                  ),
-                ),
-                SizedBox(height: 4.h),
-                // 结果
-                Row(
-                  children: [
-                    // 图标
-                    Assets.images.iconDirectionResult.image(
-                      height: 14.w,
-                      width: 14.w,
+    return Obx(() {
+      // 当前用户的头像
+      String myAvatarUrl = controller.userInfo.value?.imageUrl ?? "";
+      // 对方用户的头像
+      String taAvatarUrl = controller.currentKeyboardInfo.value?.imageUrl ?? "";
+      // 当前用户的性别
+      GenderType? myGender = GenderType.fromType(
+        controller.userInfo.value?.gender,
+      );
+      // 对方用户的性别
+      GenderType? taGender = GenderType.fromType(
+        controller.currentKeyboardInfo.value?.gender,
+      );
+      return Expanded(
+        child: Container(
+          padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 10.w),
+          decoration: BoxDecoration(
+            color: ColorName.white,
+            borderRadius: BorderRadius.circular(14.r),
+          ),
+          child: Row(
+            children: [
+              Column(
+                crossAxisAlignment: CrossAxisAlignment.start,
+                children: [
+                  // 标题
+                  Text(
+                    StringName.intimacyAnalysePredictionDirection,
+                    style: TextStyle(
+                      color: ColorName.black47,
+                      fontSize: 12.sp,
+                      fontWeight: FontWeight.w400,
                     ),
-                    SizedBox(width: 2.w),
-                    // 结果文字
-                    Text(
-                      controller.currentDirectionOption.value,
-                      style: TextStyle(
-                        color: ColorName.black80,
-                        fontSize: 13.sp,
-                        fontWeight: FontWeight.w500,
+                  ),
+                  SizedBox(height: 4.h),
+                  // 结果
+                  Row(
+                    children: [
+                      // 图标
+                      Assets.images.iconDirectionResult.image(
+                        height: 14.w,
+                        width: 14.w,
                       ),
-                    ),
-                  ],
-                ),
-              ],
-            ),
-            Expanded(child: SizedBox()),
-            // 亲密关系头像
-            IntimacyUserWidget(
-              width: 60.w,
-              height: 30.h,
-              avatarSize: 30.0,
-              avatarUrl1: '',
-              avatarUrl2: '',
-              avatarBorderWidth: 1.w,
-              loveSize: 17.w,
-            ),
-          ],
+                      SizedBox(width: 2.w),
+                      // 结果文字
+                      Text(
+                        controller.currentDirectionOption.value,
+                        style: TextStyle(
+                          color: ColorName.black80,
+                          fontSize: 13.sp,
+                          fontWeight: FontWeight.w500,
+                        ),
+                      ),
+                    ],
+                  ),
+                ],
+              ),
+              Expanded(child: SizedBox()),
+              // 亲密关系头像
+              IntimacyUserWidget(
+                width: 60.w,
+                height: 30.h,
+                avatarSize: 30.0,
+                myAvatar: myAvatarUrl,
+                taAvatar: taAvatarUrl,
+                myGender: myGender,
+                taGender: taGender,
+                avatarBorderWidth: 1.w,
+                loveSize: 17.w,
+              ),
+            ],
+          ),
         ),
-      ),
-    );
+      );
+    });
   }
 
   /// Ai模型结果
@@ -471,109 +488,125 @@ class IntimacyAnalyseUploadPage
 
   /// 推荐的亲密关系
   Widget _buildRecommendIntimacy() {
-    return Container(
-      width: double.infinity,
-      margin: EdgeInsets.only(left: 14.w, right: 14.w),
-      // 圆角背景
-      decoration: BoxDecoration(
-        // 渐变背景
-        gradient: LinearGradient(
-          colors: [
-            ColorName.bgIntimacyRelationColor1,
-            ColorName.bgIntimacyRelationColor2,
-          ],
-          begin: Alignment.centerLeft,
-          end: Alignment.centerRight,
+    return Obx(() {
+      // 当前用户的头像
+      String myAvatarUrl = controller.userInfo.value?.imageUrl ?? "";
+      // 对方用户的头像
+      String taAvatarUrl = controller.currentKeyboardInfo.value?.imageUrl ?? "";
+      // 当前用户的性别
+      GenderType? myGender = GenderType.fromType(
+        controller.userInfo.value?.gender,
+      );
+      // 对方用户的性别
+      GenderType? taGender = GenderType.fromType(
+        controller.currentKeyboardInfo.value?.gender,
+      );
+      return Container(
+        width: double.infinity,
+        margin: EdgeInsets.only(left: 14.w, right: 14.w),
+        // 圆角背景
+        decoration: BoxDecoration(
+          // 渐变背景
+          gradient: LinearGradient(
+            colors: [
+              ColorName.bgIntimacyRelationColor1,
+              ColorName.bgIntimacyRelationColor2,
+            ],
+            begin: Alignment.centerLeft,
+            end: Alignment.centerRight,
+          ),
+          shape: BoxShape.rectangle,
+          border: Border.all(color: ColorName.white80, width: 1.w),
+          borderRadius: BorderRadius.all(Radius.circular(23.r)),
         ),
-        shape: BoxShape.rectangle,
-        border: Border.all(color: ColorName.white80, width: 1.w),
-        borderRadius: BorderRadius.all(Radius.circular(23.r)),
-      ),
-      child: Row(
-        mainAxisAlignment: MainAxisAlignment.spaceBetween,
-        children: [
-          Row(
-            children: [
-              SizedBox(width: 6.w),
-              // 用户亲密头像
-              IntimacyUserWidget(
-                width: 68.w,
-                height: 34.h,
-                avatarSize: 34.0,
-                avatarUrl1: '',
-                avatarUrl2: '',
-                avatarBorderWidth: 1.w,
-                loveSize: 19.w,
-              ),
-              SizedBox(width: 4.w),
-              Text(
-                StringName.mySelf,
-                style: TextStyle(
-                  color: ColorName.black80,
-                  fontSize: 11.sp,
-                  fontWeight: FontWeight.w500,
+        child: Row(
+          mainAxisAlignment: MainAxisAlignment.spaceBetween,
+          children: [
+            Row(
+              children: [
+                SizedBox(width: 6.w),
+                // 用户亲密头像
+                IntimacyUserWidget(
+                  width: 68.w,
+                  height: 34.h,
+                  avatarSize: 34.0,
+                  myAvatar: myAvatarUrl,
+                  taAvatar: taAvatarUrl,
+                  myGender: myGender,
+                  taGender: taGender,
+                  avatarBorderWidth: 1.w,
+                  loveSize: 19.w,
                 ),
-              ),
-              SizedBox(width: 4.w),
-              Text(
-                StringName.and,
-                style: TextStyle(
-                  color: ColorName.black41,
-                  fontSize: 11.sp,
-                  fontWeight: FontWeight.w500,
+                SizedBox(width: 4.w),
+                Text(
+                  StringName.mySelf,
+                  style: TextStyle(
+                    color: ColorName.black80,
+                    fontSize: 11.sp,
+                    fontWeight: FontWeight.w500,
+                  ),
                 ),
-              ),
-              SizedBox(width: 4.w),
-              Text(
-                controller.currentKeyboardInfo.value?.name ?? "",
-                style: TextStyle(
-                  color: ColorName.black80,
-                  fontSize: 11.sp,
-                  fontWeight: FontWeight.w500,
+                SizedBox(width: 4.w),
+                Text(
+                  StringName.and,
+                  style: TextStyle(
+                    color: ColorName.black41,
+                    fontSize: 11.sp,
+                    fontWeight: FontWeight.w500,
+                  ),
                 ),
-              ),
-              SizedBox(width: 5.w),
-              GradientText(
-                // 渐变颜色
-                colors: [
-                  ColorName.intimacyRelationColor1,
-                  ColorName.intimacyRelationColor2,
-                ],
-                child: Text(
-                  StringName.intimacyRelation,
+                SizedBox(width: 4.w),
+                Text(
+                  controller.currentKeyboardInfo.value?.name ?? "",
                   style: TextStyle(
+                    color: ColorName.black80,
                     fontSize: 11.sp,
                     fontWeight: FontWeight.w500,
                   ),
                 ),
-              ),
-            ],
-          ),
-          // 切换按钮
-          GestureDetector(
-            onTap: () {
-              controller.switchTaTest();
-            },
-            child: Container(
-              padding: EdgeInsets.symmetric(horizontal: 9.w, vertical: 6.h),
-              margin: EdgeInsets.only(right: 8.w, top: 8.h, bottom: 8.h),
-              decoration: BoxDecoration(
-                color: ColorName.white,
-                borderRadius: BorderRadius.circular(22.r),
-              ),
-              child: Text(
-                StringName.intimacyAnalyseSwitchTaTest,
-                style: TextStyle(
-                  color: ColorName.black80,
-                  fontSize: 12.sp,
-                  fontWeight: FontWeight.w400,
+                SizedBox(width: 5.w),
+                GradientText(
+                  // 渐变颜色
+                  colors: [
+                    ColorName.intimacyRelationColor1,
+                    ColorName.intimacyRelationColor2,
+                  ],
+                  child: Text(
+                    StringName.intimacyRelation,
+                    style: TextStyle(
+                      fontSize: 11.sp,
+                      fontWeight: FontWeight.w500,
+                    ),
+                  ),
+                ),
+              ],
+            ),
+            // 切换按钮
+            GestureDetector(
+              onTap: () {
+                controller.switchTaTest();
+              },
+              child: Container(
+                padding: EdgeInsets.symmetric(horizontal: 9.w, vertical: 6.h),
+                margin: EdgeInsets.only(right: 8.w, top: 8.h, bottom: 8.h),
+                decoration: BoxDecoration(
+                  color: ColorName.white,
+                  borderRadius: BorderRadius.circular(22.r),
+                ),
+                child: Text(
+                  StringName.intimacyAnalyseSwitchTaTest,
+                  style: TextStyle(
+                    color: ColorName.black80,
+                    fontSize: 12.sp,
+                    fontWeight: FontWeight.w400,
+                  ),
                 ),
               ),
             ),
-          ),
-        ],
-      ),
-    );
+          ],
+        ),
+      );
+    });
   }
 
   /// 底部操作按钮
@@ -601,7 +634,7 @@ class IntimacyAnalyseUploadPage
         return SizedBox();
       } else {
         // 生成完成,判断是否已解锁
-        bool isUnlock = controller.userInfo.value?.isMember ?? false;
+        bool isUnlock = controller.memberInfo.value?.isMember ?? false;
         if (!isUnlock) {
           // 未解锁,显示立即分析按钮
           return Container(
@@ -696,7 +729,7 @@ class IntimacyAnalyseUploadPage
       return Container(
         padding: EdgeInsets.only(top: 13.h, bottom: 13.h),
         child: GradientTextBtn.withUnlock(
-          controller.userInfo.value?.isMember ?? false,
+          controller.memberInfo.value?.isMember ?? false,
           text: StringName.nextStep,
           color: ColorName.colorBrand,
           onPressed: () {
@@ -713,7 +746,7 @@ class IntimacyAnalyseUploadPage
       return Container(
         padding: EdgeInsets.only(top: 7.h, bottom: 6.h),
         child: GradientTextBtn.withUnlock(
-          controller.userInfo.value?.isMember ?? false,
+          controller.memberInfo.value?.isMember ?? false,
           text: StringName.intimacyAnalyseAnalysisNow,
           color: ColorName.colorBrand,
           desc: StringName.intimacyAnalyseAnalysisUseAiTip,
@@ -730,7 +763,7 @@ class IntimacyAnalyseUploadPage
   /// 构建卡片列表
   Widget _buildCardList() {
     // 是否已解锁
-    bool isUnlock = controller.userInfo.value?.isMember ?? false;
+    bool isUnlock = controller.memberInfo.value?.isMember ?? false;
     return Obx(() {
       // 上传页
       if (controller.isUploadPage.value) {

+ 34 - 14
lib/module/intimacy_analyse/widget/intimacy_user_widget.dart

@@ -3,6 +3,7 @@ import 'package:flutter/cupertino.dart';
 import '../../../resource/assets.gen.dart';
 import '../../../resource/colors.gen.dart';
 import '../../../widget/avatar/avatar_image_widget.dart';
+import '../../user_info/enums/gender_type.dart';
 
 /// 亲密用户组件,包含2个头像和中间一个心形图标
 class IntimacyUserWidget extends StatelessWidget {
@@ -21,11 +22,17 @@ class IntimacyUserWidget extends StatelessWidget {
   /// 爱心的大小
   final double loveSize;
 
-  /// 用户1的头像
-  final String avatarUrl1;
+  /// 的头像
+  final String myAvatar;
 
-  /// 用户2的头像
-  final String avatarUrl2;
+  /// Ta的头像
+  final String taAvatar;
+
+  /// 我的性别
+  final GenderType? myGender;
+
+  /// 他的性别
+  final GenderType? taGender;
 
   const IntimacyUserWidget({
     super.key,
@@ -34,8 +41,10 @@ class IntimacyUserWidget extends StatelessWidget {
     required this.avatarSize,
     required this.avatarBorderWidth,
     required this.loveSize,
-    required this.avatarUrl1,
-    required this.avatarUrl2,
+    required this.myAvatar,
+    required this.taAvatar,
+    required this.myGender,
+    required this.taGender,
   });
 
   @override
@@ -50,23 +59,19 @@ class IntimacyUserWidget extends StatelessWidget {
           // 用户1
           Positioned(
             left: 0,
-            child: _buildAvatar(
-              avatarUrl1,
-              defaultImage: Assets.images.iconDefaultAvatarMale.image().image,
-            ),
+            child: _buildAvatarWithGender(myAvatar, myGender),
           ),
           // 用户2
           Positioned(
             // 距离左侧的距离
             left: avatarSize - (avatarBorderWidth * 2),
             top: 0,
-            child: _buildAvatar(
-              avatarUrl2,
-              defaultImage: Assets.images.iconDefaultAvatarFemale.image().image,
-            ),
+            child: _buildAvatarWithGender(taAvatar, taGender),
           ),
           // 爱心
           Positioned(
+            // 位置,在2个头像的中间
+            left: avatarSize - (avatarBorderWidth * 2) - (loveSize / 2),
             child: Assets.images.iconIntimacyAnalyseLove.image(
               width: loveSize,
               height: loveSize,
@@ -77,6 +82,21 @@ class IntimacyUserWidget extends StatelessWidget {
     );
   }
 
+  /// 用户头像
+  /// [gender] 性别
+  Widget _buildAvatarWithGender(String? imageUrl, GenderType? gender) {
+    ImageProvider defaultImage;
+    if (gender == GenderType.male) {
+      defaultImage = Assets.images.iconDefaultAvatarMale.image().image;
+    } else if (gender == GenderType.female) {
+      defaultImage = Assets.images.iconDefaultAvatarFemale.image().image;
+    } else {
+      // 默认值
+      defaultImage = Assets.images.iconDefaultAvatarFemale.image().image;
+    }
+    return _buildAvatar(imageUrl, defaultImage: defaultImage);
+  }
+
   /// 圆形头像
   Widget _buildAvatar(String? imageUrl, {ImageProvider? defaultImage}) {
     return CircleAvatarWidget(

+ 25 - 0
lib/module/user_info/enums/gender_type.dart

@@ -0,0 +1,25 @@
+import 'package:collection/collection.dart';
+
+/// 性别
+enum GenderType {
+  /// 男
+  male(1),
+
+  /// 女
+  female(2);
+
+  final int type;
+
+  const GenderType(this.type);
+
+  /// 通过状态字符串,获取对应的状态枚举
+  static GenderType? fromType(int? type) {
+    if (type == null) {
+      return null;
+    }
+    return values.firstWhereOrNull((e) => e.type == type);
+  }
+
+  @override
+  String toString() => type.toString();
+}

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

@@ -207,6 +207,7 @@ class StringName {
   static final String intimacyAnalyseAnalysisUseAiTip = 'intimacy_analyse_analysis_use_ai_tip'.tr; // 报告内容由AI大数据解读,请勿作为决策依据
   static final String mySelf = 'my_self'.tr; // 自己
   static final String and = 'and'.tr; // 与
+  static final String andSymbol = 'and_symbol'.tr; // &
   static final String intimacyRelation = 'intimacy_relation'.tr; // 亲密关系
   static final String intimacyValue = 'intimacy_value'.tr; // 情感亲密度
   static final String intimacyCurrentStage = 'intimacy_current_stage'.tr; // 目前阶段
@@ -494,6 +495,7 @@ class StringMultiSource {
       'intimacy_analyse_analysis_use_ai_tip': '报告内容由AI大数据解读,请勿作为决策依据',
       'my_self': '自己',
       'and': '与',
+      'and_symbol': '&',
       'intimacy_relation': '亲密关系',
       'intimacy_value': '情感亲密度',
       'intimacy_current_stage': '目前阶段',