2024-08-21 18:31:19 +08:00
|
|
|
|
2024-04-10 18:01:05 +08:00
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
import 'package:star_lock/main/lockDetail/iris/irisDetail/irisDetail_logic.dart';
|
2024-07-25 14:40:02 +08:00
|
|
|
import 'package:star_lock/main/lockDetail/iris/irisDetail/irisDetail_state.dart';
|
2024-04-10 18:01:05 +08:00
|
|
|
|
|
|
|
|
import '../../../../appRouters.dart';
|
|
|
|
|
import '../../../../app_settings/app_colors.dart';
|
|
|
|
|
import '../../../../tools/appRouteObserver.dart';
|
|
|
|
|
import '../../../../tools/commonItem.dart';
|
|
|
|
|
import '../../../../tools/dateTool.dart';
|
|
|
|
|
import '../../../../tools/showIosTipView.dart';
|
|
|
|
|
import '../../../../tools/showTFView.dart';
|
|
|
|
|
import '../../../../tools/storage.dart';
|
|
|
|
|
import '../../../../tools/submitBtn.dart';
|
|
|
|
|
import '../../../../tools/titleAppBar.dart';
|
|
|
|
|
|
|
|
|
|
class CardDetailPage extends StatefulWidget {
|
|
|
|
|
const CardDetailPage({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<CardDetailPage> createState() => _CardDetailPageState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
2024-07-25 14:40:02 +08:00
|
|
|
final IrisDetailLogic logic = Get.put(IrisDetailLogic());
|
|
|
|
|
final IrisDetailState state = Get.find<IrisDetailLogic>().state;
|
2024-04-10 18:01:05 +08:00
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
backgroundColor: AppColors.mainBackgroundColor,
|
|
|
|
|
appBar: TitleAppBar(
|
2024-08-21 18:31:19 +08:00
|
|
|
barTitle: '虹膜详情'.tr,
|
2024-04-10 18:01:05 +08:00
|
|
|
haveBack: true,
|
|
|
|
|
backgroundColor: AppColors.mainColor,
|
|
|
|
|
),
|
|
|
|
|
body: ListView(
|
2024-07-25 14:40:02 +08:00
|
|
|
children: <Widget>[
|
2024-04-10 18:01:05 +08:00
|
|
|
Obx(() => CommonItem(
|
2024-08-21 18:31:19 +08:00
|
|
|
leftTitel: '虹膜号'.tr,
|
2024-04-10 18:01:05 +08:00
|
|
|
rightTitle: state.typeNumber.value,
|
|
|
|
|
isHaveDirection: false,
|
|
|
|
|
isHaveLine: true)),
|
|
|
|
|
Obx(() => CommonItem(
|
2024-07-26 09:21:22 +08:00
|
|
|
leftTitel: '姓名'.tr,
|
2024-04-10 18:01:05 +08:00
|
|
|
rightTitle: state.typeName.value,
|
|
|
|
|
isHaveDirection: true,
|
|
|
|
|
isHaveLine: true,
|
|
|
|
|
action: () {
|
|
|
|
|
showCupertinoAlertDialog(context);
|
|
|
|
|
})),
|
|
|
|
|
Obx(() => Visibility(
|
2024-07-26 09:21:22 +08:00
|
|
|
visible: state.keyType.value == 4 ||
|
2024-04-10 18:01:05 +08:00
|
|
|
state.keyType.value == 2 ||
|
2024-07-26 09:21:22 +08:00
|
|
|
state.keyType.value == 1,
|
2024-04-10 18:01:05 +08:00
|
|
|
child: CommonItem(
|
2024-07-26 09:21:22 +08:00
|
|
|
leftTitel: '有效期'.tr,
|
2024-04-10 18:01:05 +08:00
|
|
|
allHeight: 70.h,
|
|
|
|
|
// rightTitle:"2023.09.19 11:27\n2023.09.25 11:27",
|
|
|
|
|
rightTitle: logic.getKeyTypeShowDateTime(),
|
|
|
|
|
isHaveDirection: true,
|
|
|
|
|
isHaveLine: true,
|
|
|
|
|
action: () async {
|
|
|
|
|
if (state.keyType.value == 2 || state.keyType.value == 1) {
|
|
|
|
|
// 限时
|
|
|
|
|
var data = await Get.toNamed(
|
|
|
|
|
Routers.otherTypeKeyChangeDatePage,
|
2024-07-25 14:40:02 +08:00
|
|
|
arguments: <String, Object>{
|
|
|
|
|
'pushType': 0,
|
|
|
|
|
'fingerprintItemData':
|
2024-04-10 18:01:05 +08:00
|
|
|
state.fingerprintItemData.value,
|
|
|
|
|
});
|
|
|
|
|
if (data != null) {
|
|
|
|
|
setState(() {
|
2024-07-25 14:40:02 +08:00
|
|
|
state.starDate.value = data['beginTimeTimestamp'];
|
|
|
|
|
state.endDate.value = data['endTimeTimestamp'];
|
2024-04-10 18:01:05 +08:00
|
|
|
state.keyType.value = 2;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else if (state.keyType.value == 4) {
|
|
|
|
|
// 循环
|
|
|
|
|
var data = await Get.toNamed(
|
|
|
|
|
Routers.otherTypeKeyChangeValidityDatePage,
|
2024-07-25 14:40:02 +08:00
|
|
|
arguments: <String, Object>{
|
|
|
|
|
'pushType': 0,
|
|
|
|
|
'fingerprintItemData':
|
2024-04-10 18:01:05 +08:00
|
|
|
state.fingerprintItemData.value,
|
|
|
|
|
});
|
|
|
|
|
if (data != null) {
|
|
|
|
|
setState(() {
|
2024-07-25 14:40:02 +08:00
|
|
|
state.starDate.value = data['starDate'];
|
|
|
|
|
state.endDate.value = data['endDate'];
|
|
|
|
|
state.starTime.value = data['starTime'];
|
|
|
|
|
state.endTime.value = data['endTime'];
|
|
|
|
|
state.weekDay.value = data['weekDay'];
|
2024-04-10 18:01:05 +08:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}))),
|
|
|
|
|
Obx(() => Visibility(
|
2024-07-26 09:21:22 +08:00
|
|
|
visible: state.keyType.value == 4,
|
2024-04-10 18:01:05 +08:00
|
|
|
child: Obx(() => CommonItem(
|
2024-08-02 13:52:37 +08:00
|
|
|
leftTitel: '有效日'.tr,
|
2024-06-01 17:25:55 +08:00
|
|
|
rightTitle: logic.weekDayStr.join(','),
|
2024-04-10 18:01:05 +08:00
|
|
|
isHaveDirection: true,
|
|
|
|
|
isHaveLine: true,
|
|
|
|
|
action: () async {
|
|
|
|
|
var data = await Get.toNamed(
|
|
|
|
|
Routers.otherTypeKeyChangeValidityDatePage,
|
2024-07-25 14:40:02 +08:00
|
|
|
arguments: <String, Object>{
|
|
|
|
|
'pushType': 0,
|
|
|
|
|
'fingerprintItemData':
|
2024-04-10 18:01:05 +08:00
|
|
|
state.fingerprintItemData.value,
|
|
|
|
|
});
|
|
|
|
|
if (data != null) {
|
|
|
|
|
setState(() {
|
2024-07-25 14:40:02 +08:00
|
|
|
state.starDate.value = data['starDate'];
|
|
|
|
|
state.endDate.value = data['endDate'];
|
|
|
|
|
state.starTime.value = data['starTime'];
|
|
|
|
|
state.endTime.value = data['endTime'];
|
|
|
|
|
state.weekDay.value = data['weekDay'];
|
2024-04-10 18:01:05 +08:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})))),
|
|
|
|
|
Obx(() => Visibility(
|
|
|
|
|
visible: state.keyType.value == 4 ? true : false,
|
|
|
|
|
child: Obx(() => CommonItem(
|
2024-08-21 18:31:19 +08:00
|
|
|
leftTitel: '有效时间'.tr,
|
2024-04-10 18:01:05 +08:00
|
|
|
rightTitle:
|
2024-07-25 14:40:02 +08:00
|
|
|
'${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}',
|
2024-04-10 18:01:05 +08:00
|
|
|
isHaveDirection: true,
|
|
|
|
|
action: () async {
|
|
|
|
|
var data = await Get.toNamed(
|
|
|
|
|
Routers.otherTypeKeyChangeValidityDatePage,
|
2024-07-25 14:40:02 +08:00
|
|
|
arguments: <String, Object>{
|
|
|
|
|
'pushType': 0,
|
|
|
|
|
'fingerprintItemData':
|
2024-04-10 18:01:05 +08:00
|
|
|
state.fingerprintItemData.value,
|
|
|
|
|
});
|
|
|
|
|
if (data != null) {
|
|
|
|
|
setState(() {
|
2024-07-25 14:40:02 +08:00
|
|
|
state.starDate.value = data['starDate'];
|
|
|
|
|
state.endDate.value = data['endDate'];
|
|
|
|
|
state.starTime.value = data['starTime'];
|
|
|
|
|
state.endTime.value = data['endTime'];
|
|
|
|
|
state.weekDay.value = data['validityValue'];
|
2024-04-10 18:01:05 +08:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})))),
|
|
|
|
|
Container(height: 10.h),
|
|
|
|
|
Obx(() => CommonItem(
|
2024-07-26 09:21:22 +08:00
|
|
|
leftTitel: '添加者'.tr,
|
2024-04-10 18:01:05 +08:00
|
|
|
rightTitle: state.adder.value,
|
|
|
|
|
)),
|
|
|
|
|
Obx(() => CommonItem(
|
2024-07-26 09:21:22 +08:00
|
|
|
leftTitel: '添加时间'.tr,
|
2024-04-10 18:01:05 +08:00
|
|
|
rightTitle: DateTool()
|
|
|
|
|
.dateToYMDHNString(state.addTime.value.toString()),
|
|
|
|
|
)),
|
|
|
|
|
SizedBox(height: 10.h),
|
|
|
|
|
Obx(() => CommonItem(
|
2024-08-02 13:52:37 +08:00
|
|
|
leftTitel: '胁迫卡'.tr,
|
2024-07-25 14:40:02 +08:00
|
|
|
rightTitle: '',
|
2024-04-10 18:01:05 +08:00
|
|
|
isTipsImg: false,
|
|
|
|
|
isHaveRightWidget: true,
|
|
|
|
|
rightWidget: SizedBox(
|
|
|
|
|
width: 60.w, height: 50.h, child: _isStressFingerprint()))),
|
|
|
|
|
Container(height: 10.h),
|
|
|
|
|
CommonItem(
|
2024-07-25 14:40:02 +08:00
|
|
|
leftTitel: '操作记录'.tr,
|
|
|
|
|
rightTitle: '',
|
2024-04-10 18:01:05 +08:00
|
|
|
isHaveDirection: true,
|
|
|
|
|
action: () {
|
2024-05-14 09:32:06 +08:00
|
|
|
// Get.toNamed(Routers.keyOperationRecordPage, arguments: {
|
|
|
|
|
// 'lockId': state.fingerprintItemData.value.lockId.toString(),
|
|
|
|
|
// 'cardId': state.fingerprintItemData.value.cardId.toString()
|
|
|
|
|
// });
|
2024-04-10 18:01:05 +08:00
|
|
|
}),
|
|
|
|
|
// SizedBox(height: 40.h),
|
|
|
|
|
// addControlsBtn(type),
|
|
|
|
|
SizedBox(height: 30.h),
|
|
|
|
|
SubmitBtn(
|
2024-07-26 09:21:22 +08:00
|
|
|
btnName: '删除'.tr,
|
2024-04-10 18:01:05 +08:00
|
|
|
isDelete: true,
|
|
|
|
|
borderRadius: 20.w,
|
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
|
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
|
|
|
|
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
|
|
|
|
onClick: () {
|
|
|
|
|
showIosTipViewDialog(context);
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//isStressFingerprint false:不是胁迫指纹 ture:胁迫指纹
|
|
|
|
|
CupertinoSwitch _isStressFingerprint() {
|
|
|
|
|
return CupertinoSwitch(
|
|
|
|
|
activeColor: CupertinoColors.activeBlue,
|
|
|
|
|
trackColor: CupertinoColors.systemGrey5,
|
|
|
|
|
thumbColor: CupertinoColors.white,
|
|
|
|
|
value: state.isStressFingerprint.value,
|
2024-07-25 14:40:02 +08:00
|
|
|
onChanged: (bool value) {
|
2024-04-10 18:01:05 +08:00
|
|
|
setState(() {
|
|
|
|
|
state.isStressFingerprint.value = value;
|
|
|
|
|
logic.editICCardData();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Widget addControlsBtn(int type) {
|
|
|
|
|
// List<Widget> widgetList = [];
|
|
|
|
|
// List<Map<String, dynamic>> routerList = [];
|
|
|
|
|
// //卡详情
|
|
|
|
|
// if (type == 0) {
|
|
|
|
|
// routerList.add({
|
|
|
|
|
// 'btnTitle': '设置密码',
|
|
|
|
|
// 'routerName': Routers.passwordKeyDetailPage,
|
|
|
|
|
// 'type': 9
|
|
|
|
|
// });
|
|
|
|
|
// routerList.add({
|
|
|
|
|
// 'btnTitle': '设置指纹',
|
|
|
|
|
// 'routerName': Routers.otherTypeKeyManagePage,
|
|
|
|
|
// 'type': 1
|
|
|
|
|
// });
|
|
|
|
|
// routerList.add({
|
|
|
|
|
// 'btnTitle': '设置遥控',
|
|
|
|
|
// 'routerName': Routers.otherTypeKeyManagePage,
|
|
|
|
|
// 'type': 2
|
|
|
|
|
// });
|
|
|
|
|
// } else if (type == 1) {
|
|
|
|
|
// //指纹详情
|
|
|
|
|
// routerList.add({
|
|
|
|
|
// 'btnTitle': '设置密码',
|
|
|
|
|
// 'routerName': Routers.passwordKeyDetailPage,
|
|
|
|
|
// 'type': 9
|
|
|
|
|
// });
|
|
|
|
|
// routerList.add({
|
|
|
|
|
// 'btnTitle': '设置卡',
|
|
|
|
|
// 'routerName': Routers.otherTypeKeyManagePage,
|
|
|
|
|
// 'type': 0
|
|
|
|
|
// });
|
|
|
|
|
// routerList.add({
|
|
|
|
|
// 'btnTitle': '设置遥控',
|
|
|
|
|
// 'routerName': Routers.otherTypeKeyManagePage,
|
|
|
|
|
// 'type': 2
|
|
|
|
|
// });
|
|
|
|
|
// } else if (type == 2) {
|
|
|
|
|
// //遥控详情
|
|
|
|
|
// routerList.add({
|
|
|
|
|
// 'btnTitle': '设置密码',
|
|
|
|
|
// 'routerName': Routers.passwordKeyDetailPage,
|
|
|
|
|
// 'type': 9
|
|
|
|
|
// });
|
|
|
|
|
// routerList.add({
|
|
|
|
|
// 'btnTitle': '设置卡',
|
|
|
|
|
// 'routerName': Routers.otherTypeKeyManagePage,
|
|
|
|
|
// 'type': 0
|
|
|
|
|
// });
|
|
|
|
|
// routerList.add({
|
|
|
|
|
// 'btnTitle': '设置指纹',
|
|
|
|
|
// 'routerName': Routers.otherTypeKeyManagePage,
|
|
|
|
|
// 'type': 1
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// for (int i = 0; i < routerList.length; i++) {
|
|
|
|
|
// widgetList.add(SizedBox(
|
|
|
|
|
// width: ScreenUtil().screenWidth - 40.w,
|
|
|
|
|
// height: 60.h,
|
|
|
|
|
// child: OutlinedButton(
|
|
|
|
|
// style: OutlinedButton.styleFrom(
|
|
|
|
|
// // backgroundColor: Colors.white,
|
|
|
|
|
// side: BorderSide(width: 1, color: AppColors.mainColor)),
|
|
|
|
|
// onPressed: () {
|
|
|
|
|
// if (routerList[i]['type'] == 9) {
|
|
|
|
|
// Navigator.pushNamed(context, Routers.passwordKeyManagePage);
|
|
|
|
|
// } else {
|
|
|
|
|
// Navigator.pushNamed(context, Routers.otherTypeKeyManagePage,
|
|
|
|
|
// arguments: routerList[i]['type']);
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// child: Text(
|
|
|
|
|
// routerList[i]['btnTitle'],
|
|
|
|
|
// style: TextStyle(color: AppColors.mainColor, fontSize: 24.sp),
|
|
|
|
|
// )),
|
|
|
|
|
// ));
|
|
|
|
|
//
|
|
|
|
|
// widgetList.add(
|
|
|
|
|
// SizedBox(
|
|
|
|
|
// height: 10.h,
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// return Column(
|
|
|
|
|
// children: widgetList,
|
|
|
|
|
// );
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
void showCupertinoAlertDialog(BuildContext context) {
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return ShowTFView(
|
2024-07-26 09:21:22 +08:00
|
|
|
title: '修改姓名'.tr,
|
2024-07-25 14:40:02 +08:00
|
|
|
tipTitle: '',
|
2024-04-10 18:01:05 +08:00
|
|
|
controller: state.changeNameController,
|
|
|
|
|
sureClick: () {
|
|
|
|
|
if (state.changeNameController.text.isEmpty) {
|
2024-08-05 09:57:16 +08:00
|
|
|
logic.showToast('请输入姓名'.tr);
|
2024-04-10 18:01:05 +08:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Get.back();
|
|
|
|
|
state.typeName.value = state.changeNameController.text;
|
|
|
|
|
logic.editICCardData();
|
|
|
|
|
},
|
|
|
|
|
cancelClick: () {
|
|
|
|
|
Get.back();
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void showIosTipViewDialog(BuildContext context) {
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return ShowIosTipView(
|
2024-08-02 13:52:37 +08:00
|
|
|
title: '提示'.tr,
|
|
|
|
|
tipTitle: '确定要删除吗?'.tr,
|
2024-04-10 18:01:05 +08:00
|
|
|
sureClick: () async {
|
|
|
|
|
Get.back();
|
|
|
|
|
String? idStr = await Storage.getUid();
|
|
|
|
|
logic.senderAddICCard();
|
|
|
|
|
},
|
|
|
|
|
cancelClick: () {
|
|
|
|
|
Get.back();
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void didChangeDependencies() {
|
|
|
|
|
super.didChangeDependencies();
|
|
|
|
|
|
|
|
|
|
/// 路由订阅
|
|
|
|
|
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void dispose() {
|
|
|
|
|
/// 取消路由订阅
|
|
|
|
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// 从上级界面进入 当前界面即将出现
|
|
|
|
|
@override
|
|
|
|
|
void didPush() {
|
|
|
|
|
super.didPush();
|
|
|
|
|
state.ifCurrentScreen.value = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// 返回上一个界面 当前界面即将消失
|
|
|
|
|
@override
|
|
|
|
|
void didPop() {
|
|
|
|
|
super.didPop();
|
|
|
|
|
logic.cancelBlueConnetctToastTimer();
|
2024-07-26 09:21:22 +08:00
|
|
|
if (EasyLoading.isShow) {
|
|
|
|
|
EasyLoading.dismiss(animation: true);
|
|
|
|
|
}
|
2024-04-10 18:01:05 +08:00
|
|
|
state.ifCurrentScreen.value = false;
|
|
|
|
|
state.sureBtnState.value = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// 从下级返回 当前界面即将出现
|
|
|
|
|
@override
|
|
|
|
|
void didPopNext() {
|
|
|
|
|
super.didPopNext();
|
|
|
|
|
state.ifCurrentScreen.value = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// 进入下级界面 当前界面即将消失
|
|
|
|
|
@override
|
|
|
|
|
void didPushNext() {
|
|
|
|
|
super.didPushNext();
|
|
|
|
|
logic.cancelBlueConnetctToastTimer();
|
2024-07-26 09:21:22 +08:00
|
|
|
if (EasyLoading.isShow) {
|
|
|
|
|
EasyLoading.dismiss(animation: true);
|
|
|
|
|
}
|
2024-04-10 18:01:05 +08:00
|
|
|
state.ifCurrentScreen.value = false;
|
|
|
|
|
state.sureBtnState.value = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|