1,新增部分人脸实体类

2,新增锁详情部分滑动(未完成)
This commit is contained in:
Daisy 2024-01-29 17:57:05 +08:00
parent 60614a53b1
commit aab5c82670
3 changed files with 326 additions and 55 deletions

View File

@ -0,0 +1,138 @@
class FaceListDataEntity {
int? errorCode;
String? description;
String? errorMsg;
Data? data;
FaceListDataEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
FaceListDataEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null ? Data.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['errorCode'] = errorCode;
data['description'] = description;
data['errorMsg'] = errorMsg;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}
class Data {
List<FaceItemData>? list;
int? pageNo;
int? pageSize;
int? pages;
int? total;
Data({this.list, this.pageNo, this.pageSize, this.pages, this.total});
Data.fromJson(Map<String, dynamic> json) {
if (json['list'] != null) {
list = <FaceItemData>[];
json['list'].forEach((v) {
list!.add(FaceItemData.fromJson(v));
});
}
pageNo = json['pageNo'];
pageSize = json['pageSize'];
pages = json['pages'];
total = json['total'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (list != null) {
data['list'] = list!.map((v) => v.toJson()).toList();
}
data['pageNo'] = pageNo;
data['pageSize'] = pageSize;
data['pages'] = pages;
data['total'] = total;
return data;
}
}
class FaceItemData {
int? lockId;
int? faceId;
String? faceName;
String? faceNumber;
int? startDate;
int? endDate;
int? status;
int? addType;
int? faceType;
List? cyclicConfig;
String? featureData;
int? createDate;
String? senderUsername;
String? validTimeStr;
FaceItemData(
{this.lockId,
this.faceId,
this.faceName,
this.faceNumber,
this.startDate,
this.endDate,
this.status,
this.addType,
this.faceType,
this.cyclicConfig,
this.featureData,
this.createDate,
this.senderUsername,
this.validTimeStr});
FaceItemData.fromJson(Map<String, dynamic> json) {
lockId = json['lockId'];
faceId = json['faceId'];
faceName = json['faceName'];
faceNumber = json['faceNumber'];
startDate = json['startDate'];
endDate = json['endDate'];
status = json['status'];
addType = json['addType'];
faceType = json['faceType'];
if (json['cyclicConfig'] != null) {
cyclicConfig = [];
json['cyclicConfig'].forEach((v) {
cyclicConfig!.add(v);
});
}
featureData = json['featureData'];
createDate = json['createDate'];
senderUsername = json['senderUsername'];
validTimeStr = json['validTimeStr'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['lockId'] = lockId;
data['faceId'] = faceId;
data['faceName'] = faceName;
data['faceNumber'] = faceNumber;
data['startDate'] = startDate;
data['endDate'] = endDate;
data['status'] = status;
data['addType'] = addType;
data['faceType'] = faceType;
if (cyclicConfig != null) {
data['cyclicConfig'] = cyclicConfig!.map((v) => v.toJson()).toList();
}
data['featureData'] = featureData;
data['createDate'] = createDate;
data['senderUsername'] = senderUsername;
data['validTimeStr'] = validTimeStr;
return data;
}
}

View File

@ -19,7 +19,9 @@ class LockDetailPage extends StatefulWidget {
final LockListInfoItemEntity lockListInfoItemEntity;
const LockDetailPage(
{Key? key, required this.isOnlyOneData, required this.lockListInfoItemEntity})
{Key? key,
required this.isOnlyOneData,
required this.lockListInfoItemEntity})
: super(key: key);
@override
@ -50,7 +52,8 @@ class _LockDetailPageState extends State<LockDetailPage>
state.isOpenPassageMode.value = state.keyInfos.value.passageMode!;
state.lockAlias.value = state.keyInfos.value.lockAlias!;
BlueManage().connectDeviceName = state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
BlueManage().connectDeviceName =
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
List<int> publicKeyData =
state.keyInfos.value.bluetooth!.publicKey!.cast<int>();
@ -64,7 +67,8 @@ class _LockDetailPageState extends State<LockDetailPage>
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
// signKey
List<int> signKeyData = state.keyInfos.value.bluetooth!.signKey!.cast<int>();
List<int> signKeyData =
state.keyInfos.value.bluetooth!.signKey!.cast<int>();
var saveSignKeyList = changeIntListToStringList(signKeyData);
Storage.setStringList(saveBlueSignKey, saveSignKeyList);
@ -77,37 +81,75 @@ class _LockDetailPageState extends State<LockDetailPage>
@override
Widget build(BuildContext context) {
return ListView(
children: [
Stack(children: [
Container(
width: 1.sw,
height: 1.sh - ScreenUtil().statusBarHeight * 2,
color: Colors.white,
child: Column(
children: [
topWidget(),
Expanded(child: Obx(() => bottomWidget())),
],
),
),
Obx(() => Visibility(
visible: state.iSClosedUnlockSuccessfulPopup.value,
// visible: true,
child: GestureDetector(
onTap: () {
state.iSClosedUnlockSuccessfulPopup.value = false;
},
child: Container(
width: 1.sw,
height: 1.sh - ScreenUtil().statusBarHeight * 2,
color: Colors.black.withOpacity(0.3),
child: _unlockSuccessWidget()),
return CustomScrollView(
slivers: [
SliverFillRemaining(
child: Stack(
children: [
Container(
width: 1.sw,
height: 1.sh - ScreenUtil().statusBarHeight * 2,
color: Colors.white,
child: Column(
children: [
topWidget(),
// partSectionWidget(),
Expanded(child: bottomWidget())
],
),
))
]),
),
Obx(() => Visibility(
visible: state.iSClosedUnlockSuccessfulPopup.value,
child: GestureDetector(
onTap: () {
state.iSClosedUnlockSuccessfulPopup.value = false;
},
child: Container(
width: 1.sw,
height: 1.sh - ScreenUtil().statusBarHeight * 2,
color: Colors.black.withOpacity(0.3),
child: _unlockSuccessWidget(),
),
),
))
],
),
),
],
);
// return ListView(
// children: [
// Stack(children: [
// Container(
// width: 1.sw,
// height: 1.sh - ScreenUtil().statusBarHeight * 2,
// color: Colors.white,
// child: Column(
// children: [
// topWidget(),
// Expanded(child: partSectionWidget()),
// // Expanded(child: Obx(() => bottomWidget())),
// ],
// ),
// ),
// Obx(() => Visibility(
// visible: state.iSClosedUnlockSuccessfulPopup.value,
// // visible: true,
// child: GestureDetector(
// onTap: () {
// state.iSClosedUnlockSuccessfulPopup.value = false;
// },
// child: Container(
// width: 1.sw,
// height: 1.sh - ScreenUtil().statusBarHeight * 2,
// color: Colors.black.withOpacity(0.3),
// child: _unlockSuccessWidget()),
// ),
// ))
// ]),
// ],
// );
}
Widget topWidget() {
@ -121,11 +163,15 @@ class _LockDetailPageState extends State<LockDetailPage>
SizedBox(
width: 1.sw - 120.w * 2,
child: Obx(() => Center(
child: Text(
child: Text(
state.lockAlias.value,
style: TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w400, color: state.isOpenPassageMode.value == 1 ? AppColors.openPassageModeColor : AppColors.darkGrayTextColor),
)))
),
style: TextStyle(
fontSize: 22.sp,
fontWeight: FontWeight.w400,
color: state.isOpenPassageMode.value == 1
? AppColors.openPassageModeColor
: AppColors.darkGrayTextColor),
)))),
Positioned(
child: Obx(() => Row(
mainAxisAlignment: MainAxisAlignment.end,
@ -157,7 +203,9 @@ class _LockDetailPageState extends State<LockDetailPage>
children: [
Image.asset(
// state.connectState.value == 0 ? 'images/main/icon_main_openLockBtn_grey.png' : 'images/main/icon_main_openLockBtn_center.png',
state.isOpenPassageMode.value == 1 ? 'images/main/icon_main_normallyOpenMode_center.png' : 'images/main/icon_main_openLockBtn_center.png',
state.isOpenPassageMode.value == 1
? 'images/main/icon_main_normallyOpenMode_center.png'
: 'images/main/icon_main_openLockBtn_center.png',
width: 330.w,
height: 330.w,
),
@ -166,7 +214,9 @@ class _LockDetailPageState extends State<LockDetailPage>
: Positioned(
child: Image.asset(
// 'images/main/icon_main_openLockBtn_circle.png',
state.isOpenPassageMode.value == 1 ? 'images/main/icon_main_normallyOpenMode_circle.png' : 'images/main/icon_main_openLockBtn_circle.png',
state.isOpenPassageMode.value == 1
? 'images/main/icon_main_normallyOpenMode_circle.png'
: 'images/main/icon_main_openLockBtn_circle.png',
width: 330.w,
height: 330.w,
)),
@ -206,12 +256,15 @@ class _LockDetailPageState extends State<LockDetailPage>
mainAxisAlignment: MainAxisAlignment.center,
children: [
Obx(() => Text(
state.isOpenPassageMode.value == 1 ? "常开模式启动!长按闭锁" : TranslationLoader.lanKeys!.clickUnlockAndHoldDownClose!.tr,
style: TextStyle(
fontSize: 22.sp,
color: AppColors.btnDisableColor,
fontWeight: FontWeight.w500),
)),
state.isOpenPassageMode.value == 1
? "常开模式启动!长按闭锁"
: TranslationLoader
.lanKeys!.clickUnlockAndHoldDownClose!.tr,
style: TextStyle(
fontSize: 22.sp,
color: AppColors.btnDisableColor,
fontWeight: FontWeight.w500),
)),
],
),
SizedBox(
@ -230,13 +283,17 @@ class _LockDetailPageState extends State<LockDetailPage>
Text(
state.keyInfos.value.isLockOwner == 1
? TranslationLoader.lanKeys!.superAdmin!.tr
: (state.keyInfos.value.keyRight == 1 ? TranslationLoader.lanKeys!.authorizedAdmin!.tr : TranslationLoader.lanKeys!.normalUser!.tr),
: (state.keyInfos.value.keyRight == 1
? TranslationLoader.lanKeys!.authorizedAdmin!.tr
: TranslationLoader.lanKeys!.normalUser!.tr),
style: TextStyle(
fontSize: 20.sp, color: AppColors.darkGrayTextColor),
),
SizedBox(width: 80.w),
Image.asset(
state.keyInfos.value.remoteEnable == 1 ? 'images/main/icon_main_remoteUnlocking.png' : 'images/main/icon_main_remoteUnlocking_grey.png',
state.keyInfos.value.remoteEnable == 1
? 'images/main/icon_main_remoteUnlocking.png'
: 'images/main/icon_main_remoteUnlocking_grey.png',
width: 24.w,
height: 20.w,
// color: state.keyInfos.value.remoteEnable == 1
@ -248,8 +305,9 @@ class _LockDetailPageState extends State<LockDetailPage>
TranslationLoader.lanKeys!.gatewayDevice!.tr,
style: TextStyle(
fontSize: 20.sp,
color: state.keyInfos.value.remoteEnable == 1 ? AppColors.mainColor : AppColors.btnDisableColor
),
color: state.keyInfos.value.remoteEnable == 1
? AppColors.mainColor
: AppColors.btnDisableColor),
),
],
),
@ -276,7 +334,9 @@ class _LockDetailPageState extends State<LockDetailPage>
turns: state.animationController,
//view
child: Image.asset(
state.isOpenPassageMode.value == 1 ? 'images/main/icon_main_normallyOpenMode_circle.png' : 'images/main/icon_main_openLockBtn_circle.png',
state.isOpenPassageMode.value == 1
? 'images/main/icon_main_normallyOpenMode_circle.png'
: 'images/main/icon_main_openLockBtn_circle.png',
width: 330.w,
height: 330.w,
),
@ -298,6 +358,74 @@ class _LockDetailPageState extends State<LockDetailPage>
);
}
//
Widget partSectionWidget() {
return SliverToBoxAdapter(
child: SizedBox(
height: 400.0, // Adjust the height as needed
width: ScreenUtil().screenWidth,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
Container(
margin: EdgeInsets.all(10.0),
color: Colors.red,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('GridView 1'),
SizedBox(height: 10.0),
Container(
height: 200.0,
width: 200.0,
child: GridView.count(
crossAxisCount: 2,
children: List.generate(6, (index) {
return Center(
child: Text(
'Item ${index + 6}',
style: TextStyle(fontSize: 20.0),
),
);
}),
),
),
],
),
),
Container(
margin: EdgeInsets.all(10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('GridView 2'),
SizedBox(height: 10.0),
Container(
height: 200.0,
width: 200.0,
child: GridView.count(
crossAxisCount: 2,
children: List.generate(6, (index) {
return Center(
child: Text(
'Item ${index + 6}',
style: TextStyle(fontSize: 20.0),
),
);
}),
),
),
],
),
),
],
),
),
),
);
}
//
List<Widget> getBottomWidget() {
if (state.keyInfos.value.isLockOwner == 1 ||
@ -313,12 +441,16 @@ class _LockDetailPageState extends State<LockDetailPage>
List<Widget> getNormalWidget() {
var showWidgetArr = [
//
bottomItem('images/main/icon_main_operatingRecord.png', TranslationLoader.lanKeys!.operatingRecord!.tr, () {
Get.toNamed(Routers.lockOperatingRecordPage, arguments: {"keyInfo": state.keyInfos.value});
bottomItem('images/main/icon_main_operatingRecord.png',
TranslationLoader.lanKeys!.operatingRecord!.tr, () {
Get.toNamed(Routers.lockOperatingRecordPage,
arguments: {"keyInfo": state.keyInfos.value});
}),
//
bottomItem('images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, () {
bottomItem(
'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr,
() {
Get.toNamed(Routers.lockSetPage, arguments: {
"lockId": state.keyInfos.value.lockId,
"isOnlyOneData": widget.isOnlyOneData,
@ -356,7 +488,8 @@ class _LockDetailPageState extends State<LockDetailPage>
// ic卡
if (state.keyInfos.value.lockFeature!.icCard == 1) {
showWidgetArr.add(bottomItem('images/main/icon_main_icCard.png', TranslationLoader.lanKeys!.card!.tr, () {
showWidgetArr.add(bottomItem('images/main/icon_main_icCard.png',
TranslationLoader.lanKeys!.card!.tr, () {
// logic.showToast("普通用户第一次需要在锁旁边操作哦。", something: () {
// logic.showEasyLoading();
// });
@ -594,7 +727,7 @@ class _LockDetailPageState extends State<LockDetailPage>
// print("LockDetailPage===dispose");
AppRouteObserver().routeObserver.unsubscribe(this);
state.closedUnlockSuccessfulTimer?.cancel();
if(state.animationController != null){
if (state.animationController != null) {
state.animationController.reset();
state.animationController.forward();
state.animationController.dispose();

View File

@ -1,6 +1,6 @@
abstract class Api {
static String baseAddress = "https://pre.lock.star-lock.cn"; //
// static String baseAddress = "https://dev.lock.star-lock.cn"; //
// static String baseAddress = "https://pre.lock.star-lock.cn"; //
static String baseAddress = "https://dev.lock.star-lock.cn"; //
// static String baseAddress = "http://192.168.1.15:8022"; //
// static String baseAddress = "https://ge.lock.star-lock.cn"; //