From 7a23f28ede24ad87b7cab320701938d1510ca81c Mon Sep 17 00:00:00 2001 From: Komposten Date: Sun, 26 Jan 2020 19:02:38 +0100 Subject: [PATCH] :lipstick: Make pressing 'enter' in password field trigger login --- lib/pages/auth/login.dart | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/pages/auth/login.dart b/lib/pages/auth/login.dart index 54afeedcf..43746a03e 100644 --- a/lib/pages/auth/login.dart +++ b/lib/pages/auth/login.dart @@ -123,15 +123,17 @@ class OBAuthLoginPageState extends State { 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 _submitForm() async { + _isSubmitted = true; + if (_validateForm()) { + await _login(context); + } + } + Future _login(BuildContext context) async { _setLoginInProgress(true); String username = _usernameController.text.trim(); @@ -290,6 +292,7 @@ class OBAuthLoginPageState extends State { border: OutlineInputBorder(), ), autocorrect: false, + onFieldSubmitted: (v) => _submitForm(), ), const SizedBox( height: 20.0,