添加备用电池电量显示及逻辑,修复已知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',
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,

View File

@ -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<LockDetailPage>
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<LockDetailPage>
: 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<LockDetailPage>
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<LockDetailPage>
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<LockDetailPage>
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<LockDetailPage>
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();

View File

@ -54,7 +54,17 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
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),
)),
],

View File

@ -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 {

View File

@ -626,8 +626,7 @@ class _LockSetPageState extends State<LockSetPage> 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,

View File

@ -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<String, dynamic> 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();
}

View File

@ -107,16 +107,13 @@ class _MessageListPageState extends State<MessageListPage> 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),
),
),
],