diff --git a/star_lock/lib/appRouters.dart b/star_lock/lib/appRouters.dart index 54aa67f8..6d5fc3c7 100644 --- a/star_lock/lib/appRouters.dart +++ b/star_lock/lib/appRouters.dart @@ -6,12 +6,23 @@ import 'package:star_lock/login/register/starLock_register_binding.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_page.dart'; 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/catEyeSet_page.dart'; import 'package:star_lock/main/lockDetail/lcokSet/catEyeWorkMode/catEyeWorkMode_page.dart'; +import 'package:star_lock/main/lockDetail/lcokSet/coerceFingerprint/coerceFingerprint_page.dart'; +import 'package:star_lock/main/lockDetail/lcokSet/coerceFingerprintList/coerceFingerprintList_page.dart'; +import 'package:star_lock/main/lockDetail/lcokSet/coerceOpenDoor/coerceOpenDoor_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'; +import 'package:star_lock/main/lockDetail/lcokSet/lowBatteryReminder/lowBatteryReminder_page.dart'; import 'package:star_lock/main/lockDetail/lcokSet/motorPower/motorPower_page.dart'; import 'package:star_lock/main/lockDetail/lcokSet/msgNotification/msgNotification_page.dart'; +import 'package:star_lock/main/lockDetail/lcokSet/notificationMode/notificationMode_page.dart'; import 'package:star_lock/main/lockDetail/lcokSet/openDoorDirection/openDoorDirection_page.dart'; +import 'package:star_lock/main/lockDetail/lcokSet/openDoorNotify/openDoorNotify_page.dart'; import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_main_page.dart'; +import 'package:star_lock/main/lockDetail/lcokSet/nDaysUnopened/nDaysUnopened_page.dart'; import 'package:star_lock/main/lockDetail/otherTypeKey/addFace/addFace_page.dart'; import 'package:star_lock/mine/about/webviewShow_page.dart'; import 'package:star_lock/mine/mine/safeVerify/safeVerify_page.dart'; @@ -346,8 +357,19 @@ abstract class Routers { static const motorPowerPage = '/motorPowerPage'; //电机功率设置 static const openDoorDirectionPage = '/openDoorDirectionPage'; //开门方向设置 static const catEyeWorkModePage = '/catEyeWorkModePage'; //猫眼工作模式 - static const msgNotificationPage = '/msgNotificationPage'; //消息通知 + static const msgNotificationPage = '/msgNotificationPage'; //消息提醒 static const addFaceTipPage = '/addFaceTipPage'; //添加人脸 + static const nDaysUnopenedPage = '/nDaysUnopenedPage'; //N天未开门 + static const notificationModePage = '/notificationModePage'; //提醒方式 + static const openDoorNotifyPage = '/openDoorNotifyPage'; //家人到家 + static const familyDetailsPage = '/familyDetailsPage'; // 家人详情 + static const addFamilyPage = '/addFamilyPage'; //添加家人 + static const lockUserPage = '/lockUserPage'; //锁用户 + static const catEyeSetPage = '/catEyeSetPage'; //猫眼设置 + static const coerceOpenDoorPage = '/coerceOpenDoorPage'; //胁迫开门 + static const coerceFingerprintPage = '/coerceFingerprintPage'; //胁迫指纹 + static const lowBatteryReminderPage = '/lowBatteryReminderPage'; //低电量提醒 + static const coerceFingerprintListPage = '/coerceFingerprintListPage'; //指纹列表 } abstract class AppRouters { @@ -861,6 +883,31 @@ abstract class AppRouters { GetPage( name: Routers.msgNotificationPage, page: () => const MsgNotificationPage()), - GetPage(name: Routers.addFaceTipPage, page: () => const AddFaceTipPage()) + GetPage(name: Routers.addFaceTipPage, page: () => const AddFaceTipPage()), + GetPage( + name: Routers.nDaysUnopenedPage, page: () => const NDaysUnopenedPage()), + GetPage( + name: Routers.notificationModePage, + page: () => const NotificationModePage()), + GetPage( + name: Routers.openDoorNotifyPage, + page: () => const OpenDoorNotifyPage()), + GetPage( + name: Routers.familyDetailsPage, page: () => const FamilyDetailsPage()), + GetPage(name: Routers.addFamilyPage, page: () => const AddFamilyPage()), + GetPage(name: Routers.lockUserPage, page: () => const LockUserPage()), + GetPage(name: Routers.catEyeSetPage, page: () => const CatEyeSetPage()), + GetPage( + name: Routers.coerceOpenDoorPage, + page: () => const CoerceOpenDoorPage()), + GetPage( + name: Routers.coerceFingerprintPage, + page: () => const CoerceFingerprintPage()), + GetPage( + name: Routers.lowBatteryReminderPage, + page: () => const LowBatteryReminderPage()), + GetPage( + name: Routers.coerceFingerprintListPage, + page: () => const CoerceFingerprintListPage()) ]; } diff --git a/star_lock/lib/app_settings/app_colors.dart b/star_lock/lib/app_settings/app_colors.dart index eb871936..f593132e 100644 --- a/star_lock/lib/app_settings/app_colors.dart +++ b/star_lock/lib/app_settings/app_colors.dart @@ -125,5 +125,5 @@ class AppColors { static const blueTextTipsColor = Color.fromRGBO(0, 113, 255, 1); //蓝色字体tips static const blueViewBgColor = Color.fromRGBO(223, 237, 254, 1); //蓝色背景板 139 148 176 - static const msgNoticeTextColor = Color.fromRGBO(139, 148, 176, 1); //消息通知字体颜色 + static const msgNoticeTextColor = Color.fromRGBO(139, 148, 176, 1); //消息提醒字体颜色 } diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart index ed1fae5b..3dc1d880 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart @@ -86,7 +86,7 @@ class _AuthorizedAdminListPageState extends State { List getItemData = itemData; return getItemData.isEmpty ? const NoData() - : ListView.builder( + : ListView.separated( itemCount: getItemData.length, itemBuilder: (c, index) { ElectronicKeyListItem indexEntity = getItemData[index]; @@ -117,20 +117,32 @@ class _AuthorizedAdminListPageState extends State { decoration: const BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(1)), ), - child: _electronicKeyItem('images/controls_user.png', - indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () { - Navigator.pushNamed(context, Routers.electronicKeyDetailPage, - arguments: {'itemData': indexEntity}).then((val) { - if (val != null) { - logic.mockNetworkDataRequest(); - setState(() {}); - } - }); - }), + child: _electronicKeyItem( + 'images/controls_user.png', + indexEntity.keyName!, + useDateStr, + keyStatus, + isAdminKey, () { + Navigator.pushNamed( + context, Routers.electronicKeyDetailPage, + arguments: {'itemData': indexEntity}).then((val) { + if (val != null) { + logic.mockNetworkDataRequest(); + setState(() {}); + } + }); + }), ); } return const SizedBox.shrink(); - }); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider( + height: 1.h, + color: AppColors.greyLineColor, + ); + }, + ); } Widget _buildDeleteBtn(ElectronicKeyListItem passwordKeyListItem) { @@ -156,7 +168,8 @@ class _AuthorizedAdminListPageState extends State { ); } - void showIosTipViewDialog(BuildContext context, ElectronicKeyListItem passwordKeyListItem) { + void showIosTipViewDialog( + BuildContext context, ElectronicKeyListItem passwordKeyListItem) { showDialog( context: context, builder: (BuildContext context) { @@ -171,8 +184,7 @@ class _AuthorizedAdminListPageState extends State { Get.back(); }, ); - } - ); + }); } //使用期限 @@ -270,8 +282,8 @@ class _AuthorizedAdminListPageState extends State { // : Container(), Expanded( child: SizedBox( - width: 20.w, - )), + width: 20.w, + )), // Text( // keyStatus, // style: TextStyle(fontSize: 18.sp, color: Colors.red), diff --git a/star_lock/lib/main/lockDetail/lcokSet/addFamily/addFamily_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/addFamily/addFamily_logic.dart new file mode 100644 index 00000000..e69de29b diff --git a/star_lock/lib/main/lockDetail/lcokSet/addFamily/addFamily_page.dart b/star_lock/lib/main/lockDetail/lcokSet/addFamily/addFamily_page.dart new file mode 100644 index 00000000..31fb87f9 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/addFamily/addFamily_page.dart @@ -0,0 +1,129 @@ +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/tools/commonItem.dart'; +import 'package:star_lock/tools/submitBtn.dart'; + +import '../../../../../app_settings/app_colors.dart'; +import '../../../../../tools/titleAppBar.dart'; + +class AddFamilyPage extends StatefulWidget { + const AddFamilyPage({Key? key}) : super(key: key); + + @override + State createState() => _AddFamilyPageState(); +} + +class _AddFamilyPageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar( + barTitle: '添加家人', + haveBack: true, + backgroundColor: AppColors.mainColor), + body: Container( + padding: EdgeInsets.all(30.w), + child: Column( + children: [ + CommonItem( + leftTitel: '开门方式', + rightTitle: '请选择', + isHaveLine: true, + isHaveDirection: true, + action: () { + //锁用户 + Get.toNamed(Routers.lockUserPage); + }), + CommonItem( + leftTitel: '家人', + rightTitle: '', + isHaveLine: true, + isHaveRightWidget: true, + isHaveDirection: false, + rightWidget: getFamilyWidget('请输入'), + ), + SizedBox( + height: 20.h, + ), + Container( + color: Colors.white, + margin: EdgeInsets.only(bottom: 10.h), + child: Column( + children: [ + CommonItem( + leftTitel: '提醒方式', + rightTitle: "", + isHaveLine: false, + isHaveRightWidget: false, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.notificationModePage); + }, + ), + Container( + padding: EdgeInsets.only( + left: 10.w, right: 10.w, top: 12.h, bottom: 12.h), + margin: EdgeInsets.only(bottom: 20.h, top: 10.h), + decoration: BoxDecoration( + color: AppColors.mainBackgroundColor, + borderRadius: BorderRadius.circular(6.0.w), + ), + child: Text( + 'APP推送 管理员', + style: TextStyle(color: Colors.black, fontSize: 20.sp), + ), + ) + ], + ), + ), + Expanded( + child: SizedBox( + height: 40.h, + )), + SubmitBtn( + btnName: '保存', + isDisabled: false, + onClick: () {}, + ), + SizedBox( + height: 60.h, + ) + ], + ), + ), + ); + } + + // 接受者邮箱输入框 + Widget getFamilyWidget(String tfStr) { + TextEditingController emailController = TextEditingController(); + return SizedBox( + height: 50.h, + width: 360.w, + child: Row( + children: [ + Expanded( + child: TextField( + controller: emailController, + //输入框一行 + maxLines: 1, + autofocus: false, + textAlign: TextAlign.end, + decoration: InputDecoration( + //输入里面输入文字内边距设置 + contentPadding: const EdgeInsets.only(top: -12.0, bottom: 0.0), + hintText: tfStr, + hintStyle: TextStyle(fontSize: 22.sp), + //不需要输入框下划线 + border: InputBorder.none, + ), + ), + ), + ], + ), + ); + } +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/addFamily/addFamily_state.dart b/star_lock/lib/main/lockDetail/lcokSet/addFamily/addFamily_state.dart new file mode 100644 index 00000000..e69de29b diff --git a/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeSet_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeSet_logic.dart new file mode 100644 index 00000000..ee813201 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeSet_logic.dart @@ -0,0 +1,6 @@ +import 'package:star_lock/main/lockDetail/lcokSet/catEyeSet/catEyeSet_state.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; + +class CatEyeSetLogic extends BaseGetXController { + final CatEyeSetState state = CatEyeSetState(); +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeSet_page.dart b/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeSet_page.dart new file mode 100644 index 00000000..27abc1fa --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeSet_page.dart @@ -0,0 +1,125 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:star_lock/appRouters.dart'; +import 'package:star_lock/main/lockDetail/lcokSet/catEyeSet/catEyeSet_logic.dart'; +import 'package:star_lock/tools/commonItem.dart'; +import 'package:star_lock/tools/custom_bottom_sheet.dart'; + +import '../../../../app_settings/app_colors.dart'; +import '../../../../tools/titleAppBar.dart'; + +class CatEyeSetPage extends StatefulWidget { + const CatEyeSetPage({Key? key}) : super(key: key); + + @override + State createState() => _CatEyeSetPageState(); +} + +class _CatEyeSetPageState extends State { + final logic = Get.put(CatEyeSetLogic()); + final state = Get.find().state; + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + appBar: TitleAppBar( + barTitle: '猫眼设置', + haveBack: true, + backgroundColor: AppColors.mainColor), + body: Column( + children: [ + CommonItem( + leftTitel: '猫眼工作模式', + rightTitle: "", + isHaveLine: true, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.catEyeWorkModePage); + }), + Obx(() => CommonItem( + leftTitel: '自动亮屏', + rightTitle: "", + isHaveLine: true, + isHaveDirection: false, + isHaveRightWidget: true, + rightWidget: _otherToDoSwitch(1))), + Obx(() => CommonItem( + leftTitel: '亮屏持续时间', + rightTitle: state.selectBrightDuration.value, + isHaveLine: true, + isHaveDirection: true, + action: () { + _openBottomItemSheet(); + })), + Obx(() => CommonItem( + leftTitel: '逗留警告', + rightTitle: "", + isHaveLine: true, + isHaveRightWidget: true, + rightWidget: _otherToDoSwitch(2), + )), + Obx(() => CommonItem( + leftTitel: '异常警告', + rightTitle: "", + isHaveLine: true, + isHaveRightWidget: true, + rightWidget: _otherToDoSwitch(3))), + ], + )); + } + + CupertinoSwitch _otherToDoSwitch(int clickIndex) { + bool isCheck = false; + switch (clickIndex) { + case 1: //自动亮屏 + isCheck = state.isAutoBright.value; + break; + case 2: //逗留警告 + isCheck = state.isStayWarning.value; + break; + case 3: //异常警告 + isCheck = state.isExceptionWarning.value; + break; + default: + } + return CupertinoSwitch( + activeColor: CupertinoColors.activeBlue, + trackColor: CupertinoColors.systemGrey5, + thumbColor: CupertinoColors.white, + value: isCheck, + onChanged: (value) { + switch (clickIndex) { + case 1: //自动亮屏 + state.isAutoBright.value = value; + break; + case 2: //逗留警告 + state.isStayWarning.value = value; + break; + case 3: //异常警告 + state.isExceptionWarning.value = value; + break; + default: + } + }, + ); + } + + Future _openBottomItemSheet() async { + showModalBottomSheet( + context: context, + shape: RoundedRectangleBorder( + borderRadius: BorderRadiusDirectional.circular(10)), + builder: (BuildContext context) { + return AlertBottomWidget( + topTitle: '', + items: state.brightDurationTimeList, + chooseCallback: (value) { + state.selectBrightDuration.value = + state.brightDurationTimeList[value]; + }, + ); + }); + } +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeSet_state.dart b/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeSet_state.dart new file mode 100644 index 00000000..9fb26f65 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/catEyeSet/catEyeSet_state.dart @@ -0,0 +1,9 @@ +import 'package:get/get.dart'; + +class CatEyeSetState { + var brightDurationTimeList = ['10秒', '15秒', '20秒'].obs; + var selectBrightDuration = '10 秒'.obs; //选中的亮屏持续时间 + var isAutoBright = false.obs; //自动亮屏 + var isStayWarning = false.obs; //逗留警告 + var isExceptionWarning = false.obs; //异常警告 +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/coerceFingerprint/coerceFingerprint_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/coerceFingerprint/coerceFingerprint_logic.dart new file mode 100644 index 00000000..e69de29b diff --git a/star_lock/lib/main/lockDetail/lcokSet/coerceFingerprint/coerceFingerprint_page.dart b/star_lock/lib/main/lockDetail/lcokSet/coerceFingerprint/coerceFingerprint_page.dart new file mode 100644 index 00000000..166eed11 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/coerceFingerprint/coerceFingerprint_page.dart @@ -0,0 +1,91 @@ +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/tools/commonItem.dart'; +import 'package:star_lock/tools/submitBtn.dart'; + +import '../../../../../app_settings/app_colors.dart'; +import '../../../../../tools/titleAppBar.dart'; + +class CoerceFingerprintPage extends StatefulWidget { + const CoerceFingerprintPage({Key? key}) : super(key: key); + + @override + State createState() => _CoerceFingerprintPageState(); +} + +class _CoerceFingerprintPageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar( + barTitle: '胁迫指纹', + haveBack: true, + backgroundColor: AppColors.mainColor), + body: Container( + padding: EdgeInsets.all(30.w), + child: Column( + children: [ + CommonItem( + leftTitel: '胁迫指纹', + rightTitle: '请选择', + isHaveLine: true, + isHaveDirection: true, + action: () { + //锁用户 + Get.toNamed(Routers.coerceFingerprintListPage); + }), + SizedBox( + height: 20.h, + ), + Container( + color: Colors.white, + margin: EdgeInsets.only(bottom: 10.h), + child: Column( + children: [ + CommonItem( + leftTitel: '提醒方式', + rightTitle: "", + isHaveLine: false, + isHaveRightWidget: false, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.notificationModePage); + }, + ), + Container( + padding: EdgeInsets.only( + left: 10.w, right: 10.w, top: 12.h, bottom: 12.h), + margin: EdgeInsets.only(bottom: 20.h, top: 10.h), + decoration: BoxDecoration( + color: AppColors.mainBackgroundColor, + borderRadius: BorderRadius.circular(6.0.w), + ), + child: Text( + 'APP推送 管理员', + style: TextStyle(color: Colors.black, fontSize: 20.sp), + ), + ) + ], + ), + ), + Expanded( + child: SizedBox( + height: 40.h, + )), + SubmitBtn( + btnName: '保存', + isDisabled: false, + onClick: () {}, + ), + SizedBox( + height: 60.h, + ) + ], + ), + ), + ); + } +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/coerceFingerprint/coerceFingerprint_state.dart b/star_lock/lib/main/lockDetail/lcokSet/coerceFingerprint/coerceFingerprint_state.dart new file mode 100644 index 00000000..e69de29b diff --git a/star_lock/lib/main/lockDetail/lcokSet/coerceFingerprintList/coerceFingerprintList_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/coerceFingerprintList/coerceFingerprintList_logic.dart new file mode 100644 index 00000000..e69de29b diff --git a/star_lock/lib/main/lockDetail/lcokSet/coerceFingerprintList/coerceFingerprintList_page.dart b/star_lock/lib/main/lockDetail/lcokSet/coerceFingerprintList/coerceFingerprintList_page.dart new file mode 100644 index 00000000..0d99a0c5 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/coerceFingerprintList/coerceFingerprintList_page.dart @@ -0,0 +1,171 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:star_lock/main/lockDetail/lcokSet/lockUser/lockUser_logic.dart'; +import '../../../../app_settings/app_colors.dart'; +import '../../../../tools/submitBtn.dart'; +import '../../../../tools/titleAppBar.dart'; +import '../../../../translations/trans_lib.dart'; + +class CoerceFingerprintListPage extends StatefulWidget { + const CoerceFingerprintListPage({Key? key}) : super(key: key); + + @override + State createState() => + _CoerceFingerprintListPageState(); +} + +class _CoerceFingerprintListPageState extends State { + final logic = Get.put(LockUserLogic()); + 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: [ + _searchWidget(), + SizedBox( + height: 20.h, + ), + Expanded(child: _buildMainUI()), + SubmitBtn( + btnName: '确定', + onClick: () {}, + ), + SizedBox( + height: 64.h, + ) + ], + )); + } + + Widget _searchWidget() { + return Container( + height: 60.h, + margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 10.w), + decoration: BoxDecoration( + color: Colors.white, borderRadius: BorderRadius.circular(5)), + child: TextField( + //输入框一行 + maxLines: 1, + // controller: _controller, + autofocus: false, + controller: state.searchController, + onSubmitted: (value) {}, + decoration: InputDecoration( + //输入里面输入文字内边距设置 + contentPadding: const EdgeInsets.only( + top: 12.0, left: -19.0, right: -15.0, bottom: 8.0), + hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr, + hintStyle: TextStyle(fontSize: 22.sp, height: 3.0), + //不需要输入框下划线 + border: InputBorder.none, + //左边图标设置 + icon: Padding( + padding: EdgeInsets.only( + top: 20.h, bottom: 20.h, right: 20.w, left: 10.w), + child: Image.asset( + 'images/main/icon_main_search.png', + width: 40.w, + height: 40.w, + ), + ), + ), + ), + ); + } + + Widget _buildMainUI() { + return ListView.separated( + shrinkWrap: true, + itemCount: 3, + itemBuilder: (c, index) { + return _electronicKeyItem('images/icon_fingerprint.png', '我', '永久', () { + state.isCheck.value = !state.isCheck.value; + }); + }, + separatorBuilder: (BuildContext context, int index) { + return const Divider( + height: 1, + color: AppColors.greyLineColor, + ); + }, + ); + } + + Widget _electronicKeyItem( + String avatarURL, String receiveUser, String useDate, Function() action) { + return GestureDetector( + onTap: action, + child: Container( + color: Colors.white, + height: 90.h, + child: Row( + children: [ + SizedBox( + width: 30.w, + ), + Image.asset( + avatarURL, + width: 60.w, + height: 60.w, + ), + SizedBox( + width: 20.w, + ), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + receiveUser, + style: TextStyle( + fontSize: 24.sp, color: AppColors.blackColor), + ), + SizedBox(width: 10.w), + Expanded( + child: SizedBox( + width: 20.w, + )), + ], + ), + SizedBox(height: 10.h), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + useDate, + style: TextStyle( + fontSize: 18.sp, + color: AppColors.placeholderTextColor), + ), + ], + ), + SizedBox(width: 20.h), + ], + ), + ), + Obx(() => Image.asset( + state.isCheck.value == true + ? 'images/icon_round_selet.png' + : 'images/icon_round_unSelet.png', + width: 30.w, + height: 30.w, + )), + SizedBox(width: 20.h), + ], + ), + ), + ); + } +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/coerceFingerprintList/coerceFingerprintList_state.dart b/star_lock/lib/main/lockDetail/lcokSet/coerceFingerprintList/coerceFingerprintList_state.dart new file mode 100644 index 00000000..e69de29b diff --git a/star_lock/lib/main/lockDetail/lcokSet/coerceOpenDoor/coerceOpenDoor_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/coerceOpenDoor/coerceOpenDoor_logic.dart new file mode 100644 index 00000000..cf0d75b2 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/coerceOpenDoor/coerceOpenDoor_logic.dart @@ -0,0 +1,6 @@ +import 'package:star_lock/main/lockDetail/lcokSet/coerceOpenDoor/coerceOpenDoor_state.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; + +class CoerceOpenDoorLogic extends BaseGetXController { + final CoerceOpenDoorState state = CoerceOpenDoorState(); +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/coerceOpenDoor/coerceOpenDoor_page.dart b/star_lock/lib/main/lockDetail/lcokSet/coerceOpenDoor/coerceOpenDoor_page.dart new file mode 100644 index 00000000..8899b845 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/coerceOpenDoor/coerceOpenDoor_page.dart @@ -0,0 +1,154 @@ +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/main/lockDetail/lcokSet/coerceOpenDoor/coerceOpenDoor_logic.dart'; +import '../../../../app_settings/app_colors.dart'; +import '../../../../tools/submitBtn.dart'; +import '../../../../tools/titleAppBar.dart'; + +class CoerceOpenDoorPage extends StatefulWidget { + const CoerceOpenDoorPage({Key? key}) : super(key: key); + + @override + State createState() => _CoerceOpenDoorPageState(); +} + +class _CoerceOpenDoorPageState extends State { + final logic = Get.put(CoerceOpenDoorLogic()); + final state = Get.find().state; + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar( + barTitle: '胁迫开门', + haveBack: true, + backgroundColor: AppColors.mainColor, + ), + body: Column( + children: [ + _topTipsWidget(), + SizedBox( + height: 20.h, + ), + Expanded(child: _buildMainUI()), + // Expanded( + // child: Obx(() => state.itemDataList.value.isEmpty + // ? const NoData() + // : _buildMainUI(state.itemDataList.value))), + AddBottomWhiteBtn( + btnName: '胁迫指纹', + onClick: () { + Get.toNamed(Routers.coerceFingerprintPage); + }, + ), + SizedBox( + height: 64.h, + ) + ], + )); + } + + Widget _topTipsWidget() { + return Container( + alignment: Alignment.centerLeft, + margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), + child: Text( + '当被胁迫要求强行开锁时,使用胁迫指纹会触发报警,报警消息会推送给管理员,该功能需要锁联网', + style: TextStyle(color: AppColors.darkGrayTextColor, fontSize: 20.sp), + )); + } + + Widget _buildMainUI() { + return ListView.separated( + shrinkWrap: true, + itemCount: 3, + itemBuilder: (c, index) { + return _electronicKeyItem( + 'images/icon_fingerprint.png', '18682150237', '指纹', () { + //指纹详情 + }); + }, + separatorBuilder: (BuildContext context, int index) { + return const Divider( + height: 1, + color: AppColors.greyLineColor, + ); + }, + ); + } + + Widget _electronicKeyItem(String avatarURL, String familyAccount, + String openDoorWay, Function() action) { + return GestureDetector( + onTap: action, + child: Container( + color: Colors.white, + height: 90.h, + child: Row( + children: [ + SizedBox( + width: 30.w, + ), + Image.asset( + avatarURL, + width: 60.w, + height: 60.w, + ), + SizedBox( + width: 20.w, + ), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + familyAccount, + style: TextStyle( + fontSize: 24.sp, color: AppColors.blackColor), + ), + SizedBox(width: 10.w), + Expanded( + child: SizedBox( + width: 20.w, + )) + ], + ), + SizedBox(height: 10.h), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + openDoorWay, + style: TextStyle( + fontSize: 18.sp, + color: AppColors.placeholderTextColor), + ), + ], + ), + SizedBox(width: 20.h), + ], + ), + ), + Image.asset( + 'images/icon_right_grey.png', + width: 26.w, + height: 20.h, + ), + SizedBox(width: 20.h), + ], + ), + ), + ); + } +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/coerceOpenDoor/coerceOpenDoor_state.dart b/star_lock/lib/main/lockDetail/lcokSet/coerceOpenDoor/coerceOpenDoor_state.dart new file mode 100644 index 00000000..34d6f155 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/coerceOpenDoor/coerceOpenDoor_state.dart @@ -0,0 +1,7 @@ +import 'package:get/get.dart'; + +class CoerceOpenDoorState { + var pageNum = 1.obs; //请求页码 + final pageSize = 20.obs; //请求每页数据条数 + final itemDataList = [].obs; +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/faceUnlock/faceUnlock_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/faceUnlock/faceUnlock_logic.dart new file mode 100644 index 00000000..1e57c852 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/faceUnlock/faceUnlock_logic.dart @@ -0,0 +1,6 @@ +import 'package:star_lock/main/lockDetail/lcokSet/faceUnlock/faceUnlock_state.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; + +class FaceUnlockLogic extends BaseGetXController { + final FaceUnlockState state = FaceUnlockState(); +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/faceUnlock/faceUnlock_page.dart b/star_lock/lib/main/lockDetail/lcokSet/faceUnlock/faceUnlock_page.dart index 46aa772d..20aebe50 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/faceUnlock/faceUnlock_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/faceUnlock/faceUnlock_page.dart @@ -1,6 +1,8 @@ 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/main/lockDetail/lcokSet/faceUnlock/faceUnlock_logic.dart'; import 'package:star_lock/tools/custom_bottom_sheet.dart'; import '../../../../app_settings/app_colors.dart'; @@ -15,27 +17,8 @@ class FaceUnlockPage extends StatefulWidget { } class _FaceUnlockPageState extends State { - bool faceOn = false; //面容开锁 - bool autoBright = false; //自动亮屏 - String senseDistance = '远距离'; //感应距离 - String antiMisoperation = '关闭'; //防误开 - List senseDistanceList = ['远距离', '近距离']; - List antiMisoperationList = ['关闭', '5秒', '10秒', '15秒', '30秒', '60秒']; - - //高亮样式 - 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: '添加和使用面容开锁时:\n', style: titleStyle), - TextSpan( - text: - '\n1、请尽量保持单人在门前操作;\n2、请站立在门锁正前方约0.5~0.8米,面向门锁;\n3、请保持脸部无遮挡,露出五官;\n4、面容识别异常时,可触摸数字键盘任意按键,手动重启人脸识别。', - style: subTipsStyle), - ]); + final logic = Get.put(FaceUnlockLogic()); + final state = Get.find().state; @override Widget build(BuildContext context) { @@ -62,15 +45,16 @@ class _FaceUnlockPageState extends State { rightWidget: SizedBox(width: 60.w, height: 50.h, child: _switch(2))), _buildSubTitleItem( - '感应距离', '感应到门前约1.5米有人时,将自动启动面部识别开锁。', senseDistance, () { - _openBottomItemSheet(senseDistanceList, 0); + '感应距离', '感应到门前约1.5米有人时,将自动启动面部识别开锁。', state.senseDistance.value, + () { + _openBottomItemSheet(state.senseDistanceList.value, 0); }), SizedBox( height: 30.h, ), - _buildSubTitleItem('防误开', '防误开已关闭,关门后仍可使用面容开锁', antiMisoperation, - () { - _openBottomItemSheet(antiMisoperationList, 1); + _buildSubTitleItem( + '防误开', '防误开已关闭,关门后仍可使用面容开锁', state.antiMisoperation.value, () { + _openBottomItemSheet(state.antiMisoperationList.value, 1); }), Expanded( child: SizedBox( @@ -155,7 +139,7 @@ class _FaceUnlockPageState extends State { child: Padding( padding: EdgeInsets.only(left: 20.w, top: 30.h, bottom: 40.h, right: 15.w), - child: RichText(text: tipsPreviewSpan)), + child: RichText(text: state.tipsPreviewSpan)), ); } @@ -164,13 +148,13 @@ class _FaceUnlockPageState extends State { activeColor: CupertinoColors.activeBlue, trackColor: CupertinoColors.systemGrey5, thumbColor: CupertinoColors.white, - value: getIndex == 1 ? faceOn : autoBright, + value: getIndex == 1 ? state.faceOn.value : state.autoBright.value, onChanged: (value) { setState(() { if (getIndex == 1) { - faceOn = value; + state.faceOn.value = value; } else { - autoBright = value; + state.autoBright.value = value; } }); }, @@ -190,10 +174,12 @@ class _FaceUnlockPageState extends State { chooseCallback: (value) { if (clickIndex == 0) { //感应距离 - senseDistance = senseDistanceList[value]; + state.senseDistance.value = + state.senseDistanceList.value[value]; } else if (clickIndex == 1) { //防误开 - antiMisoperation = antiMisoperationList[value]; + state.antiMisoperation.value = + state.antiMisoperationList.value[value]; } setState(() {}); diff --git a/star_lock/lib/main/lockDetail/lcokSet/faceUnlock/faceUnlock_state.dart b/star_lock/lib/main/lockDetail/lcokSet/faceUnlock/faceUnlock_state.dart index e69de29b..35cf61ae 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/faceUnlock/faceUnlock_state.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/faceUnlock/faceUnlock_state.dart @@ -0,0 +1,30 @@ +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'; + +class FaceUnlockState { + var isCheck = false.obs; + var faceOn = false.obs; //面容开锁 + var autoBright = false.obs; //自动亮屏 + var senseDistance = '远距离'.obs; //感应距离 + var antiMisoperation = '关闭'.obs; //防误开 + var senseDistanceList = ['远距离', '近距离'].obs; + var antiMisoperationList = ['关闭', '5秒', '10秒', '15秒', '30秒', '60秒'].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: '添加和使用面容开锁时:\n', style: titleStyle), + TextSpan( + text: + '\n1、请尽量保持单人在门前操作;\n2、请站立在门锁正前方约0.5~0.8米,面向门锁;\n3、请保持脸部无遮挡,露出五官;\n4、面容识别异常时,可触摸数字键盘任意按键,手动重启人脸识别。', + style: subTipsStyle), + ]); +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/familyDetails/familyDetails_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/familyDetails/familyDetails_logic.dart new file mode 100644 index 00000000..dc8c8e61 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/familyDetails/familyDetails_logic.dart @@ -0,0 +1,6 @@ +import 'package:star_lock/main/lockDetail/lcokSet/familyDetails/familyDetails_state.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; + +class FamilyDetailsLogic extends BaseGetXController { + final FamilyDetailsState state = FamilyDetailsState(); +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/familyDetails/familyDetails_page.dart b/star_lock/lib/main/lockDetail/lcokSet/familyDetails/familyDetails_page.dart new file mode 100644 index 00000000..667e4e12 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/familyDetails/familyDetails_page.dart @@ -0,0 +1,167 @@ +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/main/lockDetail/lcokSet/familyDetails/familyDetails_logic.dart'; +import 'package:star_lock/tools/commonItem.dart'; +import 'package:star_lock/tools/showTFView.dart'; +import 'package:star_lock/tools/submitBtn.dart'; +import 'package:star_lock/translations/trans_lib.dart'; + +import '../../../../../app_settings/app_colors.dart'; +import '../../../../../tools/titleAppBar.dart'; + +class FamilyDetailsPage extends StatefulWidget { + const FamilyDetailsPage({Key? key}) : super(key: key); + + @override + State createState() => _FamilyDetailsPageState(); +} + +class _FamilyDetailsPageState extends State { + final logic = Get.put(FamilyDetailsLogic()); + final state = Get.find().state; + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar( + barTitle: '家人详情', + haveBack: true, + backgroundColor: AppColors.mainColor), + body: Container( + padding: EdgeInsets.all(30.w), + child: Column( + children: [ + CommonItem( + leftTitel: '开门方式', + rightTitle: '电子钥匙', + isHaveLine: true, + isHaveDirection: true, + action: () { + //锁用户 + Get.toNamed(Routers.lockUserPage); + }), + Obx(() => CommonItem( + leftTitel: '家人', + rightTitle: state.familyName.value, + isHaveLine: true, + isHaveRightWidget: false, + isHaveDirection: true, + action: () { + state.changeNameController.text = state.familyName.value; + _showEditNameAlert(context); + }, + )), + SizedBox( + height: 20.h, + ), + Container( + color: Colors.white, + margin: EdgeInsets.only(bottom: 10.h), + child: Column( + children: [ + CommonItem( + leftTitel: '提醒方式', + rightTitle: "", + isHaveLine: false, + isHaveRightWidget: false, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.notificationModePage); + }, + ), + Container( + padding: EdgeInsets.only( + left: 10.w, right: 10.w, top: 12.h, bottom: 12.h), + margin: EdgeInsets.only(bottom: 20.h, top: 10.h), + decoration: BoxDecoration( + color: AppColors.mainBackgroundColor, + borderRadius: BorderRadius.circular(6.0.w), + ), + child: Text( + 'APP推送 管理员', + style: TextStyle(color: Colors.black, fontSize: 20.sp), + ), + ) + ], + ), + ), + Expanded( + child: SizedBox( + height: 40.h, + )), + SubmitBtn( + btnName: '删除', + isDelete: true, + onClick: () { + _showDialog(context); + }, + ), + SizedBox( + height: 60.h, + ) + ], + ), + ), + ); + } + + //确认弹窗 + void _showDialog(widgetContext) { + showCupertinoDialog( + context: widgetContext, + builder: (context) { + return CupertinoAlertDialog( + title: Text( + '是否删除家人', + style: TextStyle(color: Colors.black, fontSize: 24.sp), + ), + content: Text('删除家人后,你将不会收到他到家的消息。', + style: TextStyle( + color: AppColors.darkGrayTextColor, fontSize: 22.sp)), + actions: [ + CupertinoDialogAction( + child: Text( + '取消', + style: TextStyle(color: AppColors.mainColor), + ), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + CupertinoDialogAction( + child: Text('删除', style: TextStyle(color: AppColors.mainColor)), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }, + ); + } + + void _showEditNameAlert(BuildContext context) { + showDialog( + context: context, + builder: (BuildContext context) { + return ShowTFView( + title: + "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}", + tipTitle: "请输入", + controller: state.changeNameController, + sureClick: () { + Navigator.pop(context); + state.familyName.value = state.changeNameController.text; + }, + cancelClick: () { + Navigator.pop(context); + }, + ); + }, + ); + } +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/familyDetails/familyDetails_state.dart b/star_lock/lib/main/lockDetail/lcokSet/familyDetails/familyDetails_state.dart new file mode 100644 index 00000000..f809fa22 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/familyDetails/familyDetails_state.dart @@ -0,0 +1,7 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +class FamilyDetailsState { + TextEditingController changeNameController = TextEditingController(); //修改名称 + var familyName = '我'.obs; +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart index eafca6ec..d5686bb3 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart @@ -27,8 +27,6 @@ class LockSetPage extends StatefulWidget { class _LockSetPageState extends State with RouteAware { final logic = Get.put(LockSetLogic()); final state = Get.find().state; - bool isClick1 = false; - bool isClick2 = false; @override void initState() { @@ -209,7 +207,9 @@ class _LockSetPageState extends State with RouteAware { SizedBox(height: 10.h), // 常开模式 Obx(() => Visibility( - visible: state.lockFeature.value.passageMode == 1 ? true : false, + visible: state.lockFeature.value.passageMode == 1 + ? true + : false, // visible:true, child: CommonItem( leftTitel: @@ -284,7 +284,7 @@ class _LockSetPageState extends State with RouteAware { Visibility( visible: true, child: CommonItem( - leftTitel: '消息通知', + leftTitel: '消息提醒', rightTitle: "", isHaveLine: true, isHaveDirection: true, @@ -294,12 +294,12 @@ class _LockSetPageState extends State with RouteAware { Visibility( visible: true, child: CommonItem( - leftTitel: '猫眼工作模式', + leftTitel: '猫眼设置', rightTitle: "", isHaveLine: true, isHaveDirection: true, action: () { - Get.toNamed(Routers.catEyeWorkModePage); + Get.toNamed(Routers.catEyeSetPage); })), // Obx(() => //自动亮屏已包括至面容开锁模块 @@ -352,27 +352,7 @@ class _LockSetPageState extends State with RouteAware { Get.toNamed(Routers.motorPowerPage); })), // ), - // Obx(() => - Visibility( - visible: true, - child: CommonItem( - leftTitel: '逗留警告', - rightTitle: "", - isHaveLine: true, - isHaveRightWidget: true, - rightWidget: _otherToDoSwitch(0), - )), - // ), - // Obx(() => - Visibility( - visible: true, - child: CommonItem( - leftTitel: '异常警告', - rightTitle: "", - isHaveLine: true, - isHaveRightWidget: true, - rightWidget: _otherToDoSwitch(1))), - // ), + SizedBox(height: 10.h), //-----新增至此 // 标记房态 @@ -384,7 +364,9 @@ class _LockSetPageState extends State with RouteAware { title = TranslationLoader.lanKeys!.leisure!.tr; } return Visibility( - visible: state.lockStatus.value.roomStatus == 1 ? true : false, + visible: state.lockStatus.value.roomStatus == 1 + ? true + : false, child: CommonItem( leftTitel: TranslationLoader.lanKeys!.markedHouseState!.tr, @@ -392,9 +374,11 @@ class _LockSetPageState extends State with RouteAware { isHaveLine: true, isHaveDirection: true, action: () { - Get.toNamed(Routers.markedHouseStatePage, arguments: { - 'lockSetInfoData': state.lockSetInfoData.value - }); + Get.toNamed(Routers.markedHouseStatePage, + arguments: { + 'lockSetInfoData': + state.lockSetInfoData.value + }); })); }), // 考勤 @@ -542,20 +526,21 @@ class _LockSetPageState extends State with RouteAware { } CupertinoSwitch _openCheckInSwitch() { - print("111111state.lockSettingInfo.value.attendance:${state.lockSettingInfo.value.attendance}"); + print( + "111111state.lockSettingInfo.value.attendance:${state.lockSettingInfo.value.attendance}"); return CupertinoSwitch( activeColor: CupertinoColors.activeBlue, trackColor: CupertinoColors.systemGrey5, thumbColor: CupertinoColors.white, value: ((state.isAttendance.value) == 1) ? true : false, onChanged: (value) { - logic.openCheckingInData((checkingInInfoDataEntity) { - if (checkingInInfoDataEntity.data!.companyId == 0) { - showCupertinoAlertDialog(context); - } else { - logic.setLockSetGeneralSetting(); - } - }); + logic.openCheckingInData((checkingInInfoDataEntity) { + if (checkingInInfoDataEntity.data!.companyId == 0) { + showCupertinoAlertDialog(context); + } else { + logic.setLockSetGeneralSetting(); + } + }); }, ); } @@ -586,24 +571,6 @@ class _LockSetPageState extends State with RouteAware { ); } - CupertinoSwitch _otherToDoSwitch(int clickIndex) { - return CupertinoSwitch( - activeColor: CupertinoColors.activeBlue, - trackColor: CupertinoColors.systemGrey5, - thumbColor: CupertinoColors.white, - value: clickIndex == 0 ? isClick1 : isClick2, - onChanged: (value) { - setState(() { - if (clickIndex == 0) { - isClick1 = value; - } else { - isClick2 = value; - } - }); - }, - ); - } - //确认弹窗 void showCupertinoAlertDialog(widgetContext) { showCupertinoDialog( diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockUser/lockUser_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/lockUser/lockUser_logic.dart new file mode 100644 index 00000000..f670945a --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/lockUser/lockUser_logic.dart @@ -0,0 +1,6 @@ +import 'package:star_lock/main/lockDetail/lcokSet/lockUser/lockUser_state.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; + +class LockUserLogic extends BaseGetXController { + final LockUserState state = LockUserState(); +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockUser/lockUser_page.dart b/star_lock/lib/main/lockDetail/lcokSet/lockUser/lockUser_page.dart new file mode 100644 index 00000000..d41f1087 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/lockUser/lockUser_page.dart @@ -0,0 +1,170 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:star_lock/main/lockDetail/lcokSet/lockUser/lockUser_logic.dart'; +import '../../../../app_settings/app_colors.dart'; +import '../../../../tools/submitBtn.dart'; +import '../../../../tools/titleAppBar.dart'; +import '../../../../translations/trans_lib.dart'; + +class LockUserPage extends StatefulWidget { + const LockUserPage({Key? key}) : super(key: key); + + @override + State createState() => _LockUserPageState(); +} + +class _LockUserPageState extends State { + final logic = Get.put(LockUserLogic()); + 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: [ + _searchWidget(), + SizedBox( + height: 20.h, + ), + Expanded(child: _buildMainUI()), + SubmitBtn( + btnName: '确定', + onClick: () {}, + ), + SizedBox( + height: 64.h, + ) + ], + )); + } + + Widget _searchWidget() { + return Container( + height: 60.h, + margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 10.w), + decoration: BoxDecoration( + color: Colors.white, borderRadius: BorderRadius.circular(5)), + child: TextField( + //输入框一行 + maxLines: 1, + // controller: _controller, + autofocus: false, + controller: state.searchController, + onSubmitted: (value) {}, + decoration: InputDecoration( + //输入里面输入文字内边距设置 + contentPadding: const EdgeInsets.only( + top: 12.0, left: -19.0, right: -15.0, bottom: 8.0), + hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr, + hintStyle: TextStyle(fontSize: 22.sp, height: 3.0), + //不需要输入框下划线 + border: InputBorder.none, + //左边图标设置 + icon: Padding( + padding: EdgeInsets.only( + top: 20.h, bottom: 20.h, right: 20.w, left: 10.w), + child: Image.asset( + 'images/main/icon_main_search.png', + width: 40.w, + height: 40.w, + ), + ), + ), + ), + ); + } + + Widget _buildMainUI() { + return ListView.separated( + shrinkWrap: true, + itemCount: 3, + itemBuilder: (c, index) { + return _electronicKeyItem('images/controls_user.png', '我', '永久', () { + state.isCheck.value = !state.isCheck.value; + }); + }, + separatorBuilder: (BuildContext context, int index) { + return const Divider( + height: 1, + color: AppColors.greyLineColor, + ); + }, + ); + } + + Widget _electronicKeyItem( + String avatarURL, String receiveUser, String useDate, Function() action) { + return GestureDetector( + onTap: action, + child: Container( + color: Colors.white, + height: 90.h, + child: Row( + children: [ + SizedBox( + width: 30.w, + ), + Image.asset( + avatarURL, + width: 60.w, + height: 60.w, + ), + SizedBox( + width: 20.w, + ), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + receiveUser, + style: TextStyle( + fontSize: 24.sp, color: AppColors.blackColor), + ), + SizedBox(width: 10.w), + Expanded( + child: SizedBox( + width: 20.w, + )), + ], + ), + SizedBox(height: 10.h), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + useDate, + style: TextStyle( + fontSize: 18.sp, + color: AppColors.placeholderTextColor), + ), + ], + ), + SizedBox(width: 20.h), + ], + ), + ), + Obx(() => Image.asset( + state.isCheck.value == true + ? 'images/icon_round_selet.png' + : 'images/icon_round_unSelet.png', + width: 30.w, + height: 30.w, + )), + SizedBox(width: 20.h), + ], + ), + ), + ); + } +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockUser/lockUser_state.dart b/star_lock/lib/main/lockDetail/lcokSet/lockUser/lockUser_state.dart new file mode 100644 index 00000000..8365618c --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/lockUser/lockUser_state.dart @@ -0,0 +1,7 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +class LockUserState { + TextEditingController searchController = TextEditingController(); //邮箱/手机号输入框 + var isCheck = false.obs; +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/lowBatteryReminder/lowBatteryReminder_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/lowBatteryReminder/lowBatteryReminder_logic.dart new file mode 100644 index 00000000..833130f5 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/lowBatteryReminder/lowBatteryReminder_logic.dart @@ -0,0 +1,6 @@ +import 'package:star_lock/main/lockDetail/lcokSet/lowBatteryReminder/lowBatteryReminder_state.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; + +class LowBatteryReminderLogic extends BaseGetXController { + LowBatteryReminderState state = LowBatteryReminderState(); +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/lowBatteryReminder/lowBatteryReminder_page.dart b/star_lock/lib/main/lockDetail/lcokSet/lowBatteryReminder/lowBatteryReminder_page.dart new file mode 100644 index 00000000..1b2a5e4f --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/lowBatteryReminder/lowBatteryReminder_page.dart @@ -0,0 +1,132 @@ +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/main/lockDetail/lcokSet/lowBatteryReminder/lowBatteryReminder_logic.dart'; +import 'package:star_lock/tools/commonItem.dart'; +import 'package:star_lock/tools/submitBtn.dart'; + +import '../../../../../app_settings/app_colors.dart'; +import '../../../../../tools/titleAppBar.dart'; + +class LowBatteryReminderPage extends StatefulWidget { + const LowBatteryReminderPage({Key? key}) : super(key: key); + + @override + State createState() => _LowBatteryReminderPageState(); +} + +class _LowBatteryReminderPageState extends State { + final logic = Get.put(LowBatteryReminderLogic()); + final state = Get.find().state; + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar( + barTitle: '低电量提醒', + haveBack: true, + backgroundColor: AppColors.mainColor), + body: Container( + padding: EdgeInsets.all(30.w), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + child: Text( + "打开提醒后,当锁电量低于20%、10%和5%,系统会给指定对象发送提醒消息。电量读取方式:网关读取或APP读取。", + style: TextStyle( + fontSize: 20.sp, color: AppColors.darkGrayTextColor), + )), + ], + ), + SizedBox( + height: 20.h, + ), + CommonItem( + leftTitel: '低电量提醒', + rightTitle: '', + isHaveLine: true, + isHaveDirection: false, + isHaveRightWidget: true, + rightWidget: _unOpenDoorSwitch(), + action: () {}), + Visibility( + visible: state.isLowBatteryNotify.value, + child: Column( + children: [ + SizedBox( + height: 20.h, + ), + Container( + color: Colors.white, + margin: EdgeInsets.only(bottom: 10.h), + child: Column( + children: [ + CommonItem( + leftTitel: '提醒方式', + rightTitle: "", + isHaveLine: false, + isHaveRightWidget: false, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.notificationModePage); + }, + ), + Container( + padding: EdgeInsets.only( + left: 10.w, + right: 10.w, + top: 12.h, + bottom: 12.h), + margin: EdgeInsets.only(bottom: 20.h, top: 10.h), + decoration: BoxDecoration( + color: AppColors.mainBackgroundColor, + borderRadius: BorderRadius.circular(6.0.w), + ), + child: Text( + 'APP推送 管理员', + style: TextStyle( + color: Colors.black, fontSize: 20.sp), + ), + ) + ], + ), + ) + ], + )), + Expanded( + child: SizedBox( + height: 20.h, + )), + SubmitBtn( + btnName: '保存', + onClick: () {}, + ), + SizedBox( + height: 60.h, + ) + ], + ), + ), + ); + } + + CupertinoSwitch _unOpenDoorSwitch() { + return CupertinoSwitch( + activeColor: CupertinoColors.activeBlue, + trackColor: CupertinoColors.systemGrey5, + thumbColor: CupertinoColors.white, + value: state.isLowBatteryNotify.value, + onChanged: (value) { + setState(() { + state.isLowBatteryNotify.value = value; + }); + }, + ); + } +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/lowBatteryReminder/lowBatteryReminder_state.dart b/star_lock/lib/main/lockDetail/lcokSet/lowBatteryReminder/lowBatteryReminder_state.dart new file mode 100644 index 00000000..d1af398d --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/lowBatteryReminder/lowBatteryReminder_state.dart @@ -0,0 +1,5 @@ +import 'package:get/get.dart'; + +class LowBatteryReminderState { + var isLowBatteryNotify = false.obs; // 是否低电量提醒 +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/msgNotification/msgNotification_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/msgNotification/msgNotification_logic.dart new file mode 100644 index 00000000..9817187a --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/msgNotification/msgNotification_logic.dart @@ -0,0 +1,6 @@ +import 'package:star_lock/main/lockDetail/lcokSet/msgNotification/msgNotification_state.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; + +class MsgNotificationLogic extends BaseGetXController { + final MsgNotificationState state = MsgNotificationState(); +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/msgNotification/msgNotification_page.dart b/star_lock/lib/main/lockDetail/lcokSet/msgNotification/msgNotification_page.dart index 5ba9d195..de53e6b6 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/msgNotification/msgNotification_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/msgNotification/msgNotification_page.dart @@ -1,7 +1,9 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:star_lock/tools/custom_bottom_sheet.dart'; +import 'package:get/get.dart'; +import 'package:star_lock/appRouters.dart'; +import 'package:star_lock/main/lockDetail/lcokSet/msgNotification/msgNotification_logic.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/commonItem.dart'; @@ -15,12 +17,8 @@ class MsgNotificationPage extends StatefulWidget { } class _MsgNotificationPageState extends State { - bool faceOn = false; //面容开锁 - bool autoBright = false; //自动亮屏 - String senseDistance = '远距离'; //感应距离 - String antiMisoperation = '关闭'; //防误开 - List senseDistanceList = ['远距离', '近距离']; - List antiMisoperationList = ['关闭', '5秒', '10秒', '15秒', '30秒', '60秒']; + final logic = Get.put(MsgNotificationLogic()); + final state = Get.find().state; //高亮样式 final TextStyle titleStyle = TextStyle( @@ -42,212 +40,194 @@ class _MsgNotificationPageState extends State { return Scaffold( backgroundColor: Colors.white, appBar: TitleAppBar( - barTitle: '消息通知', + barTitle: '消息提醒', haveBack: true, backgroundColor: AppColors.mainColor), - body: Column( - children: [ - Container( - alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: 40.w, top: 40.h, bottom: 30.h), - child: Text( - '门锁通知', - style: TextStyle( - color: AppColors.msgNoticeTextColor, fontSize: 24.sp), - ), - ), - CommonItem( - leftTitel: '回家开门', - rightTitle: "已启用", - isHaveLine: false, - isHaveDirection: true, - ), - SizedBox( - height: 20.h, - ), - CommonItem( - leftTitel: '离家开门', - rightTitle: "", - isHaveLine: false, - isHaveRightWidget: true, - rightWidget: - SizedBox(width: 60.w, height: 50.h, child: _switch(2))), - SizedBox( - height: 20.h, - ), - CommonItem( - leftTitel: '关门', - rightTitle: "", - isHaveLine: false, - isHaveRightWidget: true, - rightWidget: - SizedBox(width: 60.w, height: 50.h, child: _switch(2))), - SizedBox( - height: 20.h, - ), - CommonItem( - leftTitel: '异常', - rightTitle: "已启用", - isHaveLine: true, - isHaveDirection: true, - ), - SizedBox( - height: 30.h, - ), - Container( - alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: 40.w, top: 40.h, bottom: 30.h), - child: Text( - '门铃通知', - style: TextStyle( - color: AppColors.msgNoticeTextColor, fontSize: 24.sp), - ), - ), - CommonItem( - leftTitel: '有人按门铃', - rightTitle: "", - isHaveLine: false, - isHaveRightWidget: true, - rightWidget: - SizedBox(width: 60.w, height: 50.h, child: _switch(2))), - SizedBox( - height: 30.h, - ), - Container( - alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: 40.w, top: 40.h, bottom: 30.h), - child: Text( - '猫眼通知', - style: TextStyle( - color: AppColors.msgNoticeTextColor, fontSize: 24.sp), - ), - ), - CommonItem( - leftTitel: '有人出现在门口', - rightTitle: "", - isHaveLine: false, - isHaveRightWidget: true, - rightWidget: - SizedBox(width: 60.w, height: 50.h, child: _switch(2))), - ], + body: SingleChildScrollView( + child: _buildMainItem(), )); } - 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, - ) - ], + Widget _buildMainItem() { + return Column( + children: [ + Container( + alignment: Alignment.centerLeft, + margin: EdgeInsets.only(left: 40.w, top: 40.h, bottom: 30.h), + child: Text( + '门锁通知', + style: + TextStyle(color: AppColors.msgNoticeTextColor, fontSize: 24.sp), + ), ), - ), - ); - } - - Widget _buildTipsView() { - return Container( - width: ScreenUtil().screenWidth - 40.w, - margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h), - decoration: BoxDecoration( - color: AppColors.mainBackgroundColor, - borderRadius: BorderRadius.circular(10.0), - ), - child: Padding( - padding: - EdgeInsets.only(left: 20.w, top: 30.h, bottom: 40.h, right: 15.w), - child: RichText(text: tipsPreviewSpan)), + CommonItem( + leftTitel: '开门通知', + rightTitle: "已启用", + isHaveLine: false, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.openDoorNotifyPage); + }, + ), + SizedBox( + height: 20.h, + ), + CommonItem( + leftTitel: 'N天未开门', + rightTitle: "已启用", + isHaveLine: false, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.nDaysUnopenedPage); + }, + ), + SizedBox( + height: 20.h, + ), + Obx(() => CommonItem( + leftTitel: '离家开门', + rightTitle: "", + isHaveLine: false, + isHaveRightWidget: true, + rightWidget: + SizedBox(width: 60.w, height: 50.h, child: _switch(1)))), + SizedBox( + height: 20.h, + ), + Obx(() => CommonItem( + leftTitel: '门未关好', + rightTitle: "", + isHaveLine: false, + isHaveRightWidget: true, + rightWidget: + SizedBox(width: 60.w, height: 50.h, child: _switch(2)))), + SizedBox( + height: 20.h, + ), + CommonItem( + leftTitel: '防拆报警', + rightTitle: "已启用", + isHaveLine: false, + isHaveDirection: true, + ), + SizedBox( + height: 20.h, + ), + CommonItem( + leftTitel: '低电量提醒', + rightTitle: "已启用", + isHaveLine: false, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.lowBatteryReminderPage); + }, + ), + SizedBox( + height: 20.h, + ), + CommonItem( + leftTitel: '胁迫开门', + rightTitle: "", + isHaveLine: true, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.coerceOpenDoorPage); + }, + ), + SizedBox( + height: 30.h, + ), + Container( + alignment: Alignment.centerLeft, + margin: EdgeInsets.only(left: 40.w, top: 40.h, bottom: 30.h), + child: Text( + '门铃通知', + style: + TextStyle(color: AppColors.msgNoticeTextColor, fontSize: 24.sp), + ), + ), + Obx(() => CommonItem( + leftTitel: '有人按门铃', + rightTitle: "", + isHaveLine: true, + isHaveRightWidget: true, + rightWidget: + SizedBox(width: 60.w, height: 50.h, child: _switch(3)))), + SizedBox( + height: 30.h, + ), + Container( + alignment: Alignment.centerLeft, + margin: EdgeInsets.only(left: 40.w, top: 40.h, bottom: 30.h), + child: Text( + '猫眼通知', + style: + TextStyle(color: AppColors.msgNoticeTextColor, fontSize: 24.sp), + ), + ), + Obx(() => CommonItem( + leftTitel: '有人出现在门口', + rightTitle: "", + isHaveLine: false, + isHaveRightWidget: true, + rightWidget: + SizedBox(width: 60.w, height: 50.h, child: _switch(4)))), + SizedBox( + height: 60.h, + ) + ], ); } CupertinoSwitch _switch(int getIndex) { + 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; + + default: + } return CupertinoSwitch( activeColor: CupertinoColors.activeBlue, trackColor: CupertinoColors.systemGrey5, thumbColor: CupertinoColors.white, - value: getIndex == 1 ? faceOn : autoBright, + value: isCheck, onChanged: (value) { - setState(() { - if (getIndex == 1) { - faceOn = value; - } else { - autoBright = value; - } - }); + switch (getIndex) { + //离家开门 + case 1: + state.isLeaveHomeOpenDoor.value = value; + break; + //门未关好 + case 2: + state.isDoorNotShut.value = value; + break; + //有人按门铃 + case 3: + state.isSomeoneRing.value = value; + break; + //有人出现在门口 + case 4: + state.isSomeoneAppeared.value = value; + break; + + default: + } }, ); } - - 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) { - //感应距离 - senseDistance = senseDistanceList[value]; - } else if (clickIndex == 1) { - //防误开 - antiMisoperation = antiMisoperationList[value]; - } - - setState(() {}); - }, - ); - }); - } } diff --git a/star_lock/lib/main/lockDetail/lcokSet/msgNotification/msgNotification_state.dart b/star_lock/lib/main/lockDetail/lcokSet/msgNotification/msgNotification_state.dart new file mode 100644 index 00000000..d0614ba5 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/msgNotification/msgNotification_state.dart @@ -0,0 +1,9 @@ +import 'package:get/get.dart'; + +class MsgNotificationState { + var isCheck = false.obs; + var isLeaveHomeOpenDoor = false.obs; //离家开门 + var isDoorNotShut = false.obs; //门未关好 + var isSomeoneRing = false.obs; //有人按门铃 + var isSomeoneAppeared = false.obs; //有人出现在门口 +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/nDaysUnopened/nDaysUnopened_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/nDaysUnopened/nDaysUnopened_logic.dart new file mode 100644 index 00000000..5b7aa719 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/nDaysUnopened/nDaysUnopened_logic.dart @@ -0,0 +1,6 @@ +import 'package:star_lock/main/lockDetail/lcokSet/nDaysUnopened/nDaysUnopened_state.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; + +class NDaysUnopenedLogic extends BaseGetXController { + NDaysUnopenedState state = NDaysUnopenedState(); +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/nDaysUnopened/nDaysUnopened_page.dart b/star_lock/lib/main/lockDetail/lcokSet/nDaysUnopened/nDaysUnopened_page.dart new file mode 100644 index 00000000..3da8e3d7 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/nDaysUnopened/nDaysUnopened_page.dart @@ -0,0 +1,154 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_pickers/pickers.dart'; +import 'package:flutter_pickers/style/default_style.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:star_lock/appRouters.dart'; +import 'package:star_lock/main/lockDetail/lcokSet/nDaysUnopened/nDaysUnopened_logic.dart'; +import 'package:star_lock/tools/commonItem.dart'; +import 'package:star_lock/tools/submitBtn.dart'; + +import '../../../../../app_settings/app_colors.dart'; +import '../../../../../tools/titleAppBar.dart'; + +class NDaysUnopenedPage extends StatefulWidget { + const NDaysUnopenedPage({Key? key}) : super(key: key); + + @override + State createState() => _NDaysUnopenedPageState(); +} + +class _NDaysUnopenedPageState extends State { + final logic = Get.put(NDaysUnopenedLogic()); + final state = Get.find().state; + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar( + barTitle: 'N天未开门', + haveBack: true, + backgroundColor: AppColors.mainColor), + body: Container( + padding: EdgeInsets.all(30.w), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + child: Text( + "经过以上设定的时间,锁没有被开启,系统会给指定对象发送提醒消息,该功能需要锁联网", + style: TextStyle( + fontSize: 20.sp, color: AppColors.darkGrayTextColor), + )), + ], + ), + SizedBox( + height: 20.h, + ), + CommonItem( + leftTitel: 'N天未开门提醒', + rightTitle: '', + isHaveLine: true, + isHaveDirection: false, + isHaveRightWidget: true, + rightWidget: _unOpenDoorSwitch(), + action: () {}), + Visibility( + visible: state.isunOpenNotice.value, + child: Column( + children: [ + Obx(() => CommonItem( + leftTitel: '门未开时间', + rightTitle: state.unOpenDoorTime.value, + isHaveLine: true, + isHaveRightWidget: false, + isHaveDirection: true, + action: () { + _openBottomItemSheet( + context, state.unopenDoorTimeList); + }, + )), + SizedBox( + height: 20.h, + ), + Container( + color: Colors.white, + margin: EdgeInsets.only(bottom: 10.h), + child: Column( + children: [ + CommonItem( + leftTitel: '提醒方式', + rightTitle: "", + isHaveLine: false, + isHaveRightWidget: false, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.notificationModePage); + }, + ), + Container( + padding: EdgeInsets.only( + left: 10.w, + right: 10.w, + top: 12.h, + bottom: 12.h), + margin: EdgeInsets.only(bottom: 20.h, top: 10.h), + decoration: BoxDecoration( + color: AppColors.mainBackgroundColor, + borderRadius: BorderRadius.circular(6.0.w), + ), + child: Text( + 'APP推送 管理员', + style: TextStyle( + color: Colors.black, fontSize: 20.sp), + ), + ) + ], + ), + ) + ], + )), + Expanded( + child: SizedBox( + height: 20.h, + )), + SubmitBtn( + btnName: '保存', + onClick: () {}, + ), + SizedBox( + height: 60.h, + ) + ], + ), + ), + ); + } + + CupertinoSwitch _unOpenDoorSwitch() { + return CupertinoSwitch( + activeColor: CupertinoColors.activeBlue, + trackColor: CupertinoColors.systemGrey5, + thumbColor: CupertinoColors.white, + value: state.isunOpenNotice.value, + onChanged: (value) { + setState(() { + state.isunOpenNotice.value = value; + }); + }, + ); + } + + //底部选择pickerView + _openBottomItemSheet(BuildContext context, List dataList) { + Pickers.showSinglePicker(context, + data: dataList, + pickerStyle: DefaultPickerStyle(), onConfirm: (p, position) { + state.unOpenDoorTime.value = p; + }, onChanged: (p, position) {}); + } +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/nDaysUnopened/nDaysUnopened_state.dart b/star_lock/lib/main/lockDetail/lcokSet/nDaysUnopened/nDaysUnopened_state.dart new file mode 100644 index 00000000..f7c79b23 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/nDaysUnopened/nDaysUnopened_state.dart @@ -0,0 +1,24 @@ +import 'package:get/get.dart'; + +class NDaysUnopenedState { + final List unopenDoorTimeList = [ + '1天', + '2天', + '3天', + '4天', + '5天', + '6天', + '7天', + '8天', + '9天', + '10天', + '11天', + '12天', + '13天', + '14天', + '15天', + ]; + + var isunOpenNotice = false.obs; // 是否N天未开门提醒 + var unOpenDoorTime = '1天'.obs; // 未开门时间 +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/notificationMode/notificationMode_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/notificationMode/notificationMode_logic.dart new file mode 100644 index 00000000..c793f3d8 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/notificationMode/notificationMode_logic.dart @@ -0,0 +1,6 @@ +import 'package:star_lock/main/lockDetail/lcokSet/notificationMode/notificationMode_state.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; + +class NotificationModeLogic extends BaseGetXController { + NotificationModeState state = NotificationModeState(); +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/notificationMode/notificationMode_page.dart b/star_lock/lib/main/lockDetail/lcokSet/notificationMode/notificationMode_page.dart new file mode 100644 index 00000000..d3f1eba8 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/notificationMode/notificationMode_page.dart @@ -0,0 +1,343 @@ +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/main/lockDetail/lcokSet/notificationMode/notificationMode_logic.dart'; +import 'package:star_lock/tools/commonItem.dart'; +import 'package:star_lock/tools/submitBtn.dart'; +import 'package:star_lock/translations/trans_lib.dart'; + +import '../../../../../app_settings/app_colors.dart'; +import '../../../../../tools/titleAppBar.dart'; + +class NotificationModePage extends StatefulWidget { + const NotificationModePage({Key? key}) : super(key: key); + + @override + State createState() => _NotificationModePageState(); +} + +class _NotificationModePageState extends State { + final logic = Get.put(NotificationModeLogic()); + final state = Get.find().state; + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar( + barTitle: '提醒方式', + haveBack: true, + backgroundColor: AppColors.mainColor), + body: SingleChildScrollView( + child: _buildMainView(), + )); + } + + Widget _buildMainView() { + return Column( + children: [ + CommonItem( + leftTitel: 'APP推送', + rightTitle: '管理员', + isHaveLine: true, + isHaveDirection: false, + action: () {}), + SizedBox( + height: 10.h, + ), + CommonItem( + leftTitel: '邮件提醒', + rightTitle: '', + isHaveLine: true, + isHaveDirection: false, + isHaveRightWidget: true, + rightWidget: state.emailReceiverList.value.length < 3 + ? Image.asset( + 'images/icon_btn_add.png', + width: 32.w, + height: 32.w, + ) + : Container(), + action: () { + if (state.emailReceiverList.value.length < 3) { + setState(() { + state.emailReceiverList.value.add(1); + }); + } + }), + Obx(() => SizedBox( + height: state.emailReceiverList.value.length * 62.h, + child: ListView.separated( + itemCount: state.emailReceiverList.value.length, + itemBuilder: (BuildContext context, int index) { + return _buildReceiverItem(index, true); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider( + height: 1.h, + color: AppColors.greyBackgroundColor, + ); + }, + ), + )), + SizedBox( + height: 10.h, + ), + CommonItem( + leftTitel: '短信提醒', + rightTitle: '', + isHaveLine: true, + isHaveDirection: false, + isHaveRightWidget: true, + rightWidget: state.phoneReceiverList.value.length < 3 + ? Image.asset( + 'images/icon_btn_add.png', + width: 32.w, + height: 32.w, + ) + : Container(), + action: () { + if (state.phoneReceiverList.value.length < 3) { + setState(() { + state.phoneReceiverList.value.add(1); + }); + } + }), + SizedBox( + height: state.phoneReceiverList.value.length * 62.h, + child: ListView.separated( + itemCount: state.phoneReceiverList.value.length, + itemBuilder: (BuildContext context, int index) { + return _buildReceiverItem(index, false); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider( + height: 1.h, + color: AppColors.greyBackgroundColor, + ); + }, + ), + ), + SizedBox( + height: 60.h, + ), + SubmitBtn( + btnName: '确定', + onClick: () {}, + ) + ], + ); + } + + Widget _buildReceiverItem(int index, bool isEmail) { + return Container( + color: Colors.white, + child: Row( + children: [ + GestureDetector( + child: SizedBox( + // width: 40.w, + child: Row( + children: [ + SizedBox( + width: 20.w, + ), + Image.asset( + 'images/icon_massSend_delete.png', + width: 26.w, + height: 26.w, + ) + ], + ), + ), + onTap: () { + setState(() { + if (isEmail) { + state.emailReceiverList.value.removeAt(index); + } else { + state.phoneReceiverList.value.removeAt(index); + } + }); + }, + ), + Expanded( + child: Column( + children: [ + massSendReceiverCellWidget( + leftTitel: TranslationLoader.lanKeys!.receiver!.tr, + rightTitle: state.inputEmailStr.value, + isHaveLine: true, + isHaveRightWidget: true, + rightWidget: isEmail + ? getEmailTFWidget('请输入Email', 1) + : getPhoneWidget('请输入手机号', 1)), + Divider( + color: AppColors.greyLineColor, + indent: 20.w, + endIndent: 20.w, + height: 1, + ), + ], + )) + ], + ), + ); + } + + // TextEditingController _receiverController(String getStr) { + // TextEditingController controller = TextEditingController(text: getStr); + // controller.addListener(() { + // state.inputEmailStr.value = controller.text; + // print(controller.text); + // }); + + // return controller; + // } + + // 接受者邮箱输入框 + Widget getEmailTFWidget(String tfStr, int lineIndex) { + TextEditingController emailController = TextEditingController(); + return SizedBox( + height: 50.h, + width: 360.w, + child: Row( + children: [ + Expanded( + child: TextField( + controller: emailController, + //输入框一行 + maxLines: 1, + autofocus: false, + textAlign: TextAlign.end, + decoration: InputDecoration( + //输入里面输入文字内边距设置 + contentPadding: const EdgeInsets.only(top: -12.0, bottom: 0.0), + hintText: tfStr, + hintStyle: TextStyle(fontSize: 22.sp), + //不需要输入框下划线 + border: InputBorder.none, + ), + ), + ), + ], + ), + ); + } + + // 接受者手机号输入框 + Widget getPhoneWidget(String tfStr, int lineIndex) { + TextEditingController phoneController = TextEditingController(); + + return SizedBox( + height: 50.h, + width: 360.w, + child: Row( + children: [ + Expanded( + child: GestureDetector( + child: Container( + width: 90.w, + color: Colors.white, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Obx(() => Text( + '+${state.countryCode}', + style: TextStyle( + color: AppColors.darkGrayTextColor, + fontSize: 20.sp), + )), + Image.asset( + 'images/icon_grayPullDown.png', + width: 20.w, + height: 20.w, + ), + ], + ), + ), + onTap: () async { + var result = await Get.toNamed(Routers.seletCountryRegionPage); + if (result != null) { + result as Map; + state.countryCode.value = result['code']; + state.countryName.value = result['countryName']; + } + }, + )), + SizedBox( + width: 5.w, + ), + SizedBox( + width: 180.w, + child: TextField( + controller: phoneController, + //输入框一行 + maxLines: 1, + autofocus: false, + textAlign: TextAlign.end, + decoration: InputDecoration( + //输入里面输入文字内边距设置 + contentPadding: const EdgeInsets.only(top: -12.0, bottom: 0.0), + hintText: tfStr, + hintStyle: TextStyle(fontSize: 22.sp), + //不需要输入框下划线 + border: InputBorder.none, + ), + ), + ), + ], + ), + ); + } + + Widget massSendReceiverCellWidget({ + String? leftTitel, + String? rightTitle, + bool? isHaveDirection, + bool? isHaveLine, + bool? isHaveRightWidget, + Widget? rightWidget, + Function()? action, + double? allHeight, + }) { + return Column( + // mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + height: 60.h, + color: Colors.white, + padding: EdgeInsets.only(right: 20.w), // , top: 20.w, bottom: 20.w + child: Row( + children: [ + SizedBox(width: 20.w), + Text(leftTitel!, style: TextStyle(fontSize: 22.sp)), + Expanded(child: SizedBox(width: 10.w)), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + isHaveRightWidget! + ? rightWidget! + : Text( + rightTitle ?? "", + textAlign: TextAlign.end, + // overflow: TextOverflow.ellipsis, + // maxLines: 1, + style: TextStyle( + fontSize: 22.sp, + color: AppColors.darkGrayTextColor), + ) + ], + ) + ], + ), + ) + ], + ); + } +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/notificationMode/notificationMode_state.dart b/star_lock/lib/main/lockDetail/lcokSet/notificationMode/notificationMode_state.dart new file mode 100644 index 00000000..fbaebd83 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/notificationMode/notificationMode_state.dart @@ -0,0 +1,9 @@ +import 'package:get/get.dart'; + +class NotificationModeState { + var inputEmailStr = ''.obs; // 输入的邮箱地址 + var emailReceiverList = [].obs; + var phoneReceiverList = [].obs; + var countryName = '中国'.obs; + var countryCode = '86'.obs; +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/openDoorNotify/openDoorNotify_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/openDoorNotify/openDoorNotify_logic.dart new file mode 100644 index 00000000..3d826370 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/openDoorNotify/openDoorNotify_logic.dart @@ -0,0 +1,6 @@ +import 'package:star_lock/main/lockDetail/lcokSet/openDoorNotify/openDoorNotify_state.dart'; +import 'package:star_lock/tools/baseGetXController.dart'; + +class OpenDoorNotifyLogic extends BaseGetXController { + final OpenDoorNotifyState state = OpenDoorNotifyState(); +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/openDoorNotify/openDoorNotify_page.dart b/star_lock/lib/main/lockDetail/lcokSet/openDoorNotify/openDoorNotify_page.dart new file mode 100644 index 00000000..cd52a042 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/openDoorNotify/openDoorNotify_page.dart @@ -0,0 +1,154 @@ +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/main/lockDetail/lcokSet/openDoorNotify/openDoorNotify_logic.dart'; +import '../../../../app_settings/app_colors.dart'; +import '../../../../tools/submitBtn.dart'; +import '../../../../tools/titleAppBar.dart'; + +class OpenDoorNotifyPage extends StatefulWidget { + const OpenDoorNotifyPage({Key? key}) : super(key: key); + + @override + State createState() => _OpenDoorNotifyPageState(); +} + +class _OpenDoorNotifyPageState extends State { + final logic = Get.put(OpenDoorNotifyLogic()); + final state = Get.find().state; + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar( + barTitle: '家人到家', + haveBack: true, + backgroundColor: AppColors.mainColor, + ), + body: Column( + children: [ + _topTipsWidget(), + SizedBox( + height: 20.h, + ), + Expanded(child: _buildMainUI()), + // Expanded( + // child: Obx(() => state.itemDataList.value.isEmpty + // ? const NoData() + // : _buildMainUI(state.itemDataList.value))), + AddBottomWhiteBtn( + btnName: '添加家人', + onClick: () { + Get.toNamed(Routers.addFamilyPage); + }, + ), + SizedBox( + height: 64.h, + ) + ], + )); + } + + Widget _topTipsWidget() { + return Container( + alignment: Alignment.centerLeft, + margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w), + child: Text( + '若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择', + style: TextStyle(color: AppColors.darkGrayTextColor, fontSize: 20.sp), + )); + } + + Widget _buildMainUI() { + return ListView.separated( + shrinkWrap: true, + itemCount: 3, + itemBuilder: (c, index) { + return _electronicKeyItem( + 'images/controls_user.png', '18682150237', '电子钥匙', () { + Get.toNamed(Routers.familyDetailsPage); + }); + }, + separatorBuilder: (BuildContext context, int index) { + return const Divider( + height: 1, + color: AppColors.greyLineColor, + ); + }, + ); + } + + Widget _electronicKeyItem(String avatarURL, String familyAccount, + String openDoorWay, Function() action) { + return GestureDetector( + onTap: action, + child: Container( + color: Colors.white, + height: 90.h, + child: Row( + children: [ + SizedBox( + width: 30.w, + ), + Image.asset( + avatarURL, + width: 60.w, + height: 60.w, + ), + SizedBox( + width: 20.w, + ), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + familyAccount, + style: TextStyle( + fontSize: 24.sp, color: AppColors.blackColor), + ), + SizedBox(width: 10.w), + Expanded( + child: SizedBox( + width: 20.w, + )) + ], + ), + SizedBox(height: 10.h), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + openDoorWay, + style: TextStyle( + fontSize: 18.sp, + color: AppColors.placeholderTextColor), + ), + ], + ), + SizedBox(width: 20.h), + ], + ), + ), + Image.asset( + 'images/icon_right_grey.png', + width: 26.w, + height: 20.h, + ), + SizedBox(width: 20.h), + ], + ), + ), + ); + } +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/openDoorNotify/openDoorNotify_state.dart b/star_lock/lib/main/lockDetail/lcokSet/openDoorNotify/openDoorNotify_state.dart new file mode 100644 index 00000000..1a0e4265 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/openDoorNotify/openDoorNotify_state.dart @@ -0,0 +1,7 @@ +import 'package:get/get.dart'; + +class OpenDoorNotifyState { + var pageNum = 1.obs; //请求页码 + final pageSize = 20.obs; //请求每页数据条数 + final itemDataList = [].obs; +} diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart index bda8dd6e..ef19d95a 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -401,6 +401,14 @@ class _LockDetailPageState extends State Get.toNamed(Routers.lockOperatingRecordPage, arguments: {"keyInfo": widget.lockListInfoItemEntity}); }), + // 视频日志 + bottomItem('images/main/icon_main_set.png', "视频日志", () { + //视频日志 + }), + // 消息提醒 + bottomItem('images/main/icon_main_set.png', "消息提醒", () { + Get.toNamed(Routers.msgNotificationPage); + }), // 设置 bottomItem( 'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr,