1,密码模块数据传值处理
This commit is contained in:
parent
555dd4e05a
commit
cc6f206651
@ -17,7 +17,11 @@ class LockDetailPage extends StatefulWidget {
|
|||||||
final KeyInfos keyInfo;
|
final KeyInfos keyInfo;
|
||||||
final LockMainEntity lockMainEntity;
|
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);
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -34,15 +38,19 @@ class _LockDetailPageState extends State<LockDetailPage> {
|
|||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
state.keyInfos.value = widget.keyInfo;
|
state.keyInfos.value = widget.keyInfo;
|
||||||
BlueManage().connectDeviceName = state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
|
BlueManage().connectDeviceName =
|
||||||
BlueManage().connectDeviceMacAddress = state.keyInfos.value.bluetooth!.bluetoothDeviceId!;
|
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
|
||||||
|
BlueManage().connectDeviceMacAddress =
|
||||||
|
state.keyInfos.value.bluetooth!.bluetoothDeviceId!;
|
||||||
|
|
||||||
List<int> publicKeyData = state.keyInfos.value.bluetooth!.publicKey!.cast<int>();
|
List<int> publicKeyData =
|
||||||
|
state.keyInfos.value.bluetooth!.publicKey!.cast<int>();
|
||||||
var saveStrList = changeIntListToStringList(publicKeyData);
|
var saveStrList = changeIntListToStringList(publicKeyData);
|
||||||
Storage.setStringList(saveBluePublicKey, saveStrList);
|
Storage.setStringList(saveBluePublicKey, saveStrList);
|
||||||
|
|
||||||
// 私钥
|
// 私钥
|
||||||
List<int> privateKeyData = state.keyInfos.value.bluetooth!.privateKey!.cast<int>();
|
List<int> privateKeyData =
|
||||||
|
state.keyInfos.value.bluetooth!.privateKey!.cast<int>();
|
||||||
var savePrivateKeyList = changeIntListToStringList(privateKeyData);
|
var savePrivateKeyList = changeIntListToStringList(privateKeyData);
|
||||||
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
|
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
|
||||||
// print("publicKeyData:$publicKeyData saveStrList:$saveStrList privateKeyData:$privateKeyData savePrivateKeyList:$savePrivateKeyList");
|
// print("publicKeyData:$publicKeyData saveStrList:$saveStrList privateKeyData:$privateKeyData savePrivateKeyList:$savePrivateKeyList");
|
||||||
@ -52,16 +60,12 @@ class _LockDetailPageState extends State<LockDetailPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
width: 1.sw,
|
width: 1.sw,
|
||||||
height: 1.sh - ScreenUtil().statusBarHeight*2,
|
height: 1.sh - ScreenUtil().statusBarHeight * 2,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [topWidget(), Expanded(child: bottomWidget())],
|
||||||
topWidget(),
|
|
||||||
Expanded(child: bottomWidget())
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -182,7 +186,11 @@ class _LockDetailPageState extends State<LockDetailPage> {
|
|||||||
}),
|
}),
|
||||||
bottomItem('images/main/icon_main_password.png',
|
bottomItem('images/main/icon_main_password.png',
|
||||||
TranslationLoader.lanKeys!.password!.tr, () {
|
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',
|
bottomItem('images/main/icon_main_icCard.png',
|
||||||
TranslationLoader.lanKeys!.card!.tr, () {
|
TranslationLoader.lanKeys!.card!.tr, () {
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.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/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/toast.dart';
|
import 'package:star_lock/tools/toast.dart';
|
||||||
@ -20,8 +21,18 @@ class PasswordKeyListPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
||||||
|
late KeyInfos keyInfo;
|
||||||
|
late LockMainEntity lockMainEntity;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
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(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
@ -67,7 +78,10 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
|||||||
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context, Routers.passwordKeyManagePage);
|
context, Routers.passwordKeyManagePage, arguments: {
|
||||||
|
"lockMainEntity": lockMainEntity,
|
||||||
|
"keyInfo": keyInfo
|
||||||
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -86,8 +100,8 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
|||||||
|
|
||||||
//请求密码钥匙列表
|
//请求密码钥匙列表
|
||||||
Future<List<PasswordKeyListItem>> mockNetworkDataRequest() async {
|
Future<List<PasswordKeyListItem>> mockNetworkDataRequest() async {
|
||||||
PasswordKeyListEntity entity =
|
PasswordKeyListEntity entity = await ApiRepository.to
|
||||||
await ApiRepository.to.passwordKeyList('0', '28', '0', '1', '20');
|
.passwordKeyList('0', keyInfo.lockId.toString(), '0', '1', '20');
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("密码钥匙列表成功:${entity.data?.itemList}");
|
print("密码钥匙列表成功:${entity.data?.itemList}");
|
||||||
}
|
}
|
||||||
@ -102,7 +116,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
|||||||
//密码钥匙重置请求
|
//密码钥匙重置请求
|
||||||
Future<void> resetPasswordKeyListRequest() async {
|
Future<void> resetPasswordKeyListRequest() async {
|
||||||
PasswordKeyListEntity entity =
|
PasswordKeyListEntity entity =
|
||||||
await ApiRepository.to.resetPasswordKey('28', '0');
|
await ApiRepository.to.resetPasswordKey(keyInfo.lockId.toString(), '0');
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("重置电子钥匙成功啦啦啦啦啦");
|
print("重置电子钥匙成功啦啦啦啦啦");
|
||||||
Toast.show(msg: "重置成功");
|
Toast.show(msg: "重置成功");
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_tabbar.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 '../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../tools/titleAppBar.dart';
|
import '../../../../tools/titleAppBar.dart';
|
||||||
@ -15,16 +15,33 @@ class PasswordKeyManagePage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _PasswordKeyManagePageState extends State<PasswordKeyManagePage> {
|
class _PasswordKeyManagePageState extends State<PasswordKeyManagePage> {
|
||||||
var index=0;
|
var index = 0;
|
||||||
|
late KeyInfos keyInfo;
|
||||||
|
late LockMainEntity lockMainEntity;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
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(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
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(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
PasswordKeyManageTabbarPage(initialIndex: index,),
|
PasswordKeyManageTabbarPage(
|
||||||
|
initialIndex: index,
|
||||||
|
keyInfo: keyInfo,
|
||||||
|
lockMainEntity: lockMainEntity,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||||
|
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../tools/CustomUnderlineTabIndicator.dart';
|
import '../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||||
@ -9,8 +10,14 @@ import '../passwordKey_Perpetual/passwordKey_perpetual_page.dart';
|
|||||||
|
|
||||||
class PasswordKeyManageTabbarPage extends StatefulWidget {
|
class PasswordKeyManageTabbarPage extends StatefulWidget {
|
||||||
var initialIndex = 1;
|
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);
|
: super(key: key);
|
||||||
@override
|
@override
|
||||||
State<PasswordKeyManageTabbarPage> createState() =>
|
State<PasswordKeyManageTabbarPage> createState() =>
|
||||||
@ -98,6 +105,8 @@ class _PasswordKeyManageTabbarPageState
|
|||||||
children: _itemTabs
|
children: _itemTabs
|
||||||
.map((ItemView item) => PasswordKeyPerpetualPage(
|
.map((ItemView item) => PasswordKeyPerpetualPage(
|
||||||
type: item.type,
|
type: item.type,
|
||||||
|
getKeyInfo: widget.keyInfo,
|
||||||
|
lockMainEntity: widget.lockMainEntity,
|
||||||
))
|
))
|
||||||
.toList(),
|
.toList(),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -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_pickers/time_picker/model/date_mode.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.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/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/toast.dart';
|
import 'package:star_lock/tools/toast.dart';
|
||||||
@ -17,8 +18,14 @@ import '../../../../translations/trans_lib.dart';
|
|||||||
|
|
||||||
class PasswordKeyPerpetualPage extends StatefulWidget {
|
class PasswordKeyPerpetualPage extends StatefulWidget {
|
||||||
final String type;
|
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);
|
: super(key: key);
|
||||||
@override
|
@override
|
||||||
State<PasswordKeyPerpetualPage> createState() =>
|
State<PasswordKeyPerpetualPage> createState() =>
|
||||||
@ -27,14 +34,14 @@ class PasswordKeyPerpetualPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||||
final TextEditingController _controller = TextEditingController();
|
final TextEditingController _controller = TextEditingController();
|
||||||
late bool _isSendSuccess;
|
late bool _isSendSuccess; //是否发送成功
|
||||||
late bool _isPermanent;
|
late bool _isPermanent; //是否永久
|
||||||
late String _getPwdStr;
|
late String _getPwdStr;
|
||||||
String _selectEffectiveDate = ''; //生效时间
|
String _selectEffectiveDate = ''; //生效时间
|
||||||
String _selectFailureDate = ''; //失效时间
|
String _selectFailureDate = ''; //失效时间
|
||||||
late DateTime _effectiveDateTime;
|
late DateTime _effectiveDateTime;
|
||||||
late DateTime _failureDateTime;
|
late DateTime _failureDateTime;
|
||||||
late String cyclicModeStr;
|
late String cyclicModeStr; //循环模式
|
||||||
late String effectiveHourStr;
|
late String effectiveHourStr;
|
||||||
late String failureHourStr;
|
late String failureHourStr;
|
||||||
|
|
||||||
@ -365,7 +372,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
|||||||
Future<void> getKeyboardPwdRequest() async {
|
Future<void> getKeyboardPwdRequest() async {
|
||||||
String getFailureDateTime = '0';
|
String getFailureDateTime = '0';
|
||||||
String getEffectiveDateTime = '0';
|
String getEffectiveDateTime = '0';
|
||||||
String lockId = '28';
|
String lockId = widget.getKeyInfo.lockId.toString();
|
||||||
int passwordType = int.parse(widget.type);
|
int passwordType = int.parse(widget.type);
|
||||||
String getKeyType = passwordType.toString();
|
String getKeyType = passwordType.toString();
|
||||||
if (passwordType == 0) {
|
if (passwordType == 0) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user