Skip to content

Commit

Permalink
Changed Approach
Browse files Browse the repository at this point in the history
  • Loading branch information
abhay1821 committed Apr 3, 2022
1 parent 442062a commit 5759459
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions packages/smooth_app/lib/pages/user_management/sign_up_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,11 @@ class _SignUpPageState extends State<SignUpPage> {
prefixIcon: const Icon(Icons.person),
autofillHints: const <String>[AutofillHints.email],
validator: (String? value) {
final String emailTrimmed;
if (value == null || value.isEmpty) {
return appLocalizations.sign_up_page_email_error_empty;
}
emailTrimmed = value.trim();
if (value != emailTrimmed) {
_emailController.text = emailTrimmed;
value = emailTrimmed;
}
if (!UserManagementHelper.isEmailValid(value)) {
_emailController.text = value.trim();
if (!UserManagementHelper.isEmailValid(value.trim())) {
return appLocalizations.sign_up_page_email_error_invalid;
}

Expand All @@ -110,16 +105,11 @@ class _SignUpPageState extends State<SignUpPage> {
prefixIcon: const Icon(Icons.person),
autofillHints: const <String>[AutofillHints.username],
validator: (String? value) {
final String userTrimmed;
if (value == null || value.isEmpty) {
return appLocalizations.sign_up_page_username_error_empty;
}
userTrimmed = value.trim();
if (value != userTrimmed) {
_userController.text = userTrimmed;
value = userTrimmed;
}
if (!UserManagementHelper.isUsernameValid(value)) {
_userController.text = value.trim();
if (!UserManagementHelper.isUsernameValid(value.trim())) {
return appLocalizations.sign_up_page_username_description;
}
return null;
Expand Down

0 comments on commit 5759459

Please sign in to comment.