1,猫眼自定义模式相关设置同步

2,猫眼设置相关接口类型修改及处理
3,猫眼设置部分逻辑优化及完善
This commit is contained in:
Daisy 2024-04-07 14:05:31 +08:00
parent bc781eba98
commit 18dd3aa211
16 changed files with 390 additions and 289 deletions

View File

@ -24,9 +24,10 @@ class CatEyeCustomModeLogic extends BaseGetXController {
} }
state.recordTime.value = state.recordTime.value =
state.catEyeConfigData.value.catEyeModeConfig!.recordTime!; state.catEyeConfigData.value.catEyeModeConfig!.recordTime ?? '';
state.detectionDistance.value = state.detectionDistance.value =
'${state.catEyeConfigData.value.catEyeModeConfig!.detectionDistance!}'; state.catEyeConfigData.value.catEyeModeConfig!.detectionDistance ??
'';
state.realTimeMode.value = state.realTimeMode.value =
state.catEyeConfigData.value.catEyeModeConfig!.realTimeMode == 0 state.catEyeConfigData.value.catEyeModeConfig!.realTimeMode == 0
? '发生事件时查看' ? '发生事件时查看'
@ -36,8 +37,8 @@ class CatEyeCustomModeLogic extends BaseGetXController {
return entity; return entity;
} }
// // 0- 1-
void updateCatEyeModeConfig() async { void updateCatEyeModeConfig(int clickIndex) async {
var entity = await ApiRepository.to.updateCatEyeModeConfig( var entity = await ApiRepository.to.updateCatEyeModeConfig(
lockId: state.lockSetInfoData.value.lockId!, lockId: state.lockSetInfoData.value.lockId!,
catEyeConfig: [ catEyeConfig: [
@ -50,9 +51,15 @@ class CatEyeCustomModeLogic extends BaseGetXController {
state.catEyeConfigData.value.catEyeModeConfig!.recordStartTime, state.catEyeConfigData.value.catEyeModeConfig!.recordStartTime,
'recordEndTime': 'recordEndTime':
state.catEyeConfigData.value.catEyeModeConfig!.recordEndTime, state.catEyeConfigData.value.catEyeModeConfig!.recordEndTime,
'recordTime': state.recordTime.value, 'recordTime': clickIndex == 0
'detectionDistance': state.detectionDistance.value, ? state.recordTime.value
'realTimeMode': state.realTimeMode.value, : state.catEyeConfigData.value.catEyeModeConfig!.recordTime,
'detectionDistance': clickIndex == 1
? state.detectionDistance.value
: state
.catEyeConfigData.value.catEyeModeConfig!.detectionDistance,
'realTimeMode':
state.catEyeConfigData.value.catEyeModeConfig!.realTimeMode,
} }
} }
], ],

View File

@ -37,9 +37,9 @@ class _CatEyeCustomModePageState extends State<CatEyeCustomModePage> {
Navigator.pop(context, true); Navigator.pop(context, true);
}, },
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: Column( body: Obx(() => Column(
children: [ children: [
Obx(() => CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.videoSlot!.tr, leftTitel: TranslationLoader.lanKeys!.videoSlot!.tr,
rightTitle: "", rightTitle: "",
isHaveLine: false, isHaveLine: false,
@ -59,22 +59,22 @@ class _CatEyeCustomModePageState extends State<CatEyeCustomModePage> {
: null : null
}).then((value) => {logic.getLockSettingInfoData()}); }).then((value) => {logic.getLockSettingInfoData()});
}, },
)), ),
Obx(() => _buildSubTitleItem('有人出现时录像', _buildSubTitleItem('有人出现时录像', '有人在门口出现10秒后开始录像。\n有人按门铃时立即录像',
'有人在门口出现10秒后开始录像。\n有人按门铃时立即录像', state.recordTime.value, () { state.recordTime.value, () {
_openBottomItemSheet(state.showsUpVideoList.value, 0); _openBottomItemSheet(state.showsUpVideoList.value, 0);
})), }),
SizedBox( SizedBox(
height: 30.h, height: 30.h,
), ),
Obx(() => _buildSubTitleItem('人体侦测距离', '有人出现在门前1.5米范围时启动录像', _buildSubTitleItem('人体侦测距离', '有人出现在门前1.5米范围时启动录像',
state.detectionDistance.value, () { state.detectionDistance.value, () {
_openBottomItemSheet(state.detectionRangeList.value, 1); _openBottomItemSheet(state.detectionRangeList.value, 1);
})), }),
SizedBox( SizedBox(
height: 30.h, height: 30.h,
), ),
Obx(() => CommonItem( CommonItem(
leftTitel: '实时画面', leftTitel: '实时画面',
rightTitle: state.realTimeMode.value, rightTitle: state.realTimeMode.value,
isHaveLine: false, isHaveLine: false,
@ -91,9 +91,9 @@ class _CatEyeCustomModePageState extends State<CatEyeCustomModePage> {
: null : null
}).then((value) => {logic.getLockSettingInfoData()}); }).then((value) => {logic.getLockSettingInfoData()});
}, },
)) )
], ],
)); )));
} }
Widget _buildSubTitleItem( Widget _buildSubTitleItem(
@ -157,8 +157,7 @@ class _CatEyeCustomModePageState extends State<CatEyeCustomModePage> {
); );
} }
Future _openBottomItemSheet( Future _openBottomItemSheet(List bottomItemList, int clickIndex) async {
List<String> bottomItemList, int clickIndex) async {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
@ -172,11 +171,11 @@ class _CatEyeCustomModePageState extends State<CatEyeCustomModePage> {
// //
state.recordTime.value = state.showsUpVideoList.value[value]; state.recordTime.value = state.showsUpVideoList.value[value];
} else if (clickIndex == 1) { } else if (clickIndex == 1) {
// //
state.detectionDistance.value = state.detectionDistance.value =
state.detectionRangeList.value[value]; state.detectionRangeList.value[value];
} }
logic.updateCatEyeModeConfig(); logic.updateCatEyeModeConfig(clickIndex);
}, },
); );
}); });

