Procházet zdrojové kódy

[feat]增加个人档案ui,增加getKeyboardList通信

云天逵 před 8 měsíci
rodič
revize
347fdd63f4

binární
assets/images/bg_profile_love.webp


binární
assets/images/bg_profile_selected.webp


binární
assets/images/icon_profile_add.webp


binární
assets/images/icon_profile_edit.webp


binární
assets/images/icon_profile_female.webp


binární
assets/images/icon_profile_male.webp


+ 2 - 0
lib/data/api/response/keyboard_list_response.dart

@@ -13,4 +13,6 @@ class KeyboardListResponse {
 
   factory KeyboardListResponse.fromJson(Map<String, dynamic> json) =>
       _$KeyboardListResponseFromJson(json);
+
+  Map<String, dynamic> toJson() => _$KeyboardListResponseToJson(this);
 }

+ 6 - 1
lib/data/bean/keyboard_info.dart

@@ -28,10 +28,14 @@ class KeyboardInfo {
   @JsonKey(name: 'intimacy')
   int? intimacy;
 
-  //头像
+  //设置头像时用到
   @JsonKey(name: 'imageUrl')
   String? imageUrl;
 
+  // 展示头像时用到
+  @JsonKey(name: 'avatar')
+  String? avatar;
+
   @JsonKey(name: 'isChoose')
   bool? isChoose;
 
@@ -44,6 +48,7 @@ class KeyboardInfo {
     this.intimacy,
     this.imageUrl,
     this.isChoose,
+    this.avatar,
   });
 
   factory KeyboardInfo.fromJson(Map<String, dynamic> json) =>

+ 2 - 0
lib/data/bean/keyboard_info.g.dart

@@ -15,6 +15,7 @@ KeyboardInfo _$KeyboardInfoFromJson(Map<String, dynamic> json) => KeyboardInfo(
   intimacy: (json['intimacy'] as num?)?.toInt(),
   imageUrl: json['imageUrl'] as String?,
   isChoose: json['isChoose'] as bool?,
+  avatar: json['avatar'] as String?,
 );
 
 Map<String, dynamic> _$KeyboardInfoToJson(KeyboardInfo instance) =>
@@ -26,5 +27,6 @@ Map<String, dynamic> _$KeyboardInfoToJson(KeyboardInfo instance) =>
       'birthday': instance.birthday,
       'intimacy': instance.intimacy,
       'imageUrl': instance.imageUrl,
+      'avatar': instance.avatar,
       'isChoose': instance.isChoose,
     };

+ 10 - 3
lib/di/get_it.config.dart

@@ -40,6 +40,7 @@ import '../module/keyboard_manage/keyboard_manage_controller.dart' as _i922;
 import '../module/login/login_controller.dart' as _i1008;
 import '../module/main/main_controller.dart' as _i731;
 import '../module/mine/mine_controller.dart' as _i732;
+import '../module/profile/profile_controller.dart' as _i244;
 import '../module/store/discount/discount_controller.dart' as _i333;
 import '../module/store/store_controller.dart' as _i344;
 import '../module/store/suprise/goods_surprise_controller.dart' as _i935;
@@ -81,9 +82,6 @@ extension GetItInjectableX on _i174.GetIt {
         gh<_i361.Dio>(instanceName: 'defaultDio'),
       ),
     );
-    gh.lazySingleton<_i79.KeyboardAndroidPlatform>(
-      () => _i79.KeyboardAndroidPlatform(gh<_i425.ChatRepository>()),
-    );
     gh.lazySingleton<_i83.AccountRepository>(
       () => _i83.AccountRepository(gh<_i243.AtmobApi>()),
     );
@@ -108,6 +106,12 @@ extension GetItInjectableX on _i174.GetIt {
             currentKeyboardInfo: currentKeyboardInfo,
           ),
     );
