From cc6f206651d433ffcbf4250df3d3a17fe3087072 Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Thu, 31 Aug 2023 11:18:15 +0800 Subject: [PATCH] =?UTF-8?q?1=EF=BC=8C=E5=AF=86=E7=A0=81=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=BC=A0=E5=80=BC=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lockDetail/lockDetail_page.dart | 32 ++++++++++++------- .../passwordKeyList/passwordKeyList_page.dart | 22 ++++++++++--- .../passwordKeyManage_page.dart | 25 ++++++++++++--- .../passwordKeyManage_tabbar.dart | 11 ++++++- .../passwordKey_perpetual_page.dart | 17 +++++++--- 5 files changed, 81 insertions(+), 26 deletions(-) diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart index f1cd521f..03edef6b 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -17,7 +17,11 @@ class LockDetailPage extends StatefulWidget { final KeyInfos keyInfo; final LockMainEntity lockMainEntity; - const LockDetailPage({Key? key, required this.lockMainEntity, required this.isFrist, required this.keyInfo}) + const LockDetailPage( + {Key? key, + required this.lockMainEntity, + required this.isFrist, + required this.keyInfo}) : super(key: key); @override @@ -34,15 +38,19 @@ class _LockDetailPageState extends State { super.initState(); state.keyInfos.value = widget.keyInfo; - BlueManage().connectDeviceName = state.keyInfos.value.bluetooth!.bluetoothDeviceName!; - BlueManage().connectDeviceMacAddress = state.keyInfos.value.bluetooth!.bluetoothDeviceId!; + BlueManage().connectDeviceName = + state.keyInfos.value.bluetooth!.bluetoothDeviceName!; + BlueManage().connectDeviceMacAddress = + state.keyInfos.value.bluetooth!.bluetoothDeviceId!; - List publicKeyData = state.keyInfos.value.bluetooth!.publicKey!.cast(); + List publicKeyData = + state.keyInfos.value.bluetooth!.publicKey!.cast(); var saveStrList = changeIntListToStringList(publicKeyData); Storage.setStringList(saveBluePublicKey, saveStrList); // 私钥 - List privateKeyData = state.keyInfos.value.bluetooth!.privateKey!.cast(); + List privateKeyData = + state.keyInfos.value.bluetooth!.privateKey!.cast(); var savePrivateKeyList = changeIntListToStringList(privateKeyData); Storage.setStringList(saveBluePrivateKey, savePrivateKeyList); // print("publicKeyData:$publicKeyData saveStrList:$saveStrList privateKeyData:$privateKeyData savePrivateKeyList:$savePrivateKeyList"); @@ -52,16 +60,12 @@ class _LockDetailPageState extends State { @override Widget build(BuildContext context) { - return Container( width: 1.sw, - height: 1.sh - ScreenUtil().statusBarHeight*2, + height: 1.sh - ScreenUtil().statusBarHeight * 2, color: Colors.white, child: Column( - children: [ - topWidget(), - Expanded(child: bottomWidget()) - ], + children: [topWidget(), Expanded(child: bottomWidget())], ), ); } @@ -182,7 +186,11 @@ class _LockDetailPageState extends State { }), bottomItem('images/main/icon_main_password.png', TranslationLoader.lanKeys!.password!.tr, () { - Navigator.pushNamed(context, Routers.passwordKeyListPage); + Navigator.pushNamed(context, Routers.passwordKeyListPage, + arguments: { + "lockMainEntity": widget.lockMainEntity, + "keyInfo": widget.keyInfo + }); }), bottomItem('images/main/icon_main_icCard.png', TranslationLoader.lanKeys!.card!.tr, () { diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart index b74fb76f..90d5c26d 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart'; +import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/toast.dart'; @@ -20,8 +21,18 @@ class PasswordKeyListPage extends StatefulWidget { } class _PasswordKeyListPageState extends State { + late KeyInfos keyInfo; + late LockMainEntity lockMainEntity; + @override Widget build(BuildContext context) { + dynamic obj = ModalRoute.of(context)?.settings.arguments; + if (obj != null && (obj["lockMainEntity"] != null)) { + lockMainEntity = obj["lockMainEntity"]; + } + if (obj != null && (obj["keyInfo"] != null)) { + keyInfo = obj["keyInfo"]; + } return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( @@ -67,7 +78,10 @@ class _PasswordKeyListPageState extends State { btnName: TranslationLoader.lanKeys!.getPassword!.tr, onClick: () { Navigator.pushNamed( - context, Routers.passwordKeyManagePage); + context, Routers.passwordKeyManagePage, arguments: { + "lockMainEntity": lockMainEntity, + "keyInfo": keyInfo + }); }, ), SizedBox( @@ -86,8 +100,8 @@ class _PasswordKeyListPageState extends State { //请求密码钥匙列表 Future> mockNetworkDataRequest() async { - PasswordKeyListEntity entity = - await ApiRepository.to.passwordKeyList('0', '28', '0', '1', '20'); + PasswordKeyListEntity entity = await ApiRepository.to + .passwordKeyList('0', keyInfo.lockId.toString(), '0', '1', '20'); if (entity.errorCode!.codeIsSuccessful) { print("密码钥匙列表成功:${entity.data?.itemList}"); } @@ -102,7 +116,7 @@ class _PasswordKeyListPageState extends State { //密码钥匙重置请求 Future resetPasswordKeyListRequest() async { PasswordKeyListEntity entity = - await ApiRepository.to.resetPasswordKey('28', '0'); + await ApiRepository.to.resetPasswordKey(keyInfo.lockId.toString(), '0'); if (entity.errorCode!.codeIsSuccessful) { print("重置电子钥匙成功啦啦啦啦啦"); Toast.show(msg: "重置成功"); diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_page.dart index d2b15e55..29036c38 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_page.dart @@ -1,7 +1,7 @@ - import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_tabbar.dart'; +import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/titleAppBar.dart'; @@ -15,16 +15,33 @@ class PasswordKeyManagePage extends StatefulWidget { } class _PasswordKeyManagePageState extends State { - var index=0; + var index = 0; + late KeyInfos keyInfo; + late LockMainEntity lockMainEntity; @override Widget build(BuildContext context) { + dynamic obj = ModalRoute.of(context)?.settings.arguments; + if (obj != null && (obj["lockMainEntity"] != null)) { + lockMainEntity = obj["lockMainEntity"]; + } + if (obj != null && (obj["keyInfo"] != null)) { + keyInfo = obj["keyInfo"]; + } + return Scaffold( backgroundColor: AppColors.mainBackgroundColor, - appBar: TitleAppBar(barTitle: TranslationLoader.lanKeys!.getPassword!.tr, haveBack:true, backgroundColor: AppColors.mainColor), + appBar: TitleAppBar( + barTitle: TranslationLoader.lanKeys!.getPassword!.tr, + haveBack: true, + backgroundColor: AppColors.mainColor), body: Column( children: [ - PasswordKeyManageTabbarPage(initialIndex: index,), + PasswordKeyManageTabbarPage( + initialIndex: index, + keyInfo: keyInfo, + lockMainEntity: lockMainEntity, + ), ], ), ); diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_tabbar.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_tabbar.dart index d7f77edf..f5989215 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_tabbar.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_tabbar.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/CustomUnderlineTabIndicator.dart'; @@ -9,8 +10,14 @@ import '../passwordKey_Perpetual/passwordKey_perpetual_page.dart'; class PasswordKeyManageTabbarPage extends StatefulWidget { var initialIndex = 1; + final KeyInfos keyInfo; + final LockMainEntity lockMainEntity; - PasswordKeyManageTabbarPage({Key? key, required this.initialIndex}) + PasswordKeyManageTabbarPage( + {Key? key, + required this.initialIndex, + required this.keyInfo, + required this.lockMainEntity}) : super(key: key); @override State createState() => @@ -98,6 +105,8 @@ class _PasswordKeyManageTabbarPageState children: _itemTabs .map((ItemView item) => PasswordKeyPerpetualPage( type: item.type, + getKeyInfo: widget.keyInfo, + lockMainEntity: widget.lockMainEntity, )) .toList(), ), diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart index 429e90ac..940fe685 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart @@ -6,6 +6,7 @@ import 'package:flutter_pickers/style/default_style.dart'; import 'package:flutter_pickers/time_picker/model/date_mode.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/toast.dart'; @@ -17,8 +18,14 @@ import '../../../../translations/trans_lib.dart'; class PasswordKeyPerpetualPage extends StatefulWidget { final String type; + final KeyInfos getKeyInfo; + final LockMainEntity lockMainEntity; - const PasswordKeyPerpetualPage({Key? key, required this.type}) + const PasswordKeyPerpetualPage( + {Key? key, + required this.type, + required this.getKeyInfo, + required this.lockMainEntity}) : super(key: key); @override State createState() => @@ -27,14 +34,14 @@ class PasswordKeyPerpetualPage extends StatefulWidget { class _PasswordKeyPerpetualPageState extends State { final TextEditingController _controller = TextEditingController(); - late bool _isSendSuccess; - late bool _isPermanent; + late bool _isSendSuccess; //是否发送成功 + late bool _isPermanent; //是否永久 late String _getPwdStr; String _selectEffectiveDate = ''; //生效时间 String _selectFailureDate = ''; //失效时间 late DateTime _effectiveDateTime; late DateTime _failureDateTime; - late String cyclicModeStr; + late String cyclicModeStr; //循环模式 late String effectiveHourStr; late String failureHourStr; @@ -365,7 +372,7 @@ class _PasswordKeyPerpetualPageState extends State { Future getKeyboardPwdRequest() async { String getFailureDateTime = '0'; String getEffectiveDateTime = '0'; - String lockId = '28'; + String lockId = widget.getKeyInfo.lockId.toString(); int passwordType = int.parse(widget.type); String getKeyType = passwordType.toString(); if (passwordType == 0) {