feat: Added the ability to decide to go back to the first page

This commit is contained in:
Bugfix Jacques 2023-10-03 14:05:37 +02:00
parent a9380b0eb7
commit f8ecce95a0
2 changed files with 6 additions and 3 deletions

View file

@ -20,7 +20,7 @@ class RegistrationOptions {
final RegistrationTranslations registrationTranslations; final RegistrationTranslations registrationTranslations;
final List<AuthStep> registrationSteps; final List<AuthStep> registrationSteps;
final void Function(String error)? onError; final bool? Function(String error)? onError;
final VoidCallback afterRegistration; final VoidCallback afterRegistration;
final RegistrationRepository registrationRepository; final RegistrationRepository registrationRepository;
final AppBar Function(String title)? customAppbarBuilder; final AppBar Function(String title)? customAppbarBuilder;

View file

@ -27,8 +27,11 @@ class RegistrationScreen extends StatelessWidget {
if (registered == null) { if (registered == null) {
registrationOptions.afterRegistration(); registrationOptions.afterRegistration();
} else { } else {
registrationOptions.onError?.call(registered); var returnToFirstPage = registrationOptions.onError?.call(registered);
onError();
if (returnToFirstPage ?? true) {
onError();
}
} }
} catch (e) { } catch (e) {
onError(); onError();