We have an username-password based authentication using Flutter web. When we enter username and password, the Browser prompt for saving credentials dialog doesn’t fill (or detects) username but it detects password field. Is there any property I can set on TextFormField
so username field can be detected for saving in prompt?
Below is our form with TextFormField
widget:
Following is Google chrome prompt after sign-in which doesn’t fill username:
TextFormField(
controller: _usernameController,
decoration: InputDecoration(
labelText: ‘Username’,
// Other attributes
),
autofillHints: [AutofillHints.username], // This is the important line which help to make hint
),
TextFormField(
controller: _passwordController,
decoration: InputDecoration(
labelText: ‘Password’,
// Other attributes
),
obscureText: true,
autofillHints: [AutofillHints.password], // same as above
),
Soumya Ranjan Nayak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.