1、修复密码左右滑动切换添加密码类型不对问题。2、修复添加指纹卡人脸传钥匙号问题。3、取消绑定完锁之后弹框给用户修改管理员密码问题

This commit is contained in:
魏少阳 2024-04-25 16:17:49 +08:00
parent a413d81da8
commit 581311f7d9
11 changed files with 330 additions and 233 deletions

View File

@ -115,7 +115,7 @@ import 'main/lockDetail/lockSet/wirelessKeyboard/selectWirelessKeyboard/selectWi
import 'main/lockDetail/lockSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart';
import 'main/lockDetail/monitoring/monitoring/lockMonitoring_page.dart';
import 'main/lockDetail/monitoring/monitoringRealTimeScreen/monitoringRealTimeScreen_page.dart';
import 'main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyManage/passwordKeyManage_page.dart';
import 'main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart';
import 'main/lockDetail/realTimePicture/realTimePicture_page.dart';
import 'main/lockDetail/remoteControl/addRemoteControl/addRemoteControl_page.dart';
import 'main/lockDetail/remoteControl/remoteControlList/remoteControlList_page.dart';
@ -214,7 +214,7 @@ abstract class Routers {
'/ElectronicKeyPeriodValidityPage'; //
static const sendEmailNotificationPage = '/SendEmailNotificationPage'; //
static const passwordKeyListPage = '/PasswordKeyListPage'; //
static const passwordKeyManagePage = '/PasswordKeyManagePage'; //
static const passwordKeyPerpetualPage = '/PasswordKeyPerpetualPage'; //
static const passwordKeyDetailPage = '/PasswordKeyDetailPage'; //
// static const otherTypeKeyListPage = '/OtherTypeKeyListPage'; //
// static const otherTypeKeyDetailPage = '/OtherTypeKeyDetailPage'; //
@ -519,8 +519,8 @@ abstract class AppRouters {
page: () => const PasswordKeyListPage(),
),
GetPage(
name: Routers.passwordKeyManagePage,
page: () => const PasswordKeyManagePage(),
name: Routers.passwordKeyPerpetualPage,
page: () => const PasswordKeyPerpetualPage(),
),
GetPage(
name: Routers.passwordKeyDetailPage,

View File

@ -114,7 +114,7 @@ class CommandReciverManager {
oriDataList = SM4.decrypt(getDataList,
key: getPrivateKeyList, mode: SM4CryptoMode.ECB);
oriDataList = oriDataList.sublist(0, oriLen);
// print("SM4 oriDataList:$oriDataList");
print("SM4 oriDataList:$oriDataList");
break;
}
parseData(oriDataList).then((value) async {

View File

@ -81,7 +81,7 @@ class AddICCardLogic extends BaseGetXController{
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
keyID:"1",
userID:await Storage.getUid(),
cardNo:state.isAdministrator.value == "2" ? 254 : 1,
cardNo:state.isAdministrator.value == "2" ? 254 : 0,
useCountLimit:0xff,
isForce:state.isCoerced.value == "1" ? 0 : 1, //
isRound:state.selectType.value == "2" ? 1: 0, //
@ -229,7 +229,7 @@ class AddICCardLogic extends BaseGetXController{
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
keyID:"1",
userID:await Storage.getUid(),
cardNo:state.isAdministrator.value == "2" ? 254 : 1,
cardNo:state.isAdministrator.value == "2" ? 254 : 0,
useCountLimit:0xff,
isForce:state.isCoerced.value == "2" ? 1 : 0, //
isRound:state.selectType.value == "2" ? 1: 0, //

View File

@ -83,7 +83,7 @@ class AddFaceLogic extends BaseGetXController {
IoSenderManage.senderAddFaceCommand(
keyID:"1",
userID:await Storage.getUid(),
faceNo:state.isAdministrator.value == "2" ? 254 : 1,
faceNo:state.isAdministrator.value == "2" ? 254 : 0,
useCountLimit:0xff,
isForce:state.isCoerced.value == "2" ? 1 : 0, //
isRound:state.selectType.value == "2" ? 1: 0, //
@ -232,7 +232,7 @@ class AddFaceLogic extends BaseGetXController {
IoSenderManage.senderAddFaceCommand(
keyID:"1",
userID:await Storage.getUid(),
faceNo:state.isAdministrator.value == "2" ? 254 : 1,
faceNo:state.isAdministrator.value == "2" ? 254 : 0,
useCountLimit:0xff,
isForce:state.isCoerced.value == "2" ? 1 : 0, //
isRound:state.selectType.value == "2" ? 1: 0, //

View File

@ -93,7 +93,7 @@ class AddFingerprintLogic extends BaseGetXController {
IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand(
keyID:"1",
userID:await Storage.getUid(),
fingerNo:state.isAdministrator.value == "2" ? 254 : 1,
fingerNo:state.isAdministrator.value == "2" ? 254 : 0,
useCountLimit:0xff,
isForce:state.isCoerced.value == "1" ? 1 : 0, //
isRound:state.selectType.value == "2" ? 1: 0, //
@ -283,7 +283,7 @@ class AddFingerprintLogic extends BaseGetXController {
IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand(
keyID:"1",
userID:await Storage.getUid(),
fingerNo:state.isAdministrator.value == "2" ? 254 : 1,
fingerNo:state.isAdministrator.value == "2" ? 254 : 0,
useCountLimit:0xff,
isForce:state.isCoerced.value == "2" ? 1 : 0, //
isRound:state.selectType.value == "2" ? 1: 0, //

View File

@ -107,7 +107,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
AddBottomWhiteBtn(
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
onClick: () {
Navigator.pushNamed(context, Routers.passwordKeyManagePage,
Navigator.pushNamed(context, Routers.passwordKeyPerpetualPage,
arguments: {"keyInfo": state.keyInfo.value}).then((val) {
if (val != null) {
logic.pageNo = 1;

View File

@ -115,11 +115,7 @@ class _PasswordKeyManageTabbarPageState extends State<PasswordKeyManageTabbarPag
return Expanded(
child: TabBarView(
controller: _tabController,
children: _itemTabs.map((ItemView item) => PasswordKeyPerpetualPage(
type: item.type,
getKeyInfo: widget.keyInfo,
))
.toList(),
children: _itemTabs.map((ItemView item) => PasswordKeyPerpetualPage()).toList(),
),
);
}

View File

@ -16,157 +16,178 @@ import 'package:star_lock/tools/storage.dart';
import '../../../../appRouters.dart';
import '../../../../blue/blue_manage.dart';
import '../../../../blue/io_modelVendor.dart';
import '../../../../tools/CustomUnderlineTabIndicator.dart';
import '../../../../tools/NativeInteractionTool.dart';
import '../../../../tools/appRouteObserver.dart';
import '../../../../tools/commonItem.dart';
import '../../../../tools/dateTool.dart';
import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
class PasswordKeyPerpetualPage extends StatefulWidget {
final String type;
final LockListInfoItemEntity getKeyInfo;
const PasswordKeyPerpetualPage(
{Key? key, required this.type, required this.getKeyInfo})
: super(key: key);
{Key? key}) : super(key: key);
@override
State<PasswordKeyPerpetualPage> createState() =>
_PasswordKeyPerpetualPageState();
}
class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> with RouteAware{
class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> with RouteAware, SingleTickerProviderStateMixin{
final logic = Get.put(PasswordKeyPerpetualLogic());
final state = Get.find<PasswordKeyPerpetualLogic>().state;
@override
void initState() {
// TODO: implement initState
super.initState();
initData();
// state.isSendSuccess.value = false;
}
state.tabController = TabController(
vsync: this,
length: _itemTabs.length,
initialIndex: 0);
state.tabController.addListener(() {
WidgetsBinding.instance.addPostFrameCallback((_) {
state.widgetType.value = state.tabController.index;
});
void initData() {
// if (!state.isInitialized.value) {
// state.isInitialized.value = true;
// state.keyInfo.value = widget.getKeyInfo;
// }
if (state.tabController.animation!.value == state.tabController.index) {
FocusScope.of(context).requestFocus(FocusNode());
}
});
}
@override
Widget build(BuildContext context) {
state.keyInfo.value = widget.getKeyInfo;
state.widgetType.value = int.parse(widget.type);
print("state.widgetType.value:${state.widgetType.value}");
return SingleChildScrollView(
child: Obx(() => indexChangeWidget()),
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.getPassword!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
children: [
_tabBar(),
_pageWidget(),
],
),
);
}
Widget indexChangeWidget() {
if (state.isSendSuccess.value == true && state.sendSucceedType.value.toString() == widget.type) {
if (state.isSendSuccess.value == true && state.sendSucceedType.value == state.widgetType.value) {
return sendElectronicKeySucceed();
} else {
switch (int.parse(widget.type)) {
switch (state.widgetType.value) {
case 0:
{
//
return Column(
children: [
perpetualKeyWidget(
false,
TranslationLoader.lanKeys!.name!.tr,
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
state.nameController),
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip1!.tr)
],
return SingleChildScrollView(
child: Column(
children: [
perpetualKeyWidget(
false,
TranslationLoader.lanKeys!.name!.tr,
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
state.nameController),
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip1!.tr)
],
),
);
}
case 1:
{
//
return Column(
children: [
keyTimeLimitWidget(),
perpetualKeyWidget(
false,
TranslationLoader.lanKeys!.name!.tr,
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
state.nameController),
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip2!.tr)
],
return SingleChildScrollView(
child: Column(
children: [
keyTimeLimitWidget(),
perpetualKeyWidget(
false,
TranslationLoader.lanKeys!.name!.tr,
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
state.nameController),
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip2!.tr)
],
),
);
}
case 2:
{
//
return Column(
children: [
perpetualKeyWidget(
false,
TranslationLoader.lanKeys!.name!.tr,
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
state.nameController),
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip3!.tr)
],
return SingleChildScrollView(
child: Column(
children: [
perpetualKeyWidget(
false,
TranslationLoader.lanKeys!.name!.tr,
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
state.nameController),
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip3!.tr)
],
),
);
}
case 3:
{
//
return Column(
children: [
keyIfPerpetualWidget(),
state.isPermanent.value == false
? keyTimeLimitWidget()
: Container(),
perpetualKeyWidget(
false,
TranslationLoader.lanKeys!.name!.tr,
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
state.nameController),
perpetualKeyWidget(
false,
TranslationLoader.lanKeys!.password!.tr,
"请输入6-9位数字", state.pwdController
),
keyIfAdministratorWidget(),
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip4!.tr)
],
return SingleChildScrollView(
child: Column(
children: [
keyIfPerpetualWidget(),
state.isPermanent.value == false
? keyTimeLimitWidget()
: Container(),
perpetualKeyWidget(
false,
TranslationLoader.lanKeys!.name!.tr,
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
state.nameController),
perpetualKeyWidget(
false,
TranslationLoader.lanKeys!.password!.tr,
"请输入6-9位数字", state.pwdController
),
keyIfAdministratorWidget(),
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip4!.tr)
],
),
);
}
case 4:
{
//
return Column(
children: [
keyCirculationWidget(),
perpetualKeyWidget(
true,
TranslationLoader.lanKeys!.name!.tr,
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
state.nameController),
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip2!.tr)
],
return SingleChildScrollView(
child: Column(
children: [
keyCirculationWidget(),
perpetualKeyWidget(
true,
TranslationLoader.lanKeys!.name!.tr,
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
state.nameController),
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip2!.tr)
],
),
);
}
case 5:
{
//
return Column(
children: [
perpetualKeyWidget(
false,
TranslationLoader.lanKeys!.name!.tr,
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
state.nameController),
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip6!.tr)
],
return SingleChildScrollView(
child: Column(
children: [
perpetualKeyWidget(
false,
TranslationLoader.lanKeys!.name!.tr,
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
state.nameController),
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip6!.tr)
],
),
);
}
default:
@ -365,7 +386,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
height: 20.h,
),
SubmitBtn(
btnName: widget.type == "3" ? "设置密码":TranslationLoader.lanKeys!.getPassword!.tr,
btnName: state.widgetType.value == 3 ? "设置密码":TranslationLoader.lanKeys!.getPassword!.tr,
onClick: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
@ -568,6 +589,66 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
});
}
TabBar _tabBar() {
return TabBar(
controller: state.tabController,
onTap: (index){
FocusScope.of(context).requestFocus(FocusNode());
},
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(),
isScrollable: true,
indicatorColor: Colors.red,
unselectedLabelColor: Colors.black,
unselectedLabelStyle: TextStyle(
color: AppColors.mainColor,
fontSize: 24.sp,
),
automaticIndicatorColorAdjustment: true,
labelColor: AppColors.mainColor,
labelStyle: TextStyle(
color: AppColors.mainColor,
fontSize: 24.sp,
fontWeight: FontWeight.w600),
indicator: CustomUnderlineTabIndicator(
borderSide: BorderSide(color: AppColors.mainColor, width: 4.w),
strokeCap: StrokeCap.round,
width: 30.w),
);
}
Tab _tab(ItemView item) {
return Tab(
// text: item.title,
child: Container(
// width: item.title.length > 2 ? 1.sw / 8 : 1.sw / 12,
// margin: EdgeInsets.all(10.w),
// color: Colors.red,
child: Text(
item.title,
textAlign: TextAlign.center,
),
),
);
}
Widget _pageWidget() {
return Expanded(
child: TabBarView(
controller: state.tabController,
children: _itemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList(),
),
);
}
final List<ItemView> _itemTabs = <ItemView>[
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, type: "0"),
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, type: "1"),
ItemView(title: TranslationLoader.lanKeys!.once!.tr, type: "2"),
ItemView(title: TranslationLoader.lanKeys!.custom!.tr, type: "3"),
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, type: "4"),
ItemView(title: TranslationLoader.lanKeys!.clearAll!.tr, type: "5"),
];
List<Widget> initBottomSheetList() {
List<Widget> widgetList = [];
@ -684,3 +765,10 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
state.sureBtnState.value = 0;
}
}
class ItemView {
const ItemView({required this.title, required this.type});
final String title;
final String type;
}

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
@ -32,4 +33,13 @@ class PasswordKeyPerpetualState {
var sureBtnState = 0.obs;// 0() 1()
var pwdNumber = 0.obs;//
late TabController tabController;
PasswordKeyPerpetualState() {
Map map = Get.arguments;
if(map["keyInfo"] != null){
keyInfo.value = map["keyInfo"];
}
}
}

View File

@ -38,10 +38,9 @@ class SaveLockLogic extends BaseGetXController {
_replySenderCustomPasswords(reply);
}
if (reply is ChangeAdministratorPasswordReply) {
_replyChangeAdministratorPassword(reply);
}
// if (reply is ChangeAdministratorPasswordReply) {
// _replyChangeAdministratorPassword(reply);
// }
});
}
@ -152,51 +151,51 @@ class SaveLockLogic extends BaseGetXController {
}
//
Future<void> _replyChangeAdministratorPassword(Reply reply) async {
var token = reply.data.sublist(5, 9);
var saveStrList = changeIntListToStringList(token);
Storage.setStringList(saveBlueToken, saveStrList);
int status = reply.data[2];
Get.log("status:$status");
switch (status) {
case 0x00:
//
Get.log("${reply.commandType!.typeValue} 数据解析成功");
cancelBlueConnetctToastTimer();
addLockAdminPassword(false);
break;
case 0x06:
//
Get.log("${reply.commandType!.typeValue} 需要鉴权");
var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!);
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
IoSenderManage.changeAdministratorPasswordCommand(
keyID: "1",
userID: await Storage.getUid(),
pwdNo: 254,
pwd:state.adminPasswordTF.text,
useCountLimit: 0xff,
startTime: 0x11223344,
endTime: 0x11223344,
needAuthor: 1,
isBeforeAddUser: true,
signKey: signKeyDataList,
privateKey: getPrivateKeyList,
token: token);
break;
default:
//
Get.log("${reply.commandType!.typeValue} 失败");
break;
}
}
// Future<void> _replyChangeAdministratorPassword(Reply reply) async {
// var token = reply.data.sublist(5, 9);
// var saveStrList = changeIntListToStringList(token);
// Storage.setStringList(saveBlueToken, saveStrList);
//
// int status = reply.data[2];
// Get.log("status:$status");
//
// switch (status) {
// case 0x00:
// //
// Get.log("${reply.commandType!.typeValue} 数据解析成功");
// cancelBlueConnetctToastTimer();
// addLockAdminPassword(false);
// break;
// case 0x06:
// //
// Get.log("${reply.commandType!.typeValue} 需要鉴权");
//
// var signKey = await Storage.getStringList(saveBlueSignKey);
// List<int> signKeyDataList = changeStringListToIntList(signKey!);
//
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
//
// IoSenderManage.changeAdministratorPasswordCommand(
// keyID: "1",
// userID: await Storage.getUid(),
// pwdNo: 254,
// pwd:state.adminPasswordTF.text,
// useCountLimit: 0xff,
// startTime: 0x11223344,
// endTime: 0x11223344,
// needAuthor: 1,
// isBeforeAddUser: true,
// signKey: signKeyDataList,
// privateKey: getPrivateKeyList,
// token: token);
// break;
// default:
// //
// Get.log("${reply.commandType!.typeValue} 失败");
// break;
// }
// }
//
Future<void> addUserConnectBlue() async {
@ -284,45 +283,45 @@ class SaveLockLogic extends BaseGetXController {
}
// (//5)
Future<void> changeAdministratorPasswordCommand() async {
showEasyLoading();
showBlueConnetctToastTimer(action: (){
dismissEasyLoading();
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!);
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!);
IoSenderManage.changeAdministratorPasswordCommand(
keyID: "1",
userID: await Storage.getUid(),
pwdNo: 254,
pwd:state.adminPasswordTF.text,
useCountLimit: 0xff,
startTime: 0x11223344,
endTime: 0x11223344,
needAuthor: 1,
isBeforeAddUser: true,
signKey: signKeyDataList,
privateKey: getPrivateKeyList,
token: getTokenList);
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
dismissEasyLoading();
cancelBlueConnetctToastTimer();
state.saveBtnIsUsable.value = true;
if(state.ifCurrentScreen.value == true){
showBlueConnetctToast();
}
}
}, isAddEquipment: true);
}
// Future<void> changeAdministratorPasswordCommand() async {
// showEasyLoading();
// showBlueConnetctToastTimer(action: (){
// dismissEasyLoading();
// });
// BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
// if (deviceConnectionState == BluetoothConnectionState.connected) {
// var signKey = await Storage.getStringList(saveBlueSignKey);
// List<int> signKeyDataList = changeStringListToIntList(signKey!);
//
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
//
// var token = await Storage.getStringList(saveBlueToken);
// List<int> getTokenList = changeStringListToIntList(token!);
//
// IoSenderManage.changeAdministratorPasswordCommand(
// keyID: "1",
// userID: await Storage.getUid(),
// pwdNo: 254,
// pwd:state.adminPasswordTF.text,
// useCountLimit: 0xff,
// startTime: 0x11223344,
// endTime: 0x11223344,
// needAuthor: 1,
// isBeforeAddUser: true,
// signKey: signKeyDataList,
// privateKey: getPrivateKeyList,
// token: getTokenList);
// } else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
// dismissEasyLoading();
// cancelBlueConnetctToastTimer();
// state.saveBtnIsUsable.value = true;
// if(state.ifCurrentScreen.value == true){
// showBlueConnetctToast();
// }
// }
// }, isAddEquipment: true);
// }
void bindBlueAdmin() async{
@ -381,52 +380,52 @@ class SaveLockLogic extends BaseGetXController {
adminPwd: state.adminPasswordTF.text,
);
if (entity.errorCode!.codeIsSuccessful) {
if(isAddLockAdminPassword == true){
showDeletPasswordAlertDialog();
}else{
// if(isAddLockAdminPassword == true){
// showDeletPasswordAlertDialog();
// }else{
backAction();
}
// }
}
}
void showDeletPasswordAlertDialog() {
showDialog(
context: Get.context!,
builder: (BuildContext context) {
return ShowTFView(
title: "管理员密码",
tipTitle: "如需修改,请输入新的管理员密码(6位),点击确定即可修改",
leftBtnTitle: "确定".tr,
rightBtnTitle: "修改",
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp('[0-9]')),
LengthLimitingTextInputFormatter(6),
],
controller: state.adminPasswordTF,
sureClick: () {
if(state.adminPasswordTF.text.length < 6){
showToast("请输入6位管理员密码".tr);
return;
}
if(state.adminPasswordTF.text == state.adminPassword){
showToast("请输入新的管理员密码".tr);
return;
}
changeAdministratorPasswordCommand();
},
cancelClick: () {
backAction();
},
);
},
);
}
// void showDeletPasswordAlertDialog() {
// showDialog(
// context: Get.context!,
// builder: (BuildContext context) {
// return ShowTFView(
// title: "管理员密码",
// tipTitle: "如需修改,请输入新的管理员密码(6位),点击确定即可修改",
// leftBtnTitle: "确定".tr,
// rightBtnTitle: "修改",
// keyboardType: TextInputType.number,
// inputFormatters: [
// FilteringTextInputFormatter.allow(RegExp('[0-9]')),
// LengthLimitingTextInputFormatter(6),
// ],
// controller: state.adminPasswordTF,
// sureClick: () {
// if(state.adminPasswordTF.text.length < 6){
// showToast("请输入6位管理员密码".tr);
// return;
// }
//
// if(state.adminPasswordTF.text == state.adminPassword){
// showToast("请输入新的管理员密码".tr);
// return;
// }
// changeAdministratorPasswordCommand();
// },
// cancelClick: () {
// backAction();
// },
// );
// },
// );
// }
void backAction(){
BlueManage().disconnect();
Get.close(state.isFromMap == 1 ? 6 : 7);
Get.close(state.isFromMap == 1 ? 5 : 6);
}
@override

View File

@ -3,6 +3,7 @@ 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/blue/blue_manage.dart';
import '../../../app_settings/app_colors.dart';
import '../../../tools/appRouteObserver.dart';
@ -134,6 +135,7 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
///
AppRouteObserver().routeObserver.unsubscribe(this);
super.dispose();
BlueManage().stopScan();
}
///
@ -141,6 +143,7 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
void didPush() {
super.didPush();
BlueManage().stopScan();
state.ifCurrentScreen.value = true;
}
@ -149,6 +152,7 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
void didPop() {
super.didPop();
BlueManage().stopScan();
state.ifCurrentScreen.value = false;
logic.cancelBlueConnetctToastTimer();
}