From 4c9dd152cae680c3dd889357aeecd4dcb924d125 Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Wed, 12 Jun 2024 16:49:39 +0800 Subject: [PATCH] =?UTF-8?q?1=EF=BC=8C=E4=BF=AE=E5=A4=8D=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E5=88=86=E4=BA=AB=E6=8A=A5=E9=94=99=E9=97=AE?= =?UTF-8?q?=E9=A2=98=202=EF=BC=8C=E5=AE=8C=E6=88=90=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E7=B3=BB=E7=BB=9F=E9=82=AE=E4=BB=B6=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E3=80=81=E7=9F=AD=E4=BF=A1=E9=80=9A=E7=9F=A5=E5=8F=91?= =?UTF-8?q?=E9=80=81=E7=9A=84=E5=AF=B9=E6=8E=A5=E5=8F=8A=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../view/sendElectronicKeyView_page.dart | 2 +- .../sendEmailNotification_logic.dart | 14 +- .../sendEmailNotification_page.dart | 126 ++++++++++++++++-- .../sendEmailNotification_state.dart | 53 +++++--- .../passwordKeyDetail_page.dart | 93 +++++++------ .../passwordKey_perpetual_page.dart | 101 +++++++------- 6 files changed, 261 insertions(+), 128 deletions(-) diff --git a/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_page.dart b/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_page.dart index 9cdca4bb..c0a7a24c 100755 --- a/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_page.dart +++ b/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_page.dart @@ -429,7 +429,7 @@ class _SendElectronicKeyViewState extends State Get.toNamed(Routers.sendEmailNotificationPage, arguments: { 'receiver': logic.emailOrPhone, - 'userNameType': logic.state.userNameType.value, + 'channelType': logic.state.userNameType.value, 'keyId': logic.keyId }); }, diff --git a/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_logic.dart b/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_logic.dart index 207aafdd..b050ced5 100644 --- a/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_logic.dart +++ b/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_logic.dart @@ -20,17 +20,25 @@ class SendEmailNotificationLogic extends BaseGetXController { state.emailTemplateList.value = entity.data?.list ?? []; 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 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, diff --git a/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_page.dart b/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_page.dart index b6923f78..c52597a3 100755 --- a/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_page.dart +++ b/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_page.dart @@ -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 { body: SingleChildScrollView( child: Column( children: [ - 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 { isEmail: state.channelType.value == 2, onSelected: (int value) { state.notifyTypeSelect.value = value; + state.updateNotifyTypeText(); }); }, )), @@ -82,7 +90,7 @@ class _SendEmailNotificationPageState extends State { 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 { 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 { ); } + Widget _buildReceiverItemWidget() { + return Container( + constraints: BoxConstraints(maxWidth: 400.w), // 设置父组件的宽度约束 + child: Row( + mainAxisSize: MainAxisSize.min, // 设置 Row 的 mainAxisSize 属性 + children: [ + 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: [ + 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; + 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: [ + Expanded( + child: TextField( + controller: state.receiverController, + //输入框一行 + maxLines: 1, + inputFormatters: [ + 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 { 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!; }); } } diff --git a/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_state.dart b/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_state.dart index e3e2eb54..954be4dc 100644 --- a/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_state.dart +++ b/lib/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_state.dart @@ -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 { [].obs; Rx currentNotifyItem = EmailNotificationItem().obs; RxInt getKeyId = 0.obs; //获取钥匙成功得到的keyId + RxString countryCode = '86'.obs; + RxString countryName = '中国'.obs; + + Future 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 = '个人邮件'; + } + } + } } diff --git a/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart b/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart index 02f683ab..bd710065 100755 --- a/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart +++ b/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart @@ -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 createState() => _PasswordKeyDetailPageState(); } -class _PasswordKeyDetailPageState extends State with RouteAware { +class _PasswordKeyDetailPageState extends State + with RouteAware { final PasswordKeyDetailLogic logic = Get.put(PasswordKeyDetailLogic()); final PasswordKeyDetailState state = Get.find().state; @@ -44,7 +46,7 @@ class _PasswordKeyDetailPageState extends State with Rout height: 30.h, width: 30.w, ), - onPressed: _openModalBottomSheet, + onPressed: openModalBottomSheet, ), ], ), @@ -52,13 +54,14 @@ class _PasswordKeyDetailPageState extends State with Rout child: Column( children: [ 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 with Rout rightTitle: '', isHaveDirection: true, action: () { - Get.toNamed(Routers.lockOperatingRecordPage, arguments: { + Get.toNamed(Routers.lockOperatingRecordPage, + arguments: { '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 with Rout )); } - Widget bottomTip(){ + Widget bottomTip() { return Column( children: [ Container( @@ -251,10 +256,10 @@ class _PasswordKeyDetailPageState extends State with Rout children: [ 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 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 with Rout ); } - Future _openModalBottomSheet() async { + Future openModalBottomSheet() async { showModalBottomSheet( context: context, shape: RoundedRectangleBorder( @@ -345,7 +351,7 @@ class _PasswordKeyDetailPageState extends State with Rout children: [ 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 with Rout } List initBottomSheetList() { - List widgetList = []; + final List widgetList = []; widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友', 0)); widgetList.add(buildCenter3('images/icon_message.png', '短信', 1)); @@ -410,37 +416,28 @@ class _PasswordKeyDetailPageState extends State with Rout ], ), ), - onTap: () => _jumpSmartDeviceRoute(itemIndex), + onTap: () => jumpSmartDeviceRoute(itemIndex), ); } - _jumpSmartDeviceRoute(int itemIndex) { + Future 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: { + '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: } diff --git a/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart b/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart index 917bae6a..0bd4700a 100755 --- a/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart +++ b/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart @@ -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 with RouteAware, SingleTickerProviderStateMixin { final PasswordKeyPerpetualLogic logic = Get.put(PasswordKeyPerpetualLogic()); - final PasswordKeyPerpetualState state = Get.find().state; + final PasswordKeyPerpetualState state = + Get.find().state; @override void initState() { @@ -93,7 +93,8 @@ class _PasswordKeyPerpetualPageState extends State TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr, state.nameController), keyBottomWidget( - '密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。密码激活后,有效期内不限次数使用。'.tr) + '密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。密码激活后,有效期内不限次数使用。' + .tr) ], ), ); @@ -141,7 +142,10 @@ class _PasswordKeyPerpetualPageState extends State child: Column( children: [ 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 TranslationLoader.lanKeys!.name!.tr, TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr, state.nameController), - keyBottomWidget( - '清空密码底部提示'.tr) + keyBottomWidget('清空密码底部提示'.tr) ], ), ); @@ -322,7 +325,10 @@ class _PasswordKeyPerpetualPageState extends State 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 // 自定义是管理员密码 Widget keyIfAdministratorWidget() { return Visibility( - visible: - CommonDataManage().currentKeyInfo.isLockOwner == 1, + visible: CommonDataManage().currentKeyInfo.isLockOwner == 1, child: Column( children: [ // SizedBox(height: 10.h), @@ -374,11 +379,11 @@ class _PasswordKeyPerpetualPageState extends State }), 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 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 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 child: TextField( //输入框一行 maxLines: 1, - inputFormatters: editController == state.pwdController ? [ - FilteringTextInputFormatter.deny('\n'), - LengthLimitingTextInputFormatter(9), - FilteringTextInputFormatter.allow(RegExp(r'[0-9]')), - ]:[ - FilteringTextInputFormatter.deny('\n'), - LengthLimitingTextInputFormatter(50), - ], + inputFormatters: editController == state.pwdController + ? [ + FilteringTextInputFormatter.deny('\n'), + LengthLimitingTextInputFormatter(9), + FilteringTextInputFormatter.allow(RegExp(r'[0-9]')), + ] + : [ + FilteringTextInputFormatter.deny('\n'), + LengthLimitingTextInputFormatter(50), + ], keyboardType: editController == state.nameController ? TextInputType.text : TextInputType.number, @@ -657,7 +666,7 @@ class _PasswordKeyPerpetualPageState extends State children: [ 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 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 ], ), ), - onTap: () => _jumpSmartDeviceRoute(itemIndex), + onTap: () => jumpSmartDeviceRoute(itemIndex), ); } //\n生效时间:${itemData.startDate}\n类型:永久\n锁名:${itemData.keyboardPwdName} - _jumpSmartDeviceRoute(int itemIndex) { + Future 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: { + '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: }