1、修复锁分组模块问题

2、修复电子钥匙、授权管理员、密码、卡、指纹、人脸名字过长不显示问题
3、修复App开锁时需手机连网的锁问题
This commit is contained in:
魏少阳 2024-06-13 09:12:39 +08:00
parent 3e04c0de5f
commit 179af115cb
16 changed files with 330 additions and 111 deletions

View File

@ -233,7 +233,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
children: <Widget>[
Flexible(
child: Text(receiveUser,
maxLines: 3,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 24.sp,

View File

@ -46,12 +46,7 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
rightTitle: state.typeNumber.value,
isHaveDirection: false,
isHaveLine: true)),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.name!.tr,
rightTitle: state.typeName.value,
isHaveDirection: true,
isHaveLine: true,
action: () {
Obx(() => lockDataListItem(TranslationLoader.lanKeys!.name!.tr,state.typeName.value, () {
ShowTipView().showTFViewAlertDialog(
state.changeNameController,
'${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}',
@ -212,6 +207,40 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
);
}
Widget lockDataListItem(String leftTitle, String conentStr, Function()? action){
return GestureDetector(
onTap: action,
child: Container(
// height: 70.h,
padding: EdgeInsets.only(left: 20.w, right: 10.w, top: 15.h, bottom: 15.h),
decoration: BoxDecoration(
color: Colors.white,
border: Border(
bottom: BorderSide(
color: AppColors.greyLineColor, //
width: 2.0.h, //
),
)
),
child: Row(
children: <Widget>[
Text(leftTitle, style: TextStyle(fontSize: 22.sp)),
SizedBox(width: 10.w),
Expanded(
child: Text(conentStr, textAlign:TextAlign.end, style: TextStyle(fontSize: 22.sp, ))
),
SizedBox(width: 10.w),
Image.asset(
'images/icon_right_grey.png',
width: 12.w,
height: 21.w,
)
],
),
),
);
}
//isStressFingerprint false: ture:
CupertinoSwitch _isStressFingerprint() {
return CupertinoSwitch(

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart';

View File

@ -56,12 +56,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
backgroundColor: AppColors.mainColor),
body: ListView(
children: <Widget>[
Obx(() => CommonItem(
leftTitel: '姓名'.tr,
rightTitle: state.keyName.value,
isHaveDirection: true,
isHaveLine: true,
action: () {
Obx(() => lockDataListItem('姓名'.tr, state.keyName.value, () {
showCupertinoAlertDialog(
tipsTitle: '修改姓名'.tr, alertEnum: ShowAlertEnum.name);
})),
@ -282,6 +277,40 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
);
}
Widget lockDataListItem(String leftTitle, String conentStr, Function()? action){
return GestureDetector(
onTap: action,
child: Container(
// height: 70.h,
padding: EdgeInsets.only(left: 20.w, right: 10.w, top: 15.h, bottom: 15.h),
decoration: BoxDecoration(
color: Colors.white,
border: Border(
bottom: BorderSide(
color: AppColors.greyLineColor, //
width: 2.0.h, //
),
)
),
child: Row(
children: <Widget>[
Text(leftTitle, style: TextStyle(fontSize: 22.sp)),
SizedBox(width: 10.w),
Expanded(
child: Text(conentStr, textAlign:TextAlign.end, style: TextStyle(fontSize: 22.sp, ))
),
SizedBox(width: 10.w),
Image.asset(
'images/icon_right_grey.png',
width: 12.w,
height: 21.w,
)
],
),
),
);
}
CupertinoSwitch _realNameAuthSwitch() {
return CupertinoSwitch(
activeColor: CupertinoColors.activeBlue,

View File

@ -283,7 +283,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
children: <Widget>[
Flexible(
child: Text(receiveUser,
maxLines: 3,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 24.sp,

View File

@ -44,12 +44,7 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
rightTitle: state.typeNumber.value,
isHaveDirection: false,
isHaveLine: true)),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.name!.tr,
rightTitle: state.typeName.value,
isHaveDirection: true,
isHaveLine: true,
action: () {
Obx(() => lockDataListItem(TranslationLoader.lanKeys!.name!.tr, state.typeName.value, () {
// showCupertinoAlertDialog(context);
ShowTipView().showTFViewAlertDialog(
state.changeNameController,
@ -220,6 +215,40 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
);
}
Widget lockDataListItem(String leftTitle, String conentStr, Function()? action){
return GestureDetector(
onTap: action,
child: Container(
// height: 70.h,
padding: EdgeInsets.only(left: 20.w, right: 10.w, top: 15.h, bottom: 15.h),
decoration: BoxDecoration(
color: Colors.white,
border: Border(
bottom: BorderSide(
color: AppColors.greyLineColor, //
width: 2.0.h, //
),
)
),
child: Row(
children: <Widget>[
Text(leftTitle, style: TextStyle(fontSize: 22.sp)),
SizedBox(width: 10.w),
Expanded(
child: Text(conentStr, textAlign:TextAlign.end, style: TextStyle(fontSize: 22.sp, ))
),
SizedBox(width: 10.w),
Image.asset(
'images/icon_right_grey.png',
width: 12.w,
height: 21.w,
)
],
),
),
);
}
CupertinoSwitch _isStressFace() {
return CupertinoSwitch(
activeColor: CupertinoColors.activeBlue,

View File

@ -46,12 +46,7 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
rightTitle: state.typeNumber.value,
isHaveDirection: false,
isHaveLine: true)),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.name!.tr,
rightTitle: state.typeName.value,
isHaveDirection: true,
isHaveLine: true,
action: () {
Obx(() => lockDataListItem(TranslationLoader.lanKeys!.name!.tr, state.typeName.value, () {
ShowTipView().showTFViewAlertDialog(
state.changeNameController,
'${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}',
@ -227,6 +222,40 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
);
}
Widget lockDataListItem(String leftTitle, String conentStr, Function()? action){
return GestureDetector(
onTap: action,
child: Container(
// height: 70.h,
padding: EdgeInsets.only(left: 20.w, right: 10.w, top: 15.h, bottom: 15.h),
decoration: BoxDecoration(
color: Colors.white,
border: Border(
bottom: BorderSide(
color: AppColors.greyLineColor, //
width: 2.0.h, //
),
)
),
child: Row(
children: <Widget>[
Text(leftTitle, style: TextStyle(fontSize: 22.sp)),
SizedBox(width: 10.w),
Expanded(
child: Text(conentStr, textAlign:TextAlign.end, style: TextStyle(fontSize: 22.sp, ))
),
SizedBox(width: 10.w),
Image.asset(
'images/icon_right_grey.png',
width: 12.w,
height: 21.w,
)
],
),
),
);
}
//isStressFingerprint false: ture:
CupertinoSwitch _isStressFingerprint() {
return CupertinoSwitch(

View File

@ -104,12 +104,7 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
SizedBox(height: 10.h),
Obx(() => Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 || state.lockBasicInfo.value.keyRight == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockName!.tr,
rightTitle: state.lockBasicInfo.value.lockAlias,
isHaveLine: true,
isHaveDirection: true,
action: () async {
child: lockDataListItem(TranslationLoader.lanKeys!.lockName!.tr, state.lockBasicInfo.value.lockAlias ?? '', () async {
var data = await Get.toNamed(Routers.editLockNamePage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
@ -119,12 +114,7 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
});
}
}))),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockGrouping!.tr,
rightTitle: state.lockBasicInfo.value.groupName ?? '',
isHaveLine: true,
isHaveDirection: true,
action: () async {
Obx(() => lockDataListItem(TranslationLoader.lanKeys!.lockGrouping!.tr, state.lockBasicInfo.value.groupName ?? '', () async {
Get.toNamed(Routers.lockSelectGroupingPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
})!.then((val) {
@ -187,4 +177,39 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
],
));
}
Widget lockDataListItem(String leftTitle, String conentStr, Function()? action){
return GestureDetector(
onTap: action,
child: Container(
// height: 70.h,
padding: EdgeInsets.only(left: 20.w, right: 10.w, top: 15.h, bottom: 15.h),
decoration: BoxDecoration(
color: Colors.white,
border: Border(
bottom: BorderSide(
color: AppColors.greyLineColor, //
width: 2.0.h, //
),
)
),
child: Row(
children: <Widget>[
Text(leftTitle, style: TextStyle(fontSize: 22.sp)),
SizedBox(width: 10.w),
Expanded(
child: Text(conentStr, textAlign:TextAlign.end, style: TextStyle(fontSize: 22.sp, ))
),
SizedBox(width: 10.w),
Image.asset(
'images/icon_right_grey.png',
width: 12.w,
height: 21.w,
)
],
),
),
);
}
}

View File

@ -12,9 +12,9 @@ class LockSelectGroupingLogic extends BaseGetXController {
//
Future<void> addLockGroupRequest() async {
MassSendLockGroupListEntity entity = await ApiRepository.to.addLockGroup(state.changeNameController.text, '0');
final MassSendLockGroupListEntity entity = await ApiRepository.to.addLockGroup(state.changeNameController.text, '0');
if (entity.errorCode!.codeIsSuccessful) {
showToast("创建成功".tr, something: () {
showToast('创建成功'.tr, something: () {
mockNetworkDataRequest();
});
}
@ -22,15 +22,16 @@ class LockSelectGroupingLogic extends BaseGetXController {
//
Future<void> setLockGroupRequest(GroupListItem itemData) async {
MassSendLockGroupListEntity entity = await ApiRepository.to.setLockGroup(
final MassSendLockGroupListEntity entity = await ApiRepository.to.setLockGroup(
state.lockSetInfoData.value.lockId.toString(), itemData.keyGroupId.toString());
if (entity.errorCode!.codeIsSuccessful) {
showToast("设置锁分组成功".tr, something: () {
state.lockBasicInfo.value.groupId = itemData.keyGroupId;
state.lockBasicInfo.value.groupName = itemData.keyGroupName;
mockNetworkDataRequest();
state.lockSetInfoData.value.lockBasicInfo!.groupId = itemData.keyGroupId;
state.lockSetInfoData.value.lockBasicInfo!.groupName = itemData.keyGroupName;
state.lockBasicInfo.value.groupId = itemData.keyGroupId;
state.lockBasicInfo.value.groupName = itemData.keyGroupName;
state.lockSetInfoData.value.lockBasicInfo!.groupId = itemData.keyGroupId;
state.lockSetInfoData.value.lockBasicInfo!.groupName = itemData.keyGroupName;
showToast('设置锁分组成功'.tr, something: () {
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
eventBus.fire(RefreshLockListInfoDataEvent());
});
@ -38,8 +39,8 @@ class LockSelectGroupingLogic extends BaseGetXController {
}
//
void mockNetworkDataRequest() async {
MassSendLockGroupListEntity entity = await ApiRepository.to.lockGroupList('1');
Future<void> mockNetworkDataRequest() async {
final MassSendLockGroupListEntity entity = await ApiRepository.to.lockGroupList('1');
if (entity.errorCode!.codeIsSuccessful) {
state.groupList.value = entity.data!.groupList!;
}
@ -47,20 +48,17 @@ class LockSelectGroupingLogic extends BaseGetXController {
@override
void onReady() {
// TODO: implement onReady
super.onReady();
mockNetworkDataRequest();
}
@override
void onInit() {
// TODO: implement onInit
super.onInit();
}
@override
void onClose() {
// TODO: implement onClose
super.onClose();
}
}

View File

@ -1,8 +1,10 @@
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/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
import 'package:star_lock/main/lockDetail/lockSet/basicInformation/lockSelectGrouping/lockSelectGrouping_state.dart';
import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/commonItem.dart';
@ -21,8 +23,8 @@ class LockSelectGroupingPage extends StatefulWidget {
}
class _LockSelectGroupingPageState extends State<LockSelectGroupingPage> {
final logic = Get.put(LockSelectGroupingLogic());
final state = Get.find<LockSelectGroupingLogic>().state;
final LockSelectGroupingLogic logic = Get.put(LockSelectGroupingLogic());
final LockSelectGroupingState state = Get.find<LockSelectGroupingLogic>().state;
@override
Widget build(BuildContext context) {
@ -34,7 +36,7 @@ class _LockSelectGroupingPageState extends State<LockSelectGroupingPage> {
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
children: [
children: <Widget>[
Expanded(child: _buildMainUI()),
SubmitBtn(
btnName: TranslationLoader.lanKeys!.createNewGroup!.tr,
@ -44,10 +46,12 @@ class _LockSelectGroupingPageState extends State<LockSelectGroupingPage> {
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {
// showCupertinoAlertDialog(context);
ShowTipView().showTFViewAlertDialog(state.changeNameController, TranslationLoader.lanKeys!.createNewGroup!.tr, "请输入分组名称".tr, (){
ShowTipView().showTFViewAlertDialog(state.changeNameController, TranslationLoader.lanKeys!.createNewGroup!.tr, '请输入分组名称'.tr, (){
logic.addLockGroupRequest();
Get.back();
});
}, isShowSuffixIcon:true, inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(50),
]);
}),
SizedBox(
height: 40.h,
@ -60,27 +64,45 @@ class _LockSelectGroupingPageState extends State<LockSelectGroupingPage> {
Widget _buildMainUI() {
return Obx(() => state.groupList.value.isNotEmpty ? ListView.builder(
itemCount: state.groupList.value.length,
itemBuilder: (c, index) {
GroupListItem itemData = state.groupList.value[index];
return CommonItem(
leftTitel: itemData.keyGroupName,
rightTitle: "",
allHeight: 70.h,
isHaveLine: true,
isHaveDirection: false,
isHaveRightWidget: true,
rightWidget: state.lockBasicInfo.value.groupId == itemData.keyGroupId
? Image(
image: const AssetImage("images/icon_item_checked.png"),
width: 30.w,
height: 30.w,
fit: BoxFit.contain,
)
: Container(),
action: () {
logic.setLockGroupRequest(itemData);
itemBuilder: (BuildContext c, int index) {
final GroupListItem itemData = state.groupList.value[index];
return lockDataListItem(itemData.keyGroupName ?? '', state.lockBasicInfo.value.groupId == itemData.keyGroupId,
() {
logic.setLockGroupRequest(itemData).then((value) => setState(() {}));
});
}) : NoData());
}
Widget lockDataListItem(String title, bool isShowSeletIcon, Function()? action){
return GestureDetector(
onTap: action,
child: Container(
// height: 70.h,
padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 15.h, bottom: 15.h),
decoration: BoxDecoration(
color: Colors.white,
border: Border(
bottom: BorderSide(
color: AppColors.greyLineColor, //
width: 2.0.h, //
),
)
),
child: Row(
children: <Widget>[
Expanded(
child: Text(title, style: TextStyle(fontSize: 22.sp))
),
SizedBox(width: 15.w),
if (isShowSeletIcon) Image(
image: const AssetImage('images/icon_item_checked.png'),
width: 30.w,
height: 30.w,
fit: BoxFit.contain,
) else SizedBox(width: 30.w, height: 30.w,),
],
),
),
);
}
}

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@ -7,19 +6,19 @@ import '../../../electronicKey/massSendElectronicKey/massSendLockGroupList/massS
import '../../lockSet/lockSetInfo_entity.dart';
class LockSelectGroupingState {
var lockSetInfoData = LockSetInfoData().obs;
var lockBasicInfo = LockBasicInfo().obs;
var groupList = <GroupListItem>[].obs;
final TextEditingController changeNameController = TextEditingController();
LockSelectGroupingState() {
var map = Get.arguments;
if(map["lockSetInfoData"] != null){
lockSetInfoData.value = map["lockSetInfoData"];
if(map['lockSetInfoData'] != null){
lockSetInfoData.value = map['lockSetInfoData'];
if(lockSetInfoData.value.lockBasicInfo!=null){
lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!;
}
}
}
Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
Rx<LockBasicInfo> lockBasicInfo = LockBasicInfo().obs;
RxList<GroupListItem> groupList = <GroupListItem>[].obs;
final TextEditingController changeNameController = TextEditingController();
}

View File

@ -473,10 +473,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
//
Obx(
() => Visibility(
visible: (state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.attendance == 1)
? true
: false,
visible: state.lockBasicInfo.value.isLockOwner == 1 && state.lockFeature.value.attendance == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr,
rightTitle: '',

View File

@ -72,15 +72,18 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
context, state.inputPwdController);
}
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.name!.tr,
rightTitle: state.keyboardPwdName.value,
isHaveDirection: true,
isHaveLine: true,
action: () {
showCupertinoAlertDialog(
context, state.inputNameController);
})),
// Obx(() => CommonItem(
// leftTitel: TranslationLoader.lanKeys!.name!.tr,
// rightTitle: state.keyboardPwdName.value,
// isHaveDirection: true,
// isHaveLine: true,
// action: () {
// showCupertinoAlertDialog(
// context, state.inputNameController);
// })),
Obx(() => lockDataListItem(TranslationLoader.lanKeys!.name!.tr, state.keyboardPwdName.value, (){
showCupertinoAlertDialog(context, state.inputNameController);
})),
Obx(() => CommonItem(
leftTitel: '有效期',
rightTitle: logic.getUseDateStr(),
@ -277,6 +280,40 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
);
}
Widget lockDataListItem(String leftTitle, String conentStr, Function()? action){
return GestureDetector(
onTap: action,
child: Container(
// height: 70.h,
padding: EdgeInsets.only(left: 20.w, right: 10.w, top: 15.h, bottom: 15.h),
decoration: BoxDecoration(
color: Colors.white,
border: Border(
bottom: BorderSide(
color: AppColors.greyLineColor, //
width: 2.0.h, //
),
)
),
child: Row(
children: <Widget>[
Text(leftTitle, style: TextStyle(fontSize: 22.sp)),
SizedBox(width: 10.w),
Expanded(
child: Text(conentStr, textAlign:TextAlign.end, style: TextStyle(fontSize: 22.sp, ))
),
SizedBox(width: 10.w),
Image.asset(
'images/icon_right_grey.png',
width: 12.w,
height: 21.w,
)
],
),
),
);
}
//
String getSenderDate(PasswordKeyListItem indexEntity) {
String senderDate = '';

View File

@ -131,11 +131,11 @@ class _APPUnlockNeedMobileNetworkingLockPageState extends State<APPUnlockNeedMob
SubmitBtn(
btnName: TranslationLoader.lanKeys!.sure!.tr,
onClick: () {
if (state.selectLockIdList.isNotEmpty) {
// if (state.selectLockIdList.isNotEmpty) {
logic.setAppUnlockMustOnlineRequest();
} else {
logic.showToast('请选择需设置的锁');
}
// } else {
// logic.showToast('请选择需设置的锁');
// }
}),
SizedBox(
height: 40.h,

View File

@ -1,4 +1,5 @@
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/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
@ -55,7 +56,9 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
logic.showToast(
TranslationLoader.lanKeys!.pleaseEnterAGroupName!.tr);
}
});
}, isShowSuffixIcon:true, inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(50),
]);
},
),
],
@ -115,11 +118,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(1)),
),
child: CommonItem(
leftTitel: '${itemData.keyGroupName}(${itemData.lockList?.length})',
rightTitle: '',
allHeight: 70.h,
action: () {
child: lockDataListItem('${itemData.keyGroupName}(${itemData.lockList?.length})', () {
Get.toNamed(Routers.lockItemListPage, arguments: <String, GroupListItem>{
'groupListItem': itemData,
'ungrouped': state.ungrouped
@ -200,4 +199,31 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
),
);
}
Widget lockDataListItem(String title, Function()? action){
return GestureDetector(
onTap: action,
child: Container(
// height: 70.h,
padding: EdgeInsets.only(left: 20.w, right: 10.w, top: 15.h, bottom: 15.h),
decoration: BoxDecoration(
color: Colors.white,
border: Border(
bottom: BorderSide(
color: AppColors.greyLineColor, //
width: 2.0.h, //
),
)
),
child: Row(
children: <Widget>[
Expanded(child:
Text(title, style: TextStyle(fontSize: 22.sp))
),
// Text(title, style: TextStyle(fontSize: 22.sp)),
],
),
),
);
}
}

View File

@ -93,9 +93,7 @@ class ShowTipView {
);
}
void showTFViewAlertDialog(TextEditingController controller, String title,
String tipTitle, Function sureClick,
{List<TextInputFormatter>? inputFormatters, bool? isShowSuffixIcon}) {
void showTFViewAlertDialog(TextEditingController controller, String title, String tipTitle, Function sureClick, {List<TextInputFormatter>? inputFormatters, bool? isShowSuffixIcon}) {
//
showDialog(
context: Get.context!,