1、修复登录注册问题,统一添加隐藏显示密码按钮
2、部分协议Nember 1个字节修改2字节 3、修复无网络开锁获取token异常情况
This commit is contained in:
parent
b26602e844
commit
08de8f1fdf
@ -789,5 +789,6 @@
|
||||
"文件校验失败 0x03": "File verification failed 0x03",
|
||||
"固件升级完成": "Firmware upgrade completed",
|
||||
"记录":"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",
|
||||
}
|
||||
|
||||
@ -707,6 +707,7 @@
|
||||
"型号": "型号",
|
||||
"密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。密码激活后,有效期内不限次数使用。": "密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。密码激活后,有效期内不限次数使用。",
|
||||
"密码生成后,请在当日23:59前使用,否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。":"密码生成后,请在当日23:59前使用,否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。",
|
||||
"密码不一致哦":"密码不一致哦",
|
||||
|
||||
"相机": "相机",
|
||||
"相册": "相册",
|
||||
|
||||
@ -709,6 +709,7 @@
|
||||
"型号": "型号",
|
||||
"密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。密码激活后,有效期内不限次数使用。": "密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。密码激活后,有效期内不限次数使用。",
|
||||
"密码生成后,请在当日23:59前使用,否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。":"密码生成后,请在当日23:59前使用,否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。",
|
||||
"密码不一致哦":"密码不一致哦",
|
||||
|
||||
"相机": "相机",
|
||||
"相册": "相册",
|
||||
|
||||
@ -57,12 +57,13 @@ class SenderAddFaceCommand extends SenderProtocol {
|
||||
List<int> ebcData = [];
|
||||
|
||||
// 指令类型
|
||||
int type = commandType!.typeValue;
|
||||
double typeDouble = type / 256;
|
||||
int type1 = typeDouble.toInt();
|
||||
int type2 = type % 256;
|
||||
data.add(type1);
|
||||
data.add(type2);
|
||||
// int type = commandType!.typeValue;
|
||||
// double typeDouble = type / 256;
|
||||
// int type1 = typeDouble.toInt();
|
||||
// int type2 = type % 256;
|
||||
// data.add(type1);
|
||||
// data.add(type2);
|
||||
data.addAll(intChangList(commandType!.typeValue));
|
||||
|
||||
// 子命令类型
|
||||
data.add(81);
|
||||
@ -77,11 +78,12 @@ class SenderAddFaceCommand extends SenderProtocol {
|
||||
subData.addAll(utf8.encode(userID!));
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
// fingerNo
|
||||
subData.add(faceNo!);
|
||||
// faceNo
|
||||
subData.addAll(intChangList(faceNo!));
|
||||
AppLog.log("faceNo:$faceNo intChangList(faceNo!):${intChangList(faceNo!)}");
|
||||
|
||||
// UseCountLimit
|
||||
subData.add(useCountLimit!);
|
||||
subData.addAll(intChangList(useCountLimit!));
|
||||
|
||||
// isForce
|
||||
subData.add(isForce!);
|
||||
|
||||
@ -57,12 +57,13 @@ class SenderAddFingerprintWithTimeCycleCoercionCommand extends SenderProtocol {
|
||||
List<int> ebcData = [];
|
||||
|
||||
// 指令类型
|
||||
int type = commandType!.typeValue;
|
||||
double typeDouble = type / 256;
|
||||
int type1 = typeDouble.toInt();
|
||||
int type2 = type % 256;
|
||||
data.add(type1);
|
||||
data.add(type2);
|
||||
// int type = commandType!.typeValue;
|
||||
// double typeDouble = type / 256;
|
||||
// int type1 = typeDouble.toInt();
|
||||
// int type2 = type % 256;
|
||||
// data.add(type1);
|
||||
// data.add(type2);
|
||||
data.addAll(intChangList(commandType!.typeValue));
|
||||
|
||||
// 子命令类型
|
||||
data.add(36);
|
||||
@ -78,10 +79,11 @@ class SenderAddFingerprintWithTimeCycleCoercionCommand extends SenderProtocol {
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
// fingerNo
|
||||
subData.add(fingerNo!);
|
||||
subData.addAll(intChangList(fingerNo!));
|
||||
AppLog.log("fingerNo:$fingerNo intChangList(fingerNo!):${intChangList(fingerNo!)}");
|
||||
|
||||
// UseCountLimit
|
||||
subData.add(useCountLimit!);
|
||||
subData.addAll(intChangList(useCountLimit!));
|
||||
|
||||
// isForce
|
||||
subData.add(isForce!);
|
||||
|
||||
@ -57,12 +57,13 @@ class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol {
|
||||
List<int> ebcData = [];
|
||||
|
||||
// 指令类型
|
||||
int type = commandType!.typeValue;
|
||||
double typeDouble = type / 256;
|
||||
int type1 = typeDouble.toInt();
|
||||
int type2 = type % 256;
|
||||
data.add(type1);
|
||||
data.add(type2);
|
||||
// int type = commandType!.typeValue;
|
||||
// double typeDouble = type / 256;
|
||||
// int type1 = typeDouble.toInt();
|
||||
// int type2 = type % 256;
|
||||
// data.add(type1);
|
||||
// data.add(type2);
|
||||
data.addAll(intChangList(commandType!.typeValue));
|
||||
|
||||
// 子命令类型
|
||||
data.add(24);
|
||||
@ -77,11 +78,12 @@ class SenderAddICCardWithTimeCycleCoercionCommand extends SenderProtocol {
|
||||
subData.addAll(utf8.encode(userID!));
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
// fingerNo
|
||||
subData.add(cardNo!);
|
||||
// cardNo
|
||||
subData.addAll(intChangList(cardNo!));
|
||||
AppLog.log("cardNo:$cardNo intChangList(cardNo!):${intChangList(cardNo!)}");
|
||||
|
||||
// UseCountLimit
|
||||
subData.add(useCountLimit!);
|
||||
subData.addAll(intChangList(useCountLimit!));
|
||||
|
||||
// isForce
|
||||
subData.add(isForce!);
|
||||
|
||||
@ -45,12 +45,13 @@ class ChangeAdministratorPasswordCommand extends SenderProtocol {
|
||||
List<int> ebcData = [];
|
||||
|
||||
// 指令类型
|
||||
int type = commandType!.typeValue;
|
||||
double typeDouble = type / 256;
|
||||
int type1 = typeDouble.toInt();
|
||||
int type2 = type % 256;
|
||||
data.add(type1);
|
||||
data.add(type2);
|
||||
// int type = commandType!.typeValue;
|
||||
// double typeDouble = type / 256;
|
||||
// int type1 = typeDouble.toInt();
|
||||
// int type2 = type % 256;
|
||||
// data.add(type1);
|
||||
// data.add(type2);
|
||||
data.addAll(intChangList(commandType!.typeValue));
|
||||
|
||||
// 子命令类型
|
||||
data.add(2);
|
||||
@ -66,7 +67,8 @@ class ChangeAdministratorPasswordCommand extends SenderProtocol {
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
// PwdNo
|
||||
subData.add(1);
|
||||
subData.addAll(intChangList(pwdNo!));
|
||||
AppLog.log("pwdNo:$pwdNo");
|
||||
|
||||
// pwd 20
|
||||
int pwdLength = utf8.encode(pwd!).length;
|
||||
@ -74,7 +76,7 @@ class ChangeAdministratorPasswordCommand extends SenderProtocol {
|
||||
subData = getFixedLengthList(subData, 20 - pwdLength);
|
||||
|
||||
// UseCountLimit
|
||||
subData.add(0xff);
|
||||
subData.addAll(intChangList(useCountLimit!));
|
||||
|
||||
// token
|
||||
subData.addAll(token!);
|
||||
|
||||
@ -50,12 +50,13 @@ class SenderCustomPasswordsCommand extends SenderProtocol {
|
||||
List<int> ebcData = [];
|
||||
|
||||
// 指令类型
|
||||
int type = commandType!.typeValue;
|
||||
double typeDouble = type / 256;
|
||||
int type1 = typeDouble.toInt();
|
||||
int type2 = type % 256;
|
||||
data.add(type1);
|
||||
data.add(type2);
|
||||
// int type = commandType!.typeValue;
|
||||
// double typeDouble = type / 256;
|
||||
// int type1 = typeDouble.toInt();
|
||||
// int type2 = type % 256;
|
||||
// data.add(type1);
|
||||
// data.add(type2);
|
||||
data.addAll(intChangList(commandType!.typeValue));
|
||||
|
||||
// 子命令类型
|
||||
data.add(3);
|
||||
@ -71,7 +72,7 @@ class SenderCustomPasswordsCommand extends SenderProtocol {
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
// PwdNo
|
||||
subData.add(pwdNo!);
|
||||
subData.addAll(intChangList(pwdNo!));
|
||||
AppLog.log("pwdNo:$pwdNo");
|
||||
|
||||
// pwd 20
|
||||
@ -81,7 +82,7 @@ class SenderCustomPasswordsCommand extends SenderProtocol {
|
||||
AppLog.log("pwd:$pwd");
|
||||
|
||||
// UseCountLimit
|
||||
subData.add(useCountLimit!);
|
||||
subData.addAll(intChangList(useCountLimit!));
|
||||
|
||||
// token
|
||||
subData.addAll(token!);
|
||||
|
||||
@ -4,6 +4,21 @@ import 'dart:typed_data';
|
||||
import 'package:crypto/crypto.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> strList = [];
|
||||
for(int i = 0; i<list.length; i++)
|
||||
|
||||
@ -113,6 +113,7 @@ class _StarLockForgetPasswordPageState
|
||||
logic.checkNext(state.pwdController);
|
||||
},
|
||||
isPwd: true,
|
||||
isSuffixIcon: 2,
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
|
||||
@ -140,6 +141,7 @@ class _StarLockForgetPasswordPageState
|
||||
logic.checkNext(state.sureController);
|
||||
},
|
||||
isPwd: true,
|
||||
isSuffixIcon: 2,
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
|
||||
|
||||
@ -98,6 +98,7 @@ class _StarLockForgetPasswordPageState
|
||||
logic.checkNext(state.pwdController);
|
||||
},
|
||||
isPwd: true,
|
||||
isSuffixIcon: 2,
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
|
||||
@ -118,6 +119,7 @@ class _StarLockForgetPasswordPageState
|
||||
logic.checkNext(state.sureController);
|
||||
},
|
||||
isPwd: true,
|
||||
isSuffixIcon: 2,
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
|
||||
|
||||
@ -112,6 +112,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
logic.checkNext(state.pwdController);
|
||||
},
|
||||
isPwd: true,
|
||||
isSuffixIcon: 2,
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
|
||||
|
||||
@ -106,6 +106,7 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
|
||||
logic.checkNext(state.pwdController);
|
||||
},
|
||||
isPwd: true,
|
||||
isSuffixIcon: 2,
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 30.w,
|
||||
|
||||
@ -2,6 +2,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
|
||||
import '../../network/api_repository.dart';
|
||||
import '../../tools/baseGetXController.dart';
|
||||
@ -29,6 +30,11 @@ class StarLockRegisterLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
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(
|
||||
receiverType: state.isIphoneType.value == true ? 1 : 2,
|
||||
countryCode: int.parse(state.countryCode.value),
|
||||
|
||||
@ -226,6 +226,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
logic.checkNext(state.pwdController);
|
||||
},
|
||||
isPwd: true,
|
||||
isSuffixIcon: 2,
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(right: 10.w, left: 5.w),
|
||||
child: Image.asset(
|
||||
@ -252,6 +253,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
logic.checkNext(state.sureController);
|
||||
},
|
||||
isPwd: true,
|
||||
isSuffixIcon: 2,
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(right: 10.w, left: 5.w),
|
||||
child: Image.asset(
|
||||
|
||||
@ -25,7 +25,7 @@ class StarLockRegisterState {
|
||||
|
||||
bool get isEmail => RegexUtil.isEmail(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;
|
||||
|
||||
var canResend = false.obs;
|
||||
|
||||
@ -155,6 +155,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
|
||||
logic.checkNext(state.pwdController);
|
||||
},
|
||||
isPwd: true,
|
||||
isSuffixIcon: 2,
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(right: 10.w, left: 5.w),
|
||||
),
|
||||
@ -174,6 +175,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
|
||||
logic.checkNext(state.sureController);
|
||||
},
|
||||
isPwd: true,
|
||||
isSuffixIcon: 2,
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(right: 10.w, left: 5.w),
|
||||
),
|
||||
@ -201,17 +203,18 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
|
||||
),
|
||||
Obx(() => GestureDetector(
|
||||
onTap:
|
||||
state.phoneOrEmailStrIsOK.value && state.canResend.value
|
||||
? () async {
|
||||
state.phoneOrEmailStrIsOK.value && state.canResend.value ? () async {
|
||||
// Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
|
||||
var result = await Navigator.pushNamed(
|
||||
context, Routers.safetyVerificationPage,
|
||||
if(state.pwd.value != state.surePwd.value){
|
||||
logic.showToast("密码不一致哦".tr);
|
||||
return;
|
||||
}
|
||||
var result = await Get.toNamed(Routers.safetyVerificationPage,
|
||||
arguments: {
|
||||
"countryCode": state.countryCode,
|
||||
"account": state.phoneOrEmailStr.value
|
||||
});
|
||||
state.xWidth.value =
|
||||
(result as Map<String, dynamic>)['xWidth'];
|
||||
state.xWidth.value = (result as Map<String, dynamic>)['xWidth'];
|
||||
logic.sendValidationCode();
|
||||
}
|
||||
: null,
|
||||
|
||||
@ -50,7 +50,8 @@ class AddICCardLogic extends BaseGetXController{
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
state.cardNumber.value = reply.data.last.toString();
|
||||
var cardNumber = listChangInt(reply.data.sublist(9, 11)).toString();
|
||||
state.cardNumber.value = cardNumber.toString();
|
||||
cancelBlueConnetctToastTimer();
|
||||
state.ifConnectScuess.value = true;
|
||||
break;
|
||||
|
||||
@ -161,20 +161,20 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
timelineData.imagesUrl != null
|
||||
timelineData.imagesUrl!.isNotEmpty
|
||||
?
|
||||
// Image.network(
|
||||
// timelineData.imagesUrl!,
|
||||
// width: 260.w,
|
||||
// height: 260.h,
|
||||
// )
|
||||
Image(
|
||||
image: const AssetImage(
|
||||
'images/main/icon_lockDetail_monitoringvoiceFrist.png'),
|
||||
width: 240.w,
|
||||
height: 180.h,
|
||||
fit: BoxFit.contain,
|
||||
)
|
||||
Image.network(
|
||||
timelineData.imagesUrl!,
|
||||
width: 260.w,
|
||||
height: 260.h,
|
||||
)
|
||||
// Image(
|
||||
// image: const AssetImage(
|
||||
// 'images/main/icon_lockDetail_monitoringvoiceFrist.png'),
|
||||
// width: 240.w,
|
||||
// height: 180.h,
|
||||
// fit: BoxFit.contain,
|
||||
// )
|
||||
: Container(),
|
||||
Positioned(
|
||||
top: 150.h,
|
||||
|
||||
@ -132,10 +132,12 @@ class AddFaceLogic extends BaseGetXController {
|
||||
switch (status) {
|
||||
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;
|
||||
} else {
|
||||
state.faceNumber.value = (reply.data[6]).toString();
|
||||
state.faceNumber.value = faceNumber;
|
||||
}
|
||||
addFaceData();
|
||||
break;
|
||||
|
||||
@ -27,7 +27,7 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
void _initReplySubscription() {
|
||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||
// 添加指纹开始
|
||||
if(reply is SenderAddFingerprintWithTimeCycleCoercionReply) {
|
||||
if((reply is SenderAddFingerprintWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
|
||||
_replyAddFingerprintBegin(reply);
|
||||
}
|
||||
|
||||
@ -153,17 +153,17 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
|
||||
Future<void> _replyAddFingerprintConfirmation(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
|
||||
switch(status){
|
||||
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;
|
||||
}else{
|
||||
state.fingerprintNumber.value = (reply.data[6]).toString();
|
||||
state.fingerprintNumber.value = fingerprintNum;
|
||||
}
|
||||
// if(state.isCoerced.value == "1"){
|
||||
// 非胁迫指纹
|
||||
// 调用添加指纹接口
|
||||
addFingerprintsData();
|
||||
// }else{
|
||||
// // 如果是胁迫指纹在 添加完之后以后再调用添加胁迫指纹的
|
||||
|
||||
@ -432,9 +432,12 @@ class LockDetailLogic extends BaseGetXController {
|
||||
AppLog.log("从服务器获取联网token:${state.lockNetToken}");
|
||||
openDoorAction();
|
||||
}else{
|
||||
showToast("", something: (){
|
||||
showToast("网络访问失败,请检查网络是否正常".tr, something: (){
|
||||
state.openLockBtnState.value = 0;
|
||||
state.animationController!.forward();
|
||||
cancelBlueConnetctToastTimer();
|
||||
state.lockNetToken = "0";
|
||||
openDoorAction();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ class LockDetailState {
|
||||
late StreamSubscription<Reply> replySubscription;
|
||||
StreamSubscription? lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent;
|
||||
|
||||
String lockNetToken = "";
|
||||
String lockNetToken = "0";
|
||||
int differentialTime = 0;
|
||||
int lockUserNo = 0;
|
||||
var senderUserId = 0;
|
||||
|
||||
@ -48,7 +48,7 @@ class _EditLockNamePageState extends State<EditLockNamePage> {
|
||||
leftWidget: const SizedBox(),
|
||||
hintText: "请输入名称".tr,
|
||||
isHaveLeftWidget: true,
|
||||
isSuffixIcon: true,
|
||||
isSuffixIcon: 1,
|
||||
inputFormatters: [
|
||||
LengthLimitingTextInputFormatter(50),
|
||||
]),
|
||||
|
||||
@ -4,6 +4,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.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/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||
@ -205,23 +206,26 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
void _initReplySubscription() {
|
||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||
// 设置自定义密码
|
||||
if (reply is SenderCustomPasswordsReply) {
|
||||
var token = reply.data.sublist(5, 9);
|
||||
var saveStrList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
if ((reply is SenderCustomPasswordsReply) && (state.ifCurrentScreen.value == true)) {
|
||||
int status = reply.data[2];
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
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();
|
||||
cancelBlueConnetctToastTimer();
|
||||
addKeyboardPwdRequest();
|
||||
break;
|
||||
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);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ import 'package:star_lock/app_settings/app_colors.dart';
|
||||
typedef BlockStrCallback = void Function(dynamic textStr);
|
||||
typedef BlockClickCallback = void Function();
|
||||
|
||||
class LoginInput extends StatelessWidget {
|
||||
class LoginInput extends StatefulWidget {
|
||||
TextEditingController? controller;
|
||||
FocusNode? focusNode;
|
||||
List<TextInputFormatter>? inputFormatters;
|
||||
@ -22,7 +22,7 @@ class LoginInput extends StatelessWidget {
|
||||
Widget? leftWidget;
|
||||
String? label;
|
||||
bool? isPwd;
|
||||
bool? isSuffixIcon;
|
||||
int? isSuffixIcon;
|
||||
Widget? rightSlot;
|
||||
BlockStrCallback? onchangeAction;
|
||||
BlockClickCallback? onTapAction;
|
||||
@ -46,6 +46,11 @@ class LoginInput extends StatelessWidget {
|
||||
})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
State<LoginInput> createState() => _LoginInputState();
|
||||
}
|
||||
|
||||
class _LoginInputState extends State<LoginInput> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
@ -54,37 +59,48 @@ class LoginInput extends StatelessWidget {
|
||||
TextField(
|
||||
//输入框一行
|
||||
maxLines: 1,
|
||||
controller: controller,
|
||||
focusNode: focusNode,
|
||||
onChanged: onchangeAction,
|
||||
onTap: onTapAction,
|
||||
controller: widget.controller,
|
||||
focusNode: widget.focusNode,
|
||||
onChanged: widget.onchangeAction,
|
||||
onTap: widget.onTapAction,
|
||||
autofocus: false,
|
||||
inputFormatters: inputFormatters,
|
||||
inputFormatters: widget.inputFormatters,
|
||||
decoration: InputDecoration(
|
||||
//输入里面输入文字内边距设置
|
||||
contentPadding: const EdgeInsets.only(
|
||||
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),
|
||||
hintStyle: TextStyle(fontSize: 22.sp),
|
||||
hintText: hintText,
|
||||
hintText: widget.hintText,
|
||||
//不需要输入框下划线
|
||||
border: InputBorder.none,
|
||||
suffixIcon: (isSuffixIcon ?? false)
|
||||
suffixIcon: (widget.isSuffixIcon == 1)
|
||||
? IconButton(
|
||||
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
|
||||
? leftWidget
|
||||
icon: widget.isHaveLeftWidget == true
|
||||
? widget.leftWidget
|
||||
: SizedBox(
|
||||
width: 20.w,
|
||||
height: 40.w,
|
||||
),
|
||||
),
|
||||
obscureText: isPwd ?? false,
|
||||
obscureText: widget.isPwd ?? false,
|
||||
),
|
||||
Container(
|
||||
height: 0.5.h,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user