From 4780caf38918b2af2299f3b86ff72bb9be57a18f Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Sun, 14 Jul 2024 22:21:30 +0300 Subject: [PATCH] feature(registration): refactor i 3. --- .../pages/registration_screen.dart | 104 +++++++++--------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/lib/features/registration/presentation/pages/registration_screen.dart b/lib/features/registration/presentation/pages/registration_screen.dart index 0f6a3bc9..534ea113 100644 --- a/lib/features/registration/presentation/pages/registration_screen.dart +++ b/lib/features/registration/presentation/pages/registration_screen.dart @@ -197,58 +197,58 @@ class _RegistrationScreenState extends State { bool canGoNext(state) { switch (step) { - // case 2: - // List errors = validateCredentialsFields(state.sheet.email, state.sheet.name, state.sheet.password, state.sheet.passwordConfirmation); - // if (errors.isEmpty) { - // return true; - // } else { - // String errorMessage = ''; - // - // for (var error in errors) { - // errorMessage += error + '\n\n'; - // } - // - // showDialog( - // context: context, - // builder: (context) => AlertDialog( - // title: Text('Ошибка'), - // content: Text(errorMessage), - // actions: [ - // TextButton( - // onPressed: () => Navigator.pop(context), - // child: Text('OK'), - // ), - // ], - // ), - // ); - // return false; - // } - // case 3: - // List errors = validateNameFields(state.sheet.firstName, state.sheet.lastName); - // if (errors.isEmpty) { - // return true; - // } else { - // String errorMessage = ''; - // - // for (var error in errors) { - // errorMessage += error + '\n\n'; - // } - // - // showDialog( - // context: context, - // builder: (context) => AlertDialog( - // title: Text('Ошибка'), - // content: Text(errorMessage), - // actions: [ - // TextButton( - // onPressed: () => Navigator.pop(context), - // child: Text('OK'), - // ), - // ], - // ), - // ); - // return false; - // } + case 2: + List errors = validateCredentialsFields(state.sheet.email, state.sheet.name, state.sheet.password, state.sheet.passwordConfirmation); + if (errors.isEmpty) { + return true; + } else { + String errorMessage = ''; + + for (var error in errors) { + errorMessage += error + '\n\n'; + } + + showDialog( + context: context, + builder: (context) => AlertDialog( + title: Text('Ошибка'), + content: Text(errorMessage), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context), + child: Text('OK'), + ), + ], + ), + ); + return false; + } + case 3: + List errors = validateNameFields(state.sheet.firstName, state.sheet.lastName); + if (errors.isEmpty) { + return true; + } else { + String errorMessage = ''; + + for (var error in errors) { + errorMessage += error + '\n\n'; + } + + showDialog( + context: context, + builder: (context) => AlertDialog( + title: Text('Ошибка'), + content: Text(errorMessage), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context), + child: Text('OK'), + ), + ], + ), + ); + return false; + } default: return true; }