mirror of
https://github.com/Iconica-Development/flutter_registration.git
synced 2025-05-19 13:23:45 +02:00
feat: Added the ability to decide to go back to the first page
This commit is contained in:
parent
a9380b0eb7
commit
f8ecce95a0
2 changed files with 6 additions and 3 deletions
|
@ -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;
|
||||||
|
|
|
@ -27,9 +27,12 @@ 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);
|
||||||
|
|
||||||
|
if (returnToFirstPage ?? true) {
|
||||||
onError();
|
onError();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
onError();
|
onError();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue