Search code examples
iosflutterdartmobileipados

TextField's do not fill from autofill suggestion


When I'm on the login form, I get an account suggestion to autocomplete. But when I select it, the Textfields are not filled. Strangely, when I go to the passwords menu and select the same account that was suggested, it works.

I've already tested it on iPad (iPadOS 17.5.1) and iPhone (iOS 17.5.1), and the behavior is the same.

enter image description here

Code

return const Scaffold(
  body: Center(
    child: AutofillGroup(
      child: SizedBox(
        width: 350,
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            TextField(
              autofillHints: [AutofillHints.username],
              decoration: InputDecoration(hintText: "Username"),
            ),
            TextField(
              obscureText: true,
              autofillHints: [AutofillHints.password],
              decoration: InputDecoration(hintText: "Password"),
            ),
            ElevatedButton(
              onPressed: TextInput.finishAutofillContext,
              child: Text("Log In")
            )
          ],
        ),
      )
    ),
  ),
);

Solution

  • This issue was fixed in flutter version 3.24.0. Source: https://github.com/flutter/flutter/issues/148475