From 9231f3cef6056a13ea81d2fbbfcfeb6091fff8b5 Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Thu, 11 Jan 2024 17:29:02 +0800 Subject: [PATCH 1/2] =?UTF-8?q?1=EF=BC=8C=E6=96=B0=E5=A2=9E=E7=8C=AB?= =?UTF-8?q?=E7=9C=BC=E8=87=AA=E5=AE=9A=E4=B9=89=E6=A8=A1=E5=BC=8F=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=202=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=BD=95=E5=83=8F?= =?UTF-8?q?=E6=97=B6=E6=AE=B5=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/images/lan/lan_en.json | 5 +- star_lock/images/lan/lan_keys.json | 4 +- star_lock/images/lan/lan_zh.json | 5 +- star_lock/lib/appRouters.dart | 10 +- .../catEyeCustomMode_logic.dart | 6 + .../catEyeCustomMode_page.dart | 145 ++++++++++++++++++ .../catEyeCustomMode_state.dart | 40 +++++ .../catEyeWorkMode/catEyeWorkMode_page.dart | 42 ++++- .../catEyeSet/videoSlot/videoSlot_logic.dart | 1 + .../catEyeSet/videoSlot/videoSlot_page.dart | 115 ++++++++++++++ .../catEyeSet/videoSlot/videoSlot_state.dart | 0 star_lock/lib/translations/lanKeyEntity.dart | 8 + 12 files changed, 373 insertions(+), 8 deletions(-) create mode 100644 star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_logic.dart create mode 100644 star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_page.dart create mode 100644 star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_state.dart create mode 100644 star_lock/lib/main/lockDetail/lcokSet/catEyeSet/videoSlot/videoSlot_logic.dart create mode 100644 star_lock/lib/main/lockDetail/lcokSet/catEyeSet/videoSlot/videoSlot_page.dart create mode 100644 star_lock/lib/main/lockDetail/lcokSet/catEyeSet/videoSlot/videoSlot_state.dart diff --git a/star_lock/images/lan/lan_en.json b/star_lock/images/lan/lan_en.json index 9a30d5fd..5a4d2770 100644 --- a/star_lock/images/lan/lan_en.json +++ b/star_lock/images/lan/lan_en.json @@ -472,5 +472,8 @@ "openLeft": "Open Left", "openRight": "Open Right", "judgmentMethod": "Judgment Method:\n", - "judgmentMethodContent": "The man stood outside the house, facing the entrance door. \nIf the hinge or shaft of the door is on the left, the door is left open; \nA door is right-open if its hinge or shaft is on the right. \nIf the setting is wrong, it will not open and close the door properly. \nRecommended to be operated by installation or maintenance personnel." + "judgmentMethodContent": "The man stood outside the house, facing the entrance door. \nIf the hinge or shaft of the door is on the left, the door is left open; \nA door is right-open if its hinge or shaft is on the right. \nIf the setting is wrong, it will not open and close the door properly. \nRecommended to be operated by installation or maintenance personnel.", + + "customMode": "Custom mode", + "videoSlot": "Video slot" } diff --git a/star_lock/images/lan/lan_keys.json b/star_lock/images/lan/lan_keys.json index 0fd01e10..eb935da8 100644 --- a/star_lock/images/lan/lan_keys.json +++ b/star_lock/images/lan/lan_keys.json @@ -472,6 +472,8 @@ "openLeft": "openLeft", "openRight": "openRight", "judgmentMethod": "judgmentMethod", - "judgmentMethodContent": "judgmentMethodContent" + "judgmentMethodContent": "judgmentMethodContent", + "customMode": "customMode", + "videoSlot": "videoSlot" } \ No newline at end of file diff --git a/star_lock/images/lan/lan_zh.json b/star_lock/images/lan/lan_zh.json index abddb75e..164d1c62 100644 --- a/star_lock/images/lan/lan_zh.json +++ b/star_lock/images/lan/lan_zh.json @@ -475,5 +475,8 @@ "openLeft": "左开", "openRight": "右开", "judgmentMethod": "判断方法:\n", - "judgmentMethodContent": "人站在屋外,面向入户门。\n如果门的合页或门轴在左边,则门是左开;\n如果门的合页或门轴在右边,则门是右开。\n如果设置错误,将无法正常开关门。\n建议由安装或维修人员操作。" + "judgmentMethodContent": "人站在屋外,面向入户门。\n如果门的合页或门轴在左边,则门是左开;\n如果门的合页或门轴在右边,则门是右开。\n如果设置错误,将无法正常开关门。\n建议由安装或维修人员操作。", + + "customMode": "自定义模式", + "videoSlot": "录像时段" } \ No newline at end of file diff --git a/star_lock/lib/appRouters.dart b/star_lock/lib/appRouters.dart index 471fb519..e908a97d 100644 --- a/star_lock/lib/appRouters.dart +++ b/star_lock/lib/appRouters.dart @@ -7,7 +7,9 @@ import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/ma import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiver_page.dart'; import 'package:star_lock/main/lockDetail/lcokSet/addFamily/addFamily_page.dart'; +import 'package:star_lock/main/lockDetail/lcokSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_page.dart'; import 'package:star_lock/main/lockDetail/lcokSet/catEyeSet/catEyeSet/catEyeSet_page.dart'; +import 'package:star_lock/main/lockDetail/lcokSet/catEyeSet/videoSlot/videoSlot_page.dart'; import 'package:star_lock/main/lockDetail/lcokSet/faceUnlock/faceUnlock_page.dart'; import 'package:star_lock/main/lockDetail/lcokSet/familyDetails/familyDetails_page.dart'; import 'package:star_lock/main/lockDetail/lcokSet/lockUser/lockUser_page.dart'; @@ -410,6 +412,8 @@ abstract class Routers { '/passwordKeyDetailChangeDatePage'; //密码更改时间 static const realTimePicturePage = '/realTimePicturePage'; //实时监控画面 static const doorLockLogPage = '/doorLockLogPage'; //门锁日志 + static const catEyeCustomModePage = '/catEyeCustomModePage'; //猫眼自定义模式 + static const videoSlotPage = '/videoSlotPage'; //录像时段 } abstract class AppRouters { @@ -996,6 +1000,10 @@ abstract class AppRouters { GetPage( name: Routers.realTimePicturePage, page: () => const RealTimePicturePage()), - GetPage(name: Routers.doorLockLogPage, page: () => const DoorLockLogPage()) + GetPage(name: Routers.doorLockLogPage, page: () => const DoorLockLogPage()), + GetPage( + name: Routers.catEyeCustomModePage, + page: () => const CatEyeCustomModePage()), + GetPage(name: Routers.videoSlotPage, page: (() => const VideoSlotPage())), ]; } diff --git a/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_logic.dart new file mode 100644 index 00000000..bce600a1 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_logic.dart @@ -0,0 +1,6 @@ +import 'package:star_lock/main/lockDetail/lcokSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_state.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; + +class CatEyeCustomModeLogic extends BaseGetXController { + final CatEyeCustomModeState state = CatEyeCustomModeState(); +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_page.dart b/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_page.dart new file mode 100644 index 00000000..25158c67 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_page.dart @@ -0,0 +1,145 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:star_lock/appRouters.dart'; +import 'package:star_lock/app_settings/app_colors.dart'; +import 'package:star_lock/main/lockDetail/lcokSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_logic.dart'; +import 'package:star_lock/tools/commonItem.dart'; +import 'package:star_lock/tools/custom_bottom_sheet.dart'; +import 'package:star_lock/tools/titleAppBar.dart'; +import 'package:star_lock/translations/trans_lib.dart'; + +class CatEyeCustomModePage extends StatefulWidget { + const CatEyeCustomModePage({Key? key}) : super(key: key); + + @override + State createState() => _CatEyeCustomModePageState(); +} + +class _CatEyeCustomModePageState extends State { + final logic = Get.put(CatEyeCustomModeLogic()); + final state = Get.find().state; + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + appBar: TitleAppBar( + barTitle: TranslationLoader.lanKeys!.customMode!.tr, + haveBack: true, + backgroundColor: AppColors.mainColor), + body: Column( + children: [ + CommonItem( + leftTitel: TranslationLoader.lanKeys!.videoSlot!.tr, + rightTitle: "", + isHaveLine: false, + isHaveDirection: true, + isHaveRightWidget: true, + rightWidget: Text('当日22:00~次日08:00', + style: TextStyle( + fontSize: 22.sp, color: AppColors.darkGrayTextColor)), + action: () => Get.toNamed(Routers.videoSlotPage), + ), + _buildSubTitleItem('有人出现时录像', '有人在门口出现10秒后开始录像。\n有人按门铃时立即录像', + state.showsUpVideo.value, () { + _openBottomItemSheet(state.showsUpVideoList.value, 0); + }), + SizedBox( + height: 30.h, + ), + _buildSubTitleItem( + '人体侦测距离', '有人出现在门前1.5米范围时启动录像', state.detectionRange.value, () { + _openBottomItemSheet(state.detectionRangeList.value, 1); + }), + Expanded( + child: SizedBox( + height: 30.h, + )), + ], + )); + } + + Widget _buildSubTitleItem( + String leftStr, String subTitle, String rightStr, Function()? action) { + return GestureDetector( + onTap: action, + child: Container( + margin: EdgeInsets.only(left: 20.sp, right: 20.sp, top: 20.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + width: 20.w, + ), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + alignment: Alignment.centerLeft, + child: Text( + leftStr, + style: TextStyle(fontSize: 24.sp, color: Colors.black), + ), + ), + SizedBox( + height: 10.h, + ), + Container( + alignment: Alignment.centerLeft, + child: Text( + subTitle, + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 20.sp, color: AppColors.btnDisableColor), + ), + ) + ], + )), + SizedBox( + width: 20.w, + ), + Text( + rightStr, + style: TextStyle( + fontSize: 22.sp, color: AppColors.darkGrayTextColor), + ), + SizedBox( + width: 10.w, + ), + Image.asset( + 'images/icon_right_grey.png', + width: 12.w, + height: 21.w, + ) + ], + ), + ), + ); + } + + Future _openBottomItemSheet( + List bottomItemList, int clickIndex) async { + showModalBottomSheet( + context: context, + shape: RoundedRectangleBorder( + borderRadius: BorderRadiusDirectional.circular(10)), + builder: (BuildContext context) { + return AlertBottomWidget( + topTitle: '', + items: bottomItemList, + chooseCallback: (value) { + if (clickIndex == 0) { + //感应距离 + state.showsUpVideo.value = state.showsUpVideoList.value[value]; + } + + setState(() {}); + }, + ); + }); + } +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_state.dart b/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_state.dart new file mode 100644 index 00000000..a7a3a22c --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_state.dart @@ -0,0 +1,40 @@ +import 'dart:ui'; + +import 'package:flutter/material.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/translations/trans_lib.dart'; + +class CatEyeCustomModeState { + var isCheck = false.obs; + var faceOn = false.obs; //面容开锁 + var autoBright = false.obs; //自动亮屏 + var showsUpVideo = '10${TranslationLoader.lanKeys!.second!.tr}'.obs; //有人出现时录像 + var detectionRange = '约1.5米'.obs; //人体侦测距离 + var showsUpVideoList = [ + '不录像', + '立即录像', + '5${TranslationLoader.lanKeys!.second!.tr}', + '10${TranslationLoader.lanKeys!.second!.tr}', + '15${TranslationLoader.lanKeys!.second!.tr}', + '30${TranslationLoader.lanKeys!.second!.tr}', + '60${TranslationLoader.lanKeys!.second!.tr}' + ].obs; + var detectionRangeList = ['约0.8米', '约1.5米', '约3米'].obs; + //高亮样式 + final TextStyle titleStyle = TextStyle( + color: Colors.black, fontSize: 24.sp, fontWeight: FontWeight.w500); + //默认样式 + final TextStyle subTipsStyle = + TextStyle(color: AppColors.placeholderTextColor, fontSize: 22.sp); + + late InlineSpan tipsPreviewSpan = TextSpan(children: [ + TextSpan( + text: '${TranslationLoader.lanKeys!.addAndUseFaceWhenUnlocking!.tr}:\n', + style: titleStyle), + TextSpan( + text: TranslationLoader.lanKeys!.addAndUseFaceWhenUnlockingTip!.tr, + style: subTipsStyle), + ]); +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_page.dart b/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_page.dart index 24154e55..51c11f79 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_page.dart @@ -1,10 +1,11 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:star_lock/appRouters.dart'; import '../../../../../app_settings/app_colors.dart'; import '../../../../../tools/titleAppBar.dart'; - class CatEyeWorkModePage extends StatefulWidget { const CatEyeWorkModePage({Key? key}) : super(key: key); @@ -72,7 +73,8 @@ class _CatEyeWorkModePageState extends State { borderRadius: BorderRadius.circular(10.0), ), child: Padding( - padding: EdgeInsets.only(left: 20.w, top: 30.h, bottom: 30.h), + padding: EdgeInsets.only( + left: 20.w, top: 30.h, bottom: 30.h, right: 20.w), child: Row( children: [ isClick @@ -85,8 +87,40 @@ class _CatEyeWorkModePageState extends State { width: 20.w, height: 14.w, ), - SizedBox(width: 20.w), - _buildRichText(titleStr, subTitle, isClick), + SizedBox(width: 10.w), + Expanded( + child: _buildRichText(titleStr, subTitle, isClick), + ), + SizedBox( + width: 10.w, + ), + GestureDetector( + child: Container( + width: 90.w, + height: 40.h, + decoration: BoxDecoration( + color: Colors.transparent, + borderRadius: BorderRadius.circular(15.0), + border: Border.all( + color: AppColors.placeholderTextColor, width: 1.w), + ), + child: Center( + child: Text( + clickIndex == 3 ? '设置' : '查看', + style: TextStyle( + color: AppColors.placeholderTextColor, + fontSize: 20.sp), + ), + ), + ), + onTap: () { + if (clickIndex == 3) { + Get.toNamed(Routers.catEyeCustomModePage); + } else { + // Get.toNamed(Routes.catEyeWorkModeDetailPage); + } + }, + ), ], )), ), diff --git a/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/videoSlot/videoSlot_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/videoSlot/videoSlot_logic.dart new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/videoSlot/videoSlot_logic.dart @@ -0,0 +1 @@ + diff --git a/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/videoSlot/videoSlot_page.dart b/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/videoSlot/videoSlot_page.dart new file mode 100644 index 00000000..4419dfba --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/videoSlot/videoSlot_page.dart @@ -0,0 +1,115 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:star_lock/main/lockDetail/lcokSet/catEyeSet/catEyeSet/catEyeSet_logic.dart'; + +import '../../../../../app_settings/app_colors.dart'; +import '../../../../../tools/titleAppBar.dart'; + +class VideoSlotPage extends StatefulWidget { + const VideoSlotPage({Key? key}) : super(key: key); + + @override + State createState() => _VideoSlotPageState(); +} + +class _VideoSlotPageState extends State { + bool isCheck = false; + List boolList = [true, false, false, false]; + + final logic = Get.put(CatEyeSetLogic()); + final state = Get.find().state; + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar( + barTitle: '录像时段', + haveBack: true, + backgroundColor: AppColors.mainColor), + body: Column( + children: [ + SizedBox( + height: 30.h, + ), + _buildTipsView('全天', '', 0, boolList[0]), + SizedBox( + height: 30.h, + ), + _buildTipsView('自定义时间', '', 1, boolList[1]), + ], + )); + } + + Widget _buildTipsView( + String titleStr, String subTitle, int clickIndex, bool isClick) { + return GestureDetector( + child: Container( + width: ScreenUtil().screenWidth - 40.w, + margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h), + decoration: BoxDecoration( + color: isClick + ? AppColors.blueViewBgColor + : AppColors.greyBackgroundColor, + borderRadius: BorderRadius.circular(10.0), + ), + child: Padding( + padding: EdgeInsets.only( + left: 20.w, top: 30.h, bottom: 30.h, right: 20.w), + child: Row( + children: [ + isClick + ? Image.asset( + 'images/mine/icon_mine_blueSelect.png', + width: 20.w, + height: 14.w, + ) + : SizedBox( + width: 20.w, + height: 14.w, + ), + SizedBox(width: 10.w), + Expanded( + child: _buildRichText(titleStr, subTitle, isClick), + ), + SizedBox( + width: 10.w, + ), + ], + )), + ), + onTap: () { + setState(() { + for (int i = 0; i < boolList.length; i++) { + if (clickIndex == i) { + boolList[clickIndex] = true; + } else { + boolList[i] = false; + } + } + }); + }, + ); + } + + Widget _buildRichText(String titleStr, String subTitle, bool isClick) { + //高亮样式 + final TextStyle titleStyle = TextStyle( + color: isClick ? AppColors.blueTextTipsColor : Colors.black, + fontSize: 24.sp, + fontWeight: FontWeight.w500); + //默认样式 + final TextStyle subTipsStyle = TextStyle( + color: isClick + ? AppColors.blueTextTipsColor + : AppColors.placeholderTextColor, + fontSize: 20.sp); + + late InlineSpan tipsPreviewSpan = TextSpan(children: [ + TextSpan(text: titleStr, style: titleStyle), + TextSpan(text: subTitle, style: subTipsStyle), + ]); + return RichText(text: tipsPreviewSpan); + } +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/videoSlot/videoSlot_state.dart b/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/videoSlot/videoSlot_state.dart new file mode 100644 index 00000000..e69de29b diff --git a/star_lock/lib/translations/lanKeyEntity.dart b/star_lock/lib/translations/lanKeyEntity.dart index 4ea4d5d2..437919fe 100644 --- a/star_lock/lib/translations/lanKeyEntity.dart +++ b/star_lock/lib/translations/lanKeyEntity.dart @@ -430,6 +430,8 @@ class LanKeyEntity { this.hint, this.areYouSureYouWantToDeleteIt, this.faceUnlocksSet, + this.customMode, + this.videoSlot, this.automaticBrighteningScreen, this.sensingDistance, this.sensingDistanceTip, @@ -918,6 +920,8 @@ class LanKeyEntity { areYouSureYouWantToDeleteIt = json['areYouSureYouWantToDeleteIt']; faceUnlocksSet = json['faceUnlocksSet']; + customMode = json['customMode']; + videoSlot = json['videoSlot']; automaticBrighteningScreen = json['automaticBrighteningScreen']; sensingDistance = json['sensingDistance']; sensingDistanceTip = json['sensingDistanceTip']; @@ -1393,6 +1397,8 @@ class LanKeyEntity { String? areYouSureYouWantToDeleteIt; String? faceUnlocksSet; + String? customMode; + String? videoSlot; String? automaticBrighteningScreen; String? sensingDistance; String? sensingDistanceTip; @@ -1880,6 +1886,8 @@ class LanKeyEntity { map['areYouSureYouWantToDeleteIt'] = areYouSureYouWantToDeleteIt; map['faceUnlocksSet'] = faceUnlocksSet; + map['customMode'] = customMode; + map['videoSlot'] = videoSlot; map['automaticBrighteningScreen'] = automaticBrighteningScreen; map['sensingDistance'] = sensingDistance; map['sensingDistanceTip'] = sensingDistanceTip; From 3a1fb84381d859df09b8e2a4d7fe2084cc2886a6 Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Fri, 12 Jan 2024 11:59:47 +0800 Subject: [PATCH 2/2] =?UTF-8?q?1=EF=BC=8C=E7=9B=91=E8=A7=86=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E4=B8=8B=E6=96=B0=E5=A2=9E=E9=9F=B3=E9=A2=91=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=202=EF=BC=8C=E5=AE=8C=E5=96=84=E5=BD=95=E5=83=8F?= =?UTF-8?q?=E6=97=B6=E6=AE=B5=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../catEyeCustomMode_page.dart | 25 +++- .../catEyeSet/videoSlot/videoSlot_page.dart | 107 +++++++++++++--- .../monitoring/lockMonitoring_logic.dart | 4 +- .../realTimePicture_logic.dart | 121 +----------------- .../realTimePicture/realTimePicture_page.dart | 33 +++-- star_lock/lib/talk/udp/udp_reciverData.dart | 5 + star_lock/lib/tools/eventBusEventManage.dart | 6 + 7 files changed, 147 insertions(+), 154 deletions(-) diff --git a/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_page.dart b/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_page.dart index 25158c67..e2b13e7b 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeCustomMode/catEyeCustomMode_page.dart @@ -49,14 +49,21 @@ class _CatEyeCustomModePageState extends State { SizedBox( height: 30.h, ), - _buildSubTitleItem( - '人体侦测距离', '有人出现在门前1.5米范围时启动录像', state.detectionRange.value, () { - _openBottomItemSheet(state.detectionRangeList.value, 1); - }), - Expanded( - child: SizedBox( + Obx(() => _buildSubTitleItem( + '人体侦测距离', '有人出现在门前1.5米范围时启动录像', state.detectionRange.value, + () { + _openBottomItemSheet(state.detectionRangeList.value, 1); + })), + SizedBox( height: 30.h, - )), + ), + CommonItem( + leftTitel: '实时画面', + rightTitle: "全天", + isHaveLine: false, + isHaveDirection: true, + isHaveRightWidget: false, + ) ], )); } @@ -135,6 +142,10 @@ class _CatEyeCustomModePageState extends State { if (clickIndex == 0) { //感应距离 state.showsUpVideo.value = state.showsUpVideoList.value[value]; + } else if (clickIndex == 1) { + //录像时长 + state.detectionRange.value = + state.detectionRangeList.value[value]; } setState(() {}); diff --git a/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/videoSlot/videoSlot_page.dart b/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/videoSlot/videoSlot_page.dart index 4419dfba..8665dc34 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/videoSlot/videoSlot_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/videoSlot/videoSlot_page.dart @@ -37,7 +37,7 @@ class _VideoSlotPageState extends State { SizedBox( height: 30.h, ), - _buildTipsView('自定义时间', '', 1, boolList[1]), + _buildCustomTimeView('自定义时间', '', 1), ], )); } @@ -49,9 +49,7 @@ class _VideoSlotPageState extends State { width: ScreenUtil().screenWidth - 40.w, margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h), decoration: BoxDecoration( - color: isClick - ? AppColors.blueViewBgColor - : AppColors.greyBackgroundColor, + color: AppColors.greyBackgroundColor, borderRadius: BorderRadius.circular(10.0), ), child: Padding( @@ -59,19 +57,13 @@ class _VideoSlotPageState extends State { left: 20.w, top: 30.h, bottom: 30.h, right: 20.w), child: Row( children: [ - isClick - ? Image.asset( - 'images/mine/icon_mine_blueSelect.png', - width: 20.w, - height: 14.w, - ) - : SizedBox( - width: 20.w, - height: 14.w, - ), + SizedBox( + width: 20.w, + height: 14.w, + ), SizedBox(width: 10.w), Expanded( - child: _buildRichText(titleStr, subTitle, isClick), + child: _buildRichText(titleStr, subTitle, false), ), SizedBox( width: 10.w, @@ -93,6 +85,91 @@ class _VideoSlotPageState extends State { ); } +//自定义时间 + Widget _buildCustomTimeView(String leftStr, String rightStr, int isEndTIme) { + return GestureDetector( + child: Container( + width: ScreenUtil().screenWidth - 40.w, + margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h), + decoration: BoxDecoration( + color: AppColors.blueViewBgColor, + borderRadius: BorderRadius.circular(10.0), + ), + child: Padding( + padding: EdgeInsets.only( + left: 20.w, top: 30.h, bottom: 30.h, right: 20.w), + child: Column( + children: [ + Row( + children: [ + Image.asset( + 'images/mine/icon_mine_blueSelect.png', + width: 20.w, + height: 14.w, + ), + SizedBox(width: 10.w), + Expanded( + child: _buildRichText('自定义时间', '', true), + ), + SizedBox( + width: 10.w, + ), + ], + ), + Container( + height: 1, + margin: EdgeInsets.only( + left: 20.w, right: 20.w, top: 20.h, bottom: 20.h), + color: AppColors.blueTextTipsColor, + ), + startAndEndTimeRow(false), + SizedBox( + height: 30.h, + ), + startAndEndTimeRow(true), + ], + )), + ), + onTap: () {}, + ); + } + + // + Widget startAndEndTimeRow(bool isEndTime) { + return GestureDetector( + child: Row( + children: [ + SizedBox( + width: 20.w, + ), + Text( + isEndTime == false ? '开始时间' : '结束时间', + style: + TextStyle(color: AppColors.blueTextTipsColor, fontSize: 22.sp), + ), + Expanded( + child: SizedBox( + width: 20.w, + )), + Text( + isEndTime == false ? '当日22:00' : '次日08:00', + style: + TextStyle(color: AppColors.blueTextTipsColor, fontSize: 22.sp), + ), + SizedBox( + width: 10.w, + ), + Image.asset( + 'images/icon_right_grey.png', + width: 12.w, + height: 21.w, + ) + ], + ), + onTap: () {}, + ); + } + Widget _buildRichText(String titleStr, String subTitle, bool isClick) { //高亮样式 final TextStyle titleStyle = TextStyle( diff --git a/star_lock/lib/main/lockDetail/monitoring/monitoring/lockMonitoring_logic.dart b/star_lock/lib/main/lockDetail/monitoring/monitoring/lockMonitoring_logic.dart index 681f3191..cb6c69c4 100644 --- a/star_lock/lib/main/lockDetail/monitoring/monitoring/lockMonitoring_logic.dart +++ b/star_lock/lib/main/lockDetail/monitoring/monitoring/lockMonitoring_logic.dart @@ -279,8 +279,8 @@ class LockMonitoringLogic extends BaseGetXController { topBytes[6] = (state.udpSendDataFrameNumber & 0x000000FF); topBytes[7] = ((state.udpSendDataFrameNumber & 0x0000FF00) >> 8); - print( - "udpSendDataFrameNumber:${state.udpSendDataFrameNumber} topBytes[63]:${topBytes[6]} topBytes[64]:${topBytes[7]}"); + // print( + // "udpSendDataFrameNumber:${state.udpSendDataFrameNumber} topBytes[63]:${topBytes[6]} topBytes[64]:${topBytes[7]}"); topBytes.addAll(bytes); Get.log("setVoiceBytes:$topBytes"); diff --git a/star_lock/lib/main/lockDetail/realTimePicture/realTimePicture_logic.dart b/star_lock/lib/main/lockDetail/realTimePicture/realTimePicture_logic.dart index 5fc67fce..fe0931b0 100644 --- a/star_lock/lib/main/lockDetail/realTimePicture/realTimePicture_logic.dart +++ b/star_lock/lib/main/lockDetail/realTimePicture/realTimePicture_logic.dart @@ -41,51 +41,11 @@ class RealTimePictureLogic extends BaseGetXController { StreamSubscription? _getUDPStatusRefreshUIEvent; void _getUDPStatusRefreshUIAction() { _getUDPStatusRefreshUIEvent = - eventBus.on().listen((event) { + eventBus.on().listen((event) { state.udpStatus.value = event.udpStatus; - if (state.udpStatus.value == 8) { - // 接听成功了,然后刷新界面的时间 60秒以后自动挂断 - state.oneMinuteTimeTimer = - Timer.periodic(const Duration(seconds: 1), (Timer t) async { - state.oneMinuteTime.value++; - // Get.log('state.oneMinuteTime.value:${state.oneMinuteTime.value}'); - if (state.oneMinuteTime.value >= 60) { - // 超过60秒了 - state.oneMinuteTimeTimer.cancel(); - state.oneMinuteTime.value = 0; - // 挂断 - UDPSenderManage.sendMainProtocol( - command: 150, - commandTypeIsCalling: 1, - subCommand: 30, - lockID: state.getLockName.value, - lockIP: UDPManage().host, - userMobile: await state.userMobile, - userMobileIP: await state.userMobileIP, - endData: []); - CallTalk().stopPcmSound(); - - // 关闭当前界面 - Get.back(); - } - }); - } }); } - //查询监视状态 - udpQueryMonitoringStatusAction() async { - UDPSenderManage.sendMainProtocol( - command: 152, - commandTypeIsCalling: 1, - subCommand: 20, - lockID: state.getLockName.value, - lockIP: UDPManage().host, - userMobile: await state.userMobile, - userMobileIP: await state.userMobileIP, - endData: []); - } - /// 监视 udpMonitorAction() async { UDPSenderManage.sendMainProtocol( @@ -100,19 +60,6 @@ class RealTimePictureLogic extends BaseGetXController { // print('得到lockName------${state.getLockName.value}'); } - /// 接听 - udpAnswerAction() async { - UDPSenderManage.sendMainProtocol( - command: 150, - commandTypeIsCalling: 1, - subCommand: 6, - lockID: UDPManage().lockId, - lockIP: UDPManage().host, - userMobile: await state.userMobile, - userMobileIP: await state.userMobileIP, - endData: []); - } - /// 挂断 udpHangUpAction() async { UDPSenderManage.sendMainProtocol( @@ -232,67 +179,11 @@ class RealTimePictureLogic extends BaseGetXController { String? lockIP = args["lockIP"]; String? userMobile = args["userMobile"]; String? userMobileIP = args["userMobileIP"]; - - // int length = 320; // 每个子List的长度 - // List list = state.listAudioData.value.sublist(0, 320); - // for (int i = 0; i < bytes.length; i += length) { - // int end = (i + length < bytes.length) ? i + length : bytes.length; - // bytes.sublist(i, end); - // // _sendRecordData(bytes.sublist(i, end)); - // // // 刚进来是接听状态,然后改为长按对讲 - // } - - // while(list.isNotEmpty) { state.udpSendDataFrameNumber++; if (state.udpSendDataFrameNumber >= 65536) state.udpSendDataFrameNumber = 1; // 57 List topBytes = []; - // var cID = "XXXCID"; - // List cIDData = utf8.encode(cID!); - // topBytes.addAll(cIDData); - // // topBytes = getFixedLengthList(cIDData, 20 - cIDData.length); - // for (int i = 0; i < 6 - cIDData.length; i++) { - // topBytes.add(0); - // } - // - // // 命令 - // topBytes.add(150); - // - // // 命令类型 - // topBytes.add(1); - // - // // 子命令 - // topBytes.add(8); - // - // // lockID - // List lockIDData = utf8.encode(lockID!); - // topBytes.addAll(lockIDData); - // // topBytes = getFixedLengthList(lockIDData, 20 - lockIDData.length); - // for (int i = 0; i < 20 - lockIDData.length; i++) { - // topBytes.add(0); - // } - // - // // lockIP - // var lockIPList = lockIP!.split("."); - // lockIPList.forEach((element) { - // topBytes.add(int.parse(element)); - // }); - // - // // userMobile - // List userMobileData = utf8.encode(userMobile!); - // topBytes.addAll(userMobileData); - // // topBytes = getFixedLengthList(topBytes, 20 - userMobileData.length); - // for (int i = 0; i < 20 - userMobileData.length; i++) { - // topBytes.add(0); - // } - // - // // userMobileIP - // var userMobileIPList = userMobileIP!.split("."); - // userMobileIPList.forEach((element) { - // topBytes.add(int.parse(element)); - // }); - topBytes.addAll([ 1, 1, 1, 1, // 时间戳 1, 0, // 音频 @@ -307,13 +198,13 @@ class RealTimePictureLogic extends BaseGetXController { topBytes[6] = (state.udpSendDataFrameNumber & 0x000000FF); topBytes[7] = ((state.udpSendDataFrameNumber & 0x0000FF00) >> 8); - print( - "udpSendDataFrameNumber:${state.udpSendDataFrameNumber} topBytes[63]:${topBytes[6]} topBytes[64]:${topBytes[7]}"); + // print( + // "udpSendDataFrameNumber:${state.udpSendDataFrameNumber} topBytes[63]:${topBytes[6]} topBytes[64]:${topBytes[7]}"); topBytes.addAll(bytes); Get.log("setVoiceBytes:$topBytes"); UDPSenderManage.sendMainProtocol( - command: 150, + command: 152, commandTypeIsCalling: 1, subCommand: 8, lockID: lockID, @@ -427,6 +318,7 @@ class RealTimePictureLogic extends BaseGetXController { void onClose() { // TODO: implement onClose print("锁详情界面销毁了"); + CallTalk().stopPcmSound(); _getTVDataRefreshUIEvent!.cancel(); _getUDPStatusRefreshUIEvent!.cancel(); if (state.oneMinuteTimeTimer != null) { @@ -434,8 +326,5 @@ class RealTimePictureLogic extends BaseGetXController { } stopProcessing(); state.listData.value = Uint8List(0); - if (state.realTimePicTimer != null) { - state.realTimePicTimer.cancel(); - } } } diff --git a/star_lock/lib/main/lockDetail/realTimePicture/realTimePicture_page.dart b/star_lock/lib/main/lockDetail/realTimePicture/realTimePicture_page.dart index eed5ab49..68c67210 100644 --- a/star_lock/lib/main/lockDetail/realTimePicture/realTimePicture_page.dart +++ b/star_lock/lib/main/lockDetail/realTimePicture/realTimePicture_page.dart @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/talk/call/callTalk.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/showTFView.dart'; @@ -32,8 +33,11 @@ class _RealTimePicturePageState extends State Get.back(); }); - state.animationController = - AnimationController(duration: const Duration(seconds: 1), vsync: this); + state.animationController = AnimationController( + vsync: this, // 确保使用的TickerProvider是当前Widget + duration: const Duration(seconds: 1), + ); + ; state.animationController.repeat(); //动画开始、结束、向前移动或向后移动时会调用StatusListener state.animationController.addStatusListener((status) { @@ -200,8 +204,12 @@ class _RealTimePicturePageState extends State // 接听 Obx(() => bottomBtnItemWidget( getAnswerBtnImg(), getAnswerBtnName(), Colors.white, () async { - Toast.show(msg: "监视中无音频"); + //监视状态下不能发送录音 + Toast.show(msg: '监视状态下不能发送录音'); + }, longPress: () async { /* + // 开始长按 + print("onLongPress"); //获取麦克风权限 await logic.getPermissionStatus().then((value) async { if (!value) { @@ -209,15 +217,8 @@ class _RealTimePicturePageState extends State } // state.isSenderAudioData.value = false; - print("发送接听了"); - // 刚进来是接听状态,然后改为长按对讲 - logic.udpAnswerAction(); }); - */ - }, longPress: () { - /* - // 开始长按 - print("onLongPress"); + state.listAudioData.value = []; if (state.udpStatus.value == 8) { state.udpStatus.value = 9; @@ -238,6 +239,7 @@ class _RealTimePicturePageState extends State "images/main/icon_lockDetail_hangUp.png", "挂断", Colors.red, () async { // 挂断 logic.udpHangUpAction(); + CallTalk().stopPcmSound(); Get.back(); }), bottomBtnItemWidget("images/main/icon_lockDetail_monitoringUnlock.png", @@ -257,7 +259,7 @@ class _RealTimePicturePageState extends State case 9: return "images/main/icon_lockDetail_monitoringTalkback.png"; default: - return "images/main/icon_lockDetail_monitoringAnswerCalls.png"; + return "images/main/icon_lockDetail_monitoringUnTalkback.png"; } } @@ -268,7 +270,7 @@ class _RealTimePicturePageState extends State case 9: return "松开发送"; default: - return "接听"; + return "长按说话"; } } @@ -377,8 +379,11 @@ class _RealTimePicturePageState extends State void _handleFailure() { // 在这里处理失败的逻辑 - state.animationController.stop(); + CallTalk().stopPcmSound(); state.realTimePicTimer.cancel(); + if (state.animationController != null) { + state.animationController.stop(); + } } @override diff --git a/star_lock/lib/talk/udp/udp_reciverData.dart b/star_lock/lib/talk/udp/udp_reciverData.dart index 5ca238b0..699a138e 100644 --- a/star_lock/lib/talk/udp/udp_reciverData.dart +++ b/star_lock/lib/talk/udp/udp_reciverData.dart @@ -155,6 +155,8 @@ class CommandUDPReciverManager { { //监视成功 print("监视成功"); + UDPTalkClass().status = 8; + eventBus.fire(GetUDPStatusMonitorUI(UDPTalkClass().status)); } break; case 7: @@ -192,6 +194,8 @@ class CommandUDPReciverManager { break; case 30: { + CallTalk().stopPcmSound(); + // 监视结束 if ((data[7] & 0x3) == 1) { // 对方结束监视 @@ -200,6 +204,7 @@ class CommandUDPReciverManager { //结束监视反馈 print("结束监视反馈"); } + // Toast.show(msg: "对方已结束监视"); // UDPTalkClass().status = 0; // UDPTalkClass().isBeCall = false; diff --git a/star_lock/lib/tools/eventBusEventManage.dart b/star_lock/lib/tools/eventBusEventManage.dart index 6e60b3fc..740d77e1 100644 --- a/star_lock/lib/tools/eventBusEventManage.dart +++ b/star_lock/lib/tools/eventBusEventManage.dart @@ -62,6 +62,12 @@ class GetUDPStatusRefreshUI { GetUDPStatusRefreshUI(this.udpStatus); } +/// 获取到UDP接收状态然后刷新监控界面 +class GetUDPStatusMonitorUI { + int udpStatus; + GetUDPStatusMonitorUI(this.udpStatus); +} + /// 获取到第一帧图片数据后跳转 class GetFirstFrameGoPush { bool isFirstFrame;