autofill should work now

This commit is contained in:
doman 2023-07-30 15:37:11 +02:00
parent 64703dbc67
commit 9807db52ae
2 changed files with 73 additions and 68 deletions

View file

@ -105,47 +105,49 @@ class _LoginScreen extends State<LoginScreen> {
child: Container(
constraints: const BoxConstraints(maxWidth: 600),
padding: const EdgeInsets.all(10),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
TextFormField(
decoration: const InputDecoration(
labelText: 'Username',
child: AutofillGroup(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
TextFormField(
decoration: const InputDecoration(
labelText: 'Username',
),
controller: usernameController,
autofillHints: const [AutofillHints.username],
),
controller: usernameController,
autofillHints: const [AutofillHints.username],
),
TextFormField(
obscureText: true,
decoration: const InputDecoration(
labelText: 'Password',
TextFormField(
obscureText: true,
decoration: const InputDecoration(
labelText: 'Password',
),
controller: passwordController,
onFieldSubmitted: (_) => _login(),
autofillHints: const [AutofillHints.password],
),
controller: passwordController,
onFieldSubmitted: (_) => _login(),
autofillHints: const [AutofillHints.password],
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: FilledButton(
onPressed: _login,
child: const Text('Login'),
Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: FilledButton(
onPressed: _login,
child: const Text('Login'),
),
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: TextButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => RegisterScreen(apiClient: widget.apiClient),
),
);
},
child: const Text('Don\'t have an account? Register here!'),
Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: TextButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => RegisterScreen(apiClient: widget.apiClient),
),
);
},
child: const Text('Don\'t have an account? Register here!'),
),
),
),
],
],
),
),
),
),

View file

@ -90,40 +90,43 @@ class _RegisterScreen extends State<RegisterScreen> {
child: Container(
constraints: const BoxConstraints(maxWidth: 600),
padding: const EdgeInsets.all(10),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
TextFormField(
decoration: const InputDecoration(
labelText: 'Username',
child: AutofillGroup(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
TextFormField(
decoration: const InputDecoration(
labelText: 'Username',
),
controller: usernameController,
autofillHints: const [AutofillHints.username],
),
controller: usernameController,
autofillHints: const [AutofillHints.username],
),
TextFormField(
obscureText: true,
decoration: const InputDecoration(
labelText: 'Password',
TextFormField(
obscureText: true,
decoration: const InputDecoration(
labelText: 'Password',
),
controller: passwordController,
autofillHints: const [AutofillHints.password],
),
controller: passwordController,
autofillHints: const [AutofillHints.password],
),
TextFormField(
obscureText: true,
decoration: const InputDecoration(
labelText: 'Confirm password',
TextFormField(
obscureText: true,
decoration: const InputDecoration(
labelText: 'Confirm password',
),
controller: passwordConfirmController,
autofillHints: const [AutofillHints.password],
onFieldSubmitted: (_) => _register()
),
controller: passwordConfirmController,
onFieldSubmitted: (_) => _register()
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: FilledButton(
onPressed: _register,
child: const Text('Register'),
)
),
],
Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: FilledButton(
onPressed: _register,
child: const Text('Register'),
)
),
],
),
),
),
),