修复N天未开门以及添加家人bug
This commit is contained in:
parent
b86dc3798d
commit
dd48a36746
@ -1,9 +1,6 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.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/msgNotification/msgNotification/msgNotification_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/network/api_repository.dart';
|
||||
@ -13,17 +10,24 @@ class AddFamilyLogic extends BaseGetXController {
|
||||
final AddFamilyState state = AddFamilyState();
|
||||
|
||||
//添加开门通知
|
||||
void addLockNoticeSetting() async {
|
||||
var entity = await ApiRepository.to.addLockNoticeSetting(
|
||||
Future<void> addLockNoticeSetting() async {
|
||||
final MsgNotificationEntity entity =
|
||||
await ApiRepository.to.addLockNoticeSetting(
|
||||
lockId: state.getLockId.value,
|
||||
noticeType: 10,
|
||||
settingValue: {
|
||||
'openDoorId': state.lockUserKeys.value.currentOpenDoorID,
|
||||
'openDoorType': state.lockUserKeys.value.currentKeyType,
|
||||
'remark': state.lockUserKeys.value.currentKeyName ?? '',
|
||||
'noticeWay': [
|
||||
{'type': 'mail', 'accounts': getEmailAndSMSAccountList(true)},
|
||||
{'type': 'sms', 'accounts': getEmailAndSMSAccountList(false)}
|
||||
'noticeWay': <Map<String, Object>>[
|
||||
<String, Object>{
|
||||
'type': 'mail',
|
||||
'accounts': getEmailAndSMSAccountList(true)
|
||||
},
|
||||
<String, Object>{
|
||||
'type': 'sms',
|
||||
'accounts': getEmailAndSMSAccountList(false)
|
||||
}
|
||||
]
|
||||
},
|
||||
);
|
||||
@ -34,8 +38,9 @@ class AddFamilyLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
//更新开门通知
|
||||
void updateLockNoticeSetting() async {
|
||||
var entity = await ApiRepository.to.updateLockNoticeSettingAccount(
|
||||
Future<void> updateLockNoticeSetting() async {
|
||||
final OpenDoorNotifyEntity entity =
|
||||
await ApiRepository.to.updateLockNoticeSettingAccount(
|
||||
lockNoticeSettingAccountId: state.familyData.value.id!,
|
||||
settingValue: {
|
||||
'openDoorId': state.familyData.value.settingValue!.openDoorId!,
|
||||
@ -52,8 +57,9 @@ class AddFamilyLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
//删除开门通知
|
||||
void deleteLockNoticeSetting() async {
|
||||
var entity = await ApiRepository.to.deleteLockNoticeSettingAccount(
|
||||
Future<void> deleteLockNoticeSetting() async {
|
||||
final OpenDoorNotifyEntity entity =
|
||||
await ApiRepository.to.deleteLockNoticeSettingAccount(
|
||||
lockNoticeSettingAccountId: state.familyData.value.id!,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
@ -64,14 +70,14 @@ class AddFamilyLogic extends BaseGetXController {
|
||||
|
||||
//获取到家人信息的请求数组
|
||||
List getEmailAndSMSAccountList(bool isEmail) {
|
||||
List list = [];
|
||||
final List list = [];
|
||||
List accountList = [];
|
||||
isEmail
|
||||
? accountList = state.emailReceiverList.value
|
||||
: accountList = state.phoneReceiverList.value;
|
||||
for (int i = 0; i < accountList.length; i++) {
|
||||
MsgNoticeModeData item = accountList[i];
|
||||
Map map = {};
|
||||
final MsgNoticeModeData item = accountList[i];
|
||||
final Map map = {};
|
||||
map['countryCode'] = isEmail ? 0 : item.countryCode;
|
||||
map['account'] = isEmail ? item.receiveEmail : item.receivePhone;
|
||||
list.add(map);
|
||||
@ -83,9 +89,9 @@ class AddFamilyLogic extends BaseGetXController {
|
||||
String emailListStr = '';
|
||||
if (val['emailReceiverList'] != null) {
|
||||
state.emailReceiverList.value = val['emailReceiverList'];
|
||||
List emailReceiverList = state.emailReceiverList.value;
|
||||
final List emailReceiverList = state.emailReceiverList.value;
|
||||
for (int i = 0; i < emailReceiverList.length; i++) {
|
||||
MsgNoticeModeData item = emailReceiverList[i];
|
||||
final MsgNoticeModeData item = emailReceiverList[i];
|
||||
emailListStr += item.receiveEmail;
|
||||
// 检查是否为最后一个元素
|
||||
if (i < emailReceiverList.length - 1) {
|
||||
@ -101,9 +107,9 @@ class AddFamilyLogic extends BaseGetXController {
|
||||
|
||||
if (val['phoneReceiverList'] != null) {
|
||||
state.phoneReceiverList.value = val['phoneReceiverList'];
|
||||
List phoneReceiverList = state.phoneReceiverList.value;
|
||||
final List phoneReceiverList = state.phoneReceiverList.value;
|
||||
for (int i = 0; i < phoneReceiverList.length; i++) {
|
||||
MsgNoticeModeData item = phoneReceiverList[i];
|
||||
final MsgNoticeModeData item = phoneReceiverList[i];
|
||||
phoneListStr += item.receivePhone;
|
||||
// 检查是否为最后一个元素
|
||||
if (i < phoneReceiverList.length - 1) {
|
||||
@ -128,7 +134,7 @@ class AddFamilyLogic extends BaseGetXController {
|
||||
|
||||
//当前钥匙类型 1:电子钥匙 2:密码钥匙 3:指纹钥匙 4:卡钥匙 5:人脸钥匙
|
||||
String getKeyTypeStr() {
|
||||
int keyType = state.familyData.value.settingValue!.openDoorType!;
|
||||
final int keyType = state.familyData.value.settingValue!.openDoorType!;
|
||||
switch (keyType) {
|
||||
case 1:
|
||||
return '电子钥匙';
|
||||
@ -147,24 +153,24 @@ class AddFamilyLogic extends BaseGetXController {
|
||||
|
||||
//根据列表返回值得到邮箱、手机列表
|
||||
Map<String, List<MsgNoticeModeData>> getAccountsMap() {
|
||||
List<MsgNoticeModeData> mailAccounts = [];
|
||||
List<MsgNoticeModeData> smsAccounts = [];
|
||||
final List<MsgNoticeModeData> mailAccounts = <MsgNoticeModeData>[];
|
||||
final List<MsgNoticeModeData> smsAccounts = <MsgNoticeModeData>[];
|
||||
|
||||
if (state.familyData.value.settingValue != null) {
|
||||
for (NoticeWay item
|
||||
for (final NoticeWay item
|
||||
in state.familyData.value.settingValue!.noticeWayList!) {
|
||||
if (item.type == 'mail' && item.accounts != null) {
|
||||
for (Accounts account in item.accounts!) {
|
||||
for (final Accounts account in item.accounts!) {
|
||||
if (account.account != null) {
|
||||
MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData();
|
||||
final MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData();
|
||||
msgNoticeModeData.receiveEmail = account.account!;
|
||||
mailAccounts.add(msgNoticeModeData);
|
||||
}
|
||||
}
|
||||
} 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) {
|
||||
MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData();
|
||||
final MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData();
|
||||
msgNoticeModeData.receivePhone = account.account!;
|
||||
msgNoticeModeData.countryCode = account.countryCode!;
|
||||
smsAccounts.add(msgNoticeModeData);
|
||||
@ -174,7 +180,7 @@ class AddFamilyLogic extends BaseGetXController {
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
return <String, List<MsgNoticeModeData>>{
|
||||
'emailReceiverList': mailAccounts,
|
||||
'phoneReceiverList': smsAccounts,
|
||||
};
|
||||
|
||||
@ -4,8 +4,10 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/appRouters.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/showCupertinoAlertView.dart';
|
||||
import 'package:star_lock/tools/showTFView.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
import 'package:star_lock/tools/submitBtn.dart';
|
||||
@ -22,8 +24,8 @@ class AddFamilyPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _AddFamilyPageState extends State<AddFamilyPage> {
|
||||
final logic = Get.put(AddFamilyLogic());
|
||||
final state = Get.find<AddFamilyLogic>().state;
|
||||
final AddFamilyLogic logic = Get.put(AddFamilyLogic());
|
||||
final AddFamilyState state = Get.find<AddFamilyLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -36,7 +38,7 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
|
||||
body: Container(
|
||||
padding: EdgeInsets.all(30.w),
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: '开门方式'.tr,
|
||||
rightTitle: state.isDetail.value
|
||||
@ -46,9 +48,9 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
//锁用户
|
||||
Get.toNamed(Routers.lockUserPage,
|
||||
arguments: {'getLockId': state.getLockId.value})
|
||||
?.then((val) {
|
||||
Get.toNamed(Routers.lockUserPage, arguments: <String, int>{
|
||||
'getLockId': state.getLockId.value
|
||||
})?.then((val) {
|
||||
if (val != null) {
|
||||
state.lockUserKeys.value = val;
|
||||
}
|
||||
@ -73,8 +75,9 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.notificationModePage,
|
||||
arguments: {'familyData': state.familyData.value})
|
||||
?.then((val) {
|
||||
arguments: <String, DataList>{
|
||||
'familyData': state.familyData.value
|
||||
})?.then((val) {
|
||||
if (val != null) {
|
||||
state.emailListStr.value = logic.getEmailListStr(val);
|
||||
state.phontListStr.value = logic.getPhoneListStr(val);
|
||||
@ -85,10 +88,10 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
|
||||
color: Colors.white,
|
||||
margin: EdgeInsets.only(bottom: 10.h),
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
CommonItem(
|
||||
leftTitel: '提醒方式'.tr,
|
||||
rightTitle: "",
|
||||
rightTitle: '',
|
||||
isHaveLine: false,
|
||||
isHaveRightWidget: false,
|
||||
isHaveDirection: true,
|
||||
@ -117,7 +120,7 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
|
||||
: logic.checkBtnDisable(),
|
||||
isDelete: state.isDetail.value,
|
||||
onClick: () async {
|
||||
var isVip = await Storage.getBool(saveIsVip);
|
||||
bool? isVip = await Storage.getBool(saveIsVip);
|
||||
if (isVip == true) {
|
||||
if (state.isDetail.value) {
|
||||
logic.deleteLockNoticeSetting();
|
||||
@ -148,7 +151,7 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
|
||||
borderRadius: BorderRadius.circular(6.0.w),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
notifyTitle,
|
||||
style: TextStyle(color: Colors.black, fontSize: 20.sp),
|
||||
@ -173,8 +176,8 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
|
||||
builder: (BuildContext context) {
|
||||
return ShowTFView(
|
||||
title:
|
||||
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}",
|
||||
tipTitle: "请输入".tr,
|
||||
'${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}',
|
||||
tipTitle: '请输入'.tr,
|
||||
controller: state.changeNameController,
|
||||
sureClick: () {
|
||||
//发送编辑钥匙名称请求
|
||||
@ -194,13 +197,13 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
|
||||
|
||||
// 接受者信息输入框
|
||||
Widget getFamilyWidget(String tfStr) {
|
||||
TextEditingController emailController = TextEditingController();
|
||||
final TextEditingController emailController = TextEditingController();
|
||||
emailController.text = state.lockUserKeys.value.currentKeyName ?? '';
|
||||
return SizedBox(
|
||||
height: 50.h,
|
||||
width: 360.w,
|
||||
child: Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: emailController,
|
||||
@ -231,7 +234,7 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
|
||||
),
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp, textBaseline: TextBaseline.alphabetic),
|
||||
onChanged: (value) {
|
||||
onChanged: (String value) {
|
||||
state.lockUserKeys.value.currentKeyName = value;
|
||||
state.lockUserKeys.refresh();
|
||||
},
|
||||
|
||||
@ -9,12 +9,13 @@ import 'nDaysUnopened_state.dart';
|
||||
class NDaysUnopenedLogic extends BaseGetXController {
|
||||
NDaysUnopenedState state = NDaysUnopenedState();
|
||||
|
||||
void lockNoticeSettingAccountList() async {
|
||||
var entity = await ApiRepository.to.updateNdaysNotCloseDoorNoticeSetting(
|
||||
lockId: state.getLockId.value,
|
||||
dayNotOpenDoorState: state.isUnOpenNotice.value == true ? 1 : 0,
|
||||
dayNotOpenDoorValue: state.unOpenDoorTime.value,
|
||||
dayNotOpenDoorNoticeWayList: [
|
||||
Future<void> lockNoticeSettingAccountList() async {
|
||||
final OpenDoorNotifyEntity entity = await ApiRepository.to
|
||||
.updateNdaysNotCloseDoorNoticeSetting(
|
||||
lockId: state.getLockId.value,
|
||||
dayNotOpenDoorState: state.isUnOpenNotice.value == true ? 1 : 0,
|
||||
dayNotOpenDoorValue: state.unOpenDoorTime.value,
|
||||
dayNotOpenDoorNoticeWayList: [
|
||||
{'type': 'mail', 'accounts': getEmailAndSMSAccountList(true)},
|
||||
{'type': 'sms', 'accounts': getEmailAndSMSAccountList(false)}
|
||||
]);
|
||||
@ -26,14 +27,14 @@ class NDaysUnopenedLogic extends BaseGetXController {
|
||||
|
||||
//获取到家人信息的请求数组
|
||||
List getEmailAndSMSAccountList(bool isEmail) {
|
||||
List list = [];
|
||||
final List list = [];
|
||||
List accountList = [];
|
||||
isEmail
|
||||
? accountList = state.emailReceiverList.value
|
||||
: accountList = state.phoneReceiverList.value;
|
||||
for (int i = 0; i < accountList.length; i++) {
|
||||
MsgNoticeModeData item = accountList[i];
|
||||
Map map = {};
|
||||
final MsgNoticeModeData item = accountList[i];
|
||||
final Map map = {};
|
||||
map['countryCode'] = isEmail ? 0 : item.countryCode;
|
||||
map['account'] = isEmail ? item.receiveEmail : item.receivePhone;
|
||||
list.add(map);
|
||||
@ -45,9 +46,9 @@ class NDaysUnopenedLogic extends BaseGetXController {
|
||||
String emailListStr = '';
|
||||
if (val['emailReceiverList'] != null) {
|
||||
state.emailReceiverList.value = val['emailReceiverList'];
|
||||
List emailReceiverList = state.emailReceiverList.value;
|
||||
final List emailReceiverList = state.emailReceiverList.value;
|
||||
for (int i = 0; i < emailReceiverList.length; i++) {
|
||||
MsgNoticeModeData item = emailReceiverList[i];
|
||||
final MsgNoticeModeData item = emailReceiverList[i];
|
||||
emailListStr += item.receiveEmail;
|
||||
// 检查是否为最后一个元素
|
||||
if (i < emailReceiverList.length - 1) {
|
||||
@ -63,9 +64,9 @@ class NDaysUnopenedLogic extends BaseGetXController {
|
||||
|
||||
if (val['phoneReceiverList'] != null) {
|
||||
state.phoneReceiverList.value = val['phoneReceiverList'];
|
||||
List phoneReceiverList = state.phoneReceiverList.value;
|
||||
final List phoneReceiverList = state.phoneReceiverList.value;
|
||||
for (int i = 0; i < phoneReceiverList.length; i++) {
|
||||
MsgNoticeModeData item = phoneReceiverList[i];
|
||||
final MsgNoticeModeData item = phoneReceiverList[i];
|
||||
phoneListStr += item.receivePhone;
|
||||
// 检查是否为最后一个元素
|
||||
if (i < phoneReceiverList.length - 1) {
|
||||
@ -78,24 +79,24 @@ class NDaysUnopenedLogic extends BaseGetXController {
|
||||
|
||||
//根据列表返回值得到邮箱、手机列表
|
||||
Map<String, List<MsgNoticeModeData>> getAccountsMap() {
|
||||
List<MsgNoticeModeData> mailAccounts = [];
|
||||
List<MsgNoticeModeData> smsAccounts = [];
|
||||
final List<MsgNoticeModeData> mailAccounts = [];
|
||||
final List<MsgNoticeModeData> smsAccounts = [];
|
||||
|
||||
if (state.msgNoticeInfo.value.dayNotOpenDoorNoticeWayList != null) {
|
||||
for (NoticeWay item
|
||||
for (final NoticeWay item
|
||||
in state.msgNoticeInfo.value.dayNotOpenDoorNoticeWayList!) {
|
||||
if (item.type == 'mail' && item.accounts != null) {
|
||||
for (Accounts account in item.accounts!) {
|
||||
for (final Accounts account in item.accounts!) {
|
||||
if (account.account != null) {
|
||||
MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData();
|
||||
final MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData();
|
||||
msgNoticeModeData.receiveEmail = account.account!;
|
||||
mailAccounts.add(msgNoticeModeData);
|
||||
}
|
||||
}
|
||||
} 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) {
|
||||
MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData();
|
||||
final MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData();
|
||||
msgNoticeModeData.receivePhone = account.account!;
|
||||
msgNoticeModeData.countryCode = account.countryCode!;
|
||||
smsAccounts.add(msgNoticeModeData);
|
||||
|
||||
@ -4,10 +4,11 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/appRouters.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/pickers/pickers.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/submitBtn.dart';
|
||||
|
||||
@ -23,8 +24,8 @@ class NDaysUnopenedPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
|
||||
final logic = Get.put(NDaysUnopenedLogic());
|
||||
final state = Get.find<NDaysUnopenedLogic>().state;
|
||||
final NDaysUnopenedLogic logic = Get.put(NDaysUnopenedLogic());
|
||||
final NDaysUnopenedState state = Get.find<NDaysUnopenedLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -36,13 +37,13 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: ListView(
|
||||
padding: EdgeInsets.all(30.w),
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text(
|
||||
"经过以上设定的时间,锁没有被开启,系统会给指定对象发送提醒消息,该功能需要锁联网".tr,
|
||||
'经过以上设定的时间,锁没有被开启,系统会给指定对象发送提醒消息,该功能需要锁联网'.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 20.sp, color: AppColors.darkGrayTextColor),
|
||||
)),
|
||||
@ -67,7 +68,7 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
|
||||
SubmitBtn(
|
||||
btnName: '保存'.tr,
|
||||
onClick: () async {
|
||||
var isVip = await Storage.getBool(saveIsVip);
|
||||
bool? isVip = await Storage.getBool(saveIsVip);
|
||||
if (isVip == false) {
|
||||
ShowCupertinoAlertView().advancedFeatureAlert();
|
||||
} else {
|
||||
@ -87,10 +88,10 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
|
||||
return Visibility(
|
||||
visible: state.isUnOpenNotice.value,
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: '门未开时间'.tr,
|
||||
rightTitle: '${state.unOpenDoorTime.value}${'天'.tr}',
|
||||
rightTitle: '${state.unOpenDoorTime.value}天',
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: false,
|
||||
isHaveDirection: true,
|
||||
@ -104,8 +105,9 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.notificationModePage,
|
||||
arguments: {'msgNoticeInfo': state.msgNoticeInfo.value})
|
||||
?.then((val) {
|
||||
arguments: <String, MsgNoticeData>{
|
||||
'msgNoticeInfo': state.msgNoticeInfo.value
|
||||
})?.then((val) {
|
||||
if (val != null) {
|
||||
state.emailListStr.value = logic.getEmailListStr(val);
|
||||
state.phontListStr.value = logic.getPhoneListStr(val);
|
||||
@ -116,10 +118,10 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
|
||||
color: Colors.white,
|
||||
margin: EdgeInsets.only(bottom: 10.h),
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
CommonItem(
|
||||
leftTitel: '提醒方式'.tr,
|
||||
rightTitle: "",
|
||||
rightTitle: '',
|
||||
isHaveLine: false,
|
||||
isHaveRightWidget: false,
|
||||
isHaveDirection: true,
|
||||
@ -151,7 +153,7 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
|
||||
borderRadius: BorderRadius.circular(6.0.w),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
notifyTitle,
|
||||
style: TextStyle(color: Colors.black, fontSize: 20.sp),
|
||||
@ -175,7 +177,7 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: state.isUnOpenNotice.value,
|
||||
onChanged: (value) {
|
||||
onChanged: (bool value) {
|
||||
setState(() {
|
||||
state.isUnOpenNotice.value = value;
|
||||
if (!state.isUnOpenNotice.value) {
|
||||
@ -187,11 +189,12 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
|
||||
}
|
||||
|
||||
//底部选择pickerView
|
||||
_openBottomItemSheet(BuildContext context, List dataList) {
|
||||
void _openBottomItemSheet(BuildContext context, List dataList) {
|
||||
Pickers.showSinglePicker(context,
|
||||
data: dataList,
|
||||
pickerStyle: DefaultPickerStyle(), onConfirm: (p, position) {
|
||||
state.unOpenDoorTime.value = p;
|
||||
}, onChanged: (p, position) {});
|
||||
pickerStyle: DefaultPickerStyle(), onConfirm: (p, int position) {
|
||||
state.unOpenDoorTime.value =
|
||||
int.parse(state.unopenDoorTimeList[position].replaceAll('天', ''));
|
||||
}, onChanged: (p, int position) {});
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,21 +4,21 @@ import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/msgNotific
|
||||
|
||||
class NDaysUnopenedState {
|
||||
final List unopenDoorTimeList = [
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15,
|
||||
'1天',
|
||||
'2天',
|
||||
'3天',
|
||||
'4天',
|
||||
'5天',
|
||||
'6天',
|
||||
'7天',
|
||||
'8天',
|
||||
'9天',
|
||||
'10天',
|
||||
'11天',
|
||||
'12天',
|
||||
'13天',
|
||||
'14天',
|
||||
'15天',
|
||||
];
|
||||
|
||||
var isUnOpenNotice = false.obs; // 是否N天未开门提醒
|
||||
|
||||
@ -3,6 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.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_state.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_arg.dart';
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
import '../../../tools/commonItem.dart';
|
||||
@ -19,8 +20,10 @@ class ValueAddedServicesRealNamePage extends StatefulWidget {
|
||||
|
||||
class _ValueAddedServicesRealNamePageState
|
||||
extends State<ValueAddedServicesRealNamePage> {
|
||||
final logic = Get.put(ValueAddedServicesRealNameLogic());
|
||||
final state = Get.find<ValueAddedServicesRealNameLogic>().state;
|
||||
final ValueAddedServicesRealNameLogic logic =
|
||||
Get.put(ValueAddedServicesRealNameLogic());
|
||||
final ValueAddedServicesRealNameState state =
|
||||
Get.find<ValueAddedServicesRealNameLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -31,7 +34,7 @@ class _ValueAddedServicesRealNamePageState
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 1.sw,
|
||||
padding: EdgeInsets.only(
|
||||
@ -42,7 +45,7 @@ class _ValueAddedServicesRealNamePageState
|
||||
color: AppColors.darkGrayTextColor, fontSize: 20.sp),
|
||||
)),
|
||||
middleWidget(),
|
||||
Obx(() => bottomWidget())
|
||||
Obx(bottomWidget)
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -55,15 +58,15 @@ class _ValueAddedServicesRealNamePageState
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(
|
||||
"images/mine/icon_mine_valueAddedServices_noteTop.png"),
|
||||
'images/mine/icon_mine_valueAddedServices_noteTop.png'),
|
||||
fit: BoxFit.cover)),
|
||||
child: Column(children: [
|
||||
child: Column(children: <Widget>[
|
||||
Container(
|
||||
margin:
|
||||
const EdgeInsets.only(top: 15, bottom: 15, left: 30, right: 30),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Obx(() => Text(
|
||||
"${'当前剩余数量'.tr}:${state.realNameRemainCount.value}",
|
||||
style: TextStyle(fontSize: 24.sp),
|
||||
@ -75,7 +78,7 @@ class _ValueAddedServicesRealNamePageState
|
||||
padding: const EdgeInsets.only(top: 10, bottom: 10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.valueAddedServicesRecordPage,
|
||||
@ -92,7 +95,7 @@ class _ValueAddedServicesRealNamePageState
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.advancedFeaturesWebPage,
|
||||
arguments: {'isShop': false});
|
||||
arguments: <String, bool>{'isShop': false});
|
||||
},
|
||||
child: Container(
|
||||
width: 200.w,
|
||||
@ -115,9 +118,9 @@ class _ValueAddedServicesRealNamePageState
|
||||
color: Colors.white,
|
||||
margin: EdgeInsets.all(20.h),
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 20.h, bottom: 20.h, left: 30.w),
|
||||
child: Text(
|
||||
@ -143,10 +146,10 @@ class _ValueAddedServicesRealNamePageState
|
||||
Widget checkCommonItem(
|
||||
ValueAddedServicesRealNameLogic logic, String text, int clickIndex,
|
||||
{bool isHaveLine = true, bool isHaveRightWidget = true}) {
|
||||
bool check = logic.state.checkIndex.value == clickIndex;
|
||||
final bool check = logic.state.checkIndex.value == clickIndex;
|
||||
return CommonItem(
|
||||
leftTitel: text,
|
||||
rightTitle: "",
|
||||
rightTitle: '',
|
||||
allHeight: 60.h,
|
||||
isHaveLine: isHaveLine,
|
||||
isHaveRightWidget: isHaveRightWidget,
|
||||
@ -155,7 +158,7 @@ class _ValueAddedServicesRealNamePageState
|
||||
logic.check(clickIndex);
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
check
|
||||
? 'images/icon_round_select.png'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user