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? onSubmitted;
BlockClickCallback? onTapAction;
bool? isLogin; // false
bool? isLogin;// false
LoginInput({
Key? key,
@ -93,17 +93,20 @@ class _LoginInputState extends State<LoginInput> {
onTap: widget.onTapAction,
autofocus: false,
inputFormatters: widget.inputFormatters,
textInputAction: isPwd ? TextInputAction.done : TextInputAction.next,
//
keyboardType: isPwd
? TextInputType.visiblePassword
: TextInputType.emailAddress,
//
obscureText: isPwd,
textInputAction: TextInputAction.next,
keyboardType: isPwd ? TextInputType.emailAddress : null,
style: isPwd
? TextStyle(
fontSize: 22.sp,
color: Colors.transparent,
letterSpacing: 2.5,
fontFamily: 'Monospace',
)
: null,
decoration: InputDecoration(
//
// contentPadding: const EdgeInsets.only(
// top: 8.0, right: -10.0, bottom: 8.0),
contentPadding: const EdgeInsets.only(
top: 8.0, right: -10.0, bottom: 8.0),
labelText: widget.label,
labelStyle: TextStyle(
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
@ -113,12 +116,26 @@ class _LoginInputState extends State<LoginInput> {
border: InputBorder.none,
suffixIcon: (widget.isSuffixIcon ?? false)
? IconButton(
icon: const Icon(Icons.clear),
onPressed: widget.controller!.clear,
)
icon: const Icon(Icons.clear),
onPressed: widget.controller!.clear,
)
: 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),
labelText: widget.label,
labelStyle:
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
hintStyle: TextStyle(fontSize: 22.sp),
hintText: widget.hintText,
//线
border: InputBorder.none,
suffixIcon: (widget.isSuffixIcon ?? false)
? IconButton(
icon: const Icon(Icons.clear),
onPressed: widget.controller!.clear,
)
icon: const Icon(Icons.clear),
onPressed: widget.controller!.clear,
)
: null,
//
icon: widget.isHaveLeftWidget == true
? widget.leftWidget
: SizedBox(
width: 20.w,
height: 40.w,
),
width: 20.w,
height: 40.w,
),
),
obscureText: widget.isPwd ?? false,
),