fix:回滚输入框改动

This commit is contained in:
liyi 2025-04-02 09:32:40 +08:00
parent 9f43b3e7c1
commit 3f022ed878

View File

@ -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,
), ),