View File

@ -20,7 +20,7 @@ class CatEyeCustomModeState {
'30${TranslationLoader.lanKeys!.second!.tr}', '30${TranslationLoader.lanKeys!.second!.tr}',
'60${TranslationLoader.lanKeys!.second!.tr}' '60${TranslationLoader.lanKeys!.second!.tr}'
].obs; ].obs;
var detectionRangeList = ['约0.8米', '约1.5米', '约3'].obs; var detectionRangeList = ['约0.8米', '约1.5米', '约3.0'].obs;
// //
final TextStyle titleStyle = TextStyle( final TextStyle titleStyle = TextStyle(
color: Colors.black, fontSize: 24.sp, fontWeight: FontWeight.w500); color: Colors.black, fontSize: 24.sp, fontWeight: FontWeight.w500);

View File

@ -13,48 +13,64 @@ class CatEyeWorkModeLogic extends BaseGetXController {
lockId: state.lockSetInfoData.value.lockId!, lockId: state.lockSetInfoData.value.lockId!,
catEyeConfig: [ catEyeConfig: [
{ {
'catEyeMode': state.selectCatEyeWorkMode.value, 'catEyeMode':
state.boolList.value.indexWhere((element) => element == true) + 1,
'catEyeModeConfig': { 'catEyeModeConfig': {
'recordMode': state.recordMode.value, 'recordMode':
'recordStartTime': state.recordStartTime.value, state.catEyeConfigData.value.catEyeModeConfig!.recordMode,
'recordEndTime': state.recordEndTime.value, 'recordStartTime':
'recordTime': state.recordTime.value, state.catEyeConfigData.value.catEyeModeConfig!.recordStartTime,
'detectionDistance': state.detectionDistance.value, 'recordEndTime':
'realTimeMode': state.realTimeMode.value, state.catEyeConfigData.value.catEyeModeConfig!.recordEndTime,
'recordTime':
state.catEyeConfigData.value.catEyeModeConfig!.recordTime,
'detectionDistance': state
.catEyeConfigData.value.catEyeModeConfig!.detectionDistance,
'realTimeMode':
state.catEyeConfigData.value.catEyeModeConfig!.realTimeMode!,
} }
} }
], ],
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast('设置成功'); showToast('设置成功');
getLockSettingInfoData();
} }
} }
// //
Future<LockSetInfoEntity> getLockSettingInfoData() async { void getLockSettingInfoData() async {
LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData( LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData(
lockId: state.lockSetInfoData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.lockSetInfoData.value = entity.data!; state.lockSetInfoData.value = entity.data!;
state.selectCatEyeWorkMode.value = state.catEyeConfigData.value =
state.catEyeConfigData.value.catEyeMode!; entity.data!.lockSettingInfo!.catEyeConfig![0];
// state.selectCatEyeWorkMode.value =
// state.catEyeConfigData.value.catEyeMode!;
// print('得到了选中哪个模式:${state.catEyeConfigData.value.catEyeMode}');
if (state.catEyeConfigData.value.catEyeMode == if (state.catEyeConfigData.value.catEyeMode ==
XSConstantMacro.catEyeWorkModePowerSaving) { XSConstantMacro.catEyeWorkModePowerSaving) {
state.boolList.value[0] = true; // state.boolList.value[0] = true;
state.boolList.value = [true, false, false, false];
} else if (state.catEyeConfigData.value.catEyeMode == } else if (state.catEyeConfigData.value.catEyeMode ==
XSConstantMacro.catEyeWorkModeStayCapture) { XSConstantMacro.catEyeWorkModeStayCapture) {
state.boolList.value[1] = true; // state.boolList.value[1] = true;
state.boolList.value = [false, true, false, false];
} else if (state.catEyeConfigData.value.catEyeMode == } else if (state.catEyeConfigData.value.catEyeMode ==
XSConstantMacro.catEyeWorkModeRealTimeMonitoring) { XSConstantMacro.catEyeWorkModeRealTimeMonitoring) {
state.boolList.value[2] = true; // state.boolList.value[2] = true;
state.boolList.value = [false, false, true, false];
} else if (state.catEyeConfigData.value.catEyeMode == } else if (state.catEyeConfigData.value.catEyeMode ==
XSConstantMacro.catEyeWorkModeCustom) { XSConstantMacro.catEyeWorkModeCustom) {
state.boolList.value[3] = true; // state.boolList.value[3] = true;
state.boolList.value = [false, false, false, true];
} }
} }
return entity;
} }
} }

