From 86c89e782cd3dee481fe1b9740cdc6e75e280e84 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Mon, 4 May 2020 20:11:36 +0200 Subject: [PATCH] Fix issue on create account route --- lib/ui/routes/create_account_route.dart | 184 ++++++++++++------------ 1 file changed, 95 insertions(+), 89 deletions(-) diff --git a/lib/ui/routes/create_account_route.dart b/lib/ui/routes/create_account_route.dart index 6fb215b..6bdb6e0 100644 --- a/lib/ui/routes/create_account_route.dart +++ b/lib/ui/routes/create_account_route.dart @@ -78,103 +78,109 @@ class __CreateAccountRouteBodyState extends State<_CreateAccountRouteBody> { child: CircularProgressIndicator(), ); - return Padding( - padding: const EdgeInsets.all(8.0), - child: ListView( - children: [ - _createAccountResult != null - ? buildErrorCard(errorMessage) - : Container(), + return Center( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: ConstrainedBox( + constraints: BoxConstraints(maxWidth: 370), + child: ListView( + children: [ + _createAccountResult != null + ? buildErrorCard(errorMessage) + : Container(), - // First name - _InputEntry( - controller: _firstNameController, - label: tr("First name"), - onEdited: _updateUI, - icon: Icon(Icons.perm_identity), - error: _showErrors && !_isFirstNameValid - ? tr("Invalid first name!") - : null, - ), + // First name + _InputEntry( + controller: _firstNameController, + label: tr("First name"), + onEdited: _updateUI, + icon: Icon(Icons.perm_identity), + error: _showErrors && !_isFirstNameValid + ? tr("Invalid first name!") + : null, + ), - // Last name - _InputEntry( - controller: _lastNameController, - label: tr("Last name"), - onEdited: _updateUI, - icon: Icon(Icons.perm_identity), - error: _showErrors && !_isLastNameValid - ? tr("Invalid last name!") - : null, - ), + // Last name + _InputEntry( + controller: _lastNameController, + label: tr("Last name"), + onEdited: _updateUI, + icon: Icon(Icons.perm_identity), + error: _showErrors && !_isLastNameValid + ? tr("Invalid last name!") + : null, + ), - // Email address - _InputEntry( - controller: _emailController, - label: tr("Email address"), - onEdited: _updateUI, - icon: Icon(Icons.email), - keyboard: TextInputType.emailAddress, - error: _showErrors && !_isEmailValid - ? tr("Invalid email address!") - : null, - ), + // Email address + _InputEntry( + controller: _emailController, + label: tr("Email address"), + onEdited: _updateUI, + icon: Icon(Icons.email), + keyboard: TextInputType.emailAddress, + error: _showErrors && !_isEmailValid + ? tr("Invalid email address!") + : null, + ), - // Password - _InputEntry( - controller: _passwordController, - label: tr("Password"), - onEdited: _updateUI, - icon: Icon(Icons.lock), - isPassword: true, - error: _showErrors && !_isPasswordValid - ? tr("Invalid password!") - : null, - ), + // Password + _InputEntry( + controller: _passwordController, + label: tr("Password"), + onEdited: _updateUI, + icon: Icon(Icons.lock), + isPassword: true, + error: _showErrors && !_isPasswordValid + ? tr("Invalid password!") + : null, + ), - // Verify password - _InputEntry( - controller: _verifyPasswordController, - label: tr("Confirm your password"), - onEdited: _updateUI, - icon: Icon(Icons.lock_outline), - isPassword: true, - error: _showErrors && !_isPasswordConfirmationValid - ? tr("The password and its confirmation do not match!") - : null, - ), + // Verify password + _InputEntry( + controller: _verifyPasswordController, + label: tr("Confirm your password"), + onEdited: _updateUI, + icon: Icon(Icons.lock_outline), + isPassword: true, + error: _showErrors && !_isPasswordConfirmationValid + ? tr("The password and its confirmation do not match!") + : null, + ), - // TOS - CheckboxListTile( - title: Text(tr("I have read and accepted the Terms Of Service.")), - value: _acceptedTOS, - onChanged: (b) { - _acceptedTOS = b; - _updateUI(); - }, - subtitle: _showErrors && !_acceptedTOS - ? Text( - tr("You must accept the Terms Of Service to continue."), - style: TextStyle(color: Colors.redAccent), - ) - : null, - controlAffinity: ListTileControlAffinity.leading, - secondary: IconButton( - icon: Icon(Icons.open_in_new), - onPressed: _openTOS, - ), - ), + // TOS + CheckboxListTile( + title: + Text(tr("I have read and accepted the Terms Of Service.")), + value: _acceptedTOS, + onChanged: (b) { + _acceptedTOS = b; + _updateUI(); + }, + subtitle: _showErrors && !_acceptedTOS + ? Text( + tr("You must accept the Terms Of Service to continue."), + style: TextStyle(color: Colors.redAccent), + ) + : null, + controlAffinity: ListTileControlAffinity.leading, + secondary: IconButton( + icon: Icon(Icons.open_in_new), + onPressed: _openTOS, + ), + ), - // Submit button - Center( - child: RaisedButton( - color: Colors.blue, - textColor: Colors.white, - onPressed: _submitForm, - child: Text("Submit"), - ), + // Submit button + Center( + child: RaisedButton( + color: Colors.blue, + textColor: Colors.white, + onPressed: _submitForm, + child: Text("Submit"), + ), + ), + ], ), - ], + ), ), ); }