1、修复登录注册问题,统一添加隐藏显示密码按钮

2、部分协议Nember 1个字节修改2字节
3、修复无网络开锁获取token异常情况
This commit is contained in:
魏少阳 2024-05-03 18:31:15 +08:00
parent b26602e844
commit 08de8f1fdf
26 changed files with 165 additions and 95 deletions

View File

@ -789,5 +789,6 @@
"文件校验失败 0x03": "File verification failed 0x03", "文件校验失败 0x03": "File verification failed 0x03",
"固件升级完成": "Firmware upgrade completed", "固件升级完成": "Firmware upgrade completed",
"记录":"Record", "记录":"Record",
"开通高级功能后才可以对锁进行管理":"You can manage locks only after the advanced function is enabled" "开通高级功能后才可以对锁进行管理":"You can manage locks only after the advanced function is enabled",
"密码不一致哦":"The passwords are inconsistent",
} }

View File

@ -707,6 +707,7 @@
"型号": "型号", "型号": "型号",
"密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。": "密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。", "密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。": "密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。",
"密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。":"密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。", "密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。":"密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。",
"密码不一致哦":"密码不一致哦",
"相机": "相机", "相机": "相机",
"相册": "相册", "相册": "相册",

View File

@ -709,6 +709,7 @@
"型号": "型号", "型号": "型号",
"密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。": "密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。", "密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。": "密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。",
"密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。":"密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。", "密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。":"密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。",
"密码不一致哦":"密码不一致哦",
"相机": "相机", "相机": "相机",
"相册": "相册", "相册": "相册",

View File

