Merge branch 'master_hyx'
This commit is contained in:
commit
d68678a33b
@ -40,21 +40,21 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
|
||||
switch (type) {
|
||||
case '0':
|
||||
// 限时
|
||||
if (state.timeLimitBeginTime.value.isEmpty) {
|
||||
if (state.timeLimitBeginTime.isEmpty) {
|
||||
showToast("请选择开始时间".tr);
|
||||
return;
|
||||
}
|
||||
if (state.timeLimitEndTime.value.isEmpty) {
|
||||
if (state.timeLimitEndTime.isEmpty) {
|
||||
showToast("请选择结束时间".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
typeValue = XSConstantMacro.keyTypeTime;
|
||||
startDate = DateTool()
|
||||
.dateToTimestamp(state.timeLimitBeginTime.value, 1)
|
||||
.dateToTimestamp(state.timeLimitBeginTime, 1)
|
||||
.toString();
|
||||
endDate = DateTool()
|
||||
.dateToTimestamp(state.timeLimitEndTime.value, 1)
|
||||
.dateToTimestamp(state.timeLimitEndTime, 1)
|
||||
.toString();
|
||||
startTime = "0";
|
||||
endTime = "0";
|
||||
@ -73,20 +73,20 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
|
||||
break;
|
||||
case '3':
|
||||
typeValue = XSConstantMacro.keyTypeLoop;
|
||||
if (state.cycleBeginTime.value.isEmpty) {
|
||||
if (state.cycleBeginTime.isEmpty) {
|
||||
showToast("请选择有效期".tr);
|
||||
return;
|
||||
}
|
||||
startDate = DateTool()
|
||||
.dateToTimestamp(state.cycleBeginTime.value, 1)
|
||||
.dateToTimestamp(state.cycleBeginTime, 1)
|
||||
.toString();
|
||||
endDate =
|
||||
DateTool().dateToTimestamp(state.cycleEndTime.value, 1).toString();
|
||||
DateTool().dateToTimestamp(state.cycleEndTime, 1).toString();
|
||||
startTime = DateTool()
|
||||
.dateToTimestamp(state.effectiveDateTime.value, 0)
|
||||
.dateToTimestamp(state.effectiveDateTime, 0)
|
||||
.toString();
|
||||
endTime = DateTool()
|
||||
.dateToTimestamp(state.failureDateTime.value, 0)
|
||||
.dateToTimestamp(state.failureDateTime, 0)
|
||||
.toString();
|
||||
break;
|
||||
default:
|
||||
@ -96,15 +96,15 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
|
||||
String getKeyType = typeValue.toString();
|
||||
|
||||
var entity = await ApiRepository.to.sendElectronicKey(
|
||||
createUser: state.isCreateUser.value == true ? "1" : "0",
|
||||
countryCode: state.countryCode.value,
|
||||
createUser: state.isCreateUser == true ? "1" : "0",
|
||||
countryCode: state.countryCode,
|
||||
usernameType: isPhoneNumber(state.emailOrPhoneController.text) == true
|
||||
? '1'
|
||||
: '2',
|
||||
endDate: int.parse(endDate),
|
||||
faceAuthentication: state.isAuthentication.value == true ? '1' : '2',
|
||||
faceAuthentication: state.isAuthentication == true ? '1' : '2',
|
||||
isCameraEnable: '2',
|
||||
isRemoteUnlock: state.isRemoteUnlock.value == true ? '1' : '2',
|
||||
isRemoteUnlock: state.isRemoteUnlock == true ? '1' : '2',
|
||||
keyNameForAdmin: state.keyNameController.text,
|
||||
keyRight: '0',
|
||||
keyType: getKeyType,
|
||||
@ -118,13 +118,15 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
|
||||
endTime: int.parse(endTime),
|
||||
isOnlyManageSelf: 0);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.isSendSuccess.value = true;
|
||||
state.isSendSuccess = true;
|
||||
resetData();
|
||||
update();
|
||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||
} else {
|
||||
if (entity.errorCode == 425) {
|
||||
//用户未注册
|
||||
state.isCreateUser.value = true;
|
||||
state.isCreateUser = true;
|
||||
update();
|
||||
ShowTipView().showIosTipWithContentDialog(
|
||||
'${"是否发送电子钥匙给未注册账号".tr}\n${state.emailOrPhoneController.text}', () {
|
||||
sendElectronicKeyRequest();
|
||||
@ -151,14 +153,15 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
|
||||
state.keyNameController.text = "";
|
||||
state.timeLimitBeginTime = DateTool()
|
||||
.dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString())
|
||||
.obs; // 限时开始时间
|
||||
; // 限时开始时间
|
||||
state.timeLimitEndTime = DateTool()
|
||||
.dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString())
|
||||
.obs; // 限时结束时间
|
||||
state.cycleBeginTime = "".obs; // 循环开始时间
|
||||
state.cycleEndTime = "".obs; // 循环结束时间
|
||||
state.effectiveDateTime = "".obs; // 生效时间
|
||||
state.failureDateTime = "".obs; // 失效时间
|
||||
state.weekdaysList = [].obs;
|
||||
; // 限时结束时间
|
||||
state.cycleBeginTime = ""; // 循环开始时间
|
||||
state.cycleEndTime = ""; // 循环结束时间
|
||||
state.effectiveDateTime = ""; // 生效时间
|
||||
state.failureDateTime = ""; // 失效时间
|
||||
state.weekdaysList = [];
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,66 +38,64 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
tag: widget.type,
|
||||
init: SendElectronicKeyViewLogic(widget.type),
|
||||
builder: (SendElectronicKeyViewLogic logic) {
|
||||
return Obx(() {
|
||||
if (logic.state.isSendSuccess.value == true) {
|
||||
return sendElectronicKeySucceed(logic);
|
||||
} else {
|
||||
switch (widget.type) {
|
||||
case '0':
|
||||
// 限时
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyInfoWidget(logic),
|
||||
keyTimeWidget(logic),
|
||||
remoteUnlockingWidget(logic),
|
||||
keyRealNameWidget(logic),
|
||||
keyBottomWidget(logic.state.timeLimitTips, logic)
|
||||
],
|
||||
),
|
||||
);
|
||||
case '1':
|
||||
// 永久
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyInfoWidget(logic),
|
||||
remoteUnlockingWidget(logic),
|
||||
keyRealNameWidget(logic),
|
||||
keyBottomWidget(logic.state.permanentTips, logic)
|
||||
],
|
||||
),
|
||||
);
|
||||
case '2':
|
||||
// 单次
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyInfoWidget(logic),
|
||||
remoteUnlockingWidget(logic),
|
||||
keyRealNameWidget(logic),
|
||||
keyBottomWidget(logic.state.onceLimitTips, logic)
|
||||
],
|
||||
),
|
||||
);
|
||||
case '3':
|
||||
// 循环
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyInfoWidget(logic),
|
||||
keyPeriodValidityWidget(logic),
|
||||
remoteUnlockingWidget(logic),
|
||||
keyRealNameWidget(logic),
|
||||
keyBottomWidget(logic.state.cycleLimitTips, logic)
|
||||
],
|
||||
),
|
||||
);
|
||||
default:
|
||||
return Container();
|
||||
}
|
||||
if (logic.state.isSendSuccess == true) {
|
||||
return sendElectronicKeySucceed(logic);
|
||||
} else {
|
||||
switch (widget.type) {
|
||||
case '0':
|
||||
// 限时
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyInfoWidget(logic),
|
||||
keyTimeWidget(logic),
|
||||
remoteUnlockingWidget(logic),
|
||||
keyRealNameWidget(logic),
|
||||
keyBottomWidget(logic.state.timeLimitTips, logic)
|
||||
],
|
||||
),
|
||||
);
|
||||
case '1':
|
||||
// 永久
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyInfoWidget(logic),
|
||||
remoteUnlockingWidget(logic),
|
||||
keyRealNameWidget(logic),
|
||||
keyBottomWidget(logic.state.permanentTips, logic)
|
||||
],
|
||||
),
|
||||
);
|
||||
case '2':
|
||||
// 单次
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyInfoWidget(logic),
|
||||
remoteUnlockingWidget(logic),
|
||||
keyRealNameWidget(logic),
|
||||
keyBottomWidget(logic.state.onceLimitTips, logic)
|
||||
],
|
||||
),
|
||||
);
|
||||
case '3':
|
||||
// 循环
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
keyInfoWidget(logic),
|
||||
keyPeriodValidityWidget(logic),
|
||||
remoteUnlockingWidget(logic),
|
||||
keyRealNameWidget(logic),
|
||||
keyBottomWidget(logic.state.cycleLimitTips, logic)
|
||||
],
|
||||
),
|
||||
);
|
||||
default:
|
||||
return Container();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -123,18 +121,19 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
isHaveRightWidget: true,
|
||||
isHaveDirection: true,
|
||||
rightWidget: Text(
|
||||
'${logic.state.countryName.value} +${logic.state.countryCode.value}',
|
||||
'${logic.state.countryName} +${logic.state.countryCode}',
|
||||
textAlign: TextAlign.end,
|
||||
style:
|
||||
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
action: () async {
|
||||
var result = await Navigator.pushNamed(
|
||||
context, Routers.selectCountryRegionPage);
|
||||
if (result != null) {
|
||||
result as Map<String, dynamic>;
|
||||
logic.state.countryCode.value = result['code'];
|
||||
logic.state.countryName.value = result['countryName'];
|
||||
logic.state.countryCode = result['code'];
|
||||
logic.state.countryName = result['countryName'];
|
||||
logic.update();
|
||||
}
|
||||
},
|
||||
),
|
||||
@ -153,33 +152,39 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
Widget keyTimeWidget(SendElectronicKeyViewLogic logic) {
|
||||
return Column(
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||
rightTitle: logic.state.timeLimitBeginTime.value,
|
||||
rightTitle: logic.state.timeLimitBeginTime,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
PDuration selectDate = PDuration.parse(
|
||||
DateTime.parse(logic.state.timeLimitBeginTime.value));
|
||||
DateTime.parse(logic.state.timeLimitBeginTime));
|
||||
Pickers.showDatePicker(context,
|
||||
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
|
||||
logic.state.timeLimitBeginTime.value =
|
||||
DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
selectDate: selectDate,
|
||||
mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
logic.state.timeLimitBeginTime =
|
||||
DateTool().getYMDHNDateString(p, 1);
|
||||
logic.update();
|
||||
});
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||
rightTitle: logic.state.timeLimitEndTime.value,
|
||||
rightTitle: logic.state.timeLimitEndTime,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
PDuration selectDate = PDuration.parse(
|
||||
DateTime.tryParse(logic.state.timeLimitEndTime.value));
|
||||
DateTime.tryParse(logic.state.timeLimitEndTime));
|
||||
Pickers.showDatePicker(context,
|
||||
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
|
||||
logic.state.timeLimitEndTime.value =
|
||||
DateTool().getYMDHNDateString(p, 1);
|
||||
});
|
||||
})),
|
||||
selectDate: selectDate,
|
||||
mode: DateMode.YMDHM,
|
||||
onConfirm: (p) {
|
||||
logic.state.timeLimitEndTime =
|
||||
DateTool().getYMDHNDateString(p, 1);
|
||||
logic.update();
|
||||
});
|
||||
}),
|
||||
Container(height: 10.h),
|
||||
],
|
||||
);
|
||||
@ -195,7 +200,8 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
isTipsImg: true,
|
||||
tipsImgAction: () {
|
||||
ShowTipView().showSureAlertDialog(
|
||||
"人脸实名认证指的是用户在使用手机APP开锁时,需要先进行本人人脸验证,验证通过才能开锁。".tr);
|
||||
"人脸实名认证指的是用户在使用手机APP开锁时,需要先进行本人人脸验证,验证通过才能开锁。"
|
||||
.tr);
|
||||
},
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
@ -209,30 +215,32 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
Widget keyPeriodValidityWidget(SendElectronicKeyViewLogic logic) {
|
||||
return Column(
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
rightTitle:
|
||||
"${logic.state.cycleBeginTime.value}\n${logic.state.cycleEndTime.value}",
|
||||
"${logic.state.cycleBeginTime}\n${logic.state.cycleEndTime}",
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () async {
|
||||
var result =
|
||||
await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
|
||||
await Get.toNamed(
|
||||
Routers.seletKeyCyclicDatePage, arguments: {
|
||||
'validityValue': logic.state.weekdaysList,
|
||||
'starDate': logic.state.cycleBeginTime.value,
|
||||
'endDate': logic.state.cycleEndTime.value,
|
||||
'starTime': logic.state.effectiveDateTime.value,
|
||||
'endTime': logic.state.failureDateTime.value
|
||||
'starDate': logic.state.cycleBeginTime,
|
||||
'endDate': logic.state.cycleEndTime,
|
||||
'starTime': logic.state.effectiveDateTime,
|
||||
'endTime': logic.state.failureDateTime
|
||||
});
|
||||
if (result != null && result.isNotEmpty) {
|
||||
logic.state.weekdaysList.value = result['validityValue'];
|
||||
logic.state.cycleBeginTime.value = result['starDate'];
|
||||
logic.state.cycleEndTime.value = result['endDate'];
|
||||
logic.state.effectiveDateTime.value = result['starTime'];
|
||||
logic.state.failureDateTime.value = result['endTime'];
|
||||
logic.state.weekdaysList = result['validityValue'];
|
||||
logic.state.cycleBeginTime = result['starDate'];
|
||||
logic.state.cycleEndTime = result['endDate'];
|
||||
logic.state.effectiveDateTime = result['starTime'];
|
||||
logic.state.failureDateTime = result['endTime'];
|
||||
logic.update();
|
||||
}
|
||||
})),
|
||||
Obx(() => Visibility(
|
||||
}),
|
||||
Visibility(
|
||||
visible: logic.state.weekdaysList.isNotEmpty ? true : false,
|
||||
child: CommonItem(
|
||||
leftTitel: "有效日".tr,
|
||||
@ -240,66 +248,74 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () async {
|
||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||
var result = await Get.toNamed(
|
||||
Routers.seletKeyCyclicDatePage,
|
||||
arguments: {
|
||||
'validityValue': logic.state.weekdaysList,
|
||||
'starDate': logic.state.cycleBeginTime.value,
|
||||
'endDate': logic.state.cycleEndTime.value,
|
||||
'starTime': logic.state.effectiveDateTime.value,
|
||||
'endTime': logic.state.failureDateTime.value
|
||||
'starDate': logic.state.cycleBeginTime,
|
||||
'endDate': logic.state.cycleEndTime,
|
||||
'starTime': logic.state.effectiveDateTime,
|
||||
'endTime': logic.state.failureDateTime
|
||||
});
|
||||
if (result != null && result.isNotEmpty) {
|
||||
logic.state.weekdaysList.value = result['validityValue'];
|
||||
logic.state.cycleBeginTime.value = result['starDate'];
|
||||
logic.state.cycleEndTime.value = result['endDate'];
|
||||
logic.state.effectiveDateTime.value = result['starTime'];
|
||||
logic.state.failureDateTime.value = result['endTime'];
|
||||
logic.state.weekdaysList =
|
||||
result['validityValue'];
|
||||
logic.state.cycleBeginTime = result['starDate'];
|
||||
logic.state.cycleEndTime = result['endDate'];
|
||||
logic.state.effectiveDateTime =
|
||||
result['starTime'];
|
||||
logic.state.failureDateTime = result['endTime'];
|
||||
logic.update();
|
||||
}
|
||||
}))),
|
||||
Obx(() => Visibility(
|
||||
visible: logic.state.effectiveDateTime.value.isNotEmpty,
|
||||
})),
|
||||
Visibility(
|
||||
visible: logic.state.effectiveDateTime.isNotEmpty,
|
||||
child: CommonItem(
|
||||
leftTitel: "有效时间".tr,
|
||||
rightTitle:
|
||||
"${logic.state.effectiveDateTime.value}-${logic.state.failureDateTime.value}",
|
||||
"${logic.state.effectiveDateTime}-${logic.state
|
||||
.failureDateTime}",
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||
var result = await Get.toNamed(
|
||||
Routers.seletKeyCyclicDatePage,
|
||||
arguments: {
|
||||
'validityValue': logic.state.weekdaysList,
|
||||
'starDate': logic.state.cycleBeginTime.value,
|
||||
'endDate': logic.state.cycleEndTime.value,
|
||||
'starTime': logic.state.effectiveDateTime.value,
|
||||
'endTime': logic.state.failureDateTime.value
|
||||
'starDate': logic.state.cycleBeginTime,
|
||||
'endDate': logic.state.cycleEndTime,
|
||||
'starTime': logic.state.effectiveDateTime,
|
||||
'endTime': logic.state.failureDateTime
|
||||
});
|
||||
if (result != null && result.isNotEmpty) {
|
||||
logic.state.weekdaysList.value = result['validityValue'];
|
||||
logic.state.cycleBeginTime.value = result['starDate'];
|
||||
logic.state.cycleEndTime.value = result['endDate'];
|
||||
logic.state.effectiveDateTime.value = result['starTime'];
|
||||
logic.state.failureDateTime.value = result['endTime'];
|
||||
logic.state.weekdaysList =
|
||||
result['validityValue'];
|
||||
logic.state.cycleBeginTime = result['starDate'];
|
||||
logic.state.cycleEndTime = result['endDate'];
|
||||
logic.state.effectiveDateTime =
|
||||
result['starTime'];
|
||||
logic.state.failureDateTime = result['endTime'];
|
||||
logic.update();
|
||||
}
|
||||
}))),
|
||||
})),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget keyBottomWidget(
|
||||
String sendElectronicKeyTips, SendElectronicKeyViewLogic logic) {
|
||||
Widget keyBottomWidget(String sendElectronicKeyTips,
|
||||
SendElectronicKeyViewLogic logic) {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.all(20.w),
|
||||
child: Row(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
sendElectronicKeyTips,
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
||||
)),
|
||||
sendElectronicKeyTips,
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -316,7 +332,6 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
}),
|
||||
Container(
|
||||
padding: EdgeInsets.only(right: 30.w),
|
||||
// color: Colors.red,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
@ -333,7 +348,7 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.sendGroupKey!.tr,
|
||||
style:
|
||||
TextStyle(color: AppColors.mainColor, fontSize: 22.sp),
|
||||
TextStyle(color: AppColors.mainColor, fontSize: 22.sp),
|
||||
)),
|
||||
],
|
||||
),
|
||||
@ -384,8 +399,9 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
SubmitBtn(
|
||||
btnName: '完成'.tr,
|
||||
onClick: () {
|
||||
logic.state.isSendSuccess.value = false;
|
||||
logic.state.isSendSuccess = false;
|
||||
logic.resetData();
|
||||
logic.update();
|
||||
}),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
@ -442,16 +458,16 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
hintStyle: TextStyle(fontSize: 22.sp),
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
disabledBorder: const OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
border: const OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 0),
|
||||
),
|
||||
style: TextStyle(
|
||||
@ -463,32 +479,32 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
),
|
||||
isHaveBtn
|
||||
? Container(
|
||||
width: 32.w,
|
||||
height: 32.w,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
image: DecorationImage(
|
||||
image: AssetImage('images/icon_addressBook.png'),
|
||||
fit: BoxFit.fill),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
Contact? currentContact =
|
||||
await logic.state.contactPicker.selectContact();
|
||||
logic.state.contact = currentContact!;
|
||||
if (currentContact.phoneNumbers!.isNotEmpty) {
|
||||
logic.state.emailOrPhoneController.text = currentContact
|
||||
.phoneNumbers![0]
|
||||
.replaceAll(RegExp(r"\s+\b|\b\s"), "");
|
||||
}
|
||||
if (currentContact.fullName!.isNotEmpty) {
|
||||
logic.state.keyNameController.text =
|
||||
currentContact.fullName!;
|
||||
}
|
||||
},
|
||||
),
|
||||
)
|
||||
width: 32.w,
|
||||
height: 32.w,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
image: DecorationImage(
|
||||
image: AssetImage('images/icon_addressBook.png'),
|
||||
fit: BoxFit.fill),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
Contact? currentContact =
|
||||
await logic.state.contactPicker.selectContact();
|
||||
logic.state.contact = currentContact!;
|
||||
if (currentContact.phoneNumbers!.isNotEmpty) {
|
||||
logic.state.emailOrPhoneController.text = currentContact
|
||||
.phoneNumbers![0]
|
||||
.replaceAll(RegExp(r"\s+\b|\b\s"), "");
|
||||
}
|
||||
if (currentContact.fullName!.isNotEmpty) {
|
||||
logic.state.keyNameController.text =
|
||||
currentContact.fullName!;
|
||||
}
|
||||
},
|
||||
),
|
||||
)
|
||||
: Container()
|
||||
],
|
||||
),
|
||||
@ -501,8 +517,8 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
visible: logic.state.isDemoMode
|
||||
? false
|
||||
: (CommonDataManage().currentKeyInfo.lockSetting!.remoteUnlock == 1
|
||||
? true
|
||||
: false),
|
||||
? true
|
||||
: false),
|
||||
child: Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
@ -519,22 +535,22 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
}
|
||||
|
||||
//isRemote true:远程开锁 false:实名认证
|
||||
CupertinoSwitch _remoteSwitch(
|
||||
bool isRemote, SendElectronicKeyViewLogic logic) {
|
||||
CupertinoSwitch _remoteSwitch(bool isRemote,
|
||||
SendElectronicKeyViewLogic logic) {
|
||||
return CupertinoSwitch(
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: isRemote
|
||||
? logic.state.isRemoteUnlock.value
|
||||
: logic.state.isAuthentication.value,
|
||||
? logic.state.isRemoteUnlock
|
||||
: logic.state.isAuthentication,
|
||||
onChanged: (value) {
|
||||
if (isRemote) {
|
||||
logic.state.isRemoteUnlock.value = !logic.state.isRemoteUnlock.value;
|
||||
logic.state.isRemoteUnlock = !logic.state.isRemoteUnlock;
|
||||
} else {
|
||||
logic.state.isAuthentication.value =
|
||||
!logic.state.isAuthentication.value;
|
||||
if (logic.state.isAuthentication.value) {
|
||||
logic.state.isAuthentication =
|
||||
!logic.state.isAuthentication;
|
||||
if (logic.state.isAuthentication) {
|
||||
ShowTipView().showBuyTipWithContentAlert(
|
||||
titleStr: '实名认证为付费功能,请购买后再使用'.tr,
|
||||
sureClick: () {
|
||||
@ -570,7 +586,7 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
TextButton(
|
||||
style: ButtonStyle(
|
||||
overlayColor:
|
||||
MaterialStateProperty.all<Color>(Colors.white)),
|
||||
MaterialStateProperty.all<Color>(Colors.white)),
|
||||
child: Text(
|
||||
'取消'.tr,
|
||||
style: TextStyle(
|
||||
@ -594,14 +610,14 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
return widgetList;
|
||||
}
|
||||
|
||||
GestureDetector buildCenter3(
|
||||
String imageName, String titleStr, int itemIndex) {
|
||||
GestureDetector buildCenter3(String imageName, String titleStr,
|
||||
int itemIndex) {
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
width: 120.w,
|
||||
// height: 64.h,
|
||||
margin:
|
||||
EdgeInsets.only(top: 20.w, bottom: 20.w, left: 10.w, right: 10.w),
|
||||
EdgeInsets.only(top: 20.w, bottom: 20.w, left: 10.w, right: 10.w),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
@ -629,21 +645,21 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
Get.back();
|
||||
switch (itemIndex) {
|
||||
case 0:
|
||||
//微信好友
|
||||
//微信好友
|
||||
String pwdShareStr = '您好,您的电子钥匙生成成功'.tr;
|
||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||
break;
|
||||
case 1:
|
||||
//短信
|
||||
//短信
|
||||
String pwdShareStr = '您好,您的电子钥匙生成成功'.tr;
|
||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||
break;
|
||||
case 2:
|
||||
//邮件
|
||||
//邮件
|
||||
Get.toNamed(Routers.sendEmailNotificationPage);
|
||||
break;
|
||||
case 3:
|
||||
//更多
|
||||
//更多
|
||||
String pwdShareStr = '您好,您的电子钥匙生成成功'.tr;
|
||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||
break;
|
||||
|
||||
@ -3,34 +3,35 @@ import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
|
||||
|
||||
class SendElectronicKeyViewState {
|
||||
TextEditingController emailOrPhoneController = TextEditingController(); //邮箱/手机号输入框
|
||||
TextEditingController emailOrPhoneController =
|
||||
TextEditingController(); //邮箱/手机号输入框
|
||||
TextEditingController keyNameController = TextEditingController(); //钥匙名输入框
|
||||
|
||||
final FlutterContactPicker contactPicker = FlutterContactPicker();
|
||||
late Contact contact;
|
||||
|
||||
final isRemoteUnlock = false.obs; //是否允许远程开锁
|
||||
final isAuthentication = false.obs; //是否可以实名认证
|
||||
bool isRemoteUnlock = false; //是否允许远程开锁
|
||||
bool isAuthentication = false; //是否可以实名认证
|
||||
|
||||
var timeLimitBeginTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时开始时间
|
||||
var timeLimitEndTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时结束时间
|
||||
var cycleBeginTime = "".obs;// 循环开始时间
|
||||
var cycleEndTime = "".obs;// 循环结束时间
|
||||
var effectiveDateTime = "".obs;// 生效时间
|
||||
var failureDateTime = "".obs;// 失效时间
|
||||
var weekdaysList = [].obs;
|
||||
var timeLimitBeginTime = DateTool().dateToYMDHNString(
|
||||
DateTime.now().millisecondsSinceEpoch.toString()); // 限时开始时间
|
||||
var timeLimitEndTime = DateTool().dateToYMDHNString(
|
||||
DateTime.now().millisecondsSinceEpoch.toString()); // 限时结束时间
|
||||
var cycleBeginTime = ""; // 循环开始时间
|
||||
var cycleEndTime = ""; // 循环结束时间
|
||||
var effectiveDateTime = ""; // 生效时间
|
||||
var failureDateTime = ""; // 失效时间
|
||||
var weekdaysList = [];
|
||||
|
||||
var isSendSuccess = false.obs;
|
||||
var countryName = '中国'.tr.obs;
|
||||
var countryCode = '86'.obs;
|
||||
var isCreateUser = false.obs; //用户未注册时传1 已注册传0
|
||||
var isSendSuccess = false;
|
||||
var countryName = '中国'.tr;
|
||||
var countryCode = '86';
|
||||
var isCreateUser = false; //用户未注册时传1 已注册传0
|
||||
var isDemoMode = false;
|
||||
|
||||
final timeLimitTips = '接收者在有效期内可以不限次数使用'; //限时
|
||||
final permanentTips = '接收者可以使用此App开关锁'; //永久
|
||||
final onceLimitTips = '单次钥匙有效期为1小时,只能使用一次'; //单次
|
||||
final cycleLimitTips = '接收者可以在有效期内的固定时间段里,不限次数使用'; //循环
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user