View File

@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart'; import 'package:star_lock/appRouters.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_logic.dart'; import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_logic.dart';
import '../../../../../app_settings/app_colors.dart'; import '../../../../../app_settings/app_colors.dart';
@ -36,35 +35,36 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
Navigator.pop(context, true); Navigator.pop(context, true);
}, },
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: Column( body: Obx(() => Column(
children: [ children: [
SizedBox( SizedBox(
height: 30.h, height: 30.h,
), ),
Obx( _buildTipsView('省电模式:\n',
() => _buildTipsView('省电模式:\n', '适合门口较为安全的环境。\n仅发生特定事件才录像,并可查看实时画面。\n一般情况下满电可使用7-8个月', 0),
'适合门口较为安全的环境。\n仅发生特定事件才录像,并可查看实时画面。\n一般情况下满电可使用7-8个月', 0), SizedBox(
), height: 30.h,
SizedBox( ),
height: 30.h, _buildTipsView('逗留抓拍模式:\n',
), '有人逗留或发生特定事件才录像,可随时查看\n实时画面。\n一般情况下满电可使用5~6个月。', 1),
Obx(() => _buildTipsView('逗留抓拍模式:\n', SizedBox(
'有人逗留或发生特定事件才录像,可随时查看\n实时画面。\n一般情况下满电可使用5~6个月。', 1)), height: 30.h,
SizedBox( ),
height: 30.h, _buildTipsView(
), '实时监控模式:\n',
Obx(() => _buildTipsView('实时监控模式:\n', '适合门口人员复杂、较不安全的环境。\n有人出现就录像,可随时查看实时画面。\n一般情况下满电可使用2~4个月。',
'适合门口人员复杂、较不安全的环境。\n有人出现就录像,可随时查看实时画面。\n一般情况下满电可使用2~4个月。', 2)), 2),
SizedBox( SizedBox(
height: 30.h, height: 30.h,
), ),
Obx(() => _buildTipsView( _buildTipsView(
'自定义模式:\n', '根据您家门口实际情况设置录像和实时画面功能。\n可使用时长由具体设置决定。', 3)) '自定义模式:\n', '根据您家门口实际情况设置录像和实时画面功能。\n可使用时长由具体设置决定。', 3)
], ],
)); )));
} }
Widget _buildTipsView(String titleStr, String subTitle, int clickIndex) { Widget _buildTipsView(String titleStr, String subTitle, int clickIndex) {
// print('选中了哪个模式${state.boolList.value[clickIndex]}');
return GestureDetector( return GestureDetector(
child: Container( child: Container(
width: ScreenUtil().screenWidth - 40.w, width: ScreenUtil().screenWidth - 40.w,
@ -138,24 +138,24 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
for (int i = 0; i < state.boolList.value.length; i++) { for (int i = 0; i < state.boolList.value.length; i++) {
if (clickIndex == i) { if (clickIndex == i) {
state.boolList.value[clickIndex] = true; state.boolList.value[clickIndex] = true;
switch (clickIndex) { // switch (clickIndex) {
case 0: // case 0:
state.selectCatEyeWorkMode.value = // state.selectCatEyeWorkMode.value =
XSConstantMacro.catEyeWorkModePowerSaving; // XSConstantMacro.catEyeWorkModePowerSaving;
break; // break;
case 1: // case 1:
state.selectCatEyeWorkMode.value = // state.selectCatEyeWorkMode.value =
XSConstantMacro.catEyeWorkModeStayCapture; // XSConstantMacro.catEyeWorkModeStayCapture;
break; // break;
case 2: // case 2:
state.selectCatEyeWorkMode.value = // state.selectCatEyeWorkMode.value =
XSConstantMacro.catEyeWorkModeRealTimeMonitoring; // XSConstantMacro.catEyeWorkModeRealTimeMonitoring;
break; // break;
case 3: // case 3:
state.selectCatEyeWorkMode.value = // state.selectCatEyeWorkMode.value =
XSConstantMacro.catEyeWorkModeCustom; // XSConstantMacro.catEyeWorkModeCustom;
break; // break;
} // }
logic.updateCatEyeModeConfig(); logic.updateCatEyeModeConfig();
} else { } else {
state.boolList.value[i] = false; state.boolList.value[i] = false;

View File

@ -1,42 +1,34 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart'; import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
class CatEyeWorkModeState { class CatEyeWorkModeState {
var lockSetInfoData = LockSetInfoData().obs; var lockSetInfoData = LockSetInfoData().obs;
var selectCatEyeWorkMode = 0.obs; // // var selectCatEyeWorkMode = 0.obs; //
var boolList = [false, false, false, false].obs; var boolList = [false, false, false, false].obs;
var recordMode = 0.obs; // 0 1
//recordStartTime与recordEndTime参数
var recordStartTime = 0.obs; // 1709715049775,
var recordEndTime = 0.obs; //1709715049775,
var recordTime = ''.obs; //
var detectionDistance = 0.obs; //
var realTimeMode = 0.obs; // 0 1
var catEyeConfigData = CatEyeConfig().obs; var catEyeConfigData = CatEyeConfig().obs;
CatEyeWorkModeState() { CatEyeWorkModeState() {
Map map = Get.arguments; Map map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"]; lockSetInfoData.value = map["lockSetInfoData"];
if (map['catEyeConfigData'] != null) { // if (map['catEyeConfigData'] != null) {
catEyeConfigData.value = map['catEyeConfigData']; // catEyeConfigData.value = map['catEyeConfigData'];
selectCatEyeWorkMode.value = catEyeConfigData.value.catEyeMode!; // selectCatEyeWorkMode.value = catEyeConfigData.value.catEyeMode!;
if (catEyeConfigData.value.catEyeMode == // if (catEyeConfigData.value.catEyeMode ==
XSConstantMacro.catEyeWorkModePowerSaving) { // XSConstantMacro.catEyeWorkModePowerSaving) {
boolList[0] = true; // boolList[0] = true;
} else if (catEyeConfigData.value.catEyeMode == // } else if (catEyeConfigData.value.catEyeMode ==
XSConstantMacro.catEyeWorkModeStayCapture) { // XSConstantMacro.catEyeWorkModeStayCapture) {
boolList[1] = true; // boolList[1] = true;
} else if (catEyeConfigData.value.catEyeMode == // } else if (catEyeConfigData.value.catEyeMode ==
XSConstantMacro.catEyeWorkModeRealTimeMonitoring) { // XSConstantMacro.catEyeWorkModeRealTimeMonitoring) {
boolList[2] = true; // boolList[2] = true;
} else if (catEyeConfigData.value.catEyeMode == // } else if (catEyeConfigData.value.catEyeMode ==
XSConstantMacro.catEyeWorkModeCustom) { // XSConstantMacro.catEyeWorkModeCustom) {
boolList[3] = true; // boolList[3] = true;
} // }
} else { // } else {
catEyeConfigData.value = CatEyeConfig(); // catEyeConfigData.value = CatEyeConfig();
} // }
} }
} }

View File

@ -19,10 +19,8 @@ class VideoSlotLogic extends BaseGetXController {
if (state.catEyeConfigData.value.catEyeModeConfig != null) { if (state.catEyeConfigData.value.catEyeModeConfig != null) {
if (state.catEyeConfigData.value.catEyeModeConfig!.recordMode == 1) { if (state.catEyeConfigData.value.catEyeModeConfig!.recordMode == 1) {
// state.selectVideoSlot.value = '自定义时段';
state.isCustom.value = true; state.isCustom.value = true;
} else { } else {
// state.selectVideoSlot.value = '全天';
state.isCustom.value = false; state.isCustom.value = false;
} }
} }

View File

@ -20,6 +20,12 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
final logic = Get.put(VideoSlotLogic()); final logic = Get.put(VideoSlotLogic());
final state = Get.find<VideoSlotLogic>().state; final state = Get.find<VideoSlotLogic>().state;
@override
initState() {
super.initState();
logic.getLockSettingInfoData();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -52,57 +58,57 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
), ),
], ],
), ),
body: Column( body: Obx(() => Column(
children: [ children: [
SizedBox( SizedBox(
height: 30.h, height: 30.h,
), ),
_buildTipsView('全天', 0), _buildTipsView('全天', 0),
SizedBox( SizedBox(
height: 30.h, height: 30.h,
), ),
_buildCustomTimeView('自定义时间', 1), _buildCustomTimeView('自定义时间', 1),
], ],
)); )));
} }
// //
Widget _buildTipsView(String titleStr, int clickIndex) { Widget _buildTipsView(String titleStr, int clickIndex) {
return GestureDetector( return GestureDetector(
child: Obx(() => Container( child: Container(
width: ScreenUtil().screenWidth - 40.w, width: ScreenUtil().screenWidth - 40.w,
margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h), margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: state.isCustom.value == true color: state.isCustom.value == true
? AppColors.greyBackgroundColor ? AppColors.greyBackgroundColor
: AppColors.blueViewBgColor, : AppColors.blueViewBgColor,
borderRadius: BorderRadius.circular(10.0), borderRadius: BorderRadius.circular(10.0),
), ),
child: Padding( child: Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 20.w, top: 30.h, bottom: 30.h, right: 20.w), left: 20.w, top: 30.h, bottom: 30.h, right: 20.w),
child: Row( child: Row(
children: [ children: [
state.isCustom.value == false state.isCustom.value == false
? Image.asset( ? Image.asset(
'images/mine/icon_mine_blueSelect.png', 'images/mine/icon_mine_blueSelect.png',
width: 20.w, width: 20.w,
height: 14.w, height: 14.w,
) )
: SizedBox( : SizedBox(
width: 20.w, width: 20.w,
height: 14.w, height: 14.w,
), ),
SizedBox(width: 10.w), SizedBox(width: 10.w),
Expanded( Expanded(
child: _buildRichText(titleStr, false), child: _buildRichText(titleStr, false),
), ),
SizedBox( SizedBox(
width: 10.w, width: 10.w,
), ),
], ],
)), )),
)), ),
onTap: () { onTap: () {
if (clickIndex == 0) { if (clickIndex == 0) {
state.isCustom.value = false; state.isCustom.value = false;

View File

@ -18,7 +18,9 @@ class LiveVideoLogic extends BaseGetXController {
entity.data!.lockSettingInfo!.catEyeConfig![0]; entity.data!.lockSettingInfo!.catEyeConfig![0];
if (state.catEyeConfigData.value.catEyeModeConfig != null) { if (state.catEyeConfigData.value.catEyeModeConfig != null) {
if (state.catEyeConfigData.value.catEyeModeConfig!.recordMode == 1) { state.realTimeMode.value =
state.catEyeConfigData.value.catEyeModeConfig!.realTimeMode!;
if (state.catEyeConfigData.value.catEyeModeConfig!.realTimeMode == 1) {
state.isLiveView.value = true; state.isLiveView.value = true;
} else { } else {
state.isLiveView.value = false; state.isLiveView.value = false;

View File

@ -18,6 +18,12 @@ class _LiveVideoPageState extends State<LiveVideoPage> {
final logic = Get.put(LiveVideoLogic()); final logic = Get.put(LiveVideoLogic());
final state = Get.find<LiveVideoLogic>().state; final state = Get.find<LiveVideoLogic>().state;
@override
initState() {
super.initState();
logic.getLockSettingInfoData();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -25,6 +31,9 @@ class _LiveVideoPageState extends State<LiveVideoPage> {
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: '实时画面', barTitle: '实时画面',
haveBack: true, haveBack: true,
backAction: () {
Navigator.pop(context, true);
},
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
actionsList: [ actionsList: [
TextButton( TextButton(
@ -42,92 +51,91 @@ class _LiveVideoPageState extends State<LiveVideoPage> {
), ),
], ],
), ),
body: Column( body: Obx(() => Column(
children: [ children: [
SizedBox( SizedBox(
height: 80.h, height: 80.h,
), ),
Image.asset( Image.asset(
'images/lockSet_liveVideo.png', 'images/lockSet_liveVideo.png',
height: 541.h, height: 541.h,
width: 255.w, width: 255.w,
), ),
SizedBox( SizedBox(
height: 86.h, height: 86.h,
), ),
_buildTipsView('发生事件时查看\n', '仅当门锁发生事件或有人按门铃时,才能在门锁首页查看实时画面。', 0), _buildTipsView(
SizedBox( '发生事件时查看\n', '仅当门锁发生事件或有人按门铃时,才能在门锁首页查看实时画面。', 0),
height: 16.h, SizedBox(
), height: 16.h,
_buildTipsView('实时查看\n', ),
'指定时问内,无论门锁是否发生安全事件或有人按门铃,都能在门锁首页随时查看实时画面;电池续航时问将会缩短。', 1), _buildTipsView('实时查看\n',
], '指定时问内,无论门锁是否发生安全事件或有人按门铃,都能在门锁首页随时查看实时画面;电池续航时问将会缩短。', 1),
)); ],
)));
} }
Widget _buildTipsView(String titleStr, String subTitle, int clickIndex) { Widget _buildTipsView(String titleStr, String subTitle, int clickIndex) {
return Obx(() => GestureDetector( return GestureDetector(
child: Container( child: Container(
width: ScreenUtil().screenWidth - 40.w, width: ScreenUtil().screenWidth - 40.w,
margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h), margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: clickIndex == 0 color: clickIndex == 0
? (state.isLiveView.value == false ? (state.isLiveView.value == false
? AppColors.blueViewBgColor ? AppColors.blueViewBgColor
: AppColors.greyBackgroundColor) : AppColors.greyBackgroundColor)
: (state.isLiveView.value == true : (state.isLiveView.value == true
? AppColors.blueViewBgColor ? AppColors.blueViewBgColor
: AppColors.greyBackgroundColor), : AppColors.greyBackgroundColor),
borderRadius: BorderRadius.circular(10.0), borderRadius: BorderRadius.circular(10.0),
), ),
child: Padding( child: Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 20.w, top: 30.h, bottom: 30.h, right: 20.w), left: 20.w, top: 30.h, bottom: 30.h, right: 20.w),
child: Row( child: Row(
children: [ children: [
clickIndex == 0 clickIndex == 0
? (state.isLiveView.value == false ? (state.isLiveView.value == false
? Image.asset( ? Image.asset(
'images/mine/icon_mine_blueSelect.png', 'images/mine/icon_mine_blueSelect.png',
width: 20.w, width: 20.w,
height: 14.w, height: 14.w,
) )
: SizedBox( : SizedBox(
width: 20.w, width: 20.w,
height: 14.w, height: 14.w,
)) ))
: (state.isLiveView.value == true : (state.isLiveView.value == true
? Image.asset( ? Image.asset(
'images/mine/icon_mine_blueSelect.png', 'images/mine/icon_mine_blueSelect.png',
width: 20.w, width: 20.w,
height: 14.w, height: 14.w,
) )
: SizedBox( : SizedBox(
width: 20.w, width: 20.w,
height: 14.w, height: 14.w,
)), )),
SizedBox(width: 10.w), SizedBox(width: 10.w),
Expanded( Expanded(
child: _buildRichText( child: _buildRichText(
titleStr, titleStr,
subTitle, subTitle,
clickIndex == 0 clickIndex == 0
? (state.isLiveView.value == false ? true : false) ? (state.isLiveView.value == false ? true : false)
: (state.isLiveView.value == true : (state.isLiveView.value == true ? true : false)),
? true ),
: false)), ],
), )),
], ),
)), onTap: () {
), if (clickIndex == 0) {
onTap: () { state.isLiveView.value = false;
if (clickIndex == 0) { } else {
state.isLiveView.value = false; state.isLiveView.value = true;
} else { }
state.isLiveView.value = true; },
} );
},
));
} }
Widget _buildRichText(String titleStr, String subTitle, bool isClick) { Widget _buildRichText(String titleStr, String subTitle, bool isClick) {

View File

@ -357,7 +357,7 @@ class LockBasicInfo {
this.keyRight, this.keyRight,
this.senderUserId, this.senderUserId,
this.lockUserNo, this.lockUserNo,
this.weekDays}); this.weekDays});
LockBasicInfo.fromJson(Map<String, dynamic> json) { LockBasicInfo.fromJson(Map<String, dynamic> json) {
lockId = json['lockId']; lockId = json['lockId'];
@ -681,7 +681,7 @@ class CatEyeModeConfig {
int? realTimeMode; // 0 1 int? realTimeMode; // 0 1
int? recordEndTime; //- int? recordEndTime; //-
int? recordStartTime; //- int? recordStartTime; //-
int? detectionDistance; // String? detectionDistance; //
CatEyeModeConfig( CatEyeModeConfig(
{this.recordMode, {this.recordMode,
@ -693,7 +693,11 @@ class CatEyeModeConfig {
CatEyeModeConfig.fromJson(Map<String, dynamic> json) { CatEyeModeConfig.fromJson(Map<String, dynamic> json) {
recordMode = json['recordMode']; recordMode = json['recordMode'];
recordTime = json['recordTime']; if (json['recordTime'] != null) {
recordTime = json['recordTime'];
} else {
recordTime = '';
}
realTimeMode = json['realTimeMode']; realTimeMode = json['realTimeMode'];
recordEndTime = json['recordEndTime']; recordEndTime = json['recordEndTime'];
recordStartTime = json['recordStartTime']; recordStartTime = json['recordStartTime'];

View File

@ -160,7 +160,6 @@ class LockMonitoringLogic extends BaseGetXController {
userMobile: await state.userUid, userMobile: await state.userUid,
userMobileIP: await state.userMobileIP, userMobileIP: await state.userMobileIP,
endData: list); endData: list);
Get.back();
} }
// //

View File

@ -187,5 +187,7 @@ abstract class Api {
final String getVersionURL = '/app/getVersion'; // final String getVersionURL = '/app/getVersion'; //
final String updateCatEyeConfigURL = final String updateCatEyeConfigURL =
'/lockSetting/updateCatEyeConfig'; // '/lockSetting/updateCatEyeConfig'; //
final String updateFaceConfigURL = '/lockSetting/updateFaceConfig'; //
} }

View File

@ -850,13 +850,14 @@ class ApiProvider extends BaseProvider {
})); }));
// //
Future<Response> deletStaffData(int lockId, int staffId, int deleteKey) => post( Future<Response> deletStaffData(int lockId, int staffId, int deleteKey) =>
deleteStaffURL.toUrl, post(
jsonEncode({ deleteStaffURL.toUrl,
'lockId': lockId, jsonEncode({
'staffId': staffId, 'lockId': lockId,
'deleteKey': deleteKey, 'staffId': staffId,
})); 'deleteKey': deleteKey,
}));
// //
Future<Response> addStaffData( Future<Response> addStaffData(
@ -1450,19 +1451,19 @@ class ApiProvider extends BaseProvider {
jsonEncode({'endDate': endDate, 'lockIdList': lockIdList})); jsonEncode({'endDate': endDate, 'lockIdList': lockIdList}));
Future<Response> batchSendKey( Future<Response> batchSendKey(
List lockIds, List lockIds,
int createUser, int createUser,
String countryCode, String countryCode,
String receiverUsername, String receiverUsername,
String keyName, String keyName,
int keyType, int keyType,
List weekDays, List weekDays,
int startDate, int startDate,
int endDate, int endDate,
int startTime, int startTime,
int endTime, int endTime,
int remoteUnlockSwitch, int remoteUnlockSwitch,
int keyRight) => int keyRight) =>
post( post(
batchSendKeyURL.toUrl, batchSendKeyURL.toUrl,
jsonEncode({ jsonEncode({
@ -1568,8 +1569,8 @@ class ApiProvider extends BaseProvider {
})); }));
// //
Future<Response> changePassword(String date, String newPassword, Future<Response> changePassword(
String oldPassword) => String date, String newPassword, String oldPassword) =>
post( post(
changePasswordURL.toUrl, changePasswordURL.toUrl,
jsonEncode({ jsonEncode({
@ -1708,6 +1709,43 @@ class ApiProvider extends BaseProvider {
'lockId': lockId, 'lockId': lockId,
'abnormalWarn': abnormalWarn, 'abnormalWarn': abnormalWarn,
})); }));
//
Future<Response> updateFaceSwitch(int lockId, int faceSwitch) => post(
updateFaceConfigURL.toUrl,
jsonEncode({
'lockId': lockId,
'faceSwitch': faceSwitch,
}));
//
Future<Response> updateFaceConfig(int lockId, int faceInductionDistance) =>
post(
updateFaceConfigURL.toUrl,
jsonEncode({
'lockId': lockId,
'faceInductionDistance': faceInductionDistance,
}));
//
Future<Response> updateFacePreventMisrun(
int lockId, int faceAntiMistakeOpen) =>
post(
updateFaceConfigURL.toUrl,
jsonEncode({
'lockId': lockId,
'faceAntiMistakeOpen': faceAntiMistakeOpen,
}));
//
Future<Response> updateFaceAutoLightScreen(
int lockId, int faceAutoLightScreen) =>
post(
updateFaceConfigURL.toUrl,
jsonEncode({
'lockId': lockId,
'faceAutoLightScreen': faceAutoLightScreen,
}));
} }
extension ExtensionString on String { extension ExtensionString on String {

View File

@ -1574,13 +1574,11 @@ class ApiRepository {
// 2使 sendValidationCodeAuth 5 // 2使 sendValidationCodeAuth 5
Future<SendValidationCodeEntity> sendValidationCodeAuth( Future<SendValidationCodeEntity> sendValidationCodeAuth(
{ {required String countryCode,
required String countryCode, required String account,
required String account, required String channel,
required String channel, required String codeType,
required String codeType, required String xWidth}) async {
required String xWidth
}) async {
final res = await apiProvider.sendValidationCodeAuth( final res = await apiProvider.sendValidationCodeAuth(
countryCode, account, channel, codeType, xWidth); countryCode, account, channel, codeType, xWidth);
return SendValidationCodeEntity.fromJson(res.body); return SendValidationCodeEntity.fromJson(res.body);
@ -1609,9 +1607,10 @@ class ApiRepository {
} }
// //
Future<LoginEntity> changePassword(String date, String newPassword, String oldPassword) async { Future<LoginEntity> changePassword(
final res = await apiProvider.changePassword( String date, String newPassword, String oldPassword) async {
date, newPassword, oldPassword); final res =
await apiProvider.changePassword(date, newPassword, oldPassword);
return LoginEntity.fromJson(res.body); return LoginEntity.fromJson(res.body);
} }
@ -1749,4 +1748,35 @@ class ApiRepository {
await apiProvider.updateAbnormalWarnConfig(lockId, abnormalWarn); await apiProvider.updateAbnormalWarnConfig(lockId, abnormalWarn);
return VersionUndateEntity.fromJson(res.body); return VersionUndateEntity.fromJson(res.body);
} }
//
Future<VersionUndateEntity> updateFaceSwitch(
{required int lockId, required int faceSwitch}) async {
final res = await apiProvider.updateFaceSwitch(lockId, faceSwitch);
return VersionUndateEntity.fromJson(res.body);
}
//
Future<VersionUndateEntity> updateFaceConfig(
{required int lockId, required int faceInductionDistance}) async {
final res =
await apiProvider.updateFaceConfig(lockId, faceInductionDistance);
return VersionUndateEntity.fromJson(res.body);
}
//
Future<VersionUndateEntity> updateFacePreventMisrun(
{required int lockId, required int faceAntiMistakeOpen}) async {
final res =
await apiProvider.updateFacePreventMisrun(lockId, faceAntiMistakeOpen);
return VersionUndateEntity.fromJson(res.body);
}
//
Future<VersionUndateEntity> updateFaceAutoLightScreen(
{required int lockId, required int faceAutoLightScreen}) async {
final res = await apiProvider.updateFaceAutoLightScreen(
lockId, faceAutoLightScreen);
return VersionUndateEntity.fromJson(res.body);
}
} }

View File

@ -6,7 +6,7 @@ import 'package:star_lock/app_settings/app_colors.dart';
import '../translations/trans_lib.dart'; import '../translations/trans_lib.dart';
class AlertBottomWidget extends StatelessWidget { class AlertBottomWidget extends StatelessWidget {
List<String> items; List items;
ValueChanged<int> chooseCallback; ValueChanged<int> chooseCallback;
String topTitle; String topTitle;