@ -57,12 +57,13 @@ class SenderAddFaceCommand extends SenderProtocol {
List<int> ebcData = []; List<int> ebcData = [];
// //
int type = commandType!.typeValue; // int type = commandType!.typeValue;
double typeDouble = type / 256; // double typeDouble = type / 256;
int type1 = typeDouble.toInt(); // int type1 = typeDouble.toInt();
int type2 = type % 256; // int type2 = type % 256;
data.add(type1); // data.add(type1);
data.add(type2); // data.add(type2);
data.addAll(intChangList(commandType!.typeValue));
// //
data.add(81); data.add(81);
@ -77,11 +78,12 @@ class SenderAddFaceCommand extends SenderProtocol {
subData.addAll(utf8.encode(userID!)); subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength); subData = getFixedLengthList(subData, 20 - userIDLength);
// fingerNo // faceNo
subData.add(faceNo!); subData.addAll(intChangList(faceNo!));
AppLog.log("faceNo:$faceNo intChangList(faceNo!):${intChangList(faceNo!)}");
// UseCountLimit // UseCountLimit
subData.add(useCountLimit!); subData.addAll(intChangList(useCountLimit!));
// isForce // isForce
subData.add(isForce!); subData.add(isForce!);

View File

@ -57,12 +57,13 @@ class SenderAddFingerprintWithTimeCycleCoercionCommand extends SenderProtocol {
List<int> ebcData = []; List<int> ebcData = [];
// //
int type = commandType!.typeValue; // int type = commandType!.typeValue;
double typeDouble = type / 256; // double typeDouble = type / 256;
int type1 = typeDouble.toInt(); // int type1 = typeDouble.toInt();
int type2 = type % 256; // int type2 = type % 256;
data.add(type1); // data.add(type1);
data.add(type2); // data.add(type2);
data.addAll(intChangList(commandType!.typeValue));
// //
data.add(36); data.add(36);
@ -78,10 +79,11 @@ class SenderAddFingerprintWithTimeCycleCoercionCommand extends SenderProtocol {
subData = getFixedLengthList(subData, 20 - userIDLength); subData = getFixedLengthList(subData, 20 - userIDLength);
// fingerNo // fingerNo
subData.add(fingerNo!); subData.addAll(intChangList(fingerNo!));
AppLog.log("fingerNo:$fingerNo intChangList(fingerNo!):${intChangList(fingerNo!)}");
// UseCountLimit // UseCountLimit
subData.add(useCountLimit!); subData.addAll(intChangList(useCountLimit!));
// isForce // isForce
subData.add(isForce!); subData.add(isForce!);

View File

@ -57,12 +57,13 @@ class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol {
List<int> ebcData = []; List<int> ebcData = [];
// //
int type = commandType!.typeValue; // int type = commandType!.typeValue;
double typeDouble = type / 256; // double typeDouble = type / 256;
int type1 = typeDouble.toInt(); // int type1 = typeDouble.toInt();
int type2 = type % 256; // int type2 = type % 256;
data.add(type1); // data.add(type1);
data.add(type2); // data.add(type2);
data.addAll(intChangList(commandType!.typeValue));
// //
data.add(24); data.add(24);
@ -77,11 +78,12 @@ class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol {
subData.addAll(utf8.encode(userID!)); subData.addAll(utf8.encode(userID!));
subData = getFixedLengthList(subData, 20 - userIDLength); subData = getFixedLengthList(subData, 20 - userIDLength);
// fingerNo // cardNo
subData.add(cardNo!); subData.addAll(intChangList(cardNo!));
AppLog.log("cardNo:$cardNo intChangList(cardNo!):${intChangList(cardNo!)}");
// UseCountLimit // UseCountLimit
subData.add(useCountLimit!); subData.addAll(intChangList(useCountLimit!));
// isForce // isForce
subData.add(isForce!); subData.add(isForce!);

View File

@ -45,12 +45,13 @@ class ChangeAdministratorPasswordCommand extends SenderProtocol {
List<int> ebcData = []; List<int> ebcData = [];
// //
int type = commandType!.typeValue; // int type = commandType!.typeValue;
double typeDouble = type / 256; // double typeDouble = type / 256;
int type1 = typeDouble.toInt(); // int type1 = typeDouble.toInt();
int type2 = type % 256; // int type2 = type % 256;
data.add(type1); // data.add(type1);
data.add(type2); // data.add(type2);
data.addAll(intChangList(commandType!.typeValue));
// //
data.add(2); data.add(2);
@ -66,7 +67,8 @@ class ChangeAdministratorPasswordCommand extends SenderProtocol {
subData = getFixedLengthList(subData, 20 - userIDLength); subData = getFixedLengthList(subData, 20 - userIDLength);
// PwdNo // PwdNo
subData.add(1); subData.addAll(intChangList(pwdNo!));
AppLog.log("pwdNo:$pwdNo");
// pwd 20 // pwd 20
int pwdLength = utf8.encode(pwd!).length; int pwdLength = utf8.encode(pwd!).length;
@ -74,7 +76,7 @@ class ChangeAdministratorPasswordCommand extends SenderProtocol {
subData = getFixedLengthList(subData, 20 - pwdLength); subData = getFixedLengthList(subData, 20 - pwdLength);
// UseCountLimit // UseCountLimit
subData.add(0xff); subData.addAll(intChangList(useCountLimit!));
// token // token
subData.addAll(token!); subData.addAll(token!);

View File

@ -50,12 +50,13 @@ class SenderCustomPasswordsCommand extends SenderProtocol {
List<int> ebcData = []; List<int> ebcData = [];
// //
int type = commandType!.typeValue; // int type = commandType!.typeValue;
double typeDouble = type / 256; // double typeDouble = type / 256;
int type1 = typeDouble.toInt(); // int type1 = typeDouble.toInt();
int type2 = type % 256; // int type2 = type % 256;
data.add(type1); // data.add(type1);
data.add(type2); // data.add(type2);
data.addAll(intChangList(commandType!.typeValue));
// //
data.add(3); data.add(3);
@ -71,7 +72,7 @@ class SenderCustomPasswordsCommand extends SenderProtocol {
subData = getFixedLengthList(subData, 20 - userIDLength); subData = getFixedLengthList(subData, 20 - userIDLength);
// PwdNo // PwdNo
subData.add(pwdNo!); subData.addAll(intChangList(pwdNo!));
AppLog.log("pwdNo:$pwdNo"); AppLog.log("pwdNo:$pwdNo");
// pwd 20 // pwd 20
@ -81,7 +82,7 @@ class SenderCustomPasswordsCommand extends SenderProtocol {
AppLog.log("pwd:$pwd"); AppLog.log("pwd:$pwd");
// UseCountLimit // UseCountLimit
subData.add(useCountLimit!); subData.addAll(intChangList(useCountLimit!));
// token // token
subData.addAll(token!); subData.addAll(token!);

View File

@ -4,6 +4,21 @@ import 'dart:typed_data';
import 'package:crypto/crypto.dart'; import 'package:crypto/crypto.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
int listChangInt(List<int> list){
int dataLen = (list[0] << 8) + list[61];
return dataLen;
}
List<int> intChangList(int count){
List<int> intList = [];
double typeDouble = count / 256;
int type1 = typeDouble.toInt();
int type2 = count % 256;
intList.add(type1);
intList.add(type2);
return intList;
}
List<String> changeIntListToStringList(List<int> list){ List<String> changeIntListToStringList(List<int> list){
List<String> strList = []; List<String> strList = [];
for(int i = 0; i<list.length; i++) for(int i = 0; i<list.length; i++)

View File

@ -113,6 +113,7 @@ class _StarLockForgetPasswordPageState
logic.checkNext(state.pwdController); logic.checkNext(state.pwdController);
}, },
isPwd: true, isPwd: true,
isSuffixIcon: 2,
leftWidget: Padding( leftWidget: Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w), top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
@ -140,6 +141,7 @@ class _StarLockForgetPasswordPageState
logic.checkNext(state.sureController); logic.checkNext(state.sureController);
}, },
isPwd: true, isPwd: true,
isSuffixIcon: 2,
leftWidget: Padding( leftWidget: Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w), top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),

View File

@ -98,6 +98,7 @@ class _StarLockForgetPasswordPageState
logic.checkNext(state.pwdController); logic.checkNext(state.pwdController);
}, },
isPwd: true, isPwd: true,
isSuffixIcon: 2,
leftWidget: Padding( leftWidget: Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w), top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
@ -118,6 +119,7 @@ class _StarLockForgetPasswordPageState
logic.checkNext(state.sureController); logic.checkNext(state.sureController);
}, },
isPwd: true, isPwd: true,
isSuffixIcon: 2,
leftWidget: Padding( leftWidget: Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w), top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),

View File

@ -112,6 +112,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
logic.checkNext(state.pwdController); logic.checkNext(state.pwdController);
}, },
isPwd: true, isPwd: true,
isSuffixIcon: 2,
leftWidget: Padding( leftWidget: Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w), top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),

