From 3cdf05c9e000f4398f78e798b47747f9eecf07eb 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, 6 Mar 2024 17:54:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=A4=87=E7=94=A8=E7=94=B5?= =?UTF-8?q?=E6=B1=A0=E7=94=B5=E9=87=8F=E6=98=BE=E7=A4=BA=E5=8F=8A=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E4=BF=AE=E5=A4=8D=E5=B7=B2=E7=9F=A5bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../card/cardList/cardList_page.dart | 3 +- .../lockDetail/lockDetail_page.dart | 77 ++++++++++++++++--- .../uploadElectricQuantity_page.dart | 12 ++- .../lockSet/lockSet/lockSet_logic.dart | 2 +- .../lockSet/lockSet/lockSet_page.dart | 3 +- .../lockMian/entity/lockListInfo_entity.dart | 8 ++ .../message/messageList/messageList_page.dart | 17 ++-- 7 files changed, 97 insertions(+), 25 deletions(-) diff --git a/star_lock/lib/main/lockDetail/card/cardList/cardList_page.dart b/star_lock/lib/main/lockDetail/card/cardList/cardList_page.dart index ea796c9a..7541bf17 100644 --- a/star_lock/lib/main/lockDetail/card/cardList/cardList_page.dart +++ b/star_lock/lib/main/lockDetail/card/cardList/cardList_page.dart @@ -143,8 +143,7 @@ class _CardListPageState extends State with RouteAware { 'images/icon_card.png', fingerprintItemData.cardName!, (fingerprintItemData.cardType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : "", - fingerprintItemData.validTimeStr!, - () async { + fingerprintItemData.validTimeStr!, () async { var data = await Get.toNamed( Routers.cardDetailPage, arguments: { "fingerprintItemData": fingerprintItemData, diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart index 7fcf5eab..11a4cdde 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -1,3 +1,4 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -9,6 +10,7 @@ import '../../../app_settings/app_colors.dart'; import '../../../blue/blue_manage.dart'; import '../../../blue/io_tool/io_tool.dart'; import '../../../tools/appRouteObserver.dart'; +import '../../../tools/dateTool.dart'; import '../../../tools/jh_pop_menus.dart'; import '../../../tools/storage.dart'; import '../../../translations/trans_lib.dart'; @@ -91,6 +93,20 @@ class _LockDetailPageState extends State Widget build(BuildContext context) { return ListView( children: [ + Visibility( + visible: false, + child: Container( + // height: 30.h, + color: const Color(0xFFFBEFD4), + padding: EdgeInsets.only(top: 8.h, bottom: 8.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text("钥匙将在2天后失效", style: TextStyle(color: const Color(0xffCBA74B),fontSize: 24.sp)) + ], + ), + ), + ), Stack(children: [ Container( width: 1.sw, @@ -159,9 +175,12 @@ class _LockDetailPageState extends State : AppColors.darkGrayTextColor), )))), Positioned( - child: Obx(() => GestureDetector( - onTap: () { - logic.getStarLockStatus(); + child: Obx(() => Column( + children: [ + GestureDetector( + onTap: (){ + // logic.getStarLockStatus(); + showDeletAlertDialog(context, DateTool().dateToYMDHNSString(state.keyInfos.value.electricQuantityDate!.toString())); }, child: Row( mainAxisAlignment: MainAxisAlignment.end, @@ -184,7 +203,30 @@ class _LockDetailPageState extends State SizedBox(width: 20.w), ], ), - ))) + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Image.asset( + showElectricIcon(state.electricQuantity.value), + width: 30.w, + height: 24.w), + SizedBox(width: 2.w), + Text("--%", + style: TextStyle( + fontSize: 18.sp, + color: AppColors.darkGrayTextColor)), + SizedBox(width: 2.w), + Icon( + Icons.info, // 使用内置的 warning 图标,它是一个叹号 + color: AppColors.mainColor, // 设置图标颜色为红色 + size: 25.w, // 设置图标大小为 30 + ), + SizedBox(width: 20.w), + ], + ), + ], + ))) ], ), SizedBox(height: 30.h), @@ -650,9 +692,7 @@ class _LockDetailPageState extends State SizedBox(height: 10.w), Expanded( child: Text(name, - style: TextStyle( - fontSize: 20.sp, - color: isForbidden + style: TextStyle(fontSize: 20.sp, color: isForbidden ? AppColors.lockDetailBottomBtnUneable : AppColors.blackColor), textAlign: TextAlign.center)) @@ -761,6 +801,25 @@ class _LockDetailPageState extends State return formattedTime; } + void showDeletAlertDialog(BuildContext context, String dateStr) { + showCupertinoDialog( + context: context, + builder: (context) { + return CupertinoAlertDialog( + content: Text('锁更新时间:$dateStr'), + actions: [ + CupertinoDialogAction( + child: Text(TranslationLoader.lanKeys!.sure!.tr), + onPressed: () { + Get.back(); + }, + ), + ], + ); + }, + ); + } + @override void didChangeDependencies() { // TODO: implement didChangeDependencies @@ -816,14 +875,14 @@ class _LockDetailPageState extends State void didPopNext() { super.didPopNext(); state.ifCurrentScreen.value = true; - print("LockDetailPage===didPopNext"); + // print("LockDetailPage===didPopNext"); } /// 进入下级界面 当前界面即将消失 @override void didPushNext() { super.didPushNext(); - print("LockDetailPage===didPushNext"); + // print("LockDetailPage===didPushNext"); state.ifCurrentScreen.value = false; logic.cancelBlueConnetctToastTimer(); BlueManage().stopScan(); diff --git a/star_lock/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_page.dart b/star_lock/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_page.dart index bd34fc82..7748f48a 100644 --- a/star_lock/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_page.dart @@ -54,7 +54,17 @@ class _UploadElectricQuantityPageState extends State children: [ Expanded( child: Text( - "${TranslationLoader.lanKeys!.electricQuantity!.tr} ${state.lockSetInfoData.value.lockBasicInfo!.electricQuantity}%", + "电池1${TranslationLoader.lanKeys!.electricQuantity!.tr}:${state.lockSetInfoData.value.lockBasicInfo!.electricQuantity}%", + style: TextStyle(fontSize: 20.sp), + )), + ], + )), + Obx(() => Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + child: Text( + "电池2${TranslationLoader.lanKeys!.electricQuantity!.tr}:--%", style: TextStyle(fontSize: 20.sp), )), ], diff --git a/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart b/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart index e979db8d..6580fc5b 100644 --- a/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart +++ b/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart @@ -268,7 +268,7 @@ class LockSetLogic extends BaseGetXController { showEasyLoading(); showBlueConnetctToastTimer(isShowBlueConnetctToast: false, action: (){ dismissEasyLoading(); - print("1111111"); + // print("1111111"); showDeletAlertTipDialog(Get.context!); }); BlueManage().bludSendData(BlueManage().connectDeviceName, (DeviceConnectionState connectionState) async { diff --git a/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart b/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart index bf8b25e6..a0ccf33f 100644 --- a/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart @@ -626,8 +626,7 @@ class _LockSetPageState extends State with RouteAware { // 开启考勤 CupertinoSwitch _openCheckInSwitch() { - print( - "111111state.lockSettingInfo.value.attendance:${state.lockSettingInfo.value.attendance}"); + // print("111111state.lockSettingInfo.value.attendance:${state.lockSettingInfo.value.attendance}"); return CupertinoSwitch( activeColor: CupertinoColors.activeBlue, trackColor: CupertinoColors.systemGrey5, diff --git a/star_lock/lib/main/lockMian/entity/lockListInfo_entity.dart b/star_lock/lib/main/lockMian/entity/lockListInfo_entity.dart index 8fb5b4cc..76518ca9 100644 --- a/star_lock/lib/main/lockMian/entity/lockListInfo_entity.dart +++ b/star_lock/lib/main/lockMian/entity/lockListInfo_entity.dart @@ -117,6 +117,8 @@ class LockListInfoItemEntity { int? sendDate; int? lockUserNo; int? senderUserId; + int? electricQuantityDate; + int? electricQuantityStandby; Bluetooth? bluetooth; LockFeature? lockFeature; LockSetting? lockSetting; @@ -146,6 +148,8 @@ class LockListInfoItemEntity { this.lockSetting, this.sendDate, this.lockUserNo, + this.electricQuantityDate, + this.electricQuantityStandby, this.senderUserId}); LockListInfoItemEntity.fromJson(Map json) { @@ -171,6 +175,8 @@ class LockListInfoItemEntity { sendDate = json['sendDate']; lockUserNo = json['lockUserNo']; senderUserId = json['senderUserId']; + electricQuantityDate = json['electricQuantityDate']; + electricQuantityStandby = json['electricQuantityStandby']; bluetooth = json['bluetooth'] != null ? Bluetooth.fromJson(json['bluetooth']) : null; @@ -206,6 +212,8 @@ class LockListInfoItemEntity { data['sendDate'] = sendDate; data['lockUserNo'] = lockUserNo; data['senderUserId'] = senderUserId; + data['electricQuantityDate'] = electricQuantityDate; + data['electricQuantityStandby'] = electricQuantityStandby; if (bluetooth != null) { data['bluetooth'] = bluetooth!.toJson(); } diff --git a/star_lock/lib/mine/message/messageList/messageList_page.dart b/star_lock/lib/mine/message/messageList/messageList_page.dart index 4567aaac..8fcaf6c9 100644 --- a/star_lock/lib/mine/message/messageList/messageList_page.dart +++ b/star_lock/lib/mine/message/messageList/messageList_page.dart @@ -107,16 +107,13 @@ class _MessageListPageState extends State with TickerProviderSt children: [ Row( children: [ - SizedBox( - width: 1.sw - 20.w*2, - child: Flexible( - child: Text( - messageItemEntity.data!, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 22.sp, color: messageItemEntity.readAt! == 0 ? AppColors.blackColor : AppColors.placeholderTextColor), - ), + Flexible( + child: Text( + messageItemEntity.data!, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 22.sp, color: messageItemEntity.readAt! == 0 ? AppColors.blackColor : AppColors.placeholderTextColor), ), ), ],