添加备用电池电量显示及逻辑,修复已知bug

This commit is contained in:
魏少阳 2024-03-06 17:54:18 +08:00
parent fd094f916c
commit 3cdf05c9e0
7 changed files with 97 additions and 25 deletions

View File

@ -143,8 +143,7 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
'images/icon_card.png', 'images/icon_card.png',
fingerprintItemData.cardName!, fingerprintItemData.cardName!,
(fingerprintItemData.cardType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : "", (fingerprintItemData.cardType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : "",
fingerprintItemData.validTimeStr!, fingerprintItemData.validTimeStr!, () async {
() async {
var data = await Get.toNamed( var data = await Get.toNamed(
Routers.cardDetailPage, arguments: { Routers.cardDetailPage, arguments: {
"fingerprintItemData": fingerprintItemData, "fingerprintItemData": fingerprintItemData,

View File

@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.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/blue_manage.dart';
import '../../../blue/io_tool/io_tool.dart'; import '../../../blue/io_tool/io_tool.dart';
import '../../../tools/appRouteObserver.dart'; import '../../../tools/appRouteObserver.dart';
import '../../../tools/dateTool.dart';
import '../../../tools/jh_pop_menus.dart'; import '../../../tools/jh_pop_menus.dart';
import '../../../tools/storage.dart'; import '../../../tools/storage.dart';
import '../../../translations/trans_lib.dart'; import '../../../translations/trans_lib.dart';
@ -91,6 +93,20 @@ class _LockDetailPageState extends State<LockDetailPage>
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListView( return ListView(
children: [ 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: [ Stack(children: [
Container( Container(
width: 1.sw, width: 1.sw,
@ -159,9 +175,12 @@ class _LockDetailPageState extends State<LockDetailPage>
: AppColors.darkGrayTextColor), : AppColors.darkGrayTextColor),
)))), )))),
Positioned( Positioned(
child: Obx(() => GestureDetector( child: Obx(() => Column(
onTap: () { children: [
logic.getStarLockStatus(); GestureDetector(
onTap: (){
// logic.getStarLockStatus();
showDeletAlertDialog(context, DateTool().dateToYMDHNSString(state.keyInfos.value.electricQuantityDate!.toString()));
}, },
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
@ -184,7 +203,30 @@ class _LockDetailPageState extends State<LockDetailPage>
SizedBox(width: 20.w), 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), SizedBox(height: 30.h),
@ -650,9 +692,7 @@ class _LockDetailPageState extends State<LockDetailPage>
SizedBox(height: 10.w), SizedBox(height: 10.w),
Expanded( Expanded(
child: Text(name, child: Text(name,
style: TextStyle( style: TextStyle(fontSize: 20.sp, color: isForbidden
fontSize: 20.sp,
color: isForbidden
? AppColors.lockDetailBottomBtnUneable ? AppColors.lockDetailBottomBtnUneable
: AppColors.blackColor), : AppColors.blackColor),
textAlign: TextAlign.center)) textAlign: TextAlign.center))
@ -761,6 +801,25 @@ class _LockDetailPageState extends State<LockDetailPage>
return formattedTime; 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 @override
void didChangeDependencies() { void didChangeDependencies() {
// TODO: implement didChangeDependencies // TODO: implement didChangeDependencies
@ -816,14 +875,14 @@ class _LockDetailPageState extends State<LockDetailPage>
void didPopNext() { void didPopNext() {
super.didPopNext(); super.didPopNext();
state.ifCurrentScreen.value = true; state.ifCurrentScreen.value = true;
print("LockDetailPage===didPopNext"); // print("LockDetailPage===didPopNext");
} }
/// ///
@override @override
void didPushNext() { void didPushNext() {
super.didPushNext(); super.didPushNext();
print("LockDetailPage===didPushNext"); // print("LockDetailPage===didPushNext");
state.ifCurrentScreen.value = false; state.ifCurrentScreen.value = false;
logic.cancelBlueConnetctToastTimer(); logic.cancelBlueConnetctToastTimer();
BlueManage().stopScan(); BlueManage().stopScan();

View File

@ -54,7 +54,17 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
children: [ children: [
Expanded( Expanded(
child: Text( 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), style: TextStyle(fontSize: 20.sp),
)), )),
], ],

View File

@ -268,7 +268,7 @@ class LockSetLogic extends BaseGetXController {
showEasyLoading(); showEasyLoading();
showBlueConnetctToastTimer(isShowBlueConnetctToast: false, action: (){ showBlueConnetctToastTimer(isShowBlueConnetctToast: false, action: (){
dismissEasyLoading(); dismissEasyLoading();
print("1111111"); // print("1111111");
showDeletAlertTipDialog(Get.context!); showDeletAlertTipDialog(Get.context!);
}); });
BlueManage().bludSendData(BlueManage().connectDeviceName, (DeviceConnectionState connectionState) async { BlueManage().bludSendData(BlueManage().connectDeviceName, (DeviceConnectionState connectionState) async {

View File

@ -626,8 +626,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// //
CupertinoSwitch _openCheckInSwitch() { CupertinoSwitch _openCheckInSwitch() {
print( // print("111111state.lockSettingInfo.value.attendance:${state.lockSettingInfo.value.attendance}");
"111111state.lockSettingInfo.value.attendance:${state.lockSettingInfo.value.attendance}");
return CupertinoSwitch( return CupertinoSwitch(
activeColor: CupertinoColors.activeBlue, activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,

View File

@ -117,6 +117,8 @@ class LockListInfoItemEntity {
int? sendDate; int? sendDate;
int? lockUserNo; int? lockUserNo;
int? senderUserId; int? senderUserId;
int? electricQuantityDate;
int? electricQuantityStandby;
Bluetooth? bluetooth; Bluetooth? bluetooth;
LockFeature? lockFeature; LockFeature? lockFeature;
LockSetting? lockSetting; LockSetting? lockSetting;
@ -146,6 +148,8 @@ class LockListInfoItemEntity {
this.lockSetting, this.lockSetting,
this.sendDate, this.sendDate,
this.lockUserNo, this.lockUserNo,
this.electricQuantityDate,
this.electricQuantityStandby,
this.senderUserId}); this.senderUserId});
LockListInfoItemEntity.fromJson(Map<String, dynamic> json) { LockListInfoItemEntity.fromJson(Map<String, dynamic> json) {
@ -171,6 +175,8 @@ class LockListInfoItemEntity {
sendDate = json['sendDate']; sendDate = json['sendDate'];
lockUserNo = json['lockUserNo']; lockUserNo = json['lockUserNo'];
senderUserId = json['senderUserId']; senderUserId = json['senderUserId'];
electricQuantityDate = json['electricQuantityDate'];
electricQuantityStandby = json['electricQuantityStandby'];
bluetooth = json['bluetooth'] != null bluetooth = json['bluetooth'] != null
? Bluetooth.fromJson(json['bluetooth']) ? Bluetooth.fromJson(json['bluetooth'])
: null; : null;
@ -206,6 +212,8 @@ class LockListInfoItemEntity {
data['sendDate'] = sendDate; data['sendDate'] = sendDate;
data['lockUserNo'] = lockUserNo; data['lockUserNo'] = lockUserNo;
data['senderUserId'] = senderUserId; data['senderUserId'] = senderUserId;
data['electricQuantityDate'] = electricQuantityDate;
data['electricQuantityStandby'] = electricQuantityStandby;
if (bluetooth != null) { if (bluetooth != null) {
data['bluetooth'] = bluetooth!.toJson(); data['bluetooth'] = bluetooth!.toJson();
} }

View File

@ -107,16 +107,13 @@ class _MessageListPageState extends State<MessageListPage> with TickerProviderSt
children: [ children: [
Row( Row(
children: [ children: [
SizedBox( Flexible(
width: 1.sw - 20.w*2, child: Text(
child: Flexible( messageItemEntity.data!,
child: Text( maxLines: 1,
messageItemEntity.data!, overflow: TextOverflow.ellipsis,
maxLines: 1, style: TextStyle(
overflow: TextOverflow.ellipsis, fontSize: 22.sp, color: messageItemEntity.readAt! == 0 ? AppColors.blackColor : AppColors.placeholderTextColor),
style: TextStyle(
fontSize: 22.sp, color: messageItemEntity.readAt! == 0 ? AppColors.blackColor : AppColors.placeholderTextColor),
),
), ),
), ),
], ],