Flutter autofillHints 显示密码
Flutter autofillHints reveal password
问题如下
我实现了对登录字段的自动填充。该函数在 android 和 iOS 上运行良好。然而,事实证明,Pixel 4 phone 上的密码提示并不模糊。
有谁知道如何解决这个问题?
[Pixel 4 屏幕截图][1]
更新,代码如下:
AutofillGroup(
child: Column(
children: [
TextFormField(
autofillHints: [widget.signUpMode ? AutofillHints.newUsername : AutofillHints.username],
keyboardType: TextInputType.emailAddress,
autovalidateMode: AutovalidateMode.onUserInteraction,
validator: (String? value) {
if (value!.isEmpty) {
return S.of(context).formFieldValueRequiredLabel;
}
return null;
},
),
const SizedBox(height: 12),
if (widget.passwordController != null) ...[
TextFormField(
focusNode: passwordFocusNode,
autofillHints: [widget.signUpMode ? AutofillHints.newPassword : AutofillHints.password],
controller: widget.passwordController,
maxLength: 60,
obscureText: obscureText,
textAlign: TextAlign.center,
decoration: AppTheme.formFieldDecoration(),
style: AppTheme.formFieldStyleText,
keyboardType: TextInputType.text,
autovalidateMode: AutovalidateMode.onUserInteraction,
validator: (String? value) {
if (value!.isEmpty) {
return S.of(context).formFieldValueRequiredLabel;
}
return null;
},
)
],
],
),
)
您是否试过禁用对文本表单字段的建议,如下所示
TextFormField(
obscureText: true,
enableSuggestions: false, // add this line
)
问题如下
我实现了对登录字段的自动填充。该函数在 android 和 iOS 上运行良好。然而,事实证明,Pixel 4 phone 上的密码提示并不模糊。 有谁知道如何解决这个问题?
[Pixel 4 屏幕截图][1]
更新,代码如下:
AutofillGroup(
child: Column(
children: [
TextFormField(
autofillHints: [widget.signUpMode ? AutofillHints.newUsername : AutofillHints.username],
keyboardType: TextInputType.emailAddress,
autovalidateMode: AutovalidateMode.onUserInteraction,
validator: (String? value) {
if (value!.isEmpty) {
return S.of(context).formFieldValueRequiredLabel;
}
return null;
},
),
const SizedBox(height: 12),
if (widget.passwordController != null) ...[
TextFormField(
focusNode: passwordFocusNode,
autofillHints: [widget.signUpMode ? AutofillHints.newPassword : AutofillHints.password],
controller: widget.passwordController,
maxLength: 60,
obscureText: obscureText,
textAlign: TextAlign.center,
decoration: AppTheme.formFieldDecoration(),
style: AppTheme.formFieldStyleText,
keyboardType: TextInputType.text,
autovalidateMode: AutovalidateMode.onUserInteraction,
validator: (String? value) {
if (value!.isEmpty) {
return S.of(context).formFieldValueRequiredLabel;
}
return null;
},
)
],
],
),
)
您是否试过禁用对文本表单字段的建议,如下所示
TextFormField(
obscureText: true,
enableSuggestions: false, // add this line
)