Merge branch 'master_hyx'

This commit is contained in:
anfe 2024-05-13 15:02:20 +08:00
commit 4b6ae01e9a
12 changed files with 869 additions and 816 deletions

View File

@ -833,5 +833,12 @@
"姓名":"Name",
"发送":"Send",
"请确认姓名全名和身份证号码是否正确":"Please confirm that the full name and ID number are correct",
"传输期间请勿离开当前页面":"Do not leave the current page during transfer"
"传输期间请勿离开当前页面":"Do not leave the current page during transfer",
"机型": "models",
"硬件版本": "Hardware version",
"固件版本": "Firmware version",
"手动升级": "Manual upgrade",
"设备连接中...": "Device Connecting...",
"升级过程中无法开锁,请先开锁后再升级": "The lock cannot be unlocked during the upgrade, please unlock the lock before upgrading",
"钥匙无效": "The key is invalid"
}

View File

@ -861,5 +861,12 @@
"姓名":"姓名",
"发送":"发送",
"请确认姓名全名和身份证号码是否正确":"请确认姓名全名和身份证号码是否正确",
"传输期间请勿离开当前页面":"传输期间请勿离开当前页面"
"传输期间请勿离开当前页面":"传输期间请勿离开当前页面",
"机型": "机型",
"硬件版本": "硬件版本",
"固件版本": "固件版本",
"手动升级": "手动升级",
"设备连接中...": "设备连接中...",
"升级过程中无法开锁,请先开锁后再升级": "升级过程中无法开锁,请先开锁后再升级",
"钥匙无效": "钥匙无效"
}

File diff suppressed because it is too large Load Diff

View File

