From f7d3ae59c957ffacdd0a084c73beb76c3c65b405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=B0=91=E9=98=B3?= <786612630@qq.com> Date: Wed, 12 Jun 2024 09:51:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=87=AA=E5=8A=A8=E9=97=AD?= =?UTF-8?q?=E9=94=81=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BF=AE=E6=94=B9=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E4=BF=A1=E6=81=AF=E6=9C=AA=E7=BB=91=E5=AE=9A=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- images/lan/lan_en.json | 6 +- images/lan/lan_keys.json | 4 +- images/lan/lan_zh.json | 6 +- .../automaticBlocking_page.dart | 18 ++--- .../automaticBlocking_state.dart | 52 ++++++------- .../mineBindPhoneOrEmail_page.dart | 28 +++---- .../minePersonInfo_page.dart | 75 ++++++++++++++++--- 7 files changed, 125 insertions(+), 64 deletions(-) diff --git a/images/lan/lan_en.json b/images/lan/lan_en.json index aaa27648..1438df9e 100755 --- a/images/lan/lan_en.json +++ b/images/lan/lan_en.json @@ -159,7 +159,7 @@ "remoteUnlockingPageTip": "When enabled, you will be able to open the lock remotely through the gateway. This function can only be turned on and off near the lock via Bluetooth on the phone.", "currentMode": "Current Mode", "delayTime": "Delay Time", - "automaticBlockingTip": "After the time set above, the lock will automatically close. After you enable or modify the Settings, open the lock once for the time to take effect", + "automaticBlockingTip": "After the time set above, the lock will automatically close. After you enable or modify the Settings, open the lock once for the time to take effect.", "time": "Time", "normallyOpen": "Normally Open", "date": "Date", @@ -881,6 +881,6 @@ "已有": "Already has", "新增": "New", "账号格式错误": "The account format is incorrect", - "接收者信息为空": "The recipient information is empty" - + "接收者信息为空": "The recipient information is empty", + "请输入时间(秒)": "Please enter the time (seconds)", } diff --git a/images/lan/lan_keys.json b/images/lan/lan_keys.json index 868d2d26..3b8af6e6 100755 --- a/images/lan/lan_keys.json +++ b/images/lan/lan_keys.json @@ -913,6 +913,6 @@ "已有": "已有", "新增": "新增", "账号格式错误": "账号格式错误", - "接收者信息为空": "接收者信息为空" - + "接收者信息为空": "接收者信息为空", + "请输入时间(秒)": "请输入时间(秒)" } diff --git a/images/lan/lan_zh.json b/images/lan/lan_zh.json index da14d642..827c2850 100755 --- a/images/lan/lan_zh.json +++ b/images/lan/lan_zh.json @@ -159,7 +159,7 @@ "remoteUnlockingPageTip": "功能开启后,你将可以通过网关远程开锁。此功能的开启和关闭只能在锁附近通过手机蓝牙进行。", "currentMode": "当前模式", "delayTime": "延迟时间", - "automaticBlockingTip": "经过以上设定的时间,锁会自动关闭。开启或修改设置后,请先开一次锁,使时间生效", + "automaticBlockingTip": "经过以上设定的时间,锁会自动关闭。开启或修改设置后,请先开一次锁,使时间生效。", "time": "时间", "normallyOpen": "常开", "date": "日期", @@ -881,6 +881,6 @@ "已有": "已有", "新增": "新增", "账号格式错误": "账号格式错误", - "接收者信息为空": "接收者信息为空" - + "接收者信息为空": "接收者信息为空", + "请输入时间(秒)": "请输入时间(秒)" } diff --git a/lib/main/lockDetail/lockSet/automaticBlocking/automaticBlocking_page.dart b/lib/main/lockDetail/lockSet/automaticBlocking/automaticBlocking_page.dart index b559145d..d5ba8a44 100755 --- a/lib/main/lockDetail/lockSet/automaticBlocking/automaticBlocking_page.dart +++ b/lib/main/lockDetail/lockSet/automaticBlocking/automaticBlocking_page.dart @@ -90,11 +90,11 @@ class _AutomaticBlockingPageState extends State return; } final List list = [ - '5', - '10', - '15', - '30', - '60', + '5S', + '10S', + '15S', + '30S', + '60S', TranslationLoader.lanKeys!.custom!.tr ]; ShowBottomSheetTool().showSingleRowPicker( @@ -111,6 +111,7 @@ class _AutomaticBlockingPageState extends State //选择事件的回调 clickCallBack: (int index, Object str) { if (index != 5) { + str = str.toString().substring(0, str.toString().length - 1); state.isCustomLockTime.value = false; state.autoLockTime.value = str.toString(); Storage.saveAutomaticLockOffTime(str.toString()); @@ -127,13 +128,13 @@ class _AutomaticBlockingPageState extends State child: Container( color: Colors.white, padding: EdgeInsets.only( - left: 30.w, top: 10.w, right: 30.w, bottom: 10.w), + left: 20.w, top: 10.w, right: 20.w, bottom: 10.w), child: Column( children: [ Row( children: [ Text( - '${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.time!.tr}(S)', + TranslationLoader.lanKeys!.time!.tr, style: TextStyle(fontSize: 24.sp), ), ], @@ -153,8 +154,7 @@ class _AutomaticBlockingPageState extends State //输入里面输入文字内边距设置 contentPadding: const EdgeInsets.only( top: 12.0, bottom: 8.0), - hintText: - '${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.time!.tr}(S)', + hintText: '请输入时间(秒)'.tr, hintStyle: TextStyle(fontSize: 24.sp), //不需要输入框下划线 border: InputBorder.none, diff --git a/lib/main/lockDetail/lockSet/automaticBlocking/automaticBlocking_state.dart b/lib/main/lockDetail/lockSet/automaticBlocking/automaticBlocking_state.dart index 04ceaf45..7e106948 100755 --- a/lib/main/lockDetail/lockSet/automaticBlocking/automaticBlocking_state.dart +++ b/lib/main/lockDetail/lockSet/automaticBlocking/automaticBlocking_state.dart @@ -4,27 +4,14 @@ import 'package:get/get.dart'; import '../lockSet/lockSetInfo_entity.dart'; -class AutomaticBlockingState { - var lockSetInfoData = LockSetInfoData().obs; - final lockBasicInfo = LockBasicInfo().obs; - - var isJustForShow = false.obs;// 是否只是作为展示作用,因为普通用户只是展示,不可修改 - var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示 - var sureBtnState = 0.obs;// 0可点击 1 不可点击 - - var isOpen = false.obs;// 是否开启自动落锁 - var autoLockTime = "5".obs; - var isCustomLockTime = false.obs;// 自定义 - final TextEditingController timeController = TextEditingController(); - - var canNext = false.obs;// 是否可以点击下一步 +class AutomaticBlockingState {// 是否可以点击下一步 AutomaticBlockingState() { var map = Get.arguments; - lockSetInfoData.value = map["lockSetInfoData"]; + lockSetInfoData.value = map['lockSetInfoData']; lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!; - isOpen.value = lockSetInfoData.value.lockSettingInfo!.autoLock! == 1 ? true : false; + isOpen.value = lockSetInfoData.value.lockSettingInfo!.autoLock! == 1; autoLockTime.value = lockSetInfoData.value.lockSettingInfo!.autoLockSecond!.toString(); if(lockBasicInfo.value.isLockOwner == 1 || lockBasicInfo.value.keyRight == 1){ @@ -34,15 +21,30 @@ class AutomaticBlockingState { isJustForShow.value = true; } - if((lockSetInfoData.value.lockSettingInfo!.autoLock! > 0) - && (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 5) - && (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 10) - && (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 15) - && (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 30) - && (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 60)){ - isCustomLockTime.value = true; - timeController.text = autoLockTime.value; - } + // if((lockSetInfoData.value.lockSettingInfo!.autoLock! > 0) + // && (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 5) + // && (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 10) + // && (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 15) + // && (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 30) + // && (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 60)){ + // isCustomLockTime.value = true; + // timeController.text = autoLockTime.value; + // } + + timeController.text = autoLockTime.value; } + Rx lockSetInfoData = LockSetInfoData().obs; + final Rx lockBasicInfo = LockBasicInfo().obs; + + RxBool isJustForShow = false.obs;// 是否只是作为展示作用,因为普通用户只是展示,不可修改 + RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示 + RxInt sureBtnState = 0.obs;// 0可点击 1 不可点击 + + RxBool isOpen = false.obs;// 是否开启自动落锁 + RxString autoLockTime = '5'.obs; + RxBool isCustomLockTime = false.obs;// 自定义 + final TextEditingController timeController = TextEditingController(); + + RxBool canNext = false.obs; } diff --git a/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_page.dart b/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_page.dart index 7da0e4cf..98bd67e7 100755 --- a/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_page.dart +++ b/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_page.dart @@ -1,9 +1,11 @@ + 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/flavors.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_logic.dart'; +import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_state.dart'; import '../../../appRouters.dart'; import '../../../app_settings/app_colors.dart'; @@ -22,8 +24,8 @@ class MineBindPhoneOrEmailPage extends StatefulWidget { } class _MineBindPhoneOrEmailPageState extends State { - final logic = Get.put(MineBindPhoneOrEmailLogic()); - final state = Get.find().state; + final MineBindPhoneOrEmailLogic logic = Get.put(MineBindPhoneOrEmailLogic()); + final MineBindPhoneOrEmailState state = Get.find().state; @override Widget build(BuildContext context) { @@ -31,14 +33,14 @@ class _MineBindPhoneOrEmailPageState extends State { backgroundColor: AppColors.mainBackgroundColor, appBar: F.sw( skyCall: () => TitleAppBar( - barTitle: state.channel.value == "1" + barTitle: state.channel.value == '1' ? TranslationLoader.lanKeys!.mobileNumber!.tr : TranslationLoader.lanKeys!.email!.tr, haveBack: true, backgroundColor: AppColors.mainColor, ), xhjCall: () => TitleAppBar( - barTitle: state.channel.value == "1" + barTitle: state.channel.value == '1' ? TranslationLoader.lanKeys!.mobileNumber!.tr : TranslationLoader.lanKeys!.email!.tr, haveBack: true, @@ -51,7 +53,7 @@ class _MineBindPhoneOrEmailPageState extends State { color: Colors.white, padding: EdgeInsets.only(top: 10.h, left: 30.w, right: 30.w), child: Column( - children: [ + children: [ Container( width: 1.sw, padding: EdgeInsets.only(top: 5.h, bottom: 5.h), @@ -63,7 +65,7 @@ class _MineBindPhoneOrEmailPageState extends State { )), CommonItem( leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr, - rightTitle: "", + rightTitle: '', isHaveLine: true, isPadding: false, isHaveRightWidget: true, @@ -92,14 +94,14 @@ class _MineBindPhoneOrEmailPageState extends State { }, leftWidget: const SizedBox(), hintText: state.channel.value == '1' - ? "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.mobileNumber!.tr}" - : "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.email!.tr}", - inputFormatters: [ + ? '${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.mobileNumber!.tr}' + : '${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.email!.tr}', + inputFormatters: [ LengthLimitingTextInputFormatter(20), ]), SizedBox(height: 10.w), Row( - children: [ + children: [ Expanded( child: LoginInput( controller: state.codeController, @@ -109,8 +111,8 @@ class _MineBindPhoneOrEmailPageState extends State { logic.checkNext(state.codeController); }, hintText: - "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}", - inputFormatters: [ + '${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}', + inputFormatters: [ LengthLimitingTextInputFormatter(20), ]), ), @@ -156,7 +158,7 @@ class _MineBindPhoneOrEmailPageState extends State { onClick: state.canSub.value ? () { if (state.accountIsOK.value && state.codeIsOK) { - if (state.channel.value == "1") { + if (state.channel.value == '1') { logic.bindMobileRequest(); } else { logic.bindEmailRequest(); diff --git a/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart b/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart index a4fe15a5..e2108bc8 100755 --- a/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart +++ b/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart @@ -84,9 +84,36 @@ class _MinePersonInfoPageState extends State { })), Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr, - rightTitle: state.mineInfoData.value.mobile != null - ? state.mineInfoData.value.mobile! - : TranslationLoader.lanKeys!.goBind!.tr, + // rightTitle: (state.mineInfoData.value.mobile ?? '').isNotEmpty + // ? state.mineInfoData.value.mobile! + // : TranslationLoader.lanKeys!.goBind!.tr, + // rightWidget: Container( + // width: 15.w, + // height: 15.h, + // decoration: const BoxDecoration( + // color: Colors.red, + // shape: BoxShape.circle, + // ), + // ), + rightWidget: + (state.mineInfoData.value.mobile ?? '').isEmpty? + Container( + width: 15.w, + height: 15.h, + decoration: const BoxDecoration( + color: Colors.red, + shape: BoxShape.circle, + ), + ): + Text( + state.mineInfoData.value.mobile ?? '', + textAlign: TextAlign.right, + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 22.sp, color: AppColors.darkGrayTextColor), + ), + isHaveRightWidget: true, isHaveLine: true, isHaveDirection: true, action: () { @@ -109,9 +136,28 @@ class _MinePersonInfoPageState extends State { })), Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.email!.tr, - rightTitle: state.mineInfoData.value.email != null - ? state.mineInfoData.value.email! - : TranslationLoader.lanKeys!.goBind!.tr, + // rightTitle: (state.mineInfoData.value.email??'').isNotEmpty + // ? state.mineInfoData.value.email! + // : TranslationLoader.lanKeys!.goBind!.tr, + rightWidget: + (state.mineInfoData.value.email ?? '').isEmpty? + Container( + width: 15.w, + height: 15.h, + decoration: const BoxDecoration( + color: Colors.red, + shape: BoxShape.circle, + ), + ): + Text( + state.mineInfoData.value.email ?? '', + textAlign: TextAlign.right, + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 22.sp, color: AppColors.darkGrayTextColor), + ), + isHaveRightWidget: true, isHaveLine: true, isHaveDirection: true, action: () { @@ -144,9 +190,20 @@ class _MinePersonInfoPageState extends State { }), Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr, - rightTitle: state.mineInfoData.value.haveSafeAnswer == 0 - ? '去设置'.tr - : '', + isHaveRightWidget: true, + // rightTitle: state.mineInfoData.value.haveSafeAnswer == 0 + // ? '去设置'.tr + // : '', + rightWidget: + state.mineInfoData.value.haveSafeAnswer == 0 ? + Container( + width: 15.w, + height: 15.h, + decoration: const BoxDecoration( + color: Colors.red, + shape: BoxShape.circle, + ), + ):Container(), isHaveLine: true, isHaveDirection: true, action: () {