1,修复密码详情分享报错问题
2,完成密码模块系统邮件通知、短信通知发送的对接及兼容
This commit is contained in:
parent
17b5a76d2d
commit
4c9dd152ca
@ -429,7 +429,7 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
Get.toNamed(Routers.sendEmailNotificationPage,
|
||||
arguments: <String, Object?>{
|
||||
'receiver': logic.emailOrPhone,
|
||||
'userNameType': logic.state.userNameType.value,
|
||||
'channelType': logic.state.userNameType.value,
|
||||
'keyId': logic.keyId
|
||||
});
|
||||
},
|
||||
|
||||
@ -20,17 +20,25 @@ class SendEmailNotificationLogic extends BaseGetXController {
|
||||
state.emailTemplateList.value =
|
||||
entity.data?.list ?? <EmailNotificationItem>[];
|
||||
state.currentNotifyItem.value = state.emailTemplateList.first;
|
||||
state.emailController.text = state.currentNotifyItem.value.template ?? '';
|
||||
state.templateContentController.text =
|
||||
state.currentNotifyItem.value.template ?? '';
|
||||
state.emailTemplateList.refresh();
|
||||
state.currentNotifyItem.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
//发送短信、邮件通知 channelType--1短信 2邮件 openDoorType--1电子钥匙 2密码
|
||||
//发送短信、邮件通知 channelType--1短信 2邮件 opisAPKFileName
|
||||
Future<void> keyNoticeSubmitRequest() async {
|
||||
if (state.receiverController.text.isEmpty &&
|
||||
state.getReceiver.value.isEmpty) {
|
||||
showToast('请输入接收者');
|
||||
return;
|
||||
}
|
||||
final SendEmailNotificationEntity entity =
|
||||
await ApiRepository.to.keyNoticeSubmit(
|
||||
receiverName: state.getReceiver.value,
|
||||
receiverName: state.getReceiver.value.isEmpty
|
||||
? state.receiverController.text
|
||||
: state.getReceiver.value,
|
||||
lockId: CommonDataManage().currentKeyInfo.lockId ?? 0,
|
||||
keyId: state.getKeyId.value,
|
||||
channelType: state.channelType.value,
|
||||
|
||||
@ -1,13 +1,14 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.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/electronicKey/sendEmailNotification/SendEmailNotification_logic.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_entity.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_state.dart';
|
||||
import 'package:star_lock/tools/emailNotifyTypeSelectAlert.dart';
|
||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||
import 'package:star_lock/tools/pickers/style/default_style.dart';
|
||||
import 'package:star_lock/translations/trans_lib.dart';
|
||||
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/commonItem.dart';
|
||||
@ -46,11 +47,17 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
||||
rightTitle: state.getReceiver.value,
|
||||
isHaveLine: true,
|
||||
)),
|
||||
Obx(() => state.getReceiver.value.isNotEmpty
|
||||
? CommonItem(
|
||||
leftTitel: '接收者'.tr,
|
||||
rightTitle: state.getReceiver.value,
|
||||
isHaveLine: true,
|
||||
)
|
||||
: CommonItem(
|
||||
leftTitel: '接收者'.tr,
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: _buildReceiverItemWidget())),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: '类型',
|
||||
rightTitle: state.getNotifyTypeText.value,
|
||||
@ -60,6 +67,7 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
||||
isEmail: state.channelType.value == 2,
|
||||
onSelected: (int value) {
|
||||
state.notifyTypeSelect.value = value;
|
||||
state.updateNotifyTypeText();
|
||||
});
|
||||
},
|
||||
)),
|
||||
@ -82,7 +90,7 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
||||
maxLines: 8,
|
||||
maxLength: 1000,
|
||||
textAlign: TextAlign.start,
|
||||
controller: state.emailController,
|
||||
controller: state.templateContentController,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 22.sp,
|
||||
@ -127,7 +135,9 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {
|
||||
logic.keyNoticeSubmitRequest();
|
||||
if (state.notifyTypeSelect.value == 1) {
|
||||
logic.keyNoticeSubmitRequest();
|
||||
} else {}
|
||||
}),
|
||||
],
|
||||
),
|
||||
@ -135,6 +145,103 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildReceiverItemWidget() {
|
||||
return Container(
|
||||
constraints: BoxConstraints(maxWidth: 400.w), // 设置父组件的宽度约束
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min, // 设置 Row 的 mainAxisSize 属性
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
fit: FlexFit.loose, // 使用 Flexible 并设置ting fit 属性
|
||||
child: SizedBox(width: 10.w),
|
||||
),
|
||||
if (state.channelType.value == 1)
|
||||
GestureDetector(
|
||||
child: Container(
|
||||
width: 90.w,
|
||||
color: Colors.white,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Obx(() => Text(
|
||||
'+${state.countryCode.value}',
|
||||
style: TextStyle(
|
||||
color: AppColors.darkGrayTextColor,
|
||||
fontSize: 20.sp),
|
||||
)),
|
||||
Image.asset(
|
||||
'images/icon_grayPullDown.png',
|
||||
width: 20.w,
|
||||
height: 20.w,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
onTap: () async {
|
||||
final result =
|
||||
await Get.toNamed(Routers.selectCountryRegionPage);
|
||||
if (result != null) {
|
||||
result as Map<String, dynamic>;
|
||||
state.countryCode.value = result['code'];
|
||||
state.countryName.value = result['countryName'];
|
||||
}
|
||||
},
|
||||
)
|
||||
else
|
||||
Container(),
|
||||
getReceiverTFWidget(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 接受者信息输入框
|
||||
Widget getReceiverTFWidget() {
|
||||
return SizedBox(
|
||||
height: 65.h,
|
||||
width: 200.w,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: state.receiverController,
|
||||
//输入框一行
|
||||
maxLines: 1,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
FilteringTextInputFormatter.deny('\n'),
|
||||
LengthLimitingTextInputFormatter(30),
|
||||
],
|
||||
autofocus: false,
|
||||
textAlign: TextAlign.end,
|
||||
decoration: InputDecoration(
|
||||
hintText: '请输入'.tr,
|
||||
hintStyle: TextStyle(fontSize: 22.sp),
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
disabledBorder: const OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
border: const OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(width: 0, color: Colors.transparent)),
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 0),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp, textBaseline: TextBaseline.alphabetic),
|
||||
onChanged: (String value) {
|
||||
// 处理接收者输入改变事件
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 底部选择pickerView
|
||||
void openBottomItemSheet(BuildContext context) {
|
||||
final List nameList = state.emailTemplateList
|
||||
@ -145,7 +252,8 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
||||
data: nameList,
|
||||
pickerStyle: DefaultPickerStyle(), onConfirm: (p, int position) {
|
||||
state.currentNotifyItem.value = state.emailTemplateList[position];
|
||||
state.emailController.text = state.emailTemplateList[position].template!;
|
||||
state.templateContentController.text =
|
||||
state.emailTemplateList[position].template!;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,26 +12,29 @@ class SendEmailNotificationState {
|
||||
getKeyId.value = Get.arguments['keyId'];
|
||||
}
|
||||
|
||||
if (Get.arguments['userNameType'] != null) {
|
||||
channelType.value = Get.arguments['userNameType'];
|
||||
if (channelType.value == 1) {
|
||||
if (notifyTypeSelect.value == 1) {
|
||||
getNotifyTypeText.value = '系统短信';
|
||||
} else {
|
||||
getNotifyTypeText.value = '个人短信';
|
||||
}
|
||||
} else {
|
||||
if (notifyTypeSelect.value == 1) {
|
||||
getNotifyTypeText.value = '系统邮件';
|
||||
} else {
|
||||
getNotifyTypeText.value = '个人邮件';
|
||||
}
|
||||
}
|
||||
if (Get.arguments['channelType'] != null) {
|
||||
channelType.value = Get.arguments['channelType'];
|
||||
updateNotifyTypeText();
|
||||
// if (channelType.value == 1) {
|
||||
// if (notifyTypeSelect.value == 1) {
|
||||
// getNotifyTypeText.value = '系统短信';
|
||||
// } else {
|
||||
// getNotifyTypeText.value = '个人短信';
|
||||
// }
|
||||
// } else {
|
||||
// if (notifyTypeSelect.value == 1) {
|
||||
// getNotifyTypeText.value = '系统邮件';
|
||||
// } else {
|
||||
// getNotifyTypeText.value = '个人邮件';
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
RxString getReceiver = ''.obs;
|
||||
final TextEditingController emailController = TextEditingController();
|
||||
final TextEditingController templateContentController =
|
||||
TextEditingController();
|
||||
final TextEditingController receiverController = TextEditingController();
|
||||
RxInt notifyTypeSelect = 1.obs; //1 代表系统,2 代表个人
|
||||
RxInt channelType = 0.obs; //1 代表短信,2 代表邮件
|
||||
RxString getNotifyTypeText = ''.obs;
|
||||
@ -39,4 +42,22 @@ class SendEmailNotificationState {
|
||||
<EmailNotificationItem>[].obs;
|
||||
Rx<EmailNotificationItem> currentNotifyItem = EmailNotificationItem().obs;
|
||||
RxInt getKeyId = 0.obs; //获取钥匙成功得到的keyId
|
||||
RxString countryCode = '86'.obs;
|
||||
RxString countryName = '中国'.obs;
|
||||
|
||||
Future<void> updateNotifyTypeText() async {
|
||||
if (channelType.value == 1) {
|
||||
if (notifyTypeSelect.value == 1) {
|
||||
getNotifyTypeText.value = '系统短信';
|
||||
} else {
|
||||
getNotifyTypeText.value = '个人短信';
|
||||
}
|
||||
} else {
|
||||
if (notifyTypeSelect.value == 1) {
|
||||
getNotifyTypeText.value = '系统邮件';
|
||||
} else {
|
||||
getNotifyTypeText.value = '个人邮件';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart';
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_state.dart';
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
||||
import 'package:star_lock/tools/commonDataManage.dart';
|
||||
import 'package:star_lock/tools/showTFView.dart';
|
||||
import 'package:star_lock/tools/showTipView.dart';
|
||||
|
||||
@ -25,7 +26,8 @@ class PasswordKeyDetailPage extends StatefulWidget {
|
||||
State<PasswordKeyDetailPage> createState() => _PasswordKeyDetailPageState();
|
||||
}
|
||||
|
||||
class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with RouteAware {
|
||||
class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
|
||||
with RouteAware {
|
||||
final PasswordKeyDetailLogic logic = Get.put(PasswordKeyDetailLogic());
|
||||
final PasswordKeyDetailState state = Get.find<PasswordKeyDetailLogic>().state;
|
||||
|
||||
@ -44,7 +46,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
||||
height: 30.h,
|
||||
width: 30.w,
|
||||
),
|
||||
onPressed: _openModalBottomSheet,
|
||||
onPressed: openModalBottomSheet,
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -52,13 +54,14 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Obx(() => Visibility(
|
||||
visible: state.itemData.value.isCustom! == 1,
|
||||
child: CommonItem(
|
||||
leftTitel: "${"密码".tr}${TranslationLoader.lanKeys!.number!.tr}",
|
||||
rightTitle: state.itemData.value.pwdUserNo.toString(),
|
||||
isHaveDirection: false,
|
||||
isHaveLine: true),
|
||||
)),
|
||||
visible: state.itemData.value.isCustom! == 1,
|
||||
child: CommonItem(
|
||||
leftTitel:
|
||||
"${"密码".tr}${TranslationLoader.lanKeys!.number!.tr}",
|
||||
rightTitle: state.itemData.value.pwdUserNo.toString(),
|
||||
isHaveDirection: false,
|
||||
isHaveLine: true),
|
||||
)),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.password!.tr,
|
||||
rightTitle: state.keyboardPwd.value,
|
||||
@ -145,16 +148,18 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
||||
rightTitle: '',
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Get.toNamed(Routers.lockOperatingRecordPage, arguments: <String, Object?>{
|
||||
Get.toNamed(Routers.lockOperatingRecordPage,
|
||||
arguments: <String, Object?>{
|
||||
'type': 1,
|
||||
'id': state.itemData.value.keyboardPwdId.toString(),
|
||||
'id': state.itemData.value.keyboardPwdId.toString(),
|
||||
'recordName': state.itemData.value.keyboardPwdName
|
||||
});
|
||||
}),
|
||||
Visibility(
|
||||
visible: state.itemData.value.isCustom == 0 && state.itemData.value.keyboardPwdType != 1 && state.itemData.value.keyboardPwdType != 4,
|
||||
child:bottomTip()
|
||||
),
|
||||
visible: state.itemData.value.isCustom == 0 &&
|
||||
state.itemData.value.keyboardPwdType != 1 &&
|
||||
state.itemData.value.keyboardPwdType != 4,
|
||||
child: bottomTip()),
|
||||
Container(height: 40.h),
|
||||
SizedBox(
|
||||
width: ScreenUtil().screenWidth - 40.w,
|
||||
@ -241,7 +246,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
||||
));
|
||||
}
|
||||
|
||||
Widget bottomTip(){
|
||||
Widget bottomTip() {
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
@ -251,10 +256,10 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text(
|
||||
'密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。'.tr,
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontSize: 20.sp),
|
||||
)),
|
||||
'密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。'.tr,
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontSize: 20.sp),
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -280,13 +285,14 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
||||
//发送时间
|
||||
String getSenderDate(PasswordKeyListItem indexEntity) {
|
||||
String senderDate = '';
|
||||
DateTime dateStr =
|
||||
final DateTime dateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
||||
senderDate = dateStr.toLocal().toString().substring(0, 16);
|
||||
return senderDate;
|
||||
}
|
||||
|
||||
void showCupertinoAlertDialog(BuildContext context, TextEditingController inputController) {
|
||||
void showCupertinoAlertDialog(
|
||||
BuildContext context, TextEditingController inputController) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
@ -334,7 +340,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
||||
);
|
||||
}
|
||||
|
||||
Future _openModalBottomSheet() async {
|
||||
Future<void> openModalBottomSheet() async {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
shape: RoundedRectangleBorder(
|
||||
@ -345,7 +351,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: ScreenUtil().screenWidth,
|
||||
height: 180.h,
|
||||
height: 160.h,
|
||||
child: ListView(
|
||||
scrollDirection: Axis.horizontal, //横向滚动
|
||||
children: initBottomSheetList()),
|
||||
@ -373,7 +379,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
||||
}
|
||||
|
||||
List<Widget> initBottomSheetList() {
|
||||
List<Widget> widgetList = <Widget>[];
|
||||
final List<Widget> widgetList = <Widget>[];
|
||||
|
||||
widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友', 0));
|
||||
widgetList.add(buildCenter3('images/icon_message.png', '短信', 1));
|
||||
@ -410,37 +416,28 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
||||
],
|
||||
),
|
||||
),
|
||||
onTap: () => _jumpSmartDeviceRoute(itemIndex),
|
||||
onTap: () => jumpSmartDeviceRoute(itemIndex),
|
||||
);
|
||||
}
|
||||
|
||||
_jumpSmartDeviceRoute(int itemIndex) {
|
||||
Future<void> jumpSmartDeviceRoute(int itemIndex) async {
|
||||
Get.back();
|
||||
String pwdShareStr = logic.getShareContentStr();
|
||||
final String pwdShareStr = logic.getShareContentStr();
|
||||
switch (itemIndex) {
|
||||
case 0:
|
||||
//微信好友
|
||||
{
|
||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||
}
|
||||
case 0: //微信好友
|
||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||
break;
|
||||
case 1:
|
||||
//短信
|
||||
{
|
||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||
}
|
||||
case 1: //短信
|
||||
case 2: //邮件
|
||||
Get.toNamed(Routers.sendEmailNotificationPage,
|
||||
arguments: <String, Object?>{
|
||||
'receiver': '',
|
||||
'channelType': itemIndex == 1 ? 1 : 2,
|
||||
'keyId': CommonDataManage().currentKeyInfo.keyId,
|
||||
});
|
||||
break;
|
||||
case 2:
|
||||
//邮件
|
||||
{
|
||||
Get.toNamed(Routers.sendEmailNotificationPage);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
//更多
|
||||
{
|
||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||
}
|
||||
case 3: //更多
|
||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@ -39,7 +38,8 @@ class PasswordKeyPerpetualPage extends StatefulWidget {
|
||||
class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
||||
with RouteAware, SingleTickerProviderStateMixin {
|
||||
final PasswordKeyPerpetualLogic logic = Get.put(PasswordKeyPerpetualLogic());
|
||||
final PasswordKeyPerpetualState state = Get.find<PasswordKeyPerpetualLogic>().state;
|
||||
final PasswordKeyPerpetualState state =
|
||||
Get.find<PasswordKeyPerpetualLogic>().state;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -93,7 +93,8 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
state.nameController),
|
||||
keyBottomWidget(
|
||||
'密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。密码激活后,有效期内不限次数使用。'.tr)
|
||||
'密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。密码激活后,有效期内不限次数使用。'
|
||||
.tr)
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -141,7 +142,10 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
keyIfPerpetualWidget(),
|
||||
if (state.isPermanent.value == false) keyCustomTimeLimitWidget() else Container(),
|
||||
if (state.isPermanent.value == false)
|
||||
keyCustomTimeLimitWidget()
|
||||
else
|
||||
Container(),
|
||||
perpetualKeyWidget(
|
||||
false,
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
@ -189,8 +193,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
||||
TranslationLoader.lanKeys!.name!.tr,
|
||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||
state.nameController),
|
||||
keyBottomWidget(
|
||||
'清空密码底部提示'.tr)
|
||||
keyBottomWidget('清空密码底部提示'.tr)
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -322,7 +325,10 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
||||
rightTitle: '',
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(width: 60.w, height: 50.h, child: _switch())),
|
||||
if (state.isPermanent.value == true) Container(height: 10.h) else Container(height: 1.h),
|
||||
if (state.isPermanent.value == true)
|
||||
Container(height: 10.h)
|
||||
else
|
||||
Container(height: 1.h),
|
||||
],
|
||||
);
|
||||
}
|
||||
@ -330,8 +336,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
||||
// 自定义是管理员密码
|
||||
Widget keyIfAdministratorWidget() {
|
||||
return Visibility(
|
||||
visible:
|
||||
CommonDataManage().currentKeyInfo.isLockOwner == 1,
|
||||
visible: CommonDataManage().currentKeyInfo.isLockOwner == 1,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
// SizedBox(height: 10.h),
|
||||
@ -374,11 +379,11 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
||||
}),
|
||||
Visibility(
|
||||
visible: CommonDataManage().currentKeyInfo.vendor ==
|
||||
IoModelVendor.vendor_XL &&
|
||||
(CommonDataManage().currentKeyInfo.model ==
|
||||
IoModelVendor.model_XL_BLE ||
|
||||
CommonDataManage().currentKeyInfo.model ==
|
||||
IoModelVendor.model_XL_WIFI),
|
||||
IoModelVendor.vendor_XL &&
|
||||
(CommonDataManage().currentKeyInfo.model ==
|
||||
IoModelVendor.model_XL_BLE ||
|
||||
CommonDataManage().currentKeyInfo.model ==
|
||||
IoModelVendor.model_XL_WIFI),
|
||||
child: CommonItem(
|
||||
leftTitel: '结束日期',
|
||||
rightTitle: state.endTime.value,
|
||||
@ -403,7 +408,8 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
||||
final PDuration selectDate = PDuration.parse(
|
||||
DateTool().dateToDateTime(state.loopEffectiveDate.value, 0));
|
||||
Pickers.showDatePicker(context,
|
||||
selectDate: selectDate, mode: DateMode.H, onConfirm: (PDuration p) {
|
||||
selectDate: selectDate,
|
||||
mode: DateMode.H, onConfirm: (PDuration p) {
|
||||
state.loopEffectiveDate.value =
|
||||
DateTool().getYMDHNDateString(p, 5);
|
||||
state.loopStartHours.value = p.hour!;
|
||||
@ -417,7 +423,8 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
||||
final PDuration selectDate = PDuration.parse(
|
||||
DateTool().dateToDateTime(state.loopFailureDate.value, 0));
|
||||
Pickers.showDatePicker(context,
|
||||
selectDate: selectDate, mode: DateMode.H, onConfirm: (PDuration p) {
|
||||
selectDate: selectDate,
|
||||
mode: DateMode.H, onConfirm: (PDuration p) {
|
||||
state.loopFailureDate.value =
|
||||
DateTool().getYMDHNDateString(p, 5);
|
||||
state.loopEndHours.value = p.hour!;
|
||||
@ -563,14 +570,16 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
||||
child: TextField(
|
||||
//输入框一行
|
||||
maxLines: 1,
|
||||
inputFormatters: editController == state.pwdController ? <TextInputFormatter>[
|
||||
FilteringTextInputFormatter.deny('\n'),
|
||||
LengthLimitingTextInputFormatter(9),
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[0-9]')),
|
||||
]:<TextInputFormatter>[
|
||||
FilteringTextInputFormatter.deny('\n'),
|
||||
LengthLimitingTextInputFormatter(50),
|
||||
],
|
||||
inputFormatters: editController == state.pwdController
|
||||
? <TextInputFormatter>[
|
||||
FilteringTextInputFormatter.deny('\n'),
|
||||
LengthLimitingTextInputFormatter(9),
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[0-9]')),
|
||||
]
|
||||
: <TextInputFormatter>[
|
||||
FilteringTextInputFormatter.deny('\n'),
|
||||
LengthLimitingTextInputFormatter(50),
|
||||
],
|
||||
keyboardType: editController == state.nameController
|
||||
? TextInputType.text
|
||||
: TextInputType.number,
|
||||
@ -657,7 +666,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: ScreenUtil().screenWidth,
|
||||
height: 180.h,
|
||||
height: 160.h,
|
||||
child: ListView(
|
||||
scrollDirection: Axis.horizontal, //横向滚动
|
||||
children: initBottomSheetList()),
|
||||
@ -725,9 +734,8 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
||||
return Expanded(
|
||||
child: TabBarView(
|
||||
controller: state.tabController,
|
||||
children: _itemTabs
|
||||
.map((ItemView item) => Obx(indexChangeWidget))
|
||||
.toList(),
|
||||
children:
|
||||
_itemTabs.map((ItemView item) => Obx(indexChangeWidget)).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -779,38 +787,29 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
||||
],
|
||||
),
|
||||
),
|
||||
onTap: () => _jumpSmartDeviceRoute(itemIndex),
|
||||
onTap: () => jumpSmartDeviceRoute(itemIndex),
|
||||
);
|
||||
}
|
||||
|
||||
//\n生效时间:${itemData.startDate}\n类型:永久\n锁名:${itemData.keyboardPwdName}
|
||||
_jumpSmartDeviceRoute(int itemIndex) {
|
||||
Future<void> jumpSmartDeviceRoute(int itemIndex) async {
|
||||
Get.back();
|
||||
final String pwdShareStr = logic.getShareContentStr();
|
||||
switch (itemIndex) {
|
||||
case 0:
|
||||
//微信好友
|
||||
{
|
||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||
}
|
||||
case 0: //微信好友
|
||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||
break;
|
||||
case 1:
|
||||
//短信
|
||||
{
|
||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||
}
|
||||
case 1: //短信
|
||||
case 2: //邮件
|
||||
Get.toNamed(Routers.sendEmailNotificationPage,
|
||||
arguments: <String, Object?>{
|
||||
'receiver': '',
|
||||
'channelType': itemIndex == 1 ? 1 : 2,
|
||||
'keyId': CommonDataManage().currentKeyInfo.keyId,
|
||||
});
|
||||
break;
|
||||
case 2:
|
||||
//邮件
|
||||
{
|
||||
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
//更多
|
||||
{
|
||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||
}
|
||||
case 3: //更多
|
||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user