I have created a login form in flutter web, when I login, chrome detects the password that was entered, but offers only to save the password, while the username stays blank.
Google suggests the following HTML form so that credential manager can detect the credentials that needs to be stored.
<form id="signup" method="post">
<input name="email" type="text" autocomplete="username email">
<input name="display-name" type="text" autocomplete="name">
<input name="password" type="password" autocomplete="new-password">
<input type="submit" value="Sign Up!">
</form>
In my form I used both email and username but chrome credential manager is still not able to detect the username.
How can we create the form with autocomplete tag in flutter web?
Flutter supports now autofill (password, email, username, etc.) ☑️ The merged pull request with an example: https://github.com/flutter/flutter/pull/52126
Example:
@override
Widget build(BuildContext context) {
return AutofillGroup(
child: Column(
children: <Widget>[
TextField(controller: username, autofillHints: [AutofillHints.username]),
Checkbox(
value: isNewUser,
onChanged: (bool newValue) {
setState(() { isNewUser = newValue; });
},
),
if (isNewUser) TextField(controller: newPassword, autofillHints: [AutofillHints.newPassword]),
if (isNewUser) TextField(controller: repeatNewPassword, autofillHints: [AutofillHints.newPassword]),
if (!isNewUser) TextField(controller: password, autofillHints: [AutofillHints.password]),
],
),
);
}
You may need to switch to dev
or master
channel (flutter channel master
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With