diff --git a/images/other/2.png b/images/other/2.png new file mode 100644 index 00000000..3d499414 Binary files /dev/null and b/images/other/2.png differ diff --git a/images/other/ai.png b/images/other/ai.png new file mode 100644 index 00000000..0b6acd8a Binary files /dev/null and b/images/other/ai.png differ diff --git a/images/other/matter.png b/images/other/matter.png new file mode 100644 index 00000000..887d992c Binary files /dev/null and b/images/other/matter.png differ diff --git a/images/other/tuya.png b/images/other/tuya.png new file mode 100644 index 00000000..f8618310 Binary files /dev/null and b/images/other/tuya.png differ diff --git a/lib/appRouters.dart b/lib/appRouters.dart index 1293063f..d44441fd 100755 --- a/lib/appRouters.dart +++ b/lib/appRouters.dart @@ -18,6 +18,7 @@ import 'package:star_lock/main/lockDetail/iris/addIris/addIris_page.dart'; import 'package:star_lock/main/lockDetail/iris/addIrisType/addIrisTypeManage/addIrisTypeManage_page.dart'; import 'package:star_lock/main/lockDetail/iris/irisList/irisList_page.dart'; import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_main_page.dart'; +import 'package:star_lock/main/lockDetail/lockSet/aiAssistant/ai_assistant_page.dart'; import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_page.dart'; import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/catEyeSet/catEyeSet_page.dart'; import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_page.dart'; @@ -532,6 +533,7 @@ abstract class Routers { static const String permissionGuidancePage = '/permissionGuidancePage'; // 锁屏权限通知引导页面 static const String lockVoiceSettingPage = '/lockVoiceSetting'; // 锁屏权限通知引导页面 + static const String aiAssistant = '/aiAssistant'; } abstract class AppRouters { @@ -1224,6 +1226,9 @@ abstract class AppRouters { GetPage( name: Routers.thirdPartyPlatformPage, page: () => ThirdPartyPlatformPage()), + GetPage( + name: Routers.aiAssistant, + page: () => AiAssistantPage()), // 插件播放页面 // GetPage(name: Routers.h264View, page: () => H264WebView()), // webview播放页面 ]; diff --git a/lib/blue/io_tool/io_model.dart b/lib/blue/io_tool/io_model.dart index 0dc79873..2bb2603b 100755 --- a/lib/blue/io_tool/io_model.dart +++ b/lib/blue/io_tool/io_model.dart @@ -27,6 +27,11 @@ class EventSendModel { Uuid? serviceId; Uuid? characteristicId; bool? allowLongWrite = false; + + @override + String toString() { + return 'EventSendModel{data: $data, topic: $topic, sendChannel: $sendChannel, deviceId: $deviceId, serviceId: $serviceId, characteristicId: $characteristicId, allowLongWrite: $allowLongWrite}'; + } } ///接收数据类 diff --git a/lib/main/lockDetail/lockSet/aiAssistant/ai_assistant_logic.dart b/lib/main/lockDetail/lockSet/aiAssistant/ai_assistant_logic.dart new file mode 100644 index 00000000..c8239214 --- /dev/null +++ b/lib/main/lockDetail/lockSet/aiAssistant/ai_assistant_logic.dart @@ -0,0 +1,7 @@ +import 'package:star_lock/main/lockDetail/lockSet/aiAssistant/ai_assistant_state.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; + +class AiAssistantLogic extends BaseGetXController{ + final AiAssistantState state = AiAssistantState(); + +} \ No newline at end of file diff --git a/lib/main/lockDetail/lockSet/aiAssistant/ai_assistant_page.dart b/lib/main/lockDetail/lockSet/aiAssistant/ai_assistant_page.dart new file mode 100644 index 00000000..9ecaec95 --- /dev/null +++ b/lib/main/lockDetail/lockSet/aiAssistant/ai_assistant_page.dart @@ -0,0 +1,90 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:star_lock/app_settings/app_colors.dart'; +import 'package:star_lock/main/lockDetail/lockSet/aiAssistant/ai_assistant_logic.dart'; +import 'package:star_lock/main/lockDetail/lockSet/aiAssistant/ai_assistant_state.dart'; +import 'package:star_lock/tools/commonItem.dart'; +import 'package:star_lock/tools/titleAppBar.dart'; + +class AiAssistantPage extends StatefulWidget { + const AiAssistantPage({Key? key}) : super(key: key); + + @override + State createState() => _AiAssistantPageState(); +} + +class _AiAssistantPageState extends State { + final AiAssistantLogic logic = Get.put(AiAssistantLogic()); + final AiAssistantState state = Get.find().state; + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + appBar: TitleAppBar(barTitle: 'AI助理设置'.tr, haveBack: true, backgroundColor: AppColors.mainColor), + body: Container( + width: 1.sw, + padding: EdgeInsets.symmetric(horizontal: 20.w), + margin: EdgeInsets.only(top: 20.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + 'images/other/ai.png', + height: 250.h, + fit: BoxFit.cover, + ), + SizedBox( + height: 50.h, + ), + Text( + 'AI助理的支持依赖网络授权下载,打开功能开关时请保证手机数据网络的正常连接'.tr, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 20.sp, + color: Colors.grey, + fontWeight: FontWeight.w500, + ), + ), + SizedBox( + height: 50.h, + ), + CommonItem( + leftTitel: 'Ai语音菜单'.tr, + rightTitle: '', + isHaveLine: true, + // 最后一个元素不显示分割线(取反) + isHaveDirection: false, + isHaveRightWidget: true, + rightWidget: CupertinoSwitch( + value: false, + onChanged: (value) {}, + ), + action: () { + logic.showToast('功能待开放'.tr); + }, + ), + CommonItem( + leftTitel: 'Ai智能语音交互'.tr, + rightTitle: '', + isHaveLine: false, + // 最后一个元素不显示分割线(取反) + isHaveDirection: false, + isHaveRightWidget: true, + rightWidget: CupertinoSwitch( + value: false, + onChanged: (value) {}, + ), + action: () { + logic.showToast('功能待开放'.tr); + }, + ) + ], + ), + ), + ); + } +} diff --git a/lib/main/lockDetail/lockSet/aiAssistant/ai_assistant_state.dart b/lib/main/lockDetail/lockSet/aiAssistant/ai_assistant_state.dart new file mode 100644 index 00000000..e643953e --- /dev/null +++ b/lib/main/lockDetail/lockSet/aiAssistant/ai_assistant_state.dart @@ -0,0 +1,12 @@ +import 'package:get/get.dart'; +import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart'; + +class AiAssistantState { + AiAssistantState() { + final map = Get.arguments; + lockSetInfoData.value = map['lockSetInfoData']; + } + + Rx lockSetInfoData = LockSetInfoData().obs; + +} \ No newline at end of file diff --git a/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart b/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart index f3577276..015e23d3 100755 --- a/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart +++ b/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart @@ -553,6 +553,19 @@ class _LockSetPageState extends State }); }, ), + // 锁语音包设置 + CommonItem( + leftTitel: 'AI助理'.tr, + rightTitle: '', + isHaveLine: true, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.aiAssistant, + arguments: { + 'lockSetInfoData': state.lockSetInfoData.value + }); + }, + ), // 蓝牙广播(关闭则不能使用蓝牙主动开锁) /* 2024-01-12 会议确定去掉“蓝牙广播” by DaisyWu Obx(() => Visibility( diff --git a/lib/main/lockDetail/lockSet/thirdPartyPlatform/third_party_platform_page.dart b/lib/main/lockDetail/lockSet/thirdPartyPlatform/third_party_platform_page.dart index da90cd82..67ee6d9b 100644 --- a/lib/main/lockDetail/lockSet/thirdPartyPlatform/third_party_platform_page.dart +++ b/lib/main/lockDetail/lockSet/thirdPartyPlatform/third_party_platform_page.dart @@ -17,8 +17,7 @@ class ThirdPartyPlatformPage extends StatefulWidget { class _ThirdPartyPlatformPageState extends State { final ThirdPartyPlatformLogic logic = Get.put(ThirdPartyPlatformLogic()); - final ThirdPartyPlatformState state = - Get.find().state; + final ThirdPartyPlatformState state = Get.find().state; @override Widget build(BuildContext context) { @@ -46,52 +45,107 @@ class _ThirdPartyPlatformPageState extends State { } Widget _buildBody() { - return ListView.builder( - itemCount: state.platFormSet.length, - itemBuilder: (BuildContext context, int index) { - // 判断是否是最后一个元素(索引等于 itemCount - 1) - final isLastItem = index == state.platFormSet.length - 1; + return Stack( + children: [ + // 1. 背景或空白区域(可选) + Container( + color: Colors.white, + padding: EdgeInsets.all(16.w), + ), + // 2. 顶部图标行:使用 Row 并排显示 + Positioned( + top: 80.h, + left: 0, + right: 0, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, // 均匀分布 + children: [ + Image.asset( + 'images/other/tuya.png', + height: 50.h, + fit: BoxFit.cover, + ), + Image.asset( + 'images/other/2.png', // 中间图标 + height: 80.h, - // 获取当前平台数据(假设 platFormSet 是 RxList) - final platform = state.platFormSet.value[index]; - return CommonItem( - leftTitel: state.platFormSet.value[index], - rightTitle: '', - isHaveLine: !isLastItem, - // 最后一个元素不显示分割线(取反) - isHaveDirection: false, - isHaveRightWidget: true, - rightWidget: Radio( - // Radio 的值:使用平台的唯一标识(如 id) - value: platform, - // 当前选中的值:与 selectPlatFormIndex 关联的 id - groupValue: - state.platFormSet.value[state.selectPlatFormIndex.value], - // 选中颜色(可选,默认主题色) - activeColor: AppColors.mainColor, - // 点击 Radio 时回调(更新选中索引) - onChanged: (value) { - if (value != null) { - setState(() { - // 找到当前选中平台的索引(根据 id 匹配) - final newIndex = - state.platFormSet.value.indexWhere((p) => p == value); - if (newIndex != -1) { - state.selectPlatFormIndex.value = newIndex; - } - }); - } - }, + fit: BoxFit.cover, + ), + Image.asset( + 'images/other/matter.png', + width: 110.w, + fit: BoxFit.cover, + ), + ], ), - action: () { - setState(() { - state.selectPlatFormIndex.value = index; - }); - }, - ); - }, - shrinkWrap: true, - physics: const AlwaysScrollableScrollPhysics(), + ), + Positioned( + top: 220.h, + left: 20.w, + right: 20.w, + child: Text( + '第三方协议的支持依赖网络授权下载,打开功能开关时请保证手机数据网络的正常连接'.tr, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 20.sp, + color: Colors.grey, + fontWeight: FontWeight.w500, + ), + ), + ), + + Positioned( + left: 0, + right: 0, + top: 320.h, + bottom: 0, + child: ListView.builder( + itemCount: state.platFormSet.length, + itemBuilder: (BuildContext context, int index) { + // 判断是否是最后一个元素(索引等于 itemCount - 1) + final isLastItem = index == state.platFormSet.length - 1; + + // 获取当前平台数据(假设 platFormSet 是 RxList) + final platform = state.platFormSet.value[index]; + return CommonItem( + leftTitel: state.platFormSet.value[index], + rightTitle: '', + isHaveLine: !isLastItem, + // 最后一个元素不显示分割线(取反) + isHaveDirection: false, + isHaveRightWidget: true, + rightWidget: Radio( + // Radio 的值:使用平台的唯一标识(如 id) + value: platform, + // 当前选中的值:与 selectPlatFormIndex 关联的 id + groupValue: state.platFormSet.value[state.selectPlatFormIndex.value], + // 选中颜色(可选,默认主题色) + activeColor: AppColors.mainColor, + // 点击 Radio 时回调(更新选中索引) + onChanged: (value) { + if (value != null) { + setState(() { + // 找到当前选中平台的索引(根据 id 匹配) + final newIndex = state.platFormSet.value.indexWhere((p) => p == value); + if (newIndex != -1) { + state.selectPlatFormIndex.value = newIndex; + } + }); + } + }, + ), + action: () { + setState(() { + state.selectPlatFormIndex.value = index; + }); + }, + ); + }, + shrinkWrap: true, + physics: const AlwaysScrollableScrollPhysics(), + ), + ), + ], ); } }