+    gh.factory<_i244.ProfileController>(
+      () => _i244.ProfileController(
+        gh<_i274.KeyboardRepository>(),
+        gh<_i83.AccountRepository>(),
+      ),
+    );
     gh.lazySingleton<_i987.StoreRepository>(
       () => _i987.StoreRepository(
         gh<_i243.AtmobApi>(),
@@ -123,6 +127,9 @@ extension GetItInjectableX on _i174.GetIt {
     gh.factory<_i922.KeyboardManageController>(
       () => _i922.KeyboardManageController(gh<_i274.KeyboardRepository>()),
     );
+    gh.lazySingleton<_i79.KeyboardAndroidPlatform>(
+      () => _i79.KeyboardAndroidPlatform(gh<_i274.KeyboardRepository>()),
+    );
     gh.factory<_i876.FeedbackController>(
       () => _i876.FeedbackController(gh<_i83.AccountRepository>()),
     );

+ 1 - 0
lib/module/about/about_page.dart

@@ -56,6 +56,7 @@ class AboutPage extends BasePage<AboutController> {
                           color: Colors.grey[200],
                           borderRadius: BorderRadius.circular(16),
                         ),
+
                       ),
                       SizedBox(height: 21.h),
                       Text(

+ 8 - 1
lib/module/mine/mine_controller.dart

@@ -11,6 +11,8 @@ import 'package:keyboard/module/store/discount/discount_view.dart';
 
 import '../../data/consts/error_code.dart';
 import '../../data/repository/account_repository.dart';
+import '../../resource/colors.gen.dart';
+import '../profile/profile_page.dart';
 import '../store/discount/discount_controller.dart';
 import '../store/suprise/surprise_dialog.dart';
 import '../../resource/string.gen.dart';
@@ -74,16 +76,21 @@ class MineController extends BaseController {
   clickPersonalProfile() {
     debugPrint('clickPersonalProfile');
     // SurpriseDialog.show(clickConfirm: StorePage.start);
-    DiscountTicketDialog.show();
+    // DiscountTicketDialog.show();
     // SmartDialog.show(
+    //
+    //   maskColor: ColorName.black70,
     //   backType: SmartBackType.block,
     //   clickMaskDismiss: true,
     //   alignment: Alignment.bottomCenter,
     //   keepSingle: true,
+    //   tag: "discountDialog",
     //   onDismiss: () => Get.delete<DiscountController>(),
     //
     //   builder: (_) => DiscountView(),
     // );
+    ProfilePage.start();
+
   }
 
   clickFeedback() {

+ 97 - 0
lib/module/profile/profile_controller.dart

@@ -0,0 +1,97 @@
+import 'package:get/get_rx/src/rx_types/rx_types.dart';
+import 'package:injectable/injectable.dart';
+import 'package:keyboard/base/base_controller.dart';
+import 'package:keyboard/data/repository/account_repository.dart';
+import 'package:keyboard/utils/atmob_log.dart';
+import 'package:get/get.dart';
+import '../../data/api/response/user_info_response.dart';
+import '../../data/bean/keyboard_info.dart';
+import '../../data/repository/keyboard_repository.dart';
+import '../keyboard_manage/keyboard_manage_controller.dart';
+
+@injectable
+class ProfileController extends BaseController {
+  final tag = "ProfileController";
+  final KeyboardRepository keyboardRepository;
+
+  final AccountRepository accountRepository;
+
+  RxList<KeyboardInfo> get keyboardInfoList =>
+      keyboardRepository.keyboardInfoList;
+
+  UserInfoResponse? get userInfo => accountRepository.userInfo.value;
+
+  int get userGender => userInfo?.gender ?? 0;
+
+  final Rx<KeyboardInfo> _currentCustomKeyboardInfo = KeyboardInfo().obs;
+
+  KeyboardInfo get currentCustomKeyboardInfo =>
+      _currentCustomKeyboardInfo.value;
+
+  final RxList<KeyboardInfo> _customKeyboardInfoList = RxList();
+
+  // 当前自定义键盘亲密度
+  final RxInt _currentCustomIntimacy = 0.obs;
+
+  int get currentCustomIntimacy => _currentCustomIntimacy.value;
+
+  // 当前定制亲密度是否有变化
+  final RxBool _customIntimacyChanged = false.obs;
+
+  bool get customIntimacyChanged => _customIntimacyChanged.value;
+
+  ProfileController(this.keyboardRepository, this.accountRepository) {
+    AtmobLog.d(tag, '....init');
+  }
+
+  final RxBool isTest = false.obs;
+
+  @override
+  void onInit() {
+    super.onInit();
+    getCustomKeyboard();
+  }
+
+  //   获取定制键盘
+  void getCustomKeyboard() {
+    AtmobLog.i(tag, 'getCustomKeyboard');
+    keyboardRepository.getKeyboardList(type: KeyboardType.custom.name).then((
+      keyboardListResponse,
+    ) {
+      AtmobLog.i(
+        tag,
+        'keyboardListResponse: ${keyboardListResponse.keyboardInfos}',
+      );
+      _customKeyboardInfoList.value = keyboardListResponse.keyboardInfos;
+
+      //检查是否是选择的键盘,如果没有选择的键盘,默认选择第一个
+      if (_customKeyboardInfoList.isNotEmpty) {
+        _currentCustomKeyboardInfo.value = _customKeyboardInfoList.firstWhere(
+          (element) => element.isChoose == true,
+          orElse: () => _customKeyboardInfoList.first,
+        );
+        _currentCustomIntimacy.value =
+            _currentCustomKeyboardInfo.value.intimacy ?? 0;
+        _currentCustomIntimacy.listen((intimacy) {
+          _customIntimacyChanged.value =
+              _currentCustomKeyboardInfo.value.intimacy != intimacy;
+          AtmobLog.d(tag, 'intimacyChanged: $_customIntimacyChanged');
+        });
+      }
+    });
+  }
+
+  clickOnChangeKeyboard(KeyboardInfo keyboardInfo) {
+    AtmobLog.d(tag, 'clickOnChangeKeyboard: ${keyboardInfo.toJson()}');
+
+    _currentCustomKeyboardInfo.value = keyboardInfo;
+  }
+
+  clickBack() {
+    Get.back();
+  }
+
+  clickAddButton() {
+    AtmobLog.d(tag, "clickAddButton");
+  }
+}

+ 402 - 0
lib/module/profile/profile_page.dart

@@ -0,0 +1,402 @@
+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.dart';
+import 'package:keyboard/base/base_page.dart';
+import 'package:keyboard/data/bean/keyboard_info.dart';
+import 'package:keyboard/module/profile/profile_controller.dart';
+import 'package:keyboard/utils/intimacy_util.dart';
+
+import '../../resource/assets.gen.dart';
+import '../../router/app_pages.dart';
+import '../../utils/styles.dart';
+
+class ProfilePage extends BasePage<ProfileController> {
+  const ProfilePage({super.key});
+
+  static start() {
+    Get.toNamed(RoutePath.profile);
+  }
+
+  @override
+  Color backgroundColor() {
+    return const Color(0xFFF6F5FA);
+  }
+
+  @override
+  immersive() {
+    return true;
+  }
+
+  @override
+  Widget buildBody(BuildContext context) {
+    return Stack(
+      children: [
+        SafeArea(
+          child: CustomScrollView(
+            physics: const BouncingScrollPhysics(), // 更流畅的滚动
+            slivers: [
+              SliverToBoxAdapter(
+                child: Column(
+                  crossAxisAlignment: CrossAxisAlignment.start,
+                  children: [_buildTitle(), SizedBox(height: 26.h)],
+                ),
+              ),
+
+              // 键盘列表
+              Obx(() {
+                if (controller.keyboardInfoList.isEmpty) {
+                  return const SliverToBoxAdapter(child: SizedBox());
+                }
+                return SliverList(
+                  delegate: SliverChildBuilderDelegate((context, index) {
+                    KeyboardInfo keyboardInfo =
+                        controller.keyboardInfoList[index];
+                    return Obx(() {
+                      return _buildKeyboardListItem(
+                        keyboardInfo,
+                        keyboardInfo.id ==
+                            controller.currentCustomKeyboardInfo.id,
+                      );
+                    });
+                  }, childCount: controller.keyboardInfoList.length),
+                );
+              }),
+            ],
+          ),
+        ),
+
+        // 背景图片
+        IgnorePointer(child: Assets.images.bgMine.image(width: 360.w)),
+      ],
+    );
+  }
+
+  _buildKeyboardListItem(KeyboardInfo keyboardInfo, bool isChoose) {
+    return GestureDetector(
+      onTap: () {
+        controller.clickOnChangeKeyboard(keyboardInfo);
+      },
+      child: Container(
+        height: 164.h,
+        margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 12.h),
+        decoration:
+            isChoose
+                ? ShapeDecoration(
+                  gradient: LinearGradient(
+                    begin: Alignment(0.02, 0.04),
+                    end: Alignment(1.00, 1.00),
+                    colors: [const Color(0xFFE7A0FF), const Color(0xFFAB8FFA)],
+                  ),
+                  shape: RoundedRectangleBorder(
+                    borderRadius: BorderRadius.circular(22.r),
+                  ),
+                  shadows: [
+                    BoxShadow(
+                      color: Color(0x1CD6C1FF),
+                      blurRadius: 4.r,
+                      offset: Offset(0, 4.r),
+                      spreadRadius: 0,
+                    ),
+                  ],
+                )
+                : ShapeDecoration(
+                  color: Colors.white,
+                  shape: RoundedRectangleBorder(
+                    borderRadius: BorderRadius.circular(20.r),
+                  ),
+                ),
+
+        child: Stack(
+          children: [
+            isChoose
+                ? Opacity(
+                  opacity: 0.1,
+                  child: Assets.images.bgProfileSelected.image(),
+                )
+                : SizedBox(),
+            Column(
+              crossAxisAlignment: CrossAxisAlignment.center,
+              children: [
+                Padding(
+                  padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 10.h),
+                  child: Row(
+                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                    children: [
+                      Text(
+                        '我&${keyboardInfo.name}',
+                        style: TextStyle(
+                          color: const Color(0xFF202020),
+                          fontSize: 16.sp,
+                          fontWeight: FontWeight.w700,
+                        ),
+                      ),
+                      Container(
+                        height: 26.h,
+                        width: 55.w,
+                        decoration: ShapeDecoration(
+                          color:
+                              isChoose ? Colors.white : const Color(0xFFF1F1F1),
+                          shape: RoundedRectangleBorder(
+                            borderRadius: BorderRadius.circular(50.r),
+                          ),
+                        ),
+                        child: Row(
+                          mainAxisAlignment: MainAxisAlignment.center,
+                          children: [
+                            Assets.images.iconProfileEdit.image(
+                              width: 10.w,
+                              height: 10.w,
+                            ),
+                            SizedBox(width: 4.w),
+                            Text(
+                              '编辑',
+                              style: TextStyle(
+                                color: Colors.black.withAlpha(178),
+                                fontSize: 11,
+                                fontWeight: FontWeight.w500,
+                              ),
+                            ),
+                          ],
+                        ),
+                      ),
+                    ],
+                  ),
+                ),
+                SizedBox(height: 10.h),
+                Padding(
+                  padding: EdgeInsets.symmetric(horizontal: 16.w),
+                  child: Divider(
+                    height: 1.h,
+                    color: isChoose ? Colors.transparent : Color(0xffF5F5F5),
+                  ),
+                ),
+                Expanded(
+                  child: Container(
+                    margin:
+                        isChoose
+                            ? EdgeInsets.only(
+                              left: 4.w,
+                              right: 4.w,
+                              bottom: 4.w,
+                            )
+                            : EdgeInsets.all(0),
+                    decoration: ShapeDecoration(
+                      color: Colors.white,
+                      shape: RoundedRectangleBorder(
+                        borderRadius: BorderRadius.circular(20.r),
+                      ),
+                      shadows: [
+                        BoxShadow(
+                          color: Color(0x1CD6C1FF),
+                          blurRadius: 4.r,
+                          offset: Offset(0, 4),
+                          spreadRadius: 0,
+                        ),
+                      ],
+                    ),
+                    child: Row(
+                      mainAxisAlignment: MainAxisAlignment.center,
+                      children: [
+                        Stack(
+                          children: [
+                            Container(
+                              width: 78.w,
+                              height: 78.w,
+                              decoration: ShapeDecoration(
+                                color:
+                                    controller.userGender == 1
+                                        ? Color(0xFFB7B6FF)
+                                        : null,
+                                gradient:
+                                    controller.userGender == 1
+                                        ? null
+                                        : LinearGradient(
+                                          begin: Alignment(0.50, -0.00),
+                                          end: Alignment(0.50, 1.00),
+                                          colors: [
+                                            const Color(0xFFEBE6FF),
+                                            const Color(0xFFFFE6FE),
+                                          ],
+                                        ),
+                                shape: RoundedRectangleBorder(
+                                  side: BorderSide(
+                                    width: 1.5.w,
+                                    color: Colors.white,
+                                  ),
+                                  borderRadius: BorderRadius.circular(40.r),
+                                ),
+                              ),
+                              child:
+                                  controller.userInfo?.imageUrl?.isNotEmpty ==
+                                          true
+                                      ? ClipRRect(
+                                        borderRadius: BorderRadius.circular(
+                                          40.r,
+                                        ),
+                                        child: CachedNetworkImage(
+                                          width: 78.w,
+                                          height: 78.w,
+                                          imageUrl:
+                                              controller.userInfo?.imageUrl ??
+                                              "",
+                                        ),
+                                      )
+                                      : SizedBox(),
+                            ),
+                            Positioned(
+                              top: 0,
+                              right: 0,
+                              child:
+                                  controller.userGender == 1
+                                      ? Assets.images.iconProfileMale.image(
+                                        width: 20.w,
+                                        height: 20.w,
+                                      )
+                                      : Assets.images.iconProfileFemale.image(
+                                        width: 20.w,
+                                        height: 20.w,
+                                      ),
+                            ),
+                          ],
+                        ),
+                        SizedBox(width: 8.w),
+                        // 爱心
+                        Container(
+                          width: 87.w,
+                          height: 71.h,
+                          decoration: BoxDecoration(
+                            image: DecorationImage(
+                              image: Assets.images.bgProfileLove.provider(),
+                            ),
+                          ),
+                          child: Column(
+                            children: [
+                              SizedBox(height: 45.h),
+                              Container(
+                                width: 47.w,
+                                height: 19.h,
+                                decoration: ShapeDecoration(
+                                  color: Colors.white,
+                                  shape: RoundedRectangleBorder(
+                                    side: BorderSide(
+                                      width: 1.18.w,
+                                      color: const Color(0xFFFD649B),
+                                    ),
+                                    borderRadius: BorderRadius.circular(
+                                      12.36.r,
+                                    ),
+                                  ),
+                                ),
+                                child:
+                                    (keyboardInfo.intimacy != null)
+                                        ? Center(
+                                          child: Text(
+                                            IntimacyUtil.getIntimacyName(
+                                              keyboardInfo.intimacy!,
+                                            ),
+                                            style: TextStyle(
+                                              color: const Color(0xFFFF73E0),
+                                              fontSize: 11.sp,
+                                              fontWeight: FontWeight.w500,
+                                            ),
+                                          ),
+                                        )
+                                        : SizedBox(),
+                              ),
+                            ],
+                          ),
+                        ),
+                        SizedBox(width: 8.w),
+                        keyboardInfo.avatar?.isNotEmpty == true
+                            ? Stack(
+                              children: [
+                                Container(
+                                  width: 78.w,
+                                  height: 78.w,
+                                  decoration: ShapeDecoration(
+                                    color:
+                                        keyboardInfo.gender == 1
+                                            ? Color(0xFFB7B6FF)
+                                            : null,
+                                    gradient:
+                                        keyboardInfo.gender == 1
+                                            ? null
+                                            : LinearGradient(
+                                              begin: Alignment(0.50, -0.00),
+                                              end: Alignment(0.50, 1.00),
+                                              colors: [
+                                                const Color(0xFFEBE6FF),
+                                                const Color(0xFFFFE6FE),
+                                              ],
+                                            ),
+                                    shape: RoundedRectangleBorder(
+                                      side: BorderSide(
+                                        width: 1.5.w,
+                                        color: Colors.white,
+                                      ),
+                                      borderRadius: BorderRadius.circular(40.r),
+                                    ),
+                                  ),
+                                  child: ClipRRect(
+                                    borderRadius: BorderRadius.circular(40.r),
+                                    child: CachedNetworkImage(
+                                      imageUrl: keyboardInfo.avatar!,
+                                    ),
+                                  ),
+                                ),
+                                Positioned(
+                                  top: 0,
+                                  left: 0,
+                                  child:
+                                      keyboardInfo.gender == 1
+                                          ? Assets.images.iconProfileMale.image(
+                                            width: 20.w,
+                                            height: 20.w,
+                                          )
+                                          : Assets.images.iconProfileFemale
+                                              .image(width: 20.w, height: 20.w),
+                                ),
+                              ],
+                            )
+                            : SizedBox(width: 78.w, height: 78.w),
+                      ],
+                    ),
+                  ),
+                ),
+              ],
+            ),
+          ],
+        ),
+      ),
+    );
+  }
+
+  _buildTitle() {
+    return Container(
+      alignment: Alignment.centerLeft,
+      padding: EdgeInsets.only(top: 12.h, left: 16.w, right: 16.w),
+      child: Row(
+        mainAxisAlignment: MainAxisAlignment.spaceBetween,
+        children: [
+          GestureDetector(
+            onTap: controller.clickBack,
+            child: Assets.images.iconMineBackArrow.image(
+              width: 24.w,
+              height: 24.w,
+            ),
+          ),
+          Text("我", style: Styles.getTextStyleBlack204W500(17.sp)),
+          SizedBox(),
+          GestureDetector(
+            onTap: controller.clickAddButton,
+            child: Assets.images.iconProfileAdd.image(
+              width: 24.w,
+              height: 24.w,
+            ),
+          ),
+        ],
+      ),
+    );
+  }
+}

+ 17 - 72
lib/plugins/keyboard_android_platform.dart

@@ -2,24 +2,31 @@ import 'dart:convert';
 
 import 'package:flutter/services.dart';
 import 'package:flutter/widgets.dart';
+import 'package:get/get_rx/src/rx_types/rx_types.dart';
 import 'package:injectable/injectable.dart';
 import 'package:keyboard/data/repository/chat_repository.dart';
+import 'package:keyboard/data/repository/keyboard_repository.dart';
 import 'package:keyboard/utils/atmob_log.dart';
 import 'package:keyboard_android/keyboard_android.dart';
 
 import '../../data/bean/stream_deepseek_data.dart' as deepseek_data;
 import '../../di/get_it.dart';
+import '../data/bean/keyboard_info.dart';
 
 @lazySingleton
 class KeyboardAndroidPlatform {
   static const MethodChannel _channel = MethodChannel('keyboard_android');
   var tag = "KeyboardAndroidPlatform";
-  final ChatRepository chatRepository;
+
+  final KeyboardRepository keyboardRepository;
 
   /// 插件对象
   final _keyboardAndroidPlugin = KeyboardAndroid();
 
-  KeyboardAndroidPlatform(this.chatRepository) {
+  RxList<KeyboardInfo> get keyboardInfoList =>
+      keyboardRepository.keyboardInfoList;
+
+  KeyboardAndroidPlatform(this.keyboardRepository) {
     AtmobLog.d(tag, '$tag....init');
     init();
   }
@@ -27,21 +34,13 @@ class KeyboardAndroidPlatform {
   void init() {
     _channel.setMethodCallHandler((MethodCall call) async {
       switch (call.method) {
-        case 'getKeyMappings':
-          // 返回键映射
-          return [
-            {'label': 'A', 'method': 'MethodA'},
-            {'label': 'B', 'method': 'MethodB'},
-            {'label': 'C', 'method': 'MethodC'},
-            {'label': 'D', 'method': 'MethodD'},
-            {'label': 'E', 'method': 'MethodE'},
-          ];
-        case 'sendDynamicTextRequest':
-          String method = call.arguments['method'];
-          String currentContent = call.arguments['currentContent'];
-          AtmobLog.d(tag, 'method: $method, currentContent: $currentContent');
-          sendDynamicTextRequest(method, currentContent);
-          break;
+        case 'getKeyboardList':
+          String? type = call.arguments['type'];
+          var keyboardList = await keyboardRepository.getKeyboardList(
+            type: type,
+          );
+          return jsonEncode(keyboardList.toJson());
+
         default:
           throw MissingPluginException('Not implemented');
       }
@@ -55,7 +54,7 @@ class KeyboardAndroidPlatform {
     switch (method) {
       case 'MethodA':
         AtmobLog.d(tag, 'MethodA');
-        deepSeek(message: currentContent);
+
         break;
       default:
         AtmobLog.d(tag, 'default');
@@ -78,60 +77,6 @@ class KeyboardAndroidPlatform {
     return enable;
   }
 
-  void inputText(String text) {
-    debugPrint('inputText $text');
-
-    _channel.invokeMethod('inputText', {'text': text});
-  }
-
-  Future<void> deepSeek({required String message}) async {
-    try {
-      // 获取数据流
-      var stream = await chatRepository.streamDeepSeek(message);
-
-      // 创建一个 StringBuffer 来拼接流中的字符串数据
-      StringBuffer responseBuffer = StringBuffer();
-
-      // 监听流
-      await for (var event in stream) {
-        try {
-          // 解析JSON数据
-          Map<String, dynamic> json = jsonDecode(event.data);
-
-          // 如果数据不为空,则添加到 responseBuffer
-          if (json.isNotEmpty) {
-            deepseek_data.StreamDeepseekData data = deepseek_data
-                .StreamDeepseekData.fromJson(json);
-            if (data.choices == null || data.choices!.isEmpty) {
-              AtmobLog.d(tag, "data.choices == null || data.choices!.isEmpty");
-            }
-            deepseek_data.Delta? delta = data.choices![0].delta;
-
-            if (delta == null) {
-              AtmobLog.d(tag, "delta == null");
-              return;
-            }
-            // 有内容时才输入
-            if (delta.content != null) {
-              inputText(delta.content!);
-            }
-
-            responseBuffer.write(delta.content ?? '');
-          }
-        } catch (e) {
-          // 捕获 JSON 解析错误
-          print('Error parsing JSON: $e');
-        }
-      }
-
-      AtmobLog.d(tag, "responseBuffer.toString() ${responseBuffer.toString()}");
-    } catch (error) {
-      // 捕获请求错误
-
-      AtmobLog.d(tag, "Error in deepSeek: $error");
-    }
-  }
-
   static KeyboardAndroidPlatform getInstance() {
     return getIt.get<KeyboardAndroidPlatform>();
   }

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

@@ -112,6 +112,14 @@ class $AssetsImagesGen {
   AssetGenImage get bgMineVipCard =>
       const AssetGenImage('assets/images/bg_mine_vip_card.webp');
 
+  /// File path: assets/images/bg_profile_love.webp
+  AssetGenImage get bgProfileLove =>
+      const AssetGenImage('assets/images/bg_profile_love.webp');
+
+  /// File path: assets/images/bg_profile_selected.webp
+  AssetGenImage get bgProfileSelected =>
+      const AssetGenImage('assets/images/bg_profile_selected.webp');
+
   /// File path: assets/images/bg_store_selected_item.webp
   AssetGenImage get bgStoreSelectedItem =>
       const AssetGenImage('assets/images/bg_store_selected_item.webp');
@@ -397,6 +405,22 @@ class $AssetsImagesGen {
   AssetGenImage get iconMineVipOrderArrow =>
       const AssetGenImage('assets/images/icon_mine_vip_order_arrow.png');
 
+  /// File path: assets/images/icon_profile_add.webp
+  AssetGenImage get iconProfileAdd =>
+      const AssetGenImage('assets/images/icon_profile_add.webp');
+
+  /// File path: assets/images/icon_profile_edit.webp
+  AssetGenImage get iconProfileEdit =>
+      const AssetGenImage('assets/images/icon_profile_edit.webp');
+
+  /// File path: assets/images/icon_profile_female.webp
+  AssetGenImage get iconProfileFemale =>
+      const AssetGenImage('assets/images/icon_profile_female.webp');
+
+  /// File path: assets/images/icon_profile_male.webp
+  AssetGenImage get iconProfileMale =>
+      const AssetGenImage('assets/images/icon_profile_male.webp');
+
   /// File path: assets/images/icon_store_agree_privacy.webp
   AssetGenImage get iconStoreAgreePrivacy =>
       const AssetGenImage('assets/images/icon_store_agree_privacy.webp');
@@ -536,6 +560,8 @@ class $AssetsImagesGen {
     bgKeyboardManageIntimacy,
     bgMine,
     bgMineVipCard,
+    bgProfileLove,
+    bgProfileSelected,
     bgStoreSelectedItem,
     bgStoreUserReviews,
     bgSurpriseDialog,
@@ -605,6 +631,10 @@ class $AssetsImagesGen {
     iconMineVipArrow,
     iconMineVipDescArrow,
     iconMineVipOrderArrow,
+    iconProfileAdd,
+    iconProfileEdit,
+    iconProfileFemale,
+    iconProfileMale,
     iconStoreAgreePrivacy,
     iconStoreBack,
     iconStoreBanner1,

+ 7 - 4
lib/router/app_pages.dart

@@ -10,13 +10,12 @@ import 'package:keyboard/module/keyboard/keyboard_controller.dart';
 import 'package:keyboard/module/keyboard_manage/keyboard_manage_controller.dart';
 import 'package:keyboard/module/login/login_controller.dart';
 import 'package:keyboard/module/mine/mine_controller.dart';
+import 'package:keyboard/module/profile/profile_controller.dart';
+import 'package:keyboard/module/profile/profile_page.dart';
 import 'package:keyboard/module/store/store_controller.dart';
 import 'package:keyboard/module/store/store_page.dart';
 
 import '../di/get_it.dart';
-import '../module/store/discount/discount_controller.dart';
-import '../module/store/suprise/goods_surprise_controller.dart';
-import '../module/store/suprise/surprise_dialog.dart';
 import '../module/about/about_page.dart';
 import '../module/browser/browser_page.dart';
 import '../module/character/character_controller.dart';
@@ -28,6 +27,8 @@ import '../module/keyboard_manage/keyboard_manage_page.dart';
 import '../module/login/login_page.dart';
 import '../module/main/main_controller.dart';
 import '../module/main/main_page.dart';
+import '../module/store/discount/discount_controller.dart';
+import '../module/store/suprise/goods_surprise_controller.dart';
 
 abstract class AppPage {
   static final pages = <GetPage>[...generalPages];
@@ -46,6 +47,7 @@ abstract class RoutePath {
   static const characterCustomDetail = '/characterCustomDetail';
   static const characterCustomList = '/characterCustomList';
   static const store = '/store';
+  static const profile = '/profile';
 }
 
 class AppBinding extends Bindings {
@@ -67,7 +69,7 @@ class AppBinding extends Bindings {
     lazyPut(() => getIt.get<StoreController>());
     lazyPut(() => getIt.get<GoodsSurpriseController>());
     lazyPut(() => getIt.get<DiscountController>());
-
+    lazyPut(() => getIt.get<ProfileController>());
   }
 
   void lazyPut<S>(InstanceBuilderCallback<S> builder) {
@@ -92,4 +94,5 @@ final generalPages = [
     page: () => CharacterCustomListPage(),
   ),
   GetPage(name: RoutePath.store, page: () => StorePage()),
+  GetPage(name: RoutePath.profile, page: () => ProfilePage()),
 ];

+ 20 - 0
lib/utils/intimacy_util.dart

@@ -0,0 +1,20 @@
+class IntimacyUtil {
+  static final List<Map<String, dynamic>> intimacyLevels = [
+    {"max": 20.0, "min": 0.0, "name": "初相识"},
+    {"max": 40.0, "min": 21.0, "name": "追爱期"},
+    {"max": 60.0, "min": 41.0, "name": "暧昧期"},
+    {"max": 80.0, "min": 61.0, "name": "恋人"},
+    {"max": 90.0, "min": 81.0, "name": "伴侣"},
+    {"max": 100.0, "min": 91.0, "name": "老夫老妻"},
+  ];
+
+  /// 传入 intimacy 值,返回对应的名称
+  static String getIntimacyName(int intimacy) {
+    for (var level in intimacyLevels) {
+      if (intimacy >= level["min"] && intimacy <= level["max"]) {
+        return level["name"];
+      }
+    }
+    return "未知"; // 处理异常情况
+  }
+}