Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

Commit

Permalink
💄 Make pressing 'enter' in password field trigger login
Browse files Browse the repository at this point in the history
  • Loading branch information
Komposten committed Jan 26, 2020
1 parent 73e8cf0 commit 7a23f28
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/pages/auth/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,17 @@ class OBAuthLoginPageState extends State<OBAuthLoginPage> {
minWidth: double.infinity,
size: OBButtonSize.large,
child: Text(buttonText, style: TextStyle(fontSize: 18.0)),
onPressed: () async {
_isSubmitted = true;
if (_validateForm()) {
await _login(context);
}
},
onPressed: _submitForm,
);
}

Future<void> _submitForm() async {
_isSubmitted = true;
if (_validateForm()) {
await _login(context);
}
}

Future<void> _login(BuildContext context) async {
_setLoginInProgress(true);
String username = _usernameController.text.trim();
Expand Down Expand Up @@ -290,6 +292,7 @@ class OBAuthLoginPageState extends State<OBAuthLoginPage> {
border: OutlineInputBorder(),
),
autocorrect: false,
onFieldSubmitted: (v) => _submitForm(),
),
const SizedBox(
height: 20.0,
Expand Down

0 comments on commit 7a23f28

Please sign in to comment.