forked from eatvio/eatvio_app
feature(registration): iter 7
This commit is contained in:
@@ -113,8 +113,8 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
backgroundColor: appTheme.blueA400,
|
||||
onPressed: () {
|
||||
if (canGoNext(state)) {
|
||||
onPressed: () async {
|
||||
if (await canGoNext(state)) {
|
||||
setState(() {
|
||||
pageController.nextPage(
|
||||
duration: const Duration(milliseconds: 350),
|
||||
@@ -197,7 +197,7 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
bool canGoNext(state) {
|
||||
Future<bool> canGoNext(state) async {
|
||||
switch (step) {
|
||||
case 2:
|
||||
List<String> errors = validateCredentialsFields(state.sheet.email, state.sheet.name, state.sheet.password, state.sheet.passwordConfirmation);
|
||||
@@ -285,8 +285,30 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
|
||||
return false;
|
||||
}
|
||||
case 15:
|
||||
registrationCubit.tryRegistration();
|
||||
return true;
|
||||
try {
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
useSafeArea: false,
|
||||
context: context,
|
||||
builder: (context) => PopScope(
|
||||
canPop: false,
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
),
|
||||
);
|
||||
await registrationCubit.tryRegistration();
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
Navigator.pop(context);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text('Ошибка при попытке регистрации'),
|
||||
),
|
||||
);
|
||||
}
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user