新增消息提醒模块

This commit is contained in:
Daisy 2023-11-13 09:47:19 +08:00
parent 5e920b9ada
commit e63b7eb07f
44 changed files with 2270 additions and 306 deletions

View File

@ -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())
];
}

View File

@ -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); //
}

View File

@ -86,7 +86,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
List<ElectronicKeyListItem> 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<AuthorizedAdminListPage> {
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<AuthorizedAdminListPage> {
);
}
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<AuthorizedAdminListPage> {
Get.back();
},
);
}
);
});
}
//使
@ -270,8 +282,8 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
// : Container(),
Expanded(
child: SizedBox(
width: 20.w,
)),
width: 20.w,
)),
// Text(
// keyStatus,
// style: TextStyle(fontSize: 18.sp, color: Colors.red),

View File

@ -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<AddFamilyPage> createState() => _AddFamilyPageState();
}
class _AddFamilyPageState extends State<AddFamilyPage> {
@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,
),
),
),
],
),
);
}
}

View File

@ -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();
}

View File

@ -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<CatEyeSetPage> createState() => _CatEyeSetPageState();
}
class _CatEyeSetPageState extends State<CatEyeSetPage> {
final logic = Get.put(CatEyeSetLogic());
final state = Get.find<CatEyeSetLogic>().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];
},
);
});
}
}

View File

@ -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; //
}

View File

@ -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<CoerceFingerprintPage> createState() => _CoerceFingerprintPageState();
}
class _CoerceFingerprintPageState extends State<CoerceFingerprintPage> {
@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,
)
],
),
),
);
}
}

View File

@ -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<CoerceFingerprintListPage> createState() =>
_CoerceFingerprintListPageState();
}
class _CoerceFingerprintListPageState extends State<CoerceFingerprintListPage> {
final logic = Get.put(LockUserLogic());
final state = Get.find<LockUserLogic>().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),
],
),
),
);
}
}

View File

@ -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();
}

View File

@ -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<CoerceOpenDoorPage> createState() => _CoerceOpenDoorPageState();
}
class _CoerceOpenDoorPageState extends State<CoerceOpenDoorPage> {
final logic = Get.put(CoerceOpenDoorLogic());
final state = Get.find<CoerceOpenDoorLogic>().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),
],
),
),
);
}
}

View File

@ -0,0 +1,7 @@
import 'package:get/get.dart';
class CoerceOpenDoorState {
var pageNum = 1.obs; //
final pageSize = 20.obs; //
final itemDataList = [].obs;
}

View File

@ -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();
}

View File

@ -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<FaceUnlockPage> {
bool faceOn = false; //
bool autoBright = false; //
String senseDistance = '远距离'; //
String antiMisoperation = '关闭'; //
List<String> senseDistanceList = ['远距离', '近距离'];
List<String> 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<FaceUnlockLogic>().state;
@override
Widget build(BuildContext context) {
@ -62,15 +45,16 @@ class _FaceUnlockPageState extends State<FaceUnlockPage> {
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<FaceUnlockPage> {
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<FaceUnlockPage> {
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<FaceUnlockPage> {
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(() {});

View File

@ -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),
]);
}

View File

@ -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();
}

View File

@ -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<FamilyDetailsPage> createState() => _FamilyDetailsPageState();
}
class _FamilyDetailsPageState extends State<FamilyDetailsPage> {
final logic = Get.put(FamilyDetailsLogic());
final state = Get.find<FamilyDetailsLogic>().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);
},
);
},
);
}
}

View File

@ -0,0 +1,7 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class FamilyDetailsState {
TextEditingController changeNameController = TextEditingController(); //
var familyName = ''.obs;
}

View File

@ -27,8 +27,6 @@ class LockSetPage extends StatefulWidget {
class _LockSetPageState extends State<LockSetPage> with RouteAware {
final logic = Get.put(LockSetLogic());
final state = Get.find<LockSetLogic>().state;
bool isClick1 = false;
bool isClick2 = false;
@override
void initState() {
@ -209,7 +207,9 @@ class _LockSetPageState extends State<LockSetPage> 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<LockSetPage> with RouteAware {
Visibility(
visible: true,
child: CommonItem(
leftTitel: '消息通知',
leftTitel: '消息提醒',
rightTitle: "",
isHaveLine: true,
isHaveDirection: true,
@ -294,12 +294,12 @@ class _LockSetPageState extends State<LockSetPage> 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<LockSetPage> 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<LockSetPage> 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<LockSetPage> 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<LockSetPage> 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<LockSetPage> 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(

View File

@ -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();
}

View File

@ -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<LockUserPage> createState() => _LockUserPageState();
}
class _LockUserPageState extends State<LockUserPage> {
final logic = Get.put(LockUserLogic());
final state = Get.find<LockUserLogic>().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),
],
),
),
);
}
}

View File

@ -0,0 +1,7 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class LockUserState {
TextEditingController searchController = TextEditingController(); ///
var isCheck = false.obs;
}

View File

@ -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();
}

View File

@ -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<LowBatteryReminderPage> createState() => _LowBatteryReminderPageState();
}
class _LowBatteryReminderPageState extends State<LowBatteryReminderPage> {
final logic = Get.put(LowBatteryReminderLogic());
final state = Get.find<LowBatteryReminderLogic>().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;
});
},
);
}
}

View File

@ -0,0 +1,5 @@
import 'package:get/get.dart';
class LowBatteryReminderState {
var isLowBatteryNotify = false.obs; //
}

View File

@ -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();
}

View File

@ -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<MsgNotificationPage> {
bool faceOn = false; //
bool autoBright = false; //
String senseDistance = '远距离'; //
String antiMisoperation = '关闭'; //
List<String> senseDistanceList = ['远距离', '近距离'];
List<String> antiMisoperationList = ['关闭', '5秒', '10秒', '15秒', '30秒', '60秒'];
final logic = Get.put(MsgNotificationLogic());
final state = Get.find<MsgNotificationLogic>().state;
//
final TextStyle titleStyle = TextStyle(
@ -42,212 +40,194 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
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<String> 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(() {});
},
);
});
}
}

View File

@ -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; //
}

View File

@ -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();
}

View File

@ -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<NDaysUnopenedPage> createState() => _NDaysUnopenedPageState();
}
class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
final logic = Get.put(NDaysUnopenedLogic());
final state = Get.find<NDaysUnopenedLogic>().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) {});
}
}

View File

@ -0,0 +1,24 @@
import 'package:get/get.dart';
class NDaysUnopenedState {
final List<String> 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; //
}

View File

@ -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();
}

View File

@ -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<NotificationModePage> createState() => _NotificationModePageState();
}
class _NotificationModePageState extends State<NotificationModePage> {
final logic = Get.put(NotificationModeLogic());
final state = Get.find<NotificationModeLogic>().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<String, dynamic>;
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),
)
],
)
],
),
)
],
);
}
}

View File

@ -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;
}

View File

@ -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();
}

View File

@ -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<OpenDoorNotifyPage> createState() => _OpenDoorNotifyPageState();
}
class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
final logic = Get.put(OpenDoorNotifyLogic());
final state = Get.find<OpenDoorNotifyLogic>().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),
],
),
),
);
}
}

View File

@ -0,0 +1,7 @@
import 'package:get/get.dart';
class OpenDoorNotifyState {
var pageNum = 1.obs; //
final pageSize = 20.obs; //
final itemDataList = [].obs;
}

View File

@ -401,6 +401,14 @@ class _LockDetailPageState extends State<LockDetailPage>
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,