Преглед на файлове

[feat]修改KeyboardAndroidPlatform为静态工具类,增加首页部分ui

云天逵 преди 8 месеца
родител
ревизия
a0b8c4d77a

BIN
assets/images/bg_keyboard.webp


BIN
assets/images/bg_keyboard_love.webp


BIN
assets/images/icon_keyboard_default_avatar.webp


BIN
assets/images/icon_keyboard_love_Index.webp


BIN
assets/images/icon_keyboard_love_logo.webp


BIN
assets/images/icon_keyboard_title.webp


BIN
assets/images/icon_keyboard_vip_logo.webp


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

@@ -202,4 +202,6 @@
     <string name="profile_save">完成</string>
     <string name="profile_edit_save">保存</string>
 
+
+    <string name="keyboard_member_open">开通会员</string>
 </resources>

+ 12 - 2
lib/data/repository/account_repository.dart

@@ -32,6 +32,7 @@ class AccountRepository {
 
   RxnString loginPhoneNum = RxnString();
   RxBool isLogin = RxBool(false);
+  bool isLogin1 = true;
   Rxn<MemberInfo> memberStatusInfo = Rxn<MemberInfo>();
   RxBool isMember = RxBool(false);
 
@@ -44,16 +45,24 @@ class AccountRepository {
   static String? token = KVUtil.getString(keyAccountLoginToken, null);
 
   AccountRepository(this.atmobApi) {
-    AtmobLog.d(tag, '$tag....init');
+    AtmobLog.d(tag, '$tag....init $hashCode');
     isLogin.bindStream(
       loginPhoneNum.map((value) {
-        return value?.isNotEmpty == true;
+        final result = value?.isNotEmpty == true;
+        print("loginPhoneNum 变化了:$value -> isLogin: $result");
+        return result;
       }),
     );
 
     loginPhoneNum.value = KVUtil.getString(keyAccountLoginPhoneNum, null);
     refreshUserInfo();
   }
+  bool isLoginTest(){
+    isLogin1 =!isLogin1;
+    print("isLogin1.value $isLogin1 $hashCode");
+
+    return isLogin1;
+  }
 
   // 检查是否在 60 秒内重复请求
   Future<void> loginSendCode(String phoneNum) {
@@ -123,6 +132,7 @@ class AccountRepository {
           _userInfo.value = response;
           memberStatusInfo.value = response.memberInfo;
           isMember.value = response.memberInfo?.isMember == true;
+          isLogin1=true;
           return response;
         });
   }

+ 5 - 0
lib/data/repository/chat_repository.dart

@@ -8,6 +8,7 @@ import 'package:keyboard/data/api/response/chat_super_reply_response.dart';
 import 'package:keyboard/data/api/response/chat_super_speak_response.dart';
 
 import '../../base/base_response.dart';
+import '../../di/get_it.dart';
 import '../../utils/atmob_log.dart';
 import '../../utils/http_handler.dart';
 import '../../utils/sse_parse_util.dart';
@@ -95,4 +96,8 @@ class ChatRepository {
         })
         .then((stream) => SSEParseUtil.parse(stream));
   }
+
+  static ChatRepository getInstance() {
+    return getIt.get<ChatRepository>();
+  }
 }

+ 12 - 0
lib/data/repository/config_repository.dart

@@ -23,6 +23,8 @@ class ConfigRepository {
 
   CustomConfigInfo? get characterCustomConfig => _characterCustomConfig.value;
 
+
+
   ConfigRepository(this.atmobApi) {
     AtmobLog.d(tag, '$tag....init');
     refreshConfig();
@@ -40,6 +42,16 @@ class ConfigRepository {
       if (list == null || list.isEmpty) {
         return;
       }
+      if (list.isNotEmpty) {
+        for (var config in list) {
+          if (config.confCode == 'intimacy') {
+            AtmobLog.d(tag, '获取亲密度配置: ${config.value}');
+          } else if (config.confCode == 'default_avatar') {
+            AtmobLog.d(tag, '获取默认头像配置: ${config.value}');
+          }
+        }
+      }
+
     });
   }
 

+ 7 - 9
lib/di/get_it.config.dart

@@ -38,6 +38,7 @@ import '../module/character_custom/detail/character_custom_detail_controller.dar
 import '../module/character_custom/list/character_custom_list_controller.dart'
     as _i1059;
 import '../module/feedback/feedback_controller.dart' as _i876;
+import '../module/keyboard/keyboard_controller.dart' as _i161;
 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;
@@ -47,7 +48,6 @@ 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;
-import '../plugins/keyboard_android_platform.dart' as _i79;
 import '../utils/payment_status_manager.dart' as _i779;
 import 'network_module.dart' as _i567;
 
@@ -130,17 +130,15 @@ extension GetItInjectableX on _i174.GetIt {
     gh.lazySingleton<_i779.PaymentStatusManager>(
       () => _i779.PaymentStatusManager(gh<_i987.StoreRepository>()),
     );
-    gh.lazySingleton<_i79.KeyboardAndroidPlatform>(
-      () => _i79.KeyboardAndroidPlatform(
-        gh<_i274.KeyboardRepository>(),
-        gh<_i421.CharactersRepository>(),
-        gh<_i83.AccountRepository>(),
-        gh<_i425.ChatRepository>(),
-      ),
-    );
     gh.factory<_i922.KeyboardManageController>(
       () => _i922.KeyboardManageController(gh<_i274.KeyboardRepository>()),
     );
+    gh.factory<_i161.KeyBoardController>(
+      () => _i161.KeyBoardController(
+        gh<_i83.AccountRepository>(),
+        gh<_i274.KeyboardRepository>(),
+      ),
+    );
     gh.factory<_i970.CharacterGroupContentController>(
       () => _i970.CharacterGroupContentController(
         gh<_i421.CharactersRepository>(),

+ 1 - 1
lib/main.dart

@@ -35,7 +35,7 @@ void main() async {
 
   if (Platform.isAndroid) {
     //键盘
-    KeyboardAndroidPlatform.getInstance();
+    KeyboardAndroidPlatform.init();
   }
 
   runApp(const MyApp());

+ 57 - 1
lib/module/keyboard/keyboard_controller.dart

@@ -1,5 +1,61 @@
+import 'package:injectable/injectable.dart';
 import 'package:keyboard/base/base_controller.dart';
+import 'package:get/get.dart';
+import 'package:keyboard/data/bean/keyboard_info.dart';
+import 'package:keyboard/data/repository/account_repository.dart';
+import 'package:keyboard/data/repository/keyboard_repository.dart';
 
+import '../../data/api/response/user_info_response.dart';
+import '../../utils/atmob_log.dart';
+
+@injectable
 class KeyBoardController extends BaseController {
+  final tag = "KeyBoardController";
+  final AccountRepository accountRepository;
+
+  final KeyboardRepository keyboardRepository;
+
+  Rxn<UserInfoResponse> get userInfo => accountRepository.userInfo;
+
+  // 爱情指数相关数据
+  final lovePercentage = 30.obs;
+
+  // 各项指标数据
+  final moodPercentage = 20.obs;
+  final appearancePercentage = 50.obs;
+  final wealthPercentage = 30.obs;
+  final cleanlinessPercentage = 50.obs;
+
+  // 是否已添加伴侣
+  final hasPartner = false.obs;
+
+  final Rx<KeyboardInfo> currentChooseKeyboard = KeyboardInfo().obs;
+
+  KeyBoardController(this.accountRepository, this.keyboardRepository);
+
+  @override
+  void onInit() {
+    super.onInit();
+    getCustomKeyboard();
+  }
+
+  void getCustomKeyboard() {
+    AtmobLog.i(tag, 'getCustomKeyboard');
+    keyboardRepository.getKeyboardList(type: "custom").then((
+      keyboardListResponse,
+    ) {
+      AtmobLog.i(
+        tag,
+        'keyboardListResponse: ${keyboardListResponse.keyboardInfos}',
+      );
 
-}
+      for (var element in keyboardListResponse.keyboardInfos) {
+        if (element.isChoose == true) {
+          currentChooseKeyboard.value = element;
+          hasPartner.value = true;
+          break;
+        }
+      }
+    });
+  }
+}

+ 688 - 2
lib/module/keyboard/keyboard_view.dart

@@ -1,7 +1,12 @@
+import 'package:cached_network_image/cached_network_image.dart';
 import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
+import 'package:flutter_screenutil/flutter_screenutil.dart';
 import 'package:keyboard/base/base_view.dart';
-
+import 'package:get/get.dart';
+import 'package:keyboard/resource/string.gen.dart';
+import '../../resource/assets.gen.dart';
+import '../../utils/styles.dart';
 import 'keyboard_controller.dart';
 
 class KeyBoardView extends BaseView<KeyBoardController> {
@@ -9,8 +14,689 @@ class KeyBoardView extends BaseView<KeyBoardController> {
 
   @override
   Widget buildBody(BuildContext context) {
+    return Stack(
+      children: [
+        IgnorePointer(child: Assets.images.bgKeyboard.image(width: 360.w)),
+        SafeArea(
+          child: Column(
+            children: [
+              _buildTitle(),
+              Expanded(
+                child: SingleChildScrollView(
+                  child: Column(
+                    children: [
+                      _buildAvatarCard(),
+                      _buildLoveIndexCard(),
+                      _buildPopularFeatures(),
+                      _buildKeyboardSettings(),
+                    ],
+                  ),
+                ),
+              ),
+            ],
+          ),
+        ),
+      ],
+    );
+  }
+
+  // 顶部标题栏
+  Widget _buildTitle() {
     return Container(
-      child: Text("KeyBoardView", style: TextStyle(color: Colors.black)),
+      padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h),
+      color: Colors.transparent,
+      child: Row(
+        children: [
+          Assets.images.iconKeyboardTitle.image(
+            width: 110.w,
+            height: 26.h,
+            fit: BoxFit.cover,
+          ),
+          const Spacer(),
+          Container(
+            padding: EdgeInsets.symmetric(horizontal: 6.w, vertical: 6.w),
+            decoration: ShapeDecoration(
+              color: Colors.white.withAlpha(204),
+              shape: RoundedRectangleBorder(
+                side: BorderSide(width: 1, color: Colors.white),
+                borderRadius: BorderRadius.circular(13.r),
+              ),
+            ),
+            child: Row(
+              children: [
+                Assets.images.iconKeyboardVipLogo.image(
+                  width: 12.w,
+                  height: 12.w,
+                ),
+                const SizedBox(width: 2),
+                Text(
+                  StringName.keyboardMemberOpen,
+                  style: TextStyle(
+                    color: Color(0xFFA85600),
+                    fontSize: 12,
+                    fontWeight: FontWeight.w400,
+                  ),
+                ),
+                Icon(Icons.chevron_right, color: Color(0xFFA85600), size: 11.r),
+              ],
+            ),
+          ),
+        ],
+      ),
+    );
+  }
+
+  // 用户头像卡片
+  Widget _buildAvatarCard() {
+    return Obx(() {
+      return Container(
+        padding: EdgeInsets.symmetric(horizontal: 22.w),
+        decoration: BoxDecoration(color: Colors.transparent),
+        child: Column(
+          crossAxisAlignment: CrossAxisAlignment.start,
+          children: [
+            Row(
+              mainAxisAlignment: MainAxisAlignment.spaceBetween,
+              children: [
+                _buildUserAvatar(true),
+                const SizedBox(width: 16),
+                _buildLovePercentage(),
+                const SizedBox(width: 16),
+                controller.hasPartner.value
+                    ? _buildUserAvatar(false)
+                    : _buildAddPartnerButton(),
+              ],
+            ),
+            SizedBox(height: 10.h),
+          ],
+        ),
+      );
+    });
+  }
+
+  // 爱情指数卡片
+  Widget _buildLoveIndexCard() {
+    return Container(
+      margin: EdgeInsets.symmetric(horizontal: 16.w),
+      padding: EdgeInsets.symmetric(vertical: 5.h, horizontal: 11.w),
+      decoration: BoxDecoration(
+        color: Colors.white,
+        borderRadius: BorderRadius.circular(12.r),
+      ),
+      child: Row(
+        children: [
+          Assets.images.iconKeyboardLoveIndex.image(width: 72.w, height: 23.h),
+          Container(
+            height: 42.w,
+            width: 215.h,
+            decoration: BoxDecoration(
+              color: Color(0xFFFAFAFC),
+              borderRadius: BorderRadius.circular(12.r),
+            ),
+            child: Column(
+              children: [
+                Row(
+                  children: [
+                    Expanded(
+                      child: ProgressBar(
+                        title: "爱情",
+                        value: controller.appearancePercentage,
+                        color: Colors.pink.shade100,
+                      ),
+                    ),
+                    Expanded(
+                      child: ProgressBar(
+                        title: "爱情",
+                        value: controller.appearancePercentage,
+                        color: Colors.pink.shade100,
+                      ),
+                    ),
+                  ],
+                ),
+                Row(
+                  children: [
+                    Expanded(
+                      child: ProgressBar(
+                        title: "爱情",
+                        value: controller.appearancePercentage,
+                        color: Colors.pink.shade100,
+                      ),
+                    ),
+                    Expanded(
+                      child: ProgressBar(
+                        title: "爱情",
+                        value: controller.appearancePercentage,
+                        color: Colors.pink.shade100,
+                      ),
+                    ),
+                  ],
+                ),
+              ],
+            ),
+          ),
+        ],
+      ),
+    );
+  }
+
+  // 用户头像
+  Widget _buildUserAvatar(bool isUser) {
+    return Column(
+      children: [
+        Stack(
+          alignment: Alignment.bottomCenter,
+          children: [
+            Column(
+              children: [
+                Container(
+                  width: 98.r,
+                  height: 98.r,
+                  decoration: ShapeDecoration(
+                    shape: RoundedRectangleBorder(
+                      borderRadius: BorderRadius.circular(50.r),
+                    ),
+                  ),
+                  child: CachedNetworkImage(
+                    imageUrl:
+                        isUser
+                            ? controller.userInfo.value?.imageUrl ?? ""
+                            : controller.currentChooseKeyboard.value.avatar ??
+                                "",
+                    placeholder: (_, __) => const CupertinoActivityIndicator(),
+                    errorWidget:
+                        (context, url, error) => CircleAvatar(
+                          backgroundImage:
+                              Assets.images.iconKeyboardDefaultAvatar
+                                  .provider(),
+                        ),
+                    imageBuilder:
+                        (context, imageProvider) => Container(
+                          decoration: ShapeDecoration(
+                            shape: RoundedRectangleBorder(
+                              side: BorderSide(width: 2.r, color: Colors.white),
+                              borderRadius: BorderRadius.circular(50.r),
+                            ),
+                          ),
+                          child: CircleAvatar(backgroundImage: imageProvider),
+                        ),
+                  ),
+                ),
+                SizedBox(height: 10.h),
+              ],
+            ),
+            Container(
+              padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 4.w),
+              decoration: BoxDecoration(
+                color: Colors.white,
+                borderRadius: BorderRadius.circular(22.r),
+              ),
+              child: Text(
+                isUser
+                    ? controller.userInfo.value?.name ?? ""
+                    : controller.currentChooseKeyboard.value.name ?? "",
+                style: Styles.getTextStyleBlack204W400(14.sp),
+              ),
+            ),
+          ],
+        ),
+        const SizedBox(height: 4),
+        // Text(name, style: const TextStyle(fontSize: 12)),
+      ],
+    );
+  }
+
+  // 爱情百分比
+  Widget _buildLovePercentage() {
+    return Container(
+      decoration: BoxDecoration(shape: BoxShape.circle),
+      child: Center(
+        child: Column(
+          mainAxisSize: MainAxisSize.min,
+          children: [
+            Container(
+              padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 4.h),
+              decoration: ShapeDecoration(
+                color: Colors.white.withValues(alpha: 153),
+                shape: RoundedRectangleBorder(
+                  borderRadius: BorderRadius.circular(17.r),
+                ),
+              ),
+              child: Row(
+                children: [
+                  Assets.images.iconKeyboardLoveLogo.image(
+                    width: 18.w,
+                    height: 18.w,
+                  ),
+                  Text(
+                    '追爱ing',
+                    textAlign: TextAlign.center,
+                    style: Styles.getTextStyleBlack153W400(14.sp),
+                  ),
+                ],
+              ),
+            ),
+            SizedBox(height: 7.h),
+            SizedBox(
+              width: 88.w,
+              height: 72.h,
+              child: Stack(
+                children: [
+                  Assets.images.bgKeyboardLove.image(width: 88.w, height: 72.h),
+                  Positioned.fill(
+                    child: Center(
+                      child: Obx(
+                        () => Text.rich(
+                          TextSpan(
+                            children: [
+                              TextSpan(
+                                text:
+                                    controller.hasPartner.value &&
+                                            controller
+                                                    .currentChooseKeyboard
+                                                    .value
+                                                    .intimacy !=
+                                                null
+                                        ? controller
+                                            .currentChooseKeyboard
+                                            .value
+                                            .intimacy
+                                            .toString()
+                                        : "?",
+                                style: TextStyle(
+                                  color: Colors.white,
+                                  fontSize: 33.sp,
+                                  fontWeight: FontWeight.w700,
+                                  shadows: [
+                                    Shadow(
+                                      offset: Offset(0, 1),
+                                      blurRadius: 4.r,
+                                      color: const Color(
+                                        0xFFFF6BD3,
+                                      ).withValues(alpha: 0.63),
+                                    ),
+                                  ],
+                                ),
+                              ),
+                              TextSpan(
+                                text: '%',
+                                style: TextStyle(
+                                  color: Colors.white,
+                                  fontSize: 14.sp,
+                                  fontWeight: FontWeight.w700,
+                                  shadows: [
+                                    Shadow(
+                                      offset: Offset(0, 1),
+                                      blurRadius: 4.r,
+                                      color: const Color(
+                                        0xFFFF6BD3,
+                                      ).withValues(alpha: 0.63),
+                                    ),
+                                  ],
+                                ),
+                              ),
+                            ],
+                          ),
+                        ),
+                      ),
+                    ),
+                  ),
+                ],
+              ),
+            ),
+          ],
+        ),
+      ),
+    );
+  }
+
+  // 添加伴侣按钮
+  Widget _buildAddPartnerButton() {
+    return Column(
+      children: [
+        Container(
+          width: 60,
+          height: 60,
+          decoration: BoxDecoration(
+            shape: BoxShape.circle,
+            color: Colors.grey.shade200,
+          ),
+          child: const Icon(Icons.mail_outline, color: Colors.grey),
+        ),
+        const SizedBox(height: 4),
+        const Text('添加', style: TextStyle(fontSize: 12)),
+      ],
+    );
+  }
+
+  // 爱情指数项目
+  Widget _buildLoveIndexItems() {
+    return Obx(() {
+      return Row(
+        children: [
+          _buildIndexItem(
+            '心情',
+            controller.moodPercentage.value,
+            Colors.pink.shade100,
+          ),
+          _buildIndexItem(
+            '颜值',
+            controller.appearancePercentage.value,
+            Colors.purple.shade100,
+          ),
+          _buildIndexItem(
+            '财富',
+            controller.wealthPercentage.value,
+            Colors.amber.shade100,
+          ),
+          _buildIndexItem(
+            '洁净',
+            controller.cleanlinessPercentage.value,
+            Colors.blue.shade100,
+          ),
+        ],
+      );
+    });
+  }
+
+  // 单个指数项
+  Widget _buildIndexItem(String title, int percentage, Color color) {
+    return Expanded(
+      child: Column(
+        crossAxisAlignment: CrossAxisAlignment.start,
+        children: [
+          Text(title, style: const TextStyle(fontSize: 12)),
+          const SizedBox(height: 4),
+          Stack(
+            children: [
+              Container(
+                height: 6,
+                decoration: BoxDecoration(
+                  color: Colors.grey.shade200,
+                  borderRadius: BorderRadius.circular(3),
+                ),
+              ),
+              FractionallySizedBox(
+                widthFactor: percentage / 100,
+                child: Container(
+                  height: 6,
+                  decoration: BoxDecoration(
+                    color: color,
+                    borderRadius: BorderRadius.circular(3),
+                  ),
+                ),
+              ),
+            ],
+          ),
+          const SizedBox(height: 2),
+          Text(
+            '$percentage%',
+            style: TextStyle(fontSize: 10, color: Colors.grey.shade600),
+          ),
+        ],
+      ),
     );
   }
+
+  // 爆款玩法区域
+  Widget _buildPopularFeatures() {
+    return Container(
+      margin: const EdgeInsets.symmetric(horizontal: 16),
+      padding: const EdgeInsets.all(16),
+      decoration: BoxDecoration(
+        color: Colors.white,
+        borderRadius: BorderRadius.circular(16),
+      ),
+      child: Column(
+        crossAxisAlignment: CrossAxisAlignment.start,
+        children: [
+          Row(
+            children: [
+              Container(
+                width: 8,
+                height: 8,
+                decoration: BoxDecoration(
+                  shape: BoxShape.circle,
+                  color: Colors.purple.shade200,
+                ),
+              ),
+              const SizedBox(width: 8),
+              const Text(
+                '爆款玩法',
+                style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
+              ),
+            ],
+          ),
+          const SizedBox(height: 16),
+          Row(
+            children: [
+              _buildFeatureCard(
+                '追爱小键盘',
+                '轻松回复TA',
+                Colors.purple.shade50,
+                Icons.keyboard,
+                Colors.purple.shade200,
+              ),
+              const SizedBox(width: 12),
+              _buildFeatureCard(
+                '亲密度分析',
+                '探索人格密码',
+                Colors.orange.shade50,
+                Icons.favorite_border,
+                Colors.orange.shade200,
+              ),
+            ],
+          ),
+          const SizedBox(height: 12),
+          Row(
+            children: [
+              _buildFeatureCard(
+                '截图回复',
+                '上下文义分析',
+                Colors.blue.shade50,
+                Icons.screenshot_monitor,
+                Colors.blue.shade200,
+              ),
+              const SizedBox(width: 12),
+              _buildFeatureCard(
+                '截图回复',
+                '上下文义分析',
+                Colors.green.shade50,
+                Icons.message,
+                Colors.green.shade200,
+              ),
+            ],
+          ),
+        ],
+      ),
+    );
+  }
+
+  // 功能卡片
+  Widget _buildFeatureCard(
+    String title,
+    String subtitle,
+    Color bgColor,
+    IconData icon,
+    Color iconColor,
+  ) {
+    return Expanded(
+      child: Container(
+        padding: const EdgeInsets.all(12),
+        decoration: BoxDecoration(
+          color: bgColor,
+          borderRadius: BorderRadius.circular(12),
+        ),
+        child: Row(
+          children: [
+            Expanded(
+              child: Column(
+                crossAxisAlignment: CrossAxisAlignment.start,
+                children: [
+                  Text(
+                    title,
+                    style: const TextStyle(
+                      fontSize: 14,
+                      fontWeight: FontWeight.bold,
+                    ),
+                  ),
+                  const SizedBox(height: 4),
+                  Text(
+                    subtitle,
+                    style: TextStyle(fontSize: 12, color: Colors.grey.shade700),
+                  ),
+                ],
+              ),
+            ),
+            Container(
+              width: 40,
+              height: 40,
+              decoration: BoxDecoration(
+                color: Colors.white,
+                borderRadius: BorderRadius.circular(8),
+              ),
+              child: Icon(icon, color: iconColor),
+            ),
+          ],
+        ),
+      ),
+    );
+  }
+
+  // 键盘设置区域
+  Widget _buildKeyboardSettings() {
+    return Container(
+      margin: const EdgeInsets.all(16),
+      padding: const EdgeInsets.all(16),
+      decoration: BoxDecoration(
+        color: Colors.white,
+        borderRadius: BorderRadius.circular(16),
+      ),
+      child: Column(
+        crossAxisAlignment: CrossAxisAlignment.start,
+        children: [
+          Row(
+            mainAxisAlignment: MainAxisAlignment.spaceBetween,
+            children: [
+              const Text(
+                '当前键盘人设',
+                style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
+              ),
+              Row(
+                children: [
+                  const Text(
+                    '去管理',
+                    style: TextStyle(fontSize: 12, color: Colors.grey),
+                  ),
+                  Icon(
+                    Icons.chevron_right,
+                    size: 16,
+                    color: Colors.grey.shade400,
+                  ),
+                ],
+              ),
+            ],
+          ),
+          const SizedBox(height: 16),
+          Wrap(
+            spacing: 8,
+            runSpacing: 8,
+            children: [
+              _buildPersonaTag('高冷'),
+              _buildPersonaTag('幽默搞笑'),
+              _buildPersonaTag('粘心暖男'),
+              _buildPersonaTag('温柔体贴'),
+              _buildPersonaTag('阳光大男孩'),
+              _buildPersonaTag('都市精英'),
+            ],
+          ),
+        ],
+      ),
+    );
+  }
+
+  // 人设标签
+  Widget _buildPersonaTag(String text) {
+    return Container(
+      padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
+      decoration: BoxDecoration(
+        color: Colors.grey.shade100,
+        borderRadius: BorderRadius.circular(16),
+      ),
+      child: Row(
+        mainAxisSize: MainAxisSize.min,
+        children: [
+          const Icon(Icons.emoji_emotions, size: 16, color: Colors.amber),
+          const SizedBox(width: 4),
+          Text(text, style: const TextStyle(fontSize: 12)),
+        ],
+      ),
+    );
+  }
+
+  @override
+  Color backgroundColor() {
+    return const Color(0xFFF5F5F5);
+  }
+}
+
+class ProgressBar extends StatelessWidget {
+  final String title;
+  final RxInt value; // 例如传入 50,代表 50%
+  final Color color;
+
+  const ProgressBar({
+    super.key,
+    required this.title,
+    required this.value,
+    required this.color,
+  });
+
+  @override
+  Widget build(BuildContext context) {
+    return Obx(() {
+      final double progress = (value.value / 100).clamp(0.0, 1.0); // 保证 0~1 范围
+      return Container(
+        child: Row(
+          children: [
+            SizedBox(width: 40, child: Text(title)),
+            const SizedBox(width: 8),
+            Expanded(
+              child: Stack(
+                children: [
+                  Container(
+                    height: 20,
+                    decoration: BoxDecoration(
+                      color: color.withOpacity(0.15), // 修正:用 withOpacity
+                      borderRadius: BorderRadius.circular(20.r),
+                    ),
+                  ),
+                  FractionallySizedBox(
+                    widthFactor: progress,
+                    child: Container(
+                      height: 20.h,
+                      decoration: BoxDecoration(
+                        color: color,
+                        borderRadius: BorderRadius.circular(20.r),
+                      ),
+                    ),
+                  ),
+                  Positioned.fill(
+                    child: Center(
+                      child: Text(
+                        "${value.value}%",
+                        style: const TextStyle(
+                          color: Colors.white,
+                          fontSize: 12,
+                        ),
+                      ),
+                    ),
+                  ),
+                ],
+              ),
+            ),
+          ],
+        ),
+      );
+    });
+  }
 }

+ 15 - 5
lib/module/mine/mine_controller.dart

@@ -8,11 +8,13 @@ import 'package:keyboard/base/base_controller.dart';
 import 'package:keyboard/module/about/about_page.dart';
 import 'package:keyboard/module/feedback/feedback_page.dart';
 import 'package:keyboard/module/store/discount/discount_view.dart';
+import 'package:keyboard/utils/atmob_log.dart';
 
 import '../../data/consts/build_config.dart';
 import '../../data/consts/error_code.dart';
 import '../../data/repository/account_repository.dart';
 import '../../plugins/keyboard_android_platform.dart';
+import '../../plugins/keyboard_method_handler.dart';
 import '../../resource/colors.gen.dart';
 import '../profile/profile_page.dart';
 import '../store/discount/discount_controller.dart';
@@ -27,6 +29,7 @@ import '../store/ticket/discount_ticket_dialog.dart';
 class MineController extends BaseController {
   final AccountRepository accountRepository;
 
+
   MineController(this.accountRepository);
 
   bool get isLogin => accountRepository.isLogin.value;
@@ -48,18 +51,21 @@ class MineController extends BaseController {
 
   longClickVip() {
     if (BuildConfig.isDebug) {
-      KeyboardAndroidPlatform.getInstance().enableFloatingWindow(true);
-      KeyboardAndroidPlatform.getInstance().openInputMethodSettings();
+      KeyboardAndroidPlatform.enableFloatingWindow(true);
+      KeyboardAndroidPlatform.openInputMethodSettings();
     }
   }
-
+  bool isTest = false;
   clickOnlineCustomerService() {
+    accountRepository.isLoginTest();
     debugPrint('clickOnlineCustomerService');
+    isTest?
     accountRepository
         .loginUserLogin("11223344551", "1122")
         .then((data) {
           Get.back();
-          ToastUtil.show(StringName.loginSuccess);
+
+
         })
         .catchError((error) {
           if (error is LoginTooOftenException) {
@@ -75,7 +81,11 @@ class MineController extends BaseController {
           } else {
             ToastUtil.show(StringName.loginFailedToast);
           }
-        });
+        }):
+        accountRepository.logout();
+    isTest=!isTest;
+
+    AtmobLog.d("MineController", 'clickOnlineCustomerService $isLogin');
   }
 
   clickTutorials() {

+ 23 - 20
lib/module/mine/mine_view.dart

@@ -5,7 +5,7 @@ import 'package:keyboard/module/mine/mine_controller.dart';
 import 'package:keyboard/resource/string.gen.dart';
 
 import '../../resource/assets.gen.dart';
-
+import 'package:get/get.dart';
 class MineView extends BaseView<MineController> {
   const MineView({super.key});
 
@@ -86,29 +86,32 @@ class MineView extends BaseView<MineController> {
 
   // 用户信息卡片
   Widget userCard() {
-    return Row(
-      children: [
-        controller.isLogin
-            ? Assets.images.iconMineUserLogged.image(width: 56.r, height: 56.r)
-            : Assets.images.iconMineUserNoLogin.image(
-              width: 56.r,
-              height: 56.r,
+    return Obx(() {
+      return Row(
+        children: [
+          controller.isLogin
+              ? Assets.images.iconMineUserLogged.image(
+              width: 56.r, height: 56.r)
+              : Assets.images.iconMineUserNoLogin.image(
+            width: 56.r,
+            height: 56.r,
+          ),
+          SizedBox(width: 12.r),
+          Text(
+            controller.getUserName(),
+            style: TextStyle(
+              fontSize: 18.sp,
+              color: Colors.black,
+              fontWeight: FontWeight.w500,
             ),
-        SizedBox(width: 12.r),
-        Text(
-          controller.getUserName(),
-          style: TextStyle(
-            fontSize: 18.sp,
-            color: Colors.black,
-            fontWeight: FontWeight.w500,
           ),
-        ),
 
-        SizedBox(width: 4.r),
+          SizedBox(width: 4.r),
 
-        Assets.images.iconMineLoginArrow.image(width: 16.r, height: 16.r),
-      ],
-    );
+          Assets.images.iconMineLoginArrow.image(width: 16.r, height: 16.r),
+        ],
+      );
+    });
   }
 
   // VIP 卡片

+ 1 - 1
lib/module/profile/profile_controller.dart

@@ -37,7 +37,7 @@ class ProfileController extends BaseController {
     AtmobLog.d(tag, '....init');
   }
 
-  final RxBool isTest = false.obs;
+
 
   @override
   void onInit() {

+ 16 - 41
lib/plugins/keyboard_android_platform.dart

@@ -1,50 +1,26 @@
 import 'package:flutter/services.dart';
 import 'package:flutter/widgets.dart';
-import 'package:injectable/injectable.dart';
-import 'package:keyboard/data/repository/account_repository.dart';
-import 'package:keyboard/data/repository/characters_repository.dart';
-import 'package:keyboard/data/repository/keyboard_repository.dart';
 import 'package:keyboard/utils/atmob_log.dart';
 
-import '../../di/get_it.dart';
-import '../data/repository/chat_repository.dart';
 import 'keyboard_android_service.dart';
 import 'keyboard_method_handler.dart';
 
-@lazySingleton
 class KeyboardAndroidPlatform {
-  static const _channel = MethodChannel('keyboard_android');
-  final _tag = 'KeyboardAndroidPlatform';
+  KeyboardAndroidPlatform._();
 
-  final KeyboardRepository keyboardRepository;
-  final CharactersRepository charactersRepository;
-  final AccountRepository accountRepository;
-  final ChatRepository chatRepository;
+  static const MethodChannel _channel = MethodChannel('keyboard_android');
+  static const String _tag = 'KeyboardAndroidPlatform';
 
-  final KeyboardAndroidService _keyboardAndroidService;
-  final KeyboardMethodHandler _methodHandler;
+  static final KeyboardAndroidService _keyboardAndroidService =
+      KeyboardAndroidService();
+  static final KeyboardMethodHandler _methodHandler = KeyboardMethodHandler();
 
-  KeyboardAndroidPlatform(
-    this.keyboardRepository,
-    this.charactersRepository,
-    this.accountRepository,
-    this.chatRepository,
-  ) : _keyboardAndroidService = KeyboardAndroidService(),
-      _methodHandler = KeyboardMethodHandler(
-        keyboardRepository,
-        charactersRepository,
-        accountRepository,
-        chatRepository,
-      ) {
-    AtmobLog.d(_tag, '初始化 KeyboardAndroidPlatform');
-    _init();
-  }
-
-  void _init() {
+  static void init() {
+    AtmobLog.d(_tag, '初始化 KeyboardAndroidPlatform ');
     _channel.setMethodCallHandler(_methodHandler.handleMethodCall);
   }
 
-  Future<void> sendDynamicTextRequest(
+  static Future<void> sendDynamicTextRequest(
     String method,
     String currentContent,
   ) async {
@@ -58,23 +34,22 @@ class KeyboardAndroidPlatform {
     }
   }
 
-  void enableFloatingWindow(bool enable) {
+  // 打开/关闭悬浮窗
+  static void enableFloatingWindow(bool enable) {
     debugPrint('enableFloatingWindow $enable');
     _keyboardAndroidService.enableFloatingWindow(enable);
   }
 
-  void openInputMethodSettings() {
+  // 打开输入法设置
+  static void openInputMethodSettings() {
     debugPrint('openInputMethodSettings');
     _keyboardAndroidService.openInputMethodSettings();
   }
 
-  Future<bool> isTargetKeyboardEnabled() {
-    final result = _keyboardAndroidService.isTargetKeyboardEnabled();
+  //是否启用目标输入法
+  static Future<bool> isTargetKeyboardEnabled() async {
+    final result = await _keyboardAndroidService.isTargetKeyboardEnabled();
     debugPrint('isTargetKeyboardEnabled value: $result');
     return result;
   }
-
-  static KeyboardAndroidPlatform getInstance() {
-    return getIt.get<KeyboardAndroidPlatform>();
-  }
 }

+ 11 - 21
lib/plugins/keyboard_method_handler.dart

@@ -1,6 +1,5 @@
 import 'dart:convert';
 
-import 'package:collection/collection.dart';
 import 'package:flutter/services.dart';
 import 'package:keyboard/data/repository/account_repository.dart';
 import 'package:keyboard/data/repository/characters_repository.dart';
@@ -12,31 +11,23 @@ import 'package:get/get.dart';
 import '../data/api/response/chat_prologue_response.dart';
 import '../data/api/response/chat_super_speak_response.dart';
 import '../data/api/response/keyboard_list_response.dart';
+import '../di/get_it.dart';
 import '../utils/http_handler.dart';
 import '../utils/mmkv_util.dart';
 import '../utils/toast_util.dart';
 
 class KeyboardMethodHandler {
   final tag = "KeyboardMethodHandler";
-  final KeyboardRepository keyboardRepository;
-  final CharactersRepository charactersRepository;
-  final AccountRepository accountRepository;
-  final ChatRepository chatRepository;
 
   // 用处存储选中的键盘id
   static const String keyboardSelect = 'keyboard_select';
 
-  bool get isLogin => accountRepository.isLogin.value;
+  bool get isLogin => AccountRepository.getInstance().isLoginTest();
 
-  bool get isMember => accountRepository.isMember.value;
+  bool get isMember => AccountRepository.getInstance().isMember.value;
   late KeyboardListResponse keyboardListResponse;
 
-  KeyboardMethodHandler(
-    this.keyboardRepository,
-    this.charactersRepository,
-    this.accountRepository,
-    this.chatRepository,
-  );
+  KeyboardMethodHandler();
 
   Future<dynamic> handleMethodCall(MethodCall call) async {
     switch (call.method) {
@@ -71,7 +62,7 @@ class KeyboardMethodHandler {
   Future<String> _handleGetKeyboardList(MethodCall call) async {
     String? type = call.arguments?['type'] as String?;
 
-    final keyboardList = await keyboardRepository.getKeyboardList(type: type);
+    final keyboardList = await KeyboardRepository.getInstance().getKeyboardList(type: type);
     final selectedKeyboardJson = KVUtil.getString(keyboardSelect, null);
     if (selectedKeyboardJson != null) {
       try {
@@ -99,7 +90,7 @@ class KeyboardMethodHandler {
     final String keyboardId = call.arguments['keyboardId'];
 
     if (keyboardListResponse.keyboardInfos.isEmpty) {
-      keyboardListResponse = await keyboardRepository.getKeyboardList();
+      keyboardListResponse = await KeyboardRepository.getInstance().getKeyboardList();
     }
     final selectedKeyboard = keyboardListResponse.keyboardInfos
         .firstWhereOrNull((element) => element.id == keyboardId);
@@ -124,7 +115,7 @@ class KeyboardMethodHandler {
 
   Future<String> _handleGetCharacterList(MethodCall call) async {
     final String keyboardId = call.arguments['keyboardId'];
-    final characterList = await keyboardRepository.getKeyboardCharacterList(
+    final characterList = await KeyboardRepository.getInstance().getKeyboardCharacterList(
       keyboardId: keyboardId,
     );
     return jsonEncode(characterList.toJson());
@@ -132,7 +123,7 @@ class KeyboardMethodHandler {
 
   //   获取开场白列表
   Future<String> _handleGetPrologueList(MethodCall call) async {
-    final prologueList = await keyboardRepository.getPrologueList();
+    final prologueList = await KeyboardRepository.getInstance().getPrologueList();
     return jsonEncode(prologueList.toJson());
   }
 
@@ -142,7 +133,7 @@ class KeyboardMethodHandler {
     final String keyboardId = call.arguments['keyboardId'];
     final String characterId = call.arguments['characterId'];
     try {
-      final chatSuperReplyResponse = await chatRepository.chatSuperReply(
+      final chatSuperReplyResponse = await ChatRepository.getInstance().chatSuperReply(
         content: content,
         keyboardId: keyboardId,
         characterId: characterId,
@@ -167,7 +158,7 @@ class KeyboardMethodHandler {
     final String characterId = call.arguments['characterId'];
     final ChatSuperSpeakResponse chatSuperSpeakResponse;
     try {
-      chatSuperSpeakResponse = await chatRepository.chatSuperSpeak(
+      chatSuperSpeakResponse = await ChatRepository.getInstance().chatSuperSpeak(
         content: content,
         keyboardId: keyboardId,
         characterId: characterId,
@@ -189,7 +180,7 @@ class KeyboardMethodHandler {
     final String name = call.arguments['name'];
     final ChatPrologueResponse chatPrologueResponse;
     try {
-      chatPrologueResponse = await chatRepository.chatPrologue(name: name);
+      chatPrologueResponse = await ChatRepository.getInstance().chatPrologue(name: name);
       return jsonEncode(chatPrologueResponse.toJson());
     } catch (error) {
       if (error is ServerErrorException) {
@@ -212,7 +203,6 @@ class KeyboardMethodHandler {
         try {
           parsedArgs = Map<String, dynamic>.from(json.decode(args));
         } catch (e) {
-
           return '{}';
         }
       } else if (args is Map) {

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

@@ -97,6 +97,14 @@ class $AssetsImagesGen {
   AssetGenImage get bgDiscountTitle =>
       const AssetGenImage('assets/images/bg_discount_title.webp');
 
+  /// File path: assets/images/bg_keyboard.webp
+  AssetGenImage get bgKeyboard =>
+      const AssetGenImage('assets/images/bg_keyboard.webp');
+
+  /// File path: assets/images/bg_keyboard_love.webp
+  AssetGenImage get bgKeyboardLove =>
+      const AssetGenImage('assets/images/bg_keyboard_love.webp');
+
   /// File path: assets/images/bg_keyboard_manage.webp
   AssetGenImage get bgKeyboardManage =>
       const AssetGenImage('assets/images/bg_keyboard_manage.webp');
@@ -332,6 +340,18 @@ class $AssetsImagesGen {
   AssetGenImage get iconGoodsInfoTitle =>
       const AssetGenImage('assets/images/icon_goods_info_title.webp');
 
+  /// File path: assets/images/icon_keyboard_default_avatar.webp
+  AssetGenImage get iconKeyboardDefaultAvatar =>
+      const AssetGenImage('assets/images/icon_keyboard_default_avatar.webp');
+
+  /// File path: assets/images/icon_keyboard_love_Index.webp
+  AssetGenImage get iconKeyboardLoveIndex =>
+      const AssetGenImage('assets/images/icon_keyboard_love_Index.webp');
+
+  /// File path: assets/images/icon_keyboard_love_logo.webp
+  AssetGenImage get iconKeyboardLoveLogo =>
+      const AssetGenImage('assets/images/icon_keyboard_love_logo.webp');
+
   /// File path: assets/images/icon_keyboard_manage_custom.webp
   AssetGenImage get iconKeyboardManageCustom =>
       const AssetGenImage('assets/images/icon_keyboard_manage_custom.webp');
@@ -353,6 +373,14 @@ class $AssetsImagesGen {
   AssetGenImage get iconKeyboardManageX =>
       const AssetGenImage('assets/images/icon_keyboard_manage_x.webp');
 
+  /// File path: assets/images/icon_keyboard_title.webp
+  AssetGenImage get iconKeyboardTitle =>
+      const AssetGenImage('assets/images/icon_keyboard_title.webp');
+
+  /// File path: assets/images/icon_keyboard_vip_logo.webp
+  AssetGenImage get iconKeyboardVipLogo =>
+      const AssetGenImage('assets/images/icon_keyboard_vip_logo.webp');
+
   /// File path: assets/images/icon_member_retain_close.webp
   AssetGenImage get iconMemberRetainClose =>
       const AssetGenImage('assets/images/icon_member_retain_close.webp');
@@ -565,6 +593,8 @@ class $AssetsImagesGen {
     bgDiscountContent,
     bgDiscountTagTop,
     bgDiscountTitle,
+    bgKeyboard,
+    bgKeyboardLove,
     bgKeyboardManage,
     bgKeyboardManageIntimacy,
     bgMine,
@@ -622,11 +652,16 @@ class $AssetsImagesGen {
     iconDiscountTitle,
     iconDiscountTutorial,
     iconGoodsInfoTitle,
+    iconKeyboardDefaultAvatar,
+    iconKeyboardLoveIndex,
+    iconKeyboardLoveLogo,
     iconKeyboardManageCustom,
     iconKeyboardManageFavorite,
     iconKeyboardManageIntimacyText,
     iconKeyboardManagePlus,
     iconKeyboardManageX,
+    iconKeyboardTitle,
+    iconKeyboardVipLogo,
     iconMemberRetainClose,
     iconMineAbout,
     iconMineArrow,

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

@@ -143,6 +143,7 @@ class StringName {
   static final String discountDialogSocial = 'discount_dialog_social'.tr; // 扩大社交
   static final String profileSave = 'profile_save'.tr; // 完成
   static final String profileEditSave = 'profile_edit_save'.tr; // 保存
+  static final String keyboardMemberOpen = 'keyboard_member_open'.tr; // 开通会员
 }
 class StringMultiSource {
   StringMultiSource._();
@@ -289,6 +290,7 @@ class StringMultiSource {
       'discount_dialog_social': '扩大社交',
       'profile_save': '完成',
       'profile_edit_save': '保存',
+      'keyboard_member_open': '开通会员',
     },
   };
 }