@ -280,6 +280,17 @@ class BlueManage {
}
}
}
// String listStr = scanDevices
// // .where((element) =>
// // element.advertisementData.advName == 'TMH_dc8f928369ed')
// .map((e) => 'advName:${e.advertisementData.advName} '
// 'serviceUuids:${e.advertisementData.serviceUuids} '
// '是否被重置:${e.advertisementData.serviceUuids[0].toString()[31]}')
// .join(',')
// .toString();
// AppLog.log('--->扫描到的设备 ${listStr} ');
scanDevicesCallBack(scanDevices);
// EventBusManager().eventBusFir(scanDevices);
// FlutterBluePlus.stopScan();
@ -364,7 +375,7 @@ class BlueManage {
(d.device.platformName == deviceName) ||
(d.advertisementData.advName == deviceName));
ScanResult? scanResult;//使
ScanResult? scanResult; //使
if (knownDeviceIndex >= 0) {
//
connectDeviceMacAddress =
@ -381,7 +392,7 @@ class BlueManage {
}
// AppLog.log("1 connectDeviceId:$connectDeviceMacAddress connectDeviceName:$connectDeviceName");
// stopScan();
if (scanResult == null ||connectDeviceMacAddress.isEmpty) {
if (scanResult == null || connectDeviceMacAddress.isEmpty) {
// connectStateCallBack(BluetoothConnectionState.disconnected!);
return;
}

View File

@ -90,7 +90,7 @@ abstract class Reply{
case 0x0e:
//
showErrorMessage("钥匙已存在");
AppLog.log("$logTag ${commandType!.typeName} 0x0e 钥匙无效");
AppLog.log("$logTag ${commandType!.typeName} 0x0e 钥匙已存在");
break;
case 0x0f:
//
@ -124,7 +124,7 @@ abstract class Reply{
break;
case 0xff:
//
AppLog.log("$logTag ${commandType!.typeName} 0xff");
AppLog.log("$logTag ${commandType!.typeName} 0xff 异常,未知错误");
showErrorMessage("异常,未知错误");
break;
default:

View File

@ -47,6 +47,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
logic.checkNext(state.emailOrPhoneController);
state.pwdController.text = data['pwd'];
logic.checkNext(state.pwdController);
setState(() {});
}
},
),

View File

@ -223,6 +223,7 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
logic.checkNext(state.emailOrPhoneController);
state.pwdController.text = data['pwd'];
logic.checkNext(state.pwdController);
setState(() {});
}
},
style: ElevatedButton.styleFrom(

View File

@ -32,7 +32,8 @@ class LockDetailLogic extends BaseGetXController {
//
void initReplySubscription() {
state.replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
state.replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
//
if (reply is OpenDoorReply && state.ifCurrentScreen.value == true) {
_replyOpenLock(reply);
@ -88,7 +89,7 @@ class LockDetailLogic extends BaseGetXController {
state.electricQuantity.value = power;
//
if(state.keyInfos.value.lockFeature!.isSupportBackupBattery == 1){
if (state.keyInfos.value.lockFeature!.isSupportBackupBattery == 1) {
int powerStandby = reply.data[9];
state.electricQuantityStandby.value = powerStandby;
}
@ -123,10 +124,6 @@ class LockDetailLogic extends BaseGetXController {
signKey: signKeyDataList,
privateKey: getPrivateKeyList,
);
break;
case 0x07:
//
break;
case 0x16:
// ...
@ -136,8 +133,20 @@ class LockDetailLogic extends BaseGetXController {
cancelBlueConnetctToastTimer();
});
break;
case 0x0d:
// ...
showToast('钥匙无效'.tr);
state.openLockBtnState.value = 0;
state.openDoorBtnisUneable.value = false;
state.animationController!.stop();
cancelBlueConnetctToastTimer();
break;
default:
//
state.openLockBtnState.value = 0;
state.openDoorBtnisUneable.value = false;
state.animationController!.stop();
cancelBlueConnetctToastTimer();
break;
}
}
@ -173,7 +182,7 @@ class LockDetailLogic extends BaseGetXController {
if (dataLength > 0) {
reply.data.removeRange(0, 7);
// 8
if(reply.data.length < 17){
if (reply.data.length < 17) {
return;
}
var getList = splitList(reply.data, 17);
@ -185,29 +194,29 @@ class LockDetailLogic extends BaseGetXController {
var indexMap = {};
indexMap["type"] = indexList[0].toString();
if(indexList[0] == 2){
if (indexList[0] == 2) {
var passwordData = reply.data.sublist(7, 17);
var password = utf8String(passwordData);
indexMap["user"] = password.toString();
}else{
int userNo = (indexList[1]*255) + indexList[2];
} else {
int userNo = (indexList[1] * 255) + indexList[2];
indexMap["user"] = userNo.toString();
}
indexMap["success"] = "1";
int time = ((0xff & indexList[(3)]) << 24 |
(0xff & indexList[4]) << 16 |
(0xff & indexList[5]) << 8 |
(0xFF & indexList[6]));
(0xff & indexList[4]) << 16 |
(0xff & indexList[5]) << 8 |
(0xFF & indexList[6]));
indexMap["date"] = "${time * 1000}";
uploadList.add(indexMap);
}
lockRecordUploadData(uploadList);
if(dataLength == state.logCountPage){
if (dataLength == state.logCountPage) {
senderReferEventRecordTime();
}else{
} else {
await BlueManage().disconnect();
}
}
@ -351,7 +360,9 @@ class LockDetailLogic extends BaseGetXController {
var token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!);
BlueManage().bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!, (BluetoothConnectionState deviceConnectionState) async {
BlueManage()
.bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
IoSenderManage.senderOpenLock(
keyID: BlueManage().connectDeviceName,
@ -377,13 +388,15 @@ class LockDetailLogic extends BaseGetXController {
});
}
// ()
Future<void> senderReferEventRecordTime() async {
showBlueConnetctToastTimer(isShowBlueConnetctToast: false, action: () {
BlueManage().disconnect();
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
showBlueConnetctToastTimer(
isShowBlueConnetctToast: false,
action: () {
BlueManage().disconnect();
});
BlueManage().bludSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
@ -410,27 +423,30 @@ class LockDetailLogic extends BaseGetXController {
}
//
void getServerDatetime() async{
void getServerDatetime() async {
var entity = await ApiRepository.to.getServerDatetimeData();
if(entity.errorCode!.codeIsSuccessful){
state.differentialTime = entity.data!.date! ~/ 1000 - DateTime.now().millisecondsSinceEpoch ~/ 1000;
if (entity.errorCode!.codeIsSuccessful) {
state.differentialTime = entity.data!.date! ~/ 1000 -
DateTime.now().millisecondsSinceEpoch ~/ 1000;
// AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}");
}
}
int getUTCNetTime(){
return DateTime.now().millisecondsSinceEpoch ~/ 1000 + state.differentialTime;
int getUTCNetTime() {
return DateTime.now().millisecondsSinceEpoch ~/ 1000 +
state.differentialTime;
}
// token
void getLockNetToken() async {
LockNetTokenEntity entity = await ApiRepository.to.getLockNetToken(lockId: state.keyInfos.value.lockId.toString());
LockNetTokenEntity entity = await ApiRepository.to
.getLockNetToken(lockId: state.keyInfos.value.lockId.toString());
if (entity.errorCode!.codeIsSuccessful) {
state.lockNetToken = entity.data!.token!.toString();
AppLog.log("从服务器获取联网token:${state.lockNetToken}");
openDoorAction();
}else{
showToast("网络访问失败,请检查网络是否正常".tr, something: (){
} else {
showToast("网络访问失败,请检查网络是否正常".tr, something: () {
state.openLockBtnState.value = 0;
state.animationController!.forward();
cancelBlueConnetctToastTimer();
@ -442,11 +458,12 @@ class LockDetailLogic extends BaseGetXController {
//
Future<void> uploadElectricQuantityRequest() async {
KeyOperationRecordEntity entity = await ApiRepository.to.uploadElectricQuantity(
electricQuantity:state.electricQuantity.value.toString(),
electricQuantityStandby: state.electricQuantityStandby.value.toString(),
lockId: state.keyInfos.value.lockId.toString()
);
KeyOperationRecordEntity entity = await ApiRepository.to
.uploadElectricQuantity(
electricQuantity: state.electricQuantity.value.toString(),
electricQuantityStandby:
state.electricQuantityStandby.value.toString(),
lockId: state.keyInfos.value.lockId.toString());
if (entity.errorCode!.codeIsSuccessful) {
SchedulerBinding.instance.addPostFrameCallback((_) {
eventBus.fire(RefreshLockListInfoDataEvent());
@ -491,8 +508,9 @@ class LockDetailLogic extends BaseGetXController {
lockId: state.keyInfos.value.lockId.toString(), records: list);
if (entity.errorCode!.codeIsSuccessful) {
// mockNetworkDataRequest();
AppLog.log("state.keyInfos.value.keyType:${state.keyInfos.value.keyType}");
if(state.keyInfos.value.keyType == XSConstantMacro.keyTypeOnce){
AppLog.log(
"state.keyInfos.value.keyType:${state.keyInfos.value.keyType}");
if (state.keyInfos.value.keyType == XSConstantMacro.keyTypeOnce) {
//
deletKeyData();
}
@ -502,9 +520,7 @@ class LockDetailLogic extends BaseGetXController {
//
void deletKeyData() async {
var entity = await ApiRepository.to.deleteElectronicKey(
keyId:state.keyInfos.value.keyId.toString(),
includeUnderlings: 0
);
keyId: state.keyInfos.value.keyId.toString(), includeUnderlings: 0);
if (entity.errorCode!.codeIsSuccessful) {
BlueManage().connectDeviceMacAddress = "";
SchedulerBinding.instance.addPostFrameCallback((_) {
@ -514,21 +530,24 @@ class LockDetailLogic extends BaseGetXController {
}
}
///
void initLockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceAction() {
// eventBus
state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent =
eventBus.on<LockSetChangeSetRefreshLockDetailWithType>().listen((event) {
eventBus
.on<LockSetChangeSetRefreshLockDetailWithType>()
.listen((event) {
if (event.type == 0) {
// 0
state.isAttendance.value = int.parse(event.setResult);
state.keyInfos.value.lockSetting!.attendance = int.parse(event.setResult);
state.keyInfos.value.lockSetting!.attendance =
int.parse(event.setResult);
} else if (event.type == 1) {
// 1
state.isOpenLockNeedOnline.value = int.parse(event.setResult);
state.keyInfos.value.lockSetting!.appUnlockOnline = int.parse(event.setResult);
state.lockNetToken = "";// token
state.keyInfos.value.lockSetting!.appUnlockOnline =
int.parse(event.setResult);
state.lockNetToken = ""; // token
} else if (event.type == 2) {
// 2
state.isOpenPassageMode.value = int.parse(event.setResult);
@ -560,7 +579,8 @@ class LockDetailLogic extends BaseGetXController {
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusExpired ||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusDeleted ||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusReset) {
text = "${"你的钥匙".tr}${XSConstantMacro.getKeyStatusStr(state.keyInfos.value.keyStatus!)}";
text =
"${"你的钥匙".tr}${XSConstantMacro.getKeyStatusStr(state.keyInfos.value.keyStatus!)}";
} else {
text = state.isOpenPassageMode.value == 1
? "常开模式启动!长按闭锁".tr
@ -585,5 +605,4 @@ class LockDetailLogic extends BaseGetXController {
await PermissionDialog.request(Permission.location);
await PermissionDialog.requestBluetooth();
}
}

View File

@ -6,6 +6,7 @@ import 'dart:typed_data';
import 'package:crypto/crypto.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:star_lock/blue/blue_manage.dart';
@ -18,6 +19,7 @@ import 'package:star_lock/blue/sender_manage.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSet_logic.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/commonDataManage.dart';
import 'package:star_lock/tools/showTipView.dart';
import 'package:star_lock/tools/storage.dart';
import 'package:star_lock/widget/permission/permission_dialog.dart';
@ -67,7 +69,15 @@ class LockEscalationLogic extends BaseGetXController {
}
String md5Str = md5.convert(otaBin!).toString();
headJson!['fwMd5'] = md5Str;
blueOTAUpgrade(headJson!, [0, 0, 0, 0]);
ShowTipView().showIosTipWithContentDialog("升级过程中无法开锁,请先开锁后再升级".tr,
() async {
blueOTAUpgrade(headJson!, [0, 0, 0, 0]);
EasyLoading.show(
status: '设备连接中...'.tr, maskType: EasyLoadingMaskType.black);
Future.delayed(const Duration(seconds: 4), () {
EasyLoading.dismiss();
});
});
}
// ota
@ -217,7 +227,7 @@ class LockEscalationLogic extends BaseGetXController {
Uint8List bin = data.sublist(binOffset.toInt(), data.length);
//md5
String md5Str = md5.convert(bin).toString().toUpperCase();
AppLog.log('---> $md5Str ${meta['fwMd5']}');
AppLog.log('固件 md5 检验md5$md5Str 固件信息 md5${meta['fwMd5']}');
if (md5Str != meta['fwMd5']) {
showToast('文件校验失败 0x02'.tr);
return null;

View File

@ -31,136 +31,161 @@ class _LockEscalationPageState extends State<LockEscalationPage> {
),
body: Container(
padding: EdgeInsets.all(30.w),
child: Column(
children: [
Obx(() {
return logic.state.otaUpdateIng.value
? PopScope(
canPop: false,
onPopInvoked: (didPop) async {
if (logic.state.otaUpdateIng.value) {
logic.closeOTADAta();
}
},
child: const SizedBox(),
)
: const SizedBox();
}),
SizedBox(
height: 60.h,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'images/main/icon_main_lockSet_lockEscalation.png',
width: 36.w,
height: 36.w,
),
SizedBox(
width: 10.w,
),
Text(
// TranslationLoader.lanKeys!.haveNewVersion!.tr,
"未发现新版本",
style: TextStyle(
fontSize: 24.sp, fontWeight: FontWeight.w600),
)
],
),
SizedBox(
height: 30.h,
),
Text(
"${TranslationLoader.lanKeys!.currentVersion!.tr}1.0.0",
style: TextStyle(
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
),
SizedBox(
height: 40.h,
),
Obx(() {
return !logic.state.otaUpdateIng.value
? SubmitBtn(
btnName: TranslationLoader.lanKeys!.upgrade!.tr,
onClick: () {})
: SizedBox();
}),
SizedBox(
height: 10.h,
),
Obx(() {
return !logic.state.otaUpdateIng.value
? Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
// Container(
// margin: EdgeInsets.only(top: 8, bottom: 8),
// width: Get.width,
// child: Center(
// child: Text(
// // "${TranslationLoader.lanKeys!.newVersion!.tr}1.0.1",
// "未发现新版本",
// style: TextStyle(
// color: AppColors.mainColor,
// fontSize: 18.sp),
// ),
// ),
// ),
GestureDetector(
onTap: () {
logic.otaUpdate();
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'手动升级',
style: TextStyle(
color: AppColors.mainColor,
fontSize: 18.sp,
fontWeight: FontWeight.w400),
),
),
)
],
)
: Padding(
padding: EdgeInsets.symmetric(
horizontal: 50.w, vertical: 15.h),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'固件传输中',
style: TextStyle(
color: AppColors.mainColor,
fontSize: 18.sp,
fontWeight: FontWeight.w400),
),
SizedBox(
width: 10.w,
),
Expanded(
child: ClipRRect(
borderRadius: BorderRadius.all(
Radius.circular(10.r)),
child: LinearProgressIndicator(
value: logic
.state.otaProgress.value, // 50%
backgroundColor: Colors.grey[200],
valueColor:
AlwaysStoppedAnimation<Color>(
AppColors.mainColor),
),
),
),
],
),
);
}),
],
),
child: Obx(() {
return updateView(logic);
}),
));
});
}
Widget updateView(LockEscalationLogic logic) {
if (logic.state.otaUpdateIng.value) {
return otaUpdate(logic);
}
return defaultUpdate(logic);
}
//
Widget defaultUpdate(LockEscalationLogic logic) {
return Column(
children: [
SizedBox(
height: 60.h,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'images/main/icon_main_lockSet_lockEscalation.png',
width: 36.w,
height: 36.w,
),
SizedBox(
width: 10.w,
),
Text(
// TranslationLoader.lanKeys!.haveNewVersion!.tr,
"未发现新版本",
style: TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600),
)
],
),
SizedBox(
height: 30.h,
),
Text(
"${TranslationLoader.lanKeys!.currentVersion!.tr}1.0.0",
style: TextStyle(fontSize: 18.sp, color: AppColors.darkGrayTextColor),
),
SizedBox(
height: 40.h,
),
Obx(() {
return !logic.state.otaUpdateIng.value
? SubmitBtn(
btnName: TranslationLoader.lanKeys!.upgrade!.tr,
onClick: () {})
: SizedBox();
}),
SizedBox(
height: 10.h,
),
Align(
alignment: Alignment.topRight,
child: GestureDetector(
onTap: () {
logic.otaUpdate();
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'手动升级'.tr,
style: TextStyle(
color: AppColors.mainColor,
fontSize: 18.sp,
fontWeight: FontWeight.w400),
),
),
),
),
],
);
}
//ota升级
Widget otaUpdate(LockEscalationLogic logic) {
return Column(
children: [
SizedBox(
height: 20.h,
),
Text(
'${'机型'.tr}${logic.headJson?['platform']}-${logic.headJson?['product']}',
style: TextStyle(
color: AppColors.blackColor,
fontSize: 22.sp,
fontWeight: FontWeight.w600),
),
SizedBox(
height: 10.h,
),
Text(
'${'硬件版本'.tr}${logic.headJson?['hwVersion']}',
style: TextStyle(
color: AppColors.blackColor,
fontSize: 22.sp,
fontWeight: FontWeight.w600),
),
SizedBox(
height: 10.h,
),
Text(
'${'固件版本'.tr}${logic.headJson?['fwVersion']}',
style: TextStyle(
color: AppColors.blackColor,
fontSize: 22.sp,
fontWeight: FontWeight.w600),
),
SizedBox(
height: 20.h,
),
Text(
'传输期间请勿离开当前页面'.tr,
style: TextStyle(
color: AppColors.blackColor,
fontSize: 20.sp,
fontWeight: FontWeight.w400),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 50.w, vertical: 15.h),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'固件传输中',
style: TextStyle(
color: AppColors.mainColor,
fontSize: 18.sp,
fontWeight: FontWeight.w400),
),
SizedBox(
width: 10.w,
),
Expanded(
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(10.r)),
child: LinearProgressIndicator(
value: logic.state.otaProgress.value, // 50%
backgroundColor: Colors.grey[200],
valueColor:
AlwaysStoppedAnimation<Color>(AppColors.mainColor),
),
),
),
],
),
),
],
);
}
}

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -27,12 +26,17 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(barTitle: TranslationLoader.lanKeys!.addLock!.tr, haveBack:true, backgroundColor: AppColors.mainColor),
appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.addLock!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 80.h,),
SizedBox(
height: 80.h,
),
Container(
margin: EdgeInsets.only(left: 50.w, right: 50.w),
width: 1.sw,
@ -40,22 +44,29 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Flexible(
child: Text(TranslationLoader.lanKeys!.addSuccessfullyPleaseRename!.tr, style: TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w500))
),
child: Text(
TranslationLoader
.lanKeys!.addSuccessfullyPleaseRename!.tr,
style: TextStyle(
fontSize: 24.sp, fontWeight: FontWeight.w500))),
],
),
),
SizedBox(height: 80.h,),
SizedBox(
height: 80.h,
),
Container(
height: 80.h,
// color: Colors.red,
padding: EdgeInsets.only(left: 50.w, right: 50.w),
child: TextField(
controller: state.aliNameController,
onChanged: (v){
focusNode: state.focusNode,
autofocus: true,
controller: state.aliNameController,
onChanged: (v) {
state.aliName.value = v;
},
textAlign:TextAlign.center,
textAlign: TextAlign.center,
inputFormatters: [
LengthLimitingTextInputFormatter(32),
],
@ -63,58 +74,44 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
decoration: InputDecoration(
hintText: '请填写信息'.tr,
hintStyle: TextStyle(
// height: 1.1,
// height: 1.1,
fontSize: 24.sp,
fontWeight: FontWeight.w400,
color: const Color(0xFF999999)
),
color: const Color(0xFF999999)),
border: OutlineInputBorder(
///
borderRadius: BorderRadius.all(Radius.circular(50.h)),
///
borderSide: BorderSide(
///
color: AppColors.mainColor,
///
width: 1,
),
),
///
focusedBorder: OutlineInputBorder(
///
borderRadius: BorderRadius.all(Radius.circular(50.h)),
///
borderSide: BorderSide(
///
color: AppColors.mainColor,
///
width: 1,
),
),
)
),
)),
),
SizedBox(
height: 120.h,
),
SizedBox(height: 120.h,),
SubmitBtn(
btnName: TranslationLoader.lanKeys!.sure!.tr,
borderRadius: 20.w,
margin: EdgeInsets.only(
left: 50.w,
right: 50.w,
// top: 30.w,
// bottom: 30.w
left: 50.w,
right: 50.w,
// top: 30.w,
// bottom: 30.w
),
padding: EdgeInsets.only(
top: 25.w,
bottom: 25.w
),
onClick: (){
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {
logic.addUserConnectBlue();
}
),
}),
],
)
);
));
}
@override
@ -130,6 +127,7 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
void dispose() {
// TODO: implement dispose
///
state.focusNode.unfocus();
AppRouteObserver().routeObserver.unsubscribe(this);
super.dispose();
BlueManage().stopScan();

View File

@ -1,16 +1,15 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../blue/blue_manage.dart';
class SaveLockState {
var aliName = ''.obs;
var pwdTimestamp= 0.obs;
var pwdTimestamp = 0.obs;
var addressInfo = {}.obs;
TextEditingController aliNameController = TextEditingController();
FocusNode focusNode = FocusNode();
var lockUserNo = 0;
var lockInfo = {};
@ -20,15 +19,16 @@ class SaveLockState {
var isFromMap = 0; // 0: 1:
var ifCurrentScreen = true.obs; // ,
var sureBtnState = 0.obs;// 0 1
var sureBtnState = 0.obs; // 0 1
//
var adminPasswordTF = TextEditingController();
var adminPassword = '';
var lockId = 0;
SaveLockState() {
aliName.value = BlueManage().connectDeviceName;
aliName.value = BlueManage().connectDeviceName;
aliNameController.text = aliName.value;
Map map = Get.arguments;
@ -44,4 +44,4 @@ class SaveLockState {
void onClose() {
aliNameController.dispose();
}
}
}