From e47a22a53fd231310f71089b119fee53f7f142cc Mon Sep 17 00:00:00 2001 From: "sky.min" Date: Thu, 29 Jan 2026 15:16:04 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=E9=94=81=E7=89=88=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5app=E6=8F=90=E7=A4=BApwd=E9=97=AE=E9=A2=98=202.?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B0=8F=E7=B1=B3=E6=89=8B=E6=9C=BA=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E5=AF=86=E7=A0=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/mine/addLock/saveLock/saveLock_logic.dart | 8 ++++- lib/tools/tf_loginInput.dart | 32 ++++--------------- 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/lib/mine/addLock/saveLock/saveLock_logic.dart b/lib/mine/addLock/saveLock/saveLock_logic.dart index 6e10bf60..17025b2f 100755 --- a/lib/mine/addLock/saveLock/saveLock_logic.dart +++ b/lib/mine/addLock/saveLock/saveLock_logic.dart @@ -54,7 +54,6 @@ class SaveLockLogic extends BaseGetXController { // 新增----m 获取锁管理员密码 Future _replySenderReadAdminPasswordReply(Reply reply) async { - AppLog.log('响应获取管理员密码: ${reply.data}'); var token = reply.data.sublist(5, 9); var saveStrList = changeIntListToStringList(token); Storage.setStringList(saveBlueToken, saveStrList); @@ -153,6 +152,13 @@ class SaveLockLogic extends BaseGetXController { Storage.setStringList(saveBlueToken, strTokenList); final int status = reply.data[46]; + if(state.adminPassword == ''){ + final Random rng = Random(); + final int number = rng.nextInt(900000) + 100000; + state.adminPassword = number.toString(); + } else { + state.role = 1; + } switch (status) { case 0x00: //成功 如果成功保存用户编号 diff --git a/lib/tools/tf_loginInput.dart b/lib/tools/tf_loginInput.dart index f9334d84..de98e1ec 100755 --- a/lib/tools/tf_loginInput.dart +++ b/lib/tools/tf_loginInput.dart @@ -61,7 +61,6 @@ class _LoginInputState extends State { } Widget androidView() { - final TextEditingController _controller = TextEditingController(); bool isPwd = widget.isPwd ?? false; String pwd = (widget.controller?.text ?? '').replaceAll(RegExp(r'.'), '●'); return Container( @@ -86,10 +85,6 @@ class _LoginInputState extends State { controller: widget.controller, focusNode: widget.focusNode, onChanged: (String text) { - _controller.text = text; - _controller.selection = TextSelection.fromPosition( - TextPosition(offset: _controller.text.length), - ); if (widget.onchangeAction != null) { widget.onchangeAction!(text); } @@ -99,15 +94,14 @@ class _LoginInputState extends State { autofocus: false, inputFormatters: widget.inputFormatters, textInputAction: TextInputAction.next, - keyboardType: isPwd ? TextInputType.emailAddress : null, - style: isPwd - ? TextStyle( + keyboardType: isPwd ? TextInputType.visiblePassword : null, + obscureText: isPwd, // 使用系统自带的密码遮盖功能 + style: TextStyle( fontSize: 22.sp, - color: Colors.transparent, - letterSpacing: 2.5, + color: AppColors.darkGrayTextColor, // 不再使用透明色 + letterSpacing: 2.0, fontFamily: 'Monospace', - ) - : null, + ), decoration: InputDecoration( //输入里面输入文字内边距设置 contentPadding: const EdgeInsets.only( @@ -127,20 +121,6 @@ class _LoginInputState extends State { : null, ), ), - if (isPwd) - Padding( - padding: EdgeInsets.only( - top: F.sw(skyCall: () => 27.h, xhjCall: () => widget.isLogin! ? 27.h : 39.h)), - child: Text( - pwd, - style: TextStyle( - fontSize: 22.sp, - color: AppColors.darkGrayTextColor, - letterSpacing: 2.0, - fontFamily: 'Monospace', - ), - ), - ), ], ), ),