【问题标题】:Flutter autofillHints reveal passwordFlutter autofillHints 显示密码
【发布时间】:2021-08-06 12:28:37
【问题描述】:

问题如下。

我实现了登录字段的自动填充。该功能在 android 和 iOS 上运行良好。然而,事实证明,Pixel 4 手机上的密码提示并不晦涩难懂。 有谁知道如何解决这个问题?

[像素 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;
            },
          )
        ],
      ],
    ),
  )

【问题讨论】:

  • 添加您的代码..

标签: flutter textfield autofill


【解决方案1】:

您是否尝试过禁用对文本表单字段的建议,如下所示

TextFormField(
        obscureText: true,
        enableSuggestions: false, // add this line
        )

【讨论】:

    猜你喜欢
    • 2021-04-29
    • 1970-01-01
    • 2021-05-05
    • 2017-08-22
    • 1970-01-01
    • 2013-04-23
    • 2018-09-03
    • 2014-12-28
    • 1970-01-01
    相关资源
    最近更新 更多