fix:回滚输入框改动
This commit is contained in:
parent
9f43b3e7c1
commit
3f022ed878
@ -28,7 +28,7 @@ class LoginInput extends StatefulWidget {
|
|||||||
BlockStrCallback? onchangeAction;
|
BlockStrCallback? onchangeAction;
|
||||||
BlockStrCallback? onSubmitted;
|
BlockStrCallback? onSubmitted;
|
||||||
BlockClickCallback? onTapAction;
|
BlockClickCallback? onTapAction;
|
||||||
bool? isLogin; // 是否是登录之前,因为登录之前的密码框文字显示缩在左上角 默认是false
|
bool? isLogin;// 是否是登录之前,因为登录之前的密码框文字显示缩在左上角 默认是false
|
||||||
|
|
||||||
LoginInput({
|
LoginInput({
|
||||||
Key? key,
|
Key? key,
|
||||||
@ -93,17 +93,20 @@ class _LoginInputState extends State<LoginInput> {
|
|||||||
onTap: widget.onTapAction,
|
onTap: widget.onTapAction,
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
inputFormatters: widget.inputFormatters,
|
inputFormatters: widget.inputFormatters,
|
||||||
textInputAction: isPwd ? TextInputAction.done : TextInputAction.next,
|
textInputAction: TextInputAction.next,
|
||||||
// 修改键盘类型为密码类型
|
keyboardType: isPwd ? TextInputType.emailAddress : null,
|
||||||
keyboardType: isPwd
|
style: isPwd
|
||||||
? TextInputType.visiblePassword
|
? TextStyle(
|
||||||
: TextInputType.emailAddress,
|
fontSize: 22.sp,
|
||||||
// 添加密码隐藏属性
|
color: Colors.transparent,
|
||||||
obscureText: isPwd,
|
letterSpacing: 2.5,
|
||||||
|
fontFamily: 'Monospace',
|
||||||
|
)
|
||||||
|
: null,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
//输入里面输入文字内边距设置
|
//输入里面输入文字内边距设置
|
||||||
// contentPadding: const EdgeInsets.only(
|
contentPadding: const EdgeInsets.only(
|
||||||
// top: 8.0, right: -10.0, bottom: 8.0),
|
top: 8.0, right: -10.0, bottom: 8.0),
|
||||||
labelText: widget.label,
|
labelText: widget.label,
|
||||||
labelStyle: TextStyle(
|
labelStyle: TextStyle(
|
||||||
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||||
@ -113,12 +116,26 @@ class _LoginInputState extends State<LoginInput> {
|
|||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
suffixIcon: (widget.isSuffixIcon ?? false)
|
suffixIcon: (widget.isSuffixIcon ?? false)
|
||||||
? IconButton(
|
? IconButton(
|
||||||
icon: const Icon(Icons.clear),
|
icon: const Icon(Icons.clear),
|
||||||
onPressed: widget.controller!.clear,
|
onPressed: widget.controller!.clear,
|
||||||
)
|
)
|
||||||
: null,
|
: 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',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -146,24 +163,24 @@ class _LoginInputState extends State<LoginInput> {
|
|||||||
top: 8.0, left: -10.0, right: -10.0, bottom: 8.0),
|
top: 8.0, left: -10.0, right: -10.0, bottom: 8.0),
|
||||||
labelText: widget.label,
|
labelText: widget.label,
|
||||||
labelStyle:
|
labelStyle:
|
||||||
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||||
hintStyle: TextStyle(fontSize: 22.sp),
|
hintStyle: TextStyle(fontSize: 22.sp),
|
||||||
hintText: widget.hintText,
|
hintText: widget.hintText,
|
||||||
//不需要输入框下划线
|
//不需要输入框下划线
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
suffixIcon: (widget.isSuffixIcon ?? false)
|
suffixIcon: (widget.isSuffixIcon ?? false)
|
||||||
? IconButton(
|
? IconButton(
|
||||||
icon: const Icon(Icons.clear),
|
icon: const Icon(Icons.clear),
|
||||||
onPressed: widget.controller!.clear,
|
onPressed: widget.controller!.clear,
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
//左边图标设置
|
//左边图标设置
|
||||||
icon: widget.isHaveLeftWidget == true
|
icon: widget.isHaveLeftWidget == true
|
||||||
? widget.leftWidget
|
? widget.leftWidget
|
||||||
: SizedBox(
|
: SizedBox(
|
||||||
width: 20.w,
|
width: 20.w,
|
||||||
height: 40.w,
|
height: 40.w,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
obscureText: widget.isPwd ?? false,
|
obscureText: widget.isPwd ?? false,
|
||||||
),
|
),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user