mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 12:59:21 +00:00
Can submit login form from password field
This commit is contained in:
parent
692b16aa8f
commit
acf2b0d8e9
@ -76,6 +76,9 @@ class _LoginRouteState extends State<LoginRoute> {
|
|||||||
|
|
||||||
/// Build login form
|
/// Build login form
|
||||||
Widget _buildLoginForm() {
|
Widget _buildLoginForm() {
|
||||||
|
// Whether the form can be submitted or not
|
||||||
|
final valid = validateEmail(_currEmail) && _currPassword.length >= 3;
|
||||||
|
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
@ -105,16 +108,17 @@ class _LoginRouteState extends State<LoginRoute> {
|
|||||||
alignLabelWithHint: true,
|
alignLabelWithHint: true,
|
||||||
),
|
),
|
||||||
onChanged: _passwordChanged,
|
onChanged: _passwordChanged,
|
||||||
|
onSubmitted: valid ? (s) => _submitForm(context) : null,
|
||||||
),
|
),
|
||||||
|
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.all(8.0),
|
padding: EdgeInsets.all(8.0),
|
||||||
child: _loading ? CircularProgressIndicator() : RaisedButton(
|
child: _loading
|
||||||
child: Text(tr("Sign in")),
|
? CircularProgressIndicator()
|
||||||
onPressed: !validateEmail(_currEmail) || _currPassword.length < 3
|
: RaisedButton(
|
||||||
? null
|
child: Text(tr("Sign in")),
|
||||||
: () => _submitForm(context),
|
onPressed: valid ? () => _submitForm(context) : null,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user