2024-08-21 18:31:19 +08:00
|
|
|
|
|
2023-11-03 13:57:32 +08:00
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
2023-11-13 09:47:19 +08:00
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
|
import 'package:star_lock/appRouters.dart';
|
2024-04-16 18:32:42 +08:00
|
|
|
|
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_logic.dart';
|
2024-08-21 18:31:19 +08:00
|
|
|
|
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_state.dart';
|
2023-11-03 13:57:32 +08:00
|
|
|
|
|
2023-11-24 14:23:36 +08:00
|
|
|
|
import '../../../../../app_settings/app_colors.dart';
|
|
|
|
|
|
import '../../../../../tools/commonItem.dart';
|
|
|
|
|
|
import '../../../../../tools/titleAppBar.dart';
|
2023-11-03 13:57:32 +08:00
|
|
|
|
|
|
|
|
|
|
class MsgNotificationPage extends StatefulWidget {
|
|
|
|
|
|
const MsgNotificationPage({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
State<MsgNotificationPage> createState() => _MsgNotificationPageState();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _MsgNotificationPageState extends State<MsgNotificationPage> {
|
2024-08-21 18:31:19 +08:00
|
|
|
|
final MsgNotificationLogic logic = Get.put(MsgNotificationLogic());
|
|
|
|
|
|
final MsgNotificationState state = Get.find<MsgNotificationLogic>().state;
|
2023-11-03 13:57:32 +08:00
|
|
|
|
|
|
|
|
|
|
//高亮样式
|
2024-08-21 18:31:19 +08:00
|
|
|
|
final TextStyle titleStyle = TextStyle(color: Colors.black, fontSize: 24.sp, fontWeight: FontWeight.w500);
|
2023-11-03 13:57:32 +08:00
|
|
|
|
//默认样式
|
2024-08-21 18:31:19 +08:00
|
|
|
|
final TextStyle subTipsStyle = TextStyle(color: AppColors.placeholderTextColor, fontSize: 22.sp);
|
2023-11-03 13:57:32 +08:00
|
|
|
|
|
2024-08-21 18:31:19 +08:00
|
|
|
|
// late InlineSpan tipsPreviewSpan = TextSpan(children: <InlineSpan>[
|
|
|
|
|
|
// TextSpan(text: '${'添加和使用面容开锁时:'.tr}\n', style: titleStyle),
|
|
|
|
|
|
// TextSpan(
|
|
|
|
|
|
// text:
|
|
|
|
|
|
// '\n1、请尽量保持单人在门前操作;\n2、请站立在门锁正前方约0.5~0.8米,面向门锁;\n3、请保持脸部无遮挡,露出五官;\n4、面容识别异常时,可触摸数字键盘任意按键,手动重启人脸识别。',
|
|
|
|
|
|
// style: subTipsStyle),
|
|
|
|
|
|
// ]);
|
2023-11-03 13:57:32 +08:00
|
|
|
|
|
2024-04-18 18:14:17 +08:00
|
|
|
|
@override
|
|
|
|
|
|
initState() {
|
|
|
|
|
|
super.initState();
|
|
|
|
|
|
logic.getLockNoticeSetting();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-03 13:57:32 +08:00
|
|
|
|
@override
|
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
return Scaffold(
|
2023-11-24 14:23:36 +08:00
|
|
|
|
backgroundColor: AppColors.mainBackgroundColor,
|
2023-11-03 13:57:32 +08:00
|
|
|
|
appBar: TitleAppBar(
|
2024-04-20 16:58:31 +08:00
|
|
|
|
barTitle: '消息提醒'.tr,
|
2023-11-03 13:57:32 +08:00
|
|
|
|
haveBack: true,
|
|
|
|
|
|
backgroundColor: AppColors.mainColor),
|
2023-11-13 09:47:19 +08:00
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
|
|
child: _buildMainItem(),
|
2023-11-03 13:57:32 +08:00
|
|
|
|
));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-13 09:47:19 +08:00
|
|
|
|
Widget _buildMainItem() {
|
|
|
|
|
|
return Column(
|
2024-08-21 18:31:19 +08:00
|
|
|
|
children: <Widget>[
|
2023-11-13 09:47:19 +08:00
|
|
|
|
CommonItem(
|
2024-04-20 16:58:31 +08:00
|
|
|
|
leftTitel: '开门通知'.tr,
|
2024-08-21 18:31:19 +08:00
|
|
|
|
rightTitle: '',
|
2023-11-24 14:23:36 +08:00
|
|
|
|
isHaveLine: true,
|
2023-11-13 09:47:19 +08:00
|
|
|
|
isHaveDirection: true,
|
|
|
|
|
|
action: () {
|
2024-08-21 18:31:19 +08:00
|
|
|
|
Get.toNamed(Routers.openDoorNotifyPage, arguments: <String, Object>{
|
2024-04-19 13:47:56 +08:00
|
|
|
|
'lockSetInfoData': state.msgNoticeInfo.value,
|
|
|
|
|
|
'lockId': state.getLockId.value
|
|
|
|
|
|
});
|
2023-11-13 09:47:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
),
|
2024-04-18 18:14:17 +08:00
|
|
|
|
Obx(() => CommonItem(
|
2024-04-20 16:58:31 +08:00
|
|
|
|
leftTitel: 'N天未开门'.tr,
|
2024-04-18 18:14:17 +08:00
|
|
|
|
rightTitle: state.nDaysNotOpenDoor.value,
|
|
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveDirection: true,
|
|
|
|
|
|
action: () {
|
2024-08-21 18:31:19 +08:00
|
|
|
|
Get.toNamed(Routers.nDaysUnopenedPage, arguments: <String, Object>{
|
2024-04-24 10:06:37 +08:00
|
|
|
|
'lockSetInfoData': state.msgNoticeInfo.value,
|
|
|
|
|
|
'lockId': state.getLockId.value
|
|
|
|
|
|
})?.then((value) {
|
|
|
|
|
|
if (value != null) {
|
|
|
|
|
|
logic.getLockNoticeSetting();
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2024-04-18 18:14:17 +08:00
|
|
|
|
},
|
|
|
|
|
|
)),
|
2023-11-13 09:47:19 +08:00
|
|
|
|
Obx(() => CommonItem(
|
2024-04-20 16:58:31 +08:00
|
|
|
|
leftTitel: '门未关好'.tr,
|
2024-08-21 18:31:19 +08:00
|
|
|
|
rightTitle: '',
|
2023-11-24 14:23:36 +08:00
|
|
|
|
isHaveLine: true,
|
2023-11-13 09:47:19 +08:00
|
|
|
|
isHaveRightWidget: true,
|
|
|
|
|
|
rightWidget:
|
|
|
|
|
|
SizedBox(width: 60.w, height: 50.h, child: _switch(2)))),
|
2024-04-18 18:14:17 +08:00
|
|
|
|
Obx(() => CommonItem(
|
2024-04-20 16:58:31 +08:00
|
|
|
|
leftTitel: '防拆报警'.tr,
|
2024-04-19 13:47:56 +08:00
|
|
|
|
rightTitle: '',
|
|
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveRightWidget: true,
|
|
|
|
|
|
rightWidget: SizedBox(
|
|
|
|
|
|
width: 60.w,
|
|
|
|
|
|
height: 50.h,
|
|
|
|
|
|
child: _switch(5),
|
|
|
|
|
|
))),
|
2024-04-18 18:14:17 +08:00
|
|
|
|
Obx(() => CommonItem(
|
2024-04-20 16:58:31 +08:00
|
|
|
|
leftTitel: '低电量提醒'.tr,
|
2024-04-18 18:14:17 +08:00
|
|
|
|
rightTitle: state.isLowBattery.value,
|
|
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveDirection: true,
|
|
|
|
|
|
action: () {
|
2024-08-21 18:31:19 +08:00
|
|
|
|
Get.toNamed(Routers.lowBatteryReminderPage, arguments: <String, Object>{
|
2024-04-24 17:11:42 +08:00
|
|
|
|
'lockSetInfoData': state.msgNoticeInfo.value,
|
|
|
|
|
|
'lockId': state.getLockId.value
|
|
|
|
|
|
})?.then((value) {
|
|
|
|
|
|
if (value != null) {
|
|
|
|
|
|
logic.getLockNoticeSetting();
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2024-04-18 18:14:17 +08:00
|
|
|
|
},
|
|
|
|
|
|
)),
|
2023-11-13 09:47:19 +08:00
|
|
|
|
CommonItem(
|
2024-04-20 16:58:31 +08:00
|
|
|
|
leftTitel: '胁迫开门'.tr,
|
2024-08-21 18:31:19 +08:00
|
|
|
|
rightTitle: '',
|
2023-11-13 09:47:19 +08:00
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveDirection: true,
|
|
|
|
|
|
action: () {
|
2024-08-21 18:31:19 +08:00
|
|
|
|
Get.toNamed(Routers.coerceOpenDoorPage, arguments: <String, Object>{
|
2024-04-24 17:11:42 +08:00
|
|
|
|
'lockSetInfoData': state.msgNoticeInfo.value,
|
|
|
|
|
|
'lockId': state.getLockId.value
|
|
|
|
|
|
});
|
2023-11-13 09:47:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
),
|
|
|
|
|
|
SizedBox(
|
2023-11-24 14:23:36 +08:00
|
|
|
|
height: 10.h,
|
2023-11-13 09:47:19 +08:00
|
|
|
|
),
|
2024-08-07 13:37:14 +08:00
|
|
|
|
// Obx(() => CommonItem(
|
|
|
|
|
|
// leftTitel: '有人按门铃'.tr,
|
|
|
|
|
|
// rightTitle: "",
|
|
|
|
|
|
// isHaveLine: true,
|
|
|
|
|
|
// isHaveRightWidget: true,
|
|
|
|
|
|
// rightWidget:
|
|
|
|
|
|
// SizedBox(width: 60.w, height: 50.h, child: _switch(3)))),
|
2023-11-13 09:47:19 +08:00
|
|
|
|
SizedBox(
|
2023-11-24 14:23:36 +08:00
|
|
|
|
height: 10.h,
|
2023-11-13 09:47:19 +08:00
|
|
|
|
),
|
2024-06-07 15:58:24 +08:00
|
|
|
|
Obx(() => Visibility(
|
|
|
|
|
|
visible: state.isSupportCatEye.value,
|
|
|
|
|
|
child: CommonItem(
|
|
|
|
|
|
leftTitel: '有人出现在门口'.tr,
|
2024-08-21 18:31:19 +08:00
|
|
|
|
rightTitle: '',
|
2024-06-07 15:58:24 +08:00
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveRightWidget: true,
|
|
|
|
|
|
rightWidget:
|
|
|
|
|
|
SizedBox(width: 60.w, height: 50.h, child: _switch(4))))),
|
2023-11-13 09:47:19 +08:00
|
|
|
|
SizedBox(
|
|
|
|
|
|
height: 60.h,
|
2024-04-30 11:24:47 +08:00
|
|
|
|
),
|
|
|
|
|
|
Text(
|
2024-08-21 18:31:19 +08:00
|
|
|
|
'此模块功能需要锁联网后设置方可生效'.tr,
|
2024-04-30 11:24:47 +08:00
|
|
|
|
style: TextStyle(fontSize: 20.sp),
|
2023-11-13 09:47:19 +08:00
|
|
|
|
)
|
|
|
|
|
|
],
|
2023-11-03 13:57:32 +08:00
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CupertinoSwitch _switch(int getIndex) {
|
2023-11-13 09:47:19 +08:00
|
|
|
|
bool isCheck = false;
|
|
|
|
|
|
switch (getIndex) {
|
|
|
|
|
|
//离家开门
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
isCheck = state.isLeaveHomeOpenDoor.value;
|
|
|
|
|
|
break;
|
|
|
|
|
|
//门未关好
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
isCheck = state.isDoorNotShut.value;
|
|
|
|
|
|
break;
|
|
|
|
|
|
//有人按门铃
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
isCheck = state.isSomeoneRing.value;
|
|
|
|
|
|
break;
|
|
|
|
|
|
//有人出现在门口
|
|
|
|
|
|
case 4:
|
|
|
|
|
|
isCheck = state.isSomeoneAppeared.value;
|
|
|
|
|
|
break;
|
2024-04-19 13:47:56 +08:00
|
|
|
|
//防拆报警
|
|
|
|
|
|
case 5:
|
|
|
|
|
|
isCheck = state.isTamperAlarm.value;
|
|
|
|
|
|
break;
|
|
|
|
|
|
//低电量提醒
|
2023-11-13 09:47:19 +08:00
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
}
|
2023-11-03 13:57:32 +08:00
|
|
|
|
return CupertinoSwitch(
|
|
|
|
|
|
activeColor: CupertinoColors.activeBlue,
|
|
|
|
|
|
trackColor: CupertinoColors.systemGrey5,
|
|
|
|
|
|
thumbColor: CupertinoColors.white,
|
2023-11-13 09:47:19 +08:00
|
|
|
|
value: isCheck,
|
2024-08-21 18:31:19 +08:00
|
|
|
|
onChanged: (bool value) {
|
2023-11-13 09:47:19 +08:00
|
|
|
|
switch (getIndex) {
|
|
|
|
|
|
//离家开门
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
state.isLeaveHomeOpenDoor.value = value;
|
|
|
|
|
|
break;
|
|
|
|
|
|
//门未关好
|
|
|
|
|
|
case 2:
|
2024-04-18 18:14:17 +08:00
|
|
|
|
{
|
|
|
|
|
|
state.isDoorNotShut.value = value;
|
|
|
|
|
|
logic.updateDoorNotCloseSetting();
|
|
|
|
|
|
}
|
2023-11-13 09:47:19 +08:00
|
|
|
|
break;
|
|
|
|
|
|
//有人按门铃
|
|
|
|
|
|
case 3:
|
2024-04-19 13:47:56 +08:00
|
|
|
|
{
|
|
|
|
|
|
state.isSomeoneRing.value = value;
|
|
|
|
|
|
logic.updateDoorbellNoticeStateSetting();
|
|
|
|
|
|
}
|
2023-11-13 09:47:19 +08:00
|
|
|
|
break;
|
|
|
|
|
|
//有人出现在门口
|
|
|
|
|
|
case 4:
|
2024-04-19 13:47:56 +08:00
|
|
|
|
{
|
|
|
|
|
|
state.isSomeoneAppeared.value = value;
|
|
|
|
|
|
logic.updateSomeoneAtDoorNoticeStateSetting();
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
//防拆报警
|
|
|
|
|
|
case 5:
|
|
|
|
|
|
{
|
|
|
|
|
|
state.isTamperAlarm.value = value;
|
|
|
|
|
|
logic.updateTamperAlarmStateSetting();
|
|
|
|
|
|
}
|
2023-11-13 09:47:19 +08:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
}
|
2023-11-03 13:57:32 +08:00
|
|
|
|
},
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|