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', - ), - ), - ), ], ), ),