修复N天未开门以及添加家人bug

This commit is contained in:
Daisy 2024-05-21 11:07:31 +08:00
parent b86dc3798d
commit dd48a36746
6 changed files with 131 additions and 115 deletions

View File

@ -1,9 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/main/lockDetail/messageWarn/addFamily/addFamily_state.dart'; import 'package:star_lock/main/lockDetail/messageWarn/addFamily/addFamily_state.dart';
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_entity.dart';
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_entity.dart'; import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_entity.dart';
import 'package:star_lock/main/lockDetail/messageWarn/notificationMode/notificationMode_data.dart'; import 'package:star_lock/main/lockDetail/messageWarn/notificationMode/notificationMode_data.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
@ -13,17 +10,24 @@ class AddFamilyLogic extends BaseGetXController {
final AddFamilyState state = AddFamilyState(); final AddFamilyState state = AddFamilyState();
// //
void addLockNoticeSetting() async { Future<void> addLockNoticeSetting() async {
var entity = await ApiRepository.to.addLockNoticeSetting( final MsgNotificationEntity entity =
await ApiRepository.to.addLockNoticeSetting(
lockId: state.getLockId.value, lockId: state.getLockId.value,
noticeType: 10, noticeType: 10,
settingValue: { settingValue: {
'openDoorId': state.lockUserKeys.value.currentOpenDoorID, 'openDoorId': state.lockUserKeys.value.currentOpenDoorID,
'openDoorType': state.lockUserKeys.value.currentKeyType, 'openDoorType': state.lockUserKeys.value.currentKeyType,
'remark': state.lockUserKeys.value.currentKeyName ?? '', 'remark': state.lockUserKeys.value.currentKeyName ?? '',
'noticeWay': [ 'noticeWay': <Map<String, Object>>[
{'type': 'mail', 'accounts': getEmailAndSMSAccountList(true)}, <String, Object>{
{'type': 'sms', 'accounts': getEmailAndSMSAccountList(false)} 'type': 'mail',
'accounts': getEmailAndSMSAccountList(true)
},
<String, Object>{
'type': 'sms',
'accounts': getEmailAndSMSAccountList(false)
}
] ]
}, },
); );
@ -34,8 +38,9 @@ class AddFamilyLogic extends BaseGetXController {
} }
// //
void updateLockNoticeSetting() async { Future<void> updateLockNoticeSetting() async {
var entity = await ApiRepository.to.updateLockNoticeSettingAccount( final OpenDoorNotifyEntity entity =
await ApiRepository.to.updateLockNoticeSettingAccount(
lockNoticeSettingAccountId: state.familyData.value.id!, lockNoticeSettingAccountId: state.familyData.value.id!,
settingValue: { settingValue: {
'openDoorId': state.familyData.value.settingValue!.openDoorId!, 'openDoorId': state.familyData.value.settingValue!.openDoorId!,
@ -52,8 +57,9 @@ class AddFamilyLogic extends BaseGetXController {
} }
// //
void deleteLockNoticeSetting() async { Future<void> deleteLockNoticeSetting() async {
var entity = await ApiRepository.to.deleteLockNoticeSettingAccount( final OpenDoorNotifyEntity entity =
await ApiRepository.to.deleteLockNoticeSettingAccount(
lockNoticeSettingAccountId: state.familyData.value.id!, lockNoticeSettingAccountId: state.familyData.value.id!,
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
@ -64,14 +70,14 @@ class AddFamilyLogic extends BaseGetXController {
// //
List getEmailAndSMSAccountList(bool isEmail) { List getEmailAndSMSAccountList(bool isEmail) {
List list = []; final List list = [];
List accountList = []; List accountList = [];
isEmail isEmail
? accountList = state.emailReceiverList.value ? accountList = state.emailReceiverList.value
: accountList = state.phoneReceiverList.value; : accountList = state.phoneReceiverList.value;
for (int i = 0; i < accountList.length; i++) { for (int i = 0; i < accountList.length; i++) {
MsgNoticeModeData item = accountList[i]; final MsgNoticeModeData item = accountList[i];
Map map = {}; final Map map = {};
map['countryCode'] = isEmail ? 0 : item.countryCode; map['countryCode'] = isEmail ? 0 : item.countryCode;
map['account'] = isEmail ? item.receiveEmail : item.receivePhone; map['account'] = isEmail ? item.receiveEmail : item.receivePhone;
list.add(map); list.add(map);
@ -83,9 +89,9 @@ class AddFamilyLogic extends BaseGetXController {
String emailListStr = ''; String emailListStr = '';
if (val['emailReceiverList'] != null) { if (val['emailReceiverList'] != null) {
state.emailReceiverList.value = val['emailReceiverList']; state.emailReceiverList.value = val['emailReceiverList'];
List emailReceiverList = state.emailReceiverList.value; final List emailReceiverList = state.emailReceiverList.value;
for (int i = 0; i < emailReceiverList.length; i++) { for (int i = 0; i < emailReceiverList.length; i++) {
MsgNoticeModeData item = emailReceiverList[i]; final MsgNoticeModeData item = emailReceiverList[i];
emailListStr += item.receiveEmail; emailListStr += item.receiveEmail;
// //
if (i < emailReceiverList.length - 1) { if (i < emailReceiverList.length - 1) {
@ -101,9 +107,9 @@ class AddFamilyLogic extends BaseGetXController {
if (val['phoneReceiverList'] != null) { if (val['phoneReceiverList'] != null) {
state.phoneReceiverList.value = val['phoneReceiverList']; state.phoneReceiverList.value = val['phoneReceiverList'];
List phoneReceiverList = state.phoneReceiverList.value; final List phoneReceiverList = state.phoneReceiverList.value;
for (int i = 0; i < phoneReceiverList.length; i++) { for (int i = 0; i < phoneReceiverList.length; i++) {
MsgNoticeModeData item = phoneReceiverList[i]; final MsgNoticeModeData item = phoneReceiverList[i];
phoneListStr += item.receivePhone; phoneListStr += item.receivePhone;
// //
if (i < phoneReceiverList.length - 1) { if (i < phoneReceiverList.length - 1) {
@ -128,7 +134,7 @@ class AddFamilyLogic extends BaseGetXController {
// 1: 2: 3: 4: 5: // 1: 2: 3: 4: 5:
String getKeyTypeStr() { String getKeyTypeStr() {
int keyType = state.familyData.value.settingValue!.openDoorType!; final int keyType = state.familyData.value.settingValue!.openDoorType!;
switch (keyType) { switch (keyType) {
case 1: case 1:
return '电子钥匙'; return '电子钥匙';
@ -147,24 +153,24 @@ class AddFamilyLogic extends BaseGetXController {
// //
Map<String, List<MsgNoticeModeData>> getAccountsMap() { Map<String, List<MsgNoticeModeData>> getAccountsMap() {
List<MsgNoticeModeData> mailAccounts = []; final List<MsgNoticeModeData> mailAccounts = <MsgNoticeModeData>[];
List<MsgNoticeModeData> smsAccounts = []; final List<MsgNoticeModeData> smsAccounts = <MsgNoticeModeData>[];
if (state.familyData.value.settingValue != null) { if (state.familyData.value.settingValue != null) {
for (NoticeWay item for (final NoticeWay item
in state.familyData.value.settingValue!.noticeWayList!) { in state.familyData.value.settingValue!.noticeWayList!) {
if (item.type == 'mail' && item.accounts != null) { if (item.type == 'mail' && item.accounts != null) {
for (Accounts account in item.accounts!) { for (final Accounts account in item.accounts!) {
if (account.account != null) { if (account.account != null) {
MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData(); final MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData();
msgNoticeModeData.receiveEmail = account.account!; msgNoticeModeData.receiveEmail = account.account!;
mailAccounts.add(msgNoticeModeData); mailAccounts.add(msgNoticeModeData);
} }
} }
} else if (item.type == 'sms' && item.accounts != null) { } else if (item.type == 'sms' && item.accounts != null) {
for (Accounts account in item.accounts!) { for (final Accounts account in item.accounts!) {
if (account.account != null && account.countryCode != null) { if (account.account != null && account.countryCode != null) {
MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData(); final MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData();
msgNoticeModeData.receivePhone = account.account!; msgNoticeModeData.receivePhone = account.account!;
msgNoticeModeData.countryCode = account.countryCode!; msgNoticeModeData.countryCode = account.countryCode!;
smsAccounts.add(msgNoticeModeData); smsAccounts.add(msgNoticeModeData);
@ -174,7 +180,7 @@ class AddFamilyLogic extends BaseGetXController {
} }
} }
return { return <String, List<MsgNoticeModeData>>{
'emailReceiverList': mailAccounts, 'emailReceiverList': mailAccounts,
'phoneReceiverList': smsAccounts, 'phoneReceiverList': smsAccounts,
}; };

View File

@ -4,8 +4,10 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart'; import 'package:star_lock/appRouters.dart';
import 'package:star_lock/main/lockDetail/messageWarn/addFamily/addFamily_logic.dart'; import 'package:star_lock/main/lockDetail/messageWarn/addFamily/addFamily_logic.dart';
import 'package:star_lock/tools/showCupertinoAlertView.dart'; import 'package:star_lock/main/lockDetail/messageWarn/addFamily/addFamily_state.dart';
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_entity.dart';
import 'package:star_lock/tools/commonItem.dart'; import 'package:star_lock/tools/commonItem.dart';
import 'package:star_lock/tools/showCupertinoAlertView.dart';
import 'package:star_lock/tools/showTFView.dart'; import 'package:star_lock/tools/showTFView.dart';
import 'package:star_lock/tools/storage.dart'; import 'package:star_lock/tools/storage.dart';
import 'package:star_lock/tools/submitBtn.dart'; import 'package:star_lock/tools/submitBtn.dart';
@ -22,8 +24,8 @@ class AddFamilyPage extends StatefulWidget {
} }
class _AddFamilyPageState extends State<AddFamilyPage> { class _AddFamilyPageState extends State<AddFamilyPage> {
final logic = Get.put(AddFamilyLogic()); final AddFamilyLogic logic = Get.put(AddFamilyLogic());
final state = Get.find<AddFamilyLogic>().state; final AddFamilyState state = Get.find<AddFamilyLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -36,7 +38,7 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
body: Container( body: Container(
padding: EdgeInsets.all(30.w), padding: EdgeInsets.all(30.w),
child: Column( child: Column(
children: [ children: <Widget>[
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: '开门方式'.tr, leftTitel: '开门方式'.tr,
rightTitle: state.isDetail.value rightTitle: state.isDetail.value
@ -46,9 +48,9 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
// //
Get.toNamed(Routers.lockUserPage, Get.toNamed(Routers.lockUserPage, arguments: <String, int>{
arguments: {'getLockId': state.getLockId.value}) 'getLockId': state.getLockId.value
?.then((val) { })?.then((val) {
if (val != null) { if (val != null) {
state.lockUserKeys.value = val; state.lockUserKeys.value = val;
} }
@ -73,8 +75,9 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Get.toNamed(Routers.notificationModePage, Get.toNamed(Routers.notificationModePage,
arguments: {'familyData': state.familyData.value}) arguments: <String, DataList>{
?.then((val) { 'familyData': state.familyData.value
})?.then((val) {
if (val != null) { if (val != null) {
state.emailListStr.value = logic.getEmailListStr(val); state.emailListStr.value = logic.getEmailListStr(val);
state.phontListStr.value = logic.getPhoneListStr(val); state.phontListStr.value = logic.getPhoneListStr(val);
@ -85,10 +88,10 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
color: Colors.white, color: Colors.white,
margin: EdgeInsets.only(bottom: 10.h), margin: EdgeInsets.only(bottom: 10.h),
child: Column( child: Column(
children: [ children: <Widget>[
CommonItem( CommonItem(
leftTitel: '提醒方式'.tr, leftTitel: '提醒方式'.tr,
rightTitle: "", rightTitle: '',
isHaveLine: false, isHaveLine: false,
isHaveRightWidget: false, isHaveRightWidget: false,
isHaveDirection: true, isHaveDirection: true,
@ -117,7 +120,7 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
: logic.checkBtnDisable(), : logic.checkBtnDisable(),
isDelete: state.isDetail.value, isDelete: state.isDetail.value,
onClick: () async { onClick: () async {
var isVip = await Storage.getBool(saveIsVip); bool? isVip = await Storage.getBool(saveIsVip);
if (isVip == true) { if (isVip == true) {
if (state.isDetail.value) { if (state.isDetail.value) {
logic.deleteLockNoticeSetting(); logic.deleteLockNoticeSetting();
@ -148,7 +151,7 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
borderRadius: BorderRadius.circular(6.0.w), borderRadius: BorderRadius.circular(6.0.w),
), ),
child: Row( child: Row(
children: [ children: <Widget>[
Text( Text(
notifyTitle, notifyTitle,
style: TextStyle(color: Colors.black, fontSize: 20.sp), style: TextStyle(color: Colors.black, fontSize: 20.sp),
@ -173,8 +176,8 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
builder: (BuildContext context) { builder: (BuildContext context) {
return ShowTFView( return ShowTFView(
title: title:
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}", '${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}',
tipTitle: "请输入".tr, tipTitle: '请输入'.tr,
controller: state.changeNameController, controller: state.changeNameController,
sureClick: () { sureClick: () {
// //
@ -194,13 +197,13 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
// //
Widget getFamilyWidget(String tfStr) { Widget getFamilyWidget(String tfStr) {
TextEditingController emailController = TextEditingController(); final TextEditingController emailController = TextEditingController();
emailController.text = state.lockUserKeys.value.currentKeyName ?? ''; emailController.text = state.lockUserKeys.value.currentKeyName ?? '';
return SizedBox( return SizedBox(
height: 50.h, height: 50.h,
width: 360.w, width: 360.w,
child: Row( child: Row(
children: [ children: <Widget>[
Expanded( Expanded(
child: TextField( child: TextField(
controller: emailController, controller: emailController,
@ -231,7 +234,7 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
), ),
style: TextStyle( style: TextStyle(
fontSize: 22.sp, textBaseline: TextBaseline.alphabetic), fontSize: 22.sp, textBaseline: TextBaseline.alphabetic),
onChanged: (value) { onChanged: (String value) {
state.lockUserKeys.value.currentKeyName = value; state.lockUserKeys.value.currentKeyName = value;
state.lockUserKeys.refresh(); state.lockUserKeys.refresh();
}, },

View File

@ -9,12 +9,13 @@ import 'nDaysUnopened_state.dart';
class NDaysUnopenedLogic extends BaseGetXController { class NDaysUnopenedLogic extends BaseGetXController {
NDaysUnopenedState state = NDaysUnopenedState(); NDaysUnopenedState state = NDaysUnopenedState();
void lockNoticeSettingAccountList() async { Future<void> lockNoticeSettingAccountList() async {
var entity = await ApiRepository.to.updateNdaysNotCloseDoorNoticeSetting( final OpenDoorNotifyEntity entity = await ApiRepository.to
lockId: state.getLockId.value, .updateNdaysNotCloseDoorNoticeSetting(
dayNotOpenDoorState: state.isUnOpenNotice.value == true ? 1 : 0, lockId: state.getLockId.value,
dayNotOpenDoorValue: state.unOpenDoorTime.value, dayNotOpenDoorState: state.isUnOpenNotice.value == true ? 1 : 0,
dayNotOpenDoorNoticeWayList: [ dayNotOpenDoorValue: state.unOpenDoorTime.value,
dayNotOpenDoorNoticeWayList: [
{'type': 'mail', 'accounts': getEmailAndSMSAccountList(true)}, {'type': 'mail', 'accounts': getEmailAndSMSAccountList(true)},
{'type': 'sms', 'accounts': getEmailAndSMSAccountList(false)} {'type': 'sms', 'accounts': getEmailAndSMSAccountList(false)}
]); ]);
@ -26,14 +27,14 @@ class NDaysUnopenedLogic extends BaseGetXController {
// //
List getEmailAndSMSAccountList(bool isEmail) { List getEmailAndSMSAccountList(bool isEmail) {
List list = []; final List list = [];
List accountList = []; List accountList = [];
isEmail isEmail
? accountList = state.emailReceiverList.value ? accountList = state.emailReceiverList.value
: accountList = state.phoneReceiverList.value; : accountList = state.phoneReceiverList.value;
for (int i = 0; i < accountList.length; i++) { for (int i = 0; i < accountList.length; i++) {
MsgNoticeModeData item = accountList[i]; final MsgNoticeModeData item = accountList[i];
Map map = {}; final Map map = {};
map['countryCode'] = isEmail ? 0 : item.countryCode; map['countryCode'] = isEmail ? 0 : item.countryCode;
map['account'] = isEmail ? item.receiveEmail : item.receivePhone; map['account'] = isEmail ? item.receiveEmail : item.receivePhone;
list.add(map); list.add(map);
@ -45,9 +46,9 @@ class NDaysUnopenedLogic extends BaseGetXController {
String emailListStr = ''; String emailListStr = '';
if (val['emailReceiverList'] != null) { if (val['emailReceiverList'] != null) {
state.emailReceiverList.value = val['emailReceiverList']; state.emailReceiverList.value = val['emailReceiverList'];
List emailReceiverList = state.emailReceiverList.value; final List emailReceiverList = state.emailReceiverList.value;
for (int i = 0; i < emailReceiverList.length; i++) { for (int i = 0; i < emailReceiverList.length; i++) {
MsgNoticeModeData item = emailReceiverList[i]; final MsgNoticeModeData item = emailReceiverList[i];
emailListStr += item.receiveEmail; emailListStr += item.receiveEmail;
// //
if (i < emailReceiverList.length - 1) { if (i < emailReceiverList.length - 1) {
@ -63,9 +64,9 @@ class NDaysUnopenedLogic extends BaseGetXController {
if (val['phoneReceiverList'] != null) { if (val['phoneReceiverList'] != null) {
state.phoneReceiverList.value = val['phoneReceiverList']; state.phoneReceiverList.value = val['phoneReceiverList'];
List phoneReceiverList = state.phoneReceiverList.value; final List phoneReceiverList = state.phoneReceiverList.value;
for (int i = 0; i < phoneReceiverList.length; i++) { for (int i = 0; i < phoneReceiverList.length; i++) {
MsgNoticeModeData item = phoneReceiverList[i]; final MsgNoticeModeData item = phoneReceiverList[i];
phoneListStr += item.receivePhone; phoneListStr += item.receivePhone;
// //
if (i < phoneReceiverList.length - 1) { if (i < phoneReceiverList.length - 1) {
@ -78,24 +79,24 @@ class NDaysUnopenedLogic extends BaseGetXController {
// //
Map<String, List<MsgNoticeModeData>> getAccountsMap() { Map<String, List<MsgNoticeModeData>> getAccountsMap() {
List<MsgNoticeModeData> mailAccounts = []; final List<MsgNoticeModeData> mailAccounts = [];
List<MsgNoticeModeData> smsAccounts = []; final List<MsgNoticeModeData> smsAccounts = [];
if (state.msgNoticeInfo.value.dayNotOpenDoorNoticeWayList != null) { if (state.msgNoticeInfo.value.dayNotOpenDoorNoticeWayList != null) {
for (NoticeWay item for (final NoticeWay item
in state.msgNoticeInfo.value.dayNotOpenDoorNoticeWayList!) { in state.msgNoticeInfo.value.dayNotOpenDoorNoticeWayList!) {
if (item.type == 'mail' && item.accounts != null) { if (item.type == 'mail' && item.accounts != null) {
for (Accounts account in item.accounts!) { for (final Accounts account in item.accounts!) {
if (account.account != null) { if (account.account != null) {
MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData(); final MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData();
msgNoticeModeData.receiveEmail = account.account!; msgNoticeModeData.receiveEmail = account.account!;
mailAccounts.add(msgNoticeModeData); mailAccounts.add(msgNoticeModeData);
} }
} }
} else if (item.type == 'sms' && item.accounts != null) { } else if (item.type == 'sms' && item.accounts != null) {
for (Accounts account in item.accounts!) { for (final Accounts account in item.accounts!) {
if (account.account != null && account.countryCode != null) { if (account.account != null && account.countryCode != null) {
MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData(); final MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData();
msgNoticeModeData.receivePhone = account.account!; msgNoticeModeData.receivePhone = account.account!;
msgNoticeModeData.countryCode = account.countryCode!; msgNoticeModeData.countryCode = account.countryCode!;
smsAccounts.add(msgNoticeModeData); smsAccounts.add(msgNoticeModeData);

View File

@ -4,10 +4,11 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart'; import 'package:star_lock/appRouters.dart';
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_entity.dart'; import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_entity.dart';
import 'package:star_lock/tools/showCupertinoAlertView.dart'; import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/nDaysUnopened/nDaysUnopened_state.dart';
import 'package:star_lock/tools/commonItem.dart'; import 'package:star_lock/tools/commonItem.dart';
import 'package:star_lock/tools/pickers/pickers.dart'; import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/style/default_style.dart'; import 'package:star_lock/tools/pickers/style/default_style.dart';
import 'package:star_lock/tools/showCupertinoAlertView.dart';
import 'package:star_lock/tools/storage.dart'; import 'package:star_lock/tools/storage.dart';
import 'package:star_lock/tools/submitBtn.dart'; import 'package:star_lock/tools/submitBtn.dart';
@ -23,8 +24,8 @@ class NDaysUnopenedPage extends StatefulWidget {
} }
class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> { class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
final logic = Get.put(NDaysUnopenedLogic()); final NDaysUnopenedLogic logic = Get.put(NDaysUnopenedLogic());
final state = Get.find<NDaysUnopenedLogic>().state; final NDaysUnopenedState state = Get.find<NDaysUnopenedLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -36,13 +37,13 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: ListView( body: ListView(
padding: EdgeInsets.all(30.w), padding: EdgeInsets.all(30.w),
children: [ children: <Widget>[
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: <Widget>[
Expanded( Expanded(
child: Text( child: Text(
"经过以上设定的时间,锁没有被开启,系统会给指定对象发送提醒消息,该功能需要锁联网".tr, '经过以上设定的时间,锁没有被开启,系统会给指定对象发送提醒消息,该功能需要锁联网'.tr,
style: TextStyle( style: TextStyle(
fontSize: 20.sp, color: AppColors.darkGrayTextColor), fontSize: 20.sp, color: AppColors.darkGrayTextColor),
)), )),
@ -67,7 +68,7 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
SubmitBtn( SubmitBtn(
btnName: '保存'.tr, btnName: '保存'.tr,
onClick: () async { onClick: () async {
var isVip = await Storage.getBool(saveIsVip); bool? isVip = await Storage.getBool(saveIsVip);
if (isVip == false) { if (isVip == false) {
ShowCupertinoAlertView().advancedFeatureAlert(); ShowCupertinoAlertView().advancedFeatureAlert();
} else { } else {
@ -87,10 +88,10 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
return Visibility( return Visibility(
visible: state.isUnOpenNotice.value, visible: state.isUnOpenNotice.value,
child: Column( child: Column(
children: [ children: <Widget>[
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: '门未开时间'.tr, leftTitel: '门未开时间'.tr,
rightTitle: '${state.unOpenDoorTime.value}${''.tr}', rightTitle: '${state.unOpenDoorTime.value}',
isHaveLine: true, isHaveLine: true,
isHaveRightWidget: false, isHaveRightWidget: false,
isHaveDirection: true, isHaveDirection: true,
@ -104,8 +105,9 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Get.toNamed(Routers.notificationModePage, Get.toNamed(Routers.notificationModePage,
arguments: {'msgNoticeInfo': state.msgNoticeInfo.value}) arguments: <String, MsgNoticeData>{
?.then((val) { 'msgNoticeInfo': state.msgNoticeInfo.value
})?.then((val) {
if (val != null) { if (val != null) {
state.emailListStr.value = logic.getEmailListStr(val); state.emailListStr.value = logic.getEmailListStr(val);
state.phontListStr.value = logic.getPhoneListStr(val); state.phontListStr.value = logic.getPhoneListStr(val);
@ -116,10 +118,10 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
color: Colors.white, color: Colors.white,
margin: EdgeInsets.only(bottom: 10.h), margin: EdgeInsets.only(bottom: 10.h),
child: Column( child: Column(
children: [ children: <Widget>[
CommonItem( CommonItem(
leftTitel: '提醒方式'.tr, leftTitel: '提醒方式'.tr,
rightTitle: "", rightTitle: '',
isHaveLine: false, isHaveLine: false,
isHaveRightWidget: false, isHaveRightWidget: false,
isHaveDirection: true, isHaveDirection: true,
@ -151,7 +153,7 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
borderRadius: BorderRadius.circular(6.0.w), borderRadius: BorderRadius.circular(6.0.w),
), ),
child: Row( child: Row(
children: [ children: <Widget>[
Text( Text(
notifyTitle, notifyTitle,
style: TextStyle(color: Colors.black, fontSize: 20.sp), style: TextStyle(color: Colors.black, fontSize: 20.sp),
@ -175,7 +177,7 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: state.isUnOpenNotice.value, value: state.isUnOpenNotice.value,
onChanged: (value) { onChanged: (bool value) {
setState(() { setState(() {
state.isUnOpenNotice.value = value; state.isUnOpenNotice.value = value;
if (!state.isUnOpenNotice.value) { if (!state.isUnOpenNotice.value) {
@ -187,11 +189,12 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
} }
//pickerView //pickerView
_openBottomItemSheet(BuildContext context, List dataList) { void _openBottomItemSheet(BuildContext context, List dataList) {
Pickers.showSinglePicker(context, Pickers.showSinglePicker(context,
data: dataList, data: dataList,
pickerStyle: DefaultPickerStyle(), onConfirm: (p, position) { pickerStyle: DefaultPickerStyle(), onConfirm: (p, int position) {
state.unOpenDoorTime.value = p; state.unOpenDoorTime.value =
}, onChanged: (p, position) {}); int.parse(state.unopenDoorTimeList[position].replaceAll('', ''));
}, onChanged: (p, int position) {});
} }
} }

View File

@ -4,21 +4,21 @@ import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/msgNotific
class NDaysUnopenedState { class NDaysUnopenedState {
final List unopenDoorTimeList = [ final List unopenDoorTimeList = [
1, '1天',
2, '2天',
3, '3天',
4, '4天',
5, '5天',
6, '6天',
7, '7天',
8, '8天',
9, '9天',
10, '10天',
11, '11天',
12, '12天',
13, '13天',
14, '14天',
15, '15天',
]; ];
var isUnOpenNotice = false.obs; // N天未开门提醒 var isUnOpenNotice = false.obs; // N天未开门提醒

View File

@ -3,6 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart'; import 'package:star_lock/appRouters.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRealName/value_added_services_real_name_logic.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRealName/value_added_services_real_name_logic.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRealName/value_added_services_real_name_state.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_arg.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_arg.dart';
import '../../../app_settings/app_colors.dart'; import '../../../app_settings/app_colors.dart';
import '../../../tools/commonItem.dart'; import '../../../tools/commonItem.dart';
@ -19,8 +20,10 @@ class ValueAddedServicesRealNamePage extends StatefulWidget {
class _ValueAddedServicesRealNamePageState class _ValueAddedServicesRealNamePageState
extends State<ValueAddedServicesRealNamePage> { extends State<ValueAddedServicesRealNamePage> {
final logic = Get.put(ValueAddedServicesRealNameLogic()); final ValueAddedServicesRealNameLogic logic =
final state = Get.find<ValueAddedServicesRealNameLogic>().state; Get.put(ValueAddedServicesRealNameLogic());
final ValueAddedServicesRealNameState state =
Get.find<ValueAddedServicesRealNameLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -31,7 +34,7 @@ class _ValueAddedServicesRealNamePageState
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: Column( body: Column(
children: [ children: <Widget>[
Container( Container(
width: 1.sw, width: 1.sw,
padding: EdgeInsets.only( padding: EdgeInsets.only(
@ -42,7 +45,7 @@ class _ValueAddedServicesRealNamePageState
color: AppColors.darkGrayTextColor, fontSize: 20.sp), color: AppColors.darkGrayTextColor, fontSize: 20.sp),
)), )),
middleWidget(), middleWidget(),
Obx(() => bottomWidget()) Obx(bottomWidget)
], ],
), ),
); );
@ -55,15 +58,15 @@ class _ValueAddedServicesRealNamePageState
decoration: const BoxDecoration( decoration: const BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: AssetImage( image: AssetImage(
"images/mine/icon_mine_valueAddedServices_noteTop.png"), 'images/mine/icon_mine_valueAddedServices_noteTop.png'),
fit: BoxFit.cover)), fit: BoxFit.cover)),
child: Column(children: [ child: Column(children: <Widget>[
Container( Container(
margin: margin:
const EdgeInsets.only(top: 15, bottom: 15, left: 30, right: 30), const EdgeInsets.only(top: 15, bottom: 15, left: 30, right: 30),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: <Widget>[
Obx(() => Text( Obx(() => Text(
"${'当前剩余数量'.tr}:${state.realNameRemainCount.value}", "${'当前剩余数量'.tr}:${state.realNameRemainCount.value}",
style: TextStyle(fontSize: 24.sp), style: TextStyle(fontSize: 24.sp),
@ -75,7 +78,7 @@ class _ValueAddedServicesRealNamePageState
padding: const EdgeInsets.only(top: 10, bottom: 10), padding: const EdgeInsets.only(top: 10, bottom: 10),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: <Widget>[
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Get.toNamed(Routers.valueAddedServicesRecordPage, Get.toNamed(Routers.valueAddedServicesRecordPage,
@ -92,7 +95,7 @@ class _ValueAddedServicesRealNamePageState
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Get.toNamed(Routers.advancedFeaturesWebPage, Get.toNamed(Routers.advancedFeaturesWebPage,
arguments: {'isShop': false}); arguments: <String, bool>{'isShop': false});
}, },
child: Container( child: Container(
width: 200.w, width: 200.w,
@ -115,9 +118,9 @@ class _ValueAddedServicesRealNamePageState
color: Colors.white, color: Colors.white,
margin: EdgeInsets.all(20.h), margin: EdgeInsets.all(20.h),
child: Column( child: Column(
children: [ children: <Widget>[
Column( Column(
children: [ children: <Widget>[
Container( Container(
padding: EdgeInsets.only(top: 20.h, bottom: 20.h, left: 30.w), padding: EdgeInsets.only(top: 20.h, bottom: 20.h, left: 30.w),
child: Text( child: Text(
@ -143,10 +146,10 @@ class _ValueAddedServicesRealNamePageState
Widget checkCommonItem( Widget checkCommonItem(
ValueAddedServicesRealNameLogic logic, String text, int clickIndex, ValueAddedServicesRealNameLogic logic, String text, int clickIndex,
{bool isHaveLine = true, bool isHaveRightWidget = true}) { {bool isHaveLine = true, bool isHaveRightWidget = true}) {
bool check = logic.state.checkIndex.value == clickIndex; final bool check = logic.state.checkIndex.value == clickIndex;
return CommonItem( return CommonItem(
leftTitel: text, leftTitel: text,
rightTitle: "", rightTitle: '',
allHeight: 60.h, allHeight: 60.h,
isHaveLine: isHaveLine, isHaveLine: isHaveLine,
isHaveRightWidget: isHaveRightWidget, isHaveRightWidget: isHaveRightWidget,
@ -155,7 +158,7 @@ class _ValueAddedServicesRealNamePageState
logic.check(clickIndex); logic.check(clickIndex);
}, },
child: Row( child: Row(
children: [ children: <Widget>[
Image.asset( Image.asset(
check check
? 'images/icon_round_select.png' ? 'images/icon_round_select.png'