From aab5c826709d185910e104cb748a784ab6d6c500 Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Mon, 29 Jan 2024 17:57:05 +0800 Subject: [PATCH] =?UTF-8?q?1=EF=BC=8C=E6=96=B0=E5=A2=9E=E9=83=A8=E5=88=86?= =?UTF-8?q?=E4=BA=BA=E8=84=B8=E5=AE=9E=E4=BD=93=E7=B1=BB=202=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=94=81=E8=AF=A6=E6=83=85=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=BB=91=E5=8A=A8=EF=BC=88=E6=9C=AA=E5=AE=8C=E6=88=90=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../face/faceList/faceList_entity.dart | 138 ++++++++++ .../lockDetail/lockDetail_page.dart | 239 ++++++++++++++---- star_lock/lib/network/api.dart | 4 +- 3 files changed, 326 insertions(+), 55 deletions(-) create mode 100644 star_lock/lib/main/lockDetail/face/faceList/faceList_entity.dart diff --git a/star_lock/lib/main/lockDetail/face/faceList/faceList_entity.dart b/star_lock/lib/main/lockDetail/face/faceList/faceList_entity.dart new file mode 100644 index 00000000..fe45d406 --- /dev/null +++ b/star_lock/lib/main/lockDetail/face/faceList/faceList_entity.dart @@ -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 json) { + errorCode = json['errorCode']; + description = json['description']; + errorMsg = json['errorMsg']; + data = json['data'] != null ? Data.fromJson(json['data']) : null; + } + + Map toJson() { + final Map data = {}; + data['errorCode'] = errorCode; + data['description'] = description; + data['errorMsg'] = errorMsg; + if (this.data != null) { + data['data'] = this.data!.toJson(); + } + return data; + } +} + +class Data { + List? list; + int? pageNo; + int? pageSize; + int? pages; + int? total; + + Data({this.list, this.pageNo, this.pageSize, this.pages, this.total}); + + Data.fromJson(Map json) { + if (json['list'] != null) { + list = []; + json['list'].forEach((v) { + list!.add(FaceItemData.fromJson(v)); + }); + } + pageNo = json['pageNo']; + pageSize = json['pageSize']; + pages = json['pages']; + total = json['total']; + } + + Map toJson() { + final Map data = {}; + 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 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 toJson() { + final Map data = {}; + 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; + } +} diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart index ae1a5472..a5ca52d5 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -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 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 publicKeyData = state.keyInfos.value.bluetooth!.publicKey!.cast(); @@ -64,7 +67,8 @@ class _LockDetailPageState extends State Storage.setStringList(saveBluePrivateKey, savePrivateKeyList); // signKey - List signKeyData = state.keyInfos.value.bluetooth!.signKey!.cast(); + List signKeyData = + state.keyInfos.value.bluetooth!.signKey!.cast(); var saveSignKeyList = changeIntListToStringList(signKeyData); Storage.setStringList(saveBlueSignKey, saveSignKeyList); @@ -77,37 +81,75 @@ class _LockDetailPageState extends State @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 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 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 : 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 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 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 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 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 ); } + //横向滑动区域 + 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 getBottomWidget() { if (state.keyInfos.value.isLockOwner == 1 || @@ -313,12 +441,16 @@ class _LockDetailPageState extends State List 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 // 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 // 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(); diff --git a/star_lock/lib/network/api.dart b/star_lock/lib/network/api.dart index 5f658d46..0f0096cc 100644 --- a/star_lock/lib/network/api.dart +++ b/star_lock/lib/network/api.dart @@ -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"; //葛工开发环境地址