View File

@ -106,6 +106,7 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
logic.checkNext(state.pwdController); logic.checkNext(state.pwdController);
}, },
isPwd: true, isPwd: true,
isSuffixIcon: 2,
leftWidget: Padding( leftWidget: Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 30.w, top: 30.w,

View File

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import '../../network/api_repository.dart'; import '../../network/api_repository.dart';
import '../../tools/baseGetXController.dart'; import '../../tools/baseGetXController.dart';
@ -29,6 +30,11 @@ class StarLockRegisterLogic extends BaseGetXController {
} }
void register() async { void register() async {
AppLog.log("state.pwd.value:${state.pwd.value} state.surePwd.value:${state.surePwd.value}");
if(state.pwd.value != state.surePwd.value){
showToast("密码不一致哦".tr);
return;
}
var entity = await ApiRepository.to.register( var entity = await ApiRepository.to.register(
receiverType: state.isIphoneType.value == true ? 1 : 2, receiverType: state.isIphoneType.value == true ? 1 : 2,
countryCode: int.parse(state.countryCode.value), countryCode: int.parse(state.countryCode.value),

View File

@ -226,6 +226,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
logic.checkNext(state.pwdController); logic.checkNext(state.pwdController);
}, },
isPwd: true, isPwd: true,
isSuffixIcon: 2,
leftWidget: Padding( leftWidget: Padding(
padding: EdgeInsets.only(right: 10.w, left: 5.w), padding: EdgeInsets.only(right: 10.w, left: 5.w),
child: Image.asset( child: Image.asset(
@ -252,6 +253,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
logic.checkNext(state.sureController); logic.checkNext(state.sureController);
}, },
isPwd: true, isPwd: true,
isSuffixIcon: 2,
leftWidget: Padding( leftWidget: Padding(
padding: EdgeInsets.only(right: 10.w, left: 5.w), padding: EdgeInsets.only(right: 10.w, left: 5.w),
child: Image.asset( child: Image.asset(

View File

@ -25,7 +25,7 @@ class StarLockRegisterState {
bool get isEmail => RegexUtil.isEmail(phoneOrEmailStr.value); bool get isEmail => RegexUtil.isEmail(phoneOrEmailStr.value);
bool get isIphone => RegexUtil.isMobileSimple(phoneOrEmailStr.value); bool get isIphone => RegexUtil.isMobileSimple(phoneOrEmailStr.value);
bool get pwdIsOK => pwd.value.isNotEmpty && (pwd.value == surePwd.value); bool get pwdIsOK => pwd.value.isNotEmpty && surePwd.value.isNotEmpty;
bool get codeIsOK => verificationCode.value.isNotEmpty; bool get codeIsOK => verificationCode.value.isNotEmpty;
var canResend = false.obs; var canResend = false.obs;

View File

@ -155,6 +155,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
logic.checkNext(state.pwdController); logic.checkNext(state.pwdController);
}, },
isPwd: true, isPwd: true,
isSuffixIcon: 2,
leftWidget: Padding( leftWidget: Padding(
padding: EdgeInsets.only(right: 10.w, left: 5.w), padding: EdgeInsets.only(right: 10.w, left: 5.w),
), ),
@ -174,6 +175,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
logic.checkNext(state.sureController); logic.checkNext(state.sureController);
}, },
isPwd: true, isPwd: true,
isSuffixIcon: 2,
leftWidget: Padding( leftWidget: Padding(
padding: EdgeInsets.only(right: 10.w, left: 5.w), padding: EdgeInsets.only(right: 10.w, left: 5.w),
), ),
@ -201,17 +203,18 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
), ),
Obx(() => GestureDetector( Obx(() => GestureDetector(
onTap: onTap:
state.phoneOrEmailStrIsOK.value && state.canResend.value state.phoneOrEmailStrIsOK.value && state.canResend.value ? () async {
? () async {
// Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value}); // Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
var result = await Navigator.pushNamed( if(state.pwd.value != state.surePwd.value){
context, Routers.safetyVerificationPage, logic.showToast("密码不一致哦".tr);
return;
}
var result = await Get.toNamed(Routers.safetyVerificationPage,
arguments: { arguments: {
"countryCode": state.countryCode, "countryCode": state.countryCode,
"account": state.phoneOrEmailStr.value "account": state.phoneOrEmailStr.value
}); });
state.xWidth.value = state.xWidth.value = (result as Map<String, dynamic>)['xWidth'];
(result as Map<String, dynamic>)['xWidth'];
logic.sendValidationCode(); logic.sendValidationCode();
} }
: null, : null,

View File

@ -50,7 +50,8 @@ class AddICCardLogic extends BaseGetXController{
switch(status){ switch(status){
case 0x00: case 0x00:
// //
state.cardNumber.value = reply.data.last.toString(); var cardNumber = listChangInt(reply.data.sublist(9, 11)).toString();
state.cardNumber.value = cardNumber.toString();
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
state.ifConnectScuess.value = true; state.ifConnectScuess.value = true;
break; break;

View File

@ -161,20 +161,20 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
}, },
child: Stack( child: Stack(
children: [ children: [
timelineData.imagesUrl != null timelineData.imagesUrl!.isNotEmpty
? ?
// Image.network( Image.network(
// timelineData.imagesUrl!, timelineData.imagesUrl!,
// width: 260.w, width: 260.w,
// height: 260.h, height: 260.h,
// ) )
Image( // Image(
image: const AssetImage( // image: const AssetImage(
'images/main/icon_lockDetail_monitoringvoiceFrist.png'), // 'images/main/icon_lockDetail_monitoringvoiceFrist.png'),
width: 240.w, // width: 240.w,
height: 180.h, // height: 180.h,
fit: BoxFit.contain, // fit: BoxFit.contain,
) // )
: Container(), : Container(),
Positioned( Positioned(
top: 150.h, top: 150.h,

View File

@ -132,10 +132,12 @@ class AddFaceLogic extends BaseGetXController {
switch (status) { switch (status) {
case 0x00: case 0x00:
// //
if (state.faceNumber.value == (reply.data[6]).toString()) { var faceNumber = listChangInt(reply.data.sublist(6, 7)).toString();
// if (state.faceNumber.value == (reply.data[6]).toString()) {
if (state.faceNumber.value == faceNumber) {
return; return;
} else { } else {
state.faceNumber.value = (reply.data[6]).toString(); state.faceNumber.value = faceNumber;
} }
addFaceData(); addFaceData();
break; break;

View File

@ -27,7 +27,7 @@ class AddFingerprintLogic extends BaseGetXController {
void _initReplySubscription() { void _initReplySubscription() {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async { _replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
// //
if(reply is SenderAddFingerprintWithTimeCycleCoercionReply) { if((reply is SenderAddFingerprintWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
_replyAddFingerprintBegin(reply); _replyAddFingerprintBegin(reply);
} }
@ -153,17 +153,17 @@ class AddFingerprintLogic extends BaseGetXController {
Future<void> _replyAddFingerprintConfirmation(Reply reply) async { Future<void> _replyAddFingerprintConfirmation(Reply reply) async {
int status = reply.data[2]; int status = reply.data[2];
switch(status){ switch(status){
case 0x00: case 0x00:
// //
if(state.fingerprintNumber.value == (reply.data[6]).toString()){ var fingerprintNum = listChangInt(reply.data.sublist(9, 11)).toString();
if(state.fingerprintNumber.value == fingerprintNum){
return; return;
}else{ }else{
state.fingerprintNumber.value = (reply.data[6]).toString(); state.fingerprintNumber.value = fingerprintNum;
} }
// if(state.isCoerced.value == "1"){ // if(state.isCoerced.value == "1"){
// //
addFingerprintsData(); addFingerprintsData();
// }else{ // }else{
// // // //

View File

@ -432,9 +432,12 @@ class LockDetailLogic extends BaseGetXController {
AppLog.log("从服务器获取联网token:${state.lockNetToken}"); AppLog.log("从服务器获取联网token:${state.lockNetToken}");
openDoorAction(); openDoorAction();
}else{ }else{
showToast("", something: (){ showToast("网络访问失败,请检查网络是否正常".tr, something: (){
state.openLockBtnState.value = 0; state.openLockBtnState.value = 0;
state.animationController!.forward();
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
state.lockNetToken = "0";
openDoorAction();
}); });
} }
} }

View File

@ -13,7 +13,7 @@ class LockDetailState {
late StreamSubscription<Reply> replySubscription; late StreamSubscription<Reply> replySubscription;
StreamSubscription? lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent; StreamSubscription? lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent;
String lockNetToken = ""; String lockNetToken = "0";
int differentialTime = 0; int differentialTime = 0;
int lockUserNo = 0; int lockUserNo = 0;
var senderUserId = 0; var senderUserId = 0;

View File

@ -48,7 +48,7 @@ class _EditLockNamePageState extends State<EditLockNamePage> {
leftWidget: const SizedBox(), leftWidget: const SizedBox(),
hintText: "请输入名称".tr, hintText: "请输入名称".tr,
isHaveLeftWidget: true, isHaveLeftWidget: true,
isSuffixIcon: true, isSuffixIcon: 1,
inputFormatters: [ inputFormatters: [
LengthLimitingTextInputFormatter(50), LengthLimitingTextInputFormatter(50),
]), ]),

View File

@ -4,6 +4,7 @@ import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/eventBusEventManage.dart'; import 'package:star_lock/tools/eventBusEventManage.dart';
@ -205,23 +206,26 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
void _initReplySubscription() { void _initReplySubscription() {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async { _replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
// //
if (reply is SenderCustomPasswordsReply) { if ((reply is SenderCustomPasswordsReply) && (state.ifCurrentScreen.value == true)) {
var token = reply.data.sublist(5, 9);
var saveStrList = changeIntListToStringList(token);
Storage.setStringList(saveBlueToken, saveStrList);
int status = reply.data[2]; int status = reply.data[2];
switch (status) { switch (status) {
case 0x00: case 0x00:
// //
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
state.pwdNumber.value = (reply.data[9]); state.pwdNumber.value = listChangInt(reply.data.sublist(9, 11));
// AppLog.log("密码编号:${state.pwdNumber.value}");
dismissEasyLoading(); dismissEasyLoading();
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
addKeyboardPwdRequest(); addKeyboardPwdRequest();
break; break;
case 0x06: case 0x06:
// //
var token = reply.data.sublist(5, 9);
// AppLog.log("token:$token");
var saveStrList = changeIntListToStringList(token);
Storage.setStringList(saveBlueToken, saveStrList);
var privateKey = await Storage.getStringList(saveBluePrivateKey); var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);

View File

@ -11,7 +11,7 @@ import 'package:star_lock/app_settings/app_colors.dart';
typedef BlockStrCallback = void Function(dynamic textStr); typedef BlockStrCallback = void Function(dynamic textStr);
typedef BlockClickCallback = void Function(); typedef BlockClickCallback = void Function();
class LoginInput extends StatelessWidget { class LoginInput extends StatefulWidget {
TextEditingController? controller; TextEditingController? controller;
FocusNode? focusNode; FocusNode? focusNode;
List<TextInputFormatter>? inputFormatters; List<TextInputFormatter>? inputFormatters;
@ -22,7 +22,7 @@ class LoginInput extends StatelessWidget {
Widget? leftWidget; Widget? leftWidget;
String? label; String? label;
bool? isPwd; bool? isPwd;
bool? isSuffixIcon; int? isSuffixIcon;
Widget? rightSlot; Widget? rightSlot;
BlockStrCallback? onchangeAction; BlockStrCallback? onchangeAction;
BlockClickCallback? onTapAction; BlockClickCallback? onTapAction;
@ -46,6 +46,11 @@ class LoginInput extends StatelessWidget {
}) })
: super(key: key); : super(key: key);
@override
State<LoginInput> createState() => _LoginInputState();
}
class _LoginInputState extends State<LoginInput> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
@ -54,37 +59,48 @@ class LoginInput extends StatelessWidget {
TextField( TextField(
// //
maxLines: 1, maxLines: 1,
controller: controller, controller: widget.controller,
focusNode: focusNode, focusNode: widget.focusNode,
onChanged: onchangeAction, onChanged: widget.onchangeAction,
onTap: onTapAction, onTap: widget.onTapAction,
autofocus: false, autofocus: false,
inputFormatters: inputFormatters, inputFormatters: widget.inputFormatters,
decoration: InputDecoration( decoration: InputDecoration(
// //
contentPadding: const EdgeInsets.only( contentPadding: const EdgeInsets.only(
top: 8.0, left: -19.0, right: -15.0, bottom: 8.0), top: 8.0, left: -19.0, right: -15.0, bottom: 8.0),
labelText: label, labelText: widget.label,
labelStyle: TextStyle(fontSize: 22.sp,color: AppColors.darkGrayTextColor), labelStyle: TextStyle(fontSize: 22.sp,color: AppColors.darkGrayTextColor),
hintStyle: TextStyle(fontSize: 22.sp), hintStyle: TextStyle(fontSize: 22.sp),
hintText: hintText, hintText: widget.hintText,
//线 //线
border: InputBorder.none, border: InputBorder.none,
suffixIcon: (isSuffixIcon ?? false) suffixIcon: (widget.isSuffixIcon == 1)
? IconButton( ? IconButton(
icon: const Icon(Icons.clear), icon: const Icon(Icons.clear),
onPressed: controller!.clear, onPressed: widget.controller!.clear,
) )
: null, : (widget.isSuffixIcon == 2 ? IconButton(
icon: Icon(
// _obscureText
widget.isPwd! ? Icons.visibility_off : Icons.visibility,
),
onPressed: () {
// _obscureText
setState(() {
widget.isPwd = !widget.isPwd!;
});
},
):null),
// //
icon: isHaveLeftWidget == true icon: widget.isHaveLeftWidget == true
? leftWidget ? widget.leftWidget
: SizedBox( : SizedBox(
width: 20.w, width: 20.w,
height: 40.w, height: 40.w,
), ),
), ),
obscureText: isPwd ?? false, obscureText: widget.isPwd ?? false,
), ),
Container( Container(
height: 0.5.h, height: 0.5.h,