@@ -32,6 +32,36 @@ class RegisterScreen extends MultiProviderScreen {
|
32 | 32 | /// {@macro ui.auth.screens.responsive_page.desktop_layout_direction}
|
33 | 33 | final TextDirection? desktopLayoutDirection;
|
34 | 34 |
|
| 35 | +/// [RegisterScreen] could invoke these actions: |
| 36 | +/// |
| 37 | +/// * [EmailLinkSignInAction] |
| 38 | +/// * [VerifyPhoneAction] |
| 39 | +/// * [AuthStateChangeAction] |
| 40 | +/// |
| 41 | +/// These actions could be used to trigger route transtion or display |
| 42 | +/// a dialog. |
| 43 | +/// |
| 44 | +/// ```dart |
| 45 | +/// SignInScreen( |
| 46 | +/// actions: [ |
| 47 | +/// VerifyPhoneAction((context, _) { |
| 48 | +/// Navigator.pushNamed(context, '/phone'); |
| 49 | +/// }), |
| 50 | +/// AuthStateChangeAction<SignedIn>((context, state) { |
| 51 | +/// if (!state.user!.emailVerified) { |
| 52 | +/// Navigator.pushNamed(context, '/verify-email'); |
| 53 | +/// } else { |
| 54 | +/// Navigator.pushReplacementNamed(context, '/profile'); |
| 55 | +/// } |
| 56 | +/// }), |
| 57 | +/// EmailLinkSignInAction((context) { |
| 58 | +/// Navigator.pushReplacementNamed(context, '/email-link-sign-in'); |
| 59 | +/// }), |
| 60 | +/// ], |
| 61 | +/// ) |
| 62 | +/// ``` |
| 63 | + final List<FirebaseUIAction>? actions; |
| 64 | + |
35 | 65 | /// An email that [EmailForm] should be pre-filled with.
|
36 | 66 | final String? email;
|
37 | 67 |
|
@@ -62,6 +92,7 @@ class RegisterScreen extends MultiProviderScreen {
|
62 | 92 | Key? key,
|
63 | 93 | FirebaseAuth? auth,
|
64 | 94 | List<AuthProvider>? providers,
|
| 95 | +this.actions, |
65 | 96 | this.headerMaxExtent,
|
66 | 97 | this.headerBuilder,
|
67 | 98 | this.sideBuilder,
|
@@ -78,21 +109,24 @@ class RegisterScreen extends MultiProviderScreen {
|
78 | 109 |
|
79 | 110 | @override
|
80 | 111 | Widget build(BuildContext context) {
|
81 |
| -return LoginScreen( |
82 |
| -styles: styles, |
83 |
| -action: AuthAction.signUp, |
84 |
| -providers: providers, |
85 |
| -resizeToAvoidBottomInset: resizeToAvoidBottomInset, |
86 |
| -auth: auth, |
87 |
| -headerMaxExtent: headerMaxExtent, |
88 |
| -headerBuilder: headerBuilder, |
89 |
| -sideBuilder: sideBuilder, |
90 |
| -desktopLayoutDirection: desktopLayoutDirection, |
91 |
| -oauthButtonVariant: oauthButtonVariant, |
92 |
| -email: email, |
93 |
| -showAuthActionSwitch: showAuthActionSwitch, |
94 |
| -subtitleBuilder: subtitleBuilder, |
95 |
| -footerBuilder: footerBuilder, |
| 112 | +return FirebaseUIActions( |
| 113 | +actions: actions ?? [], |
| 114 | +child: LoginScreen( |
| 115 | +styles: styles, |
| 116 | +action: AuthAction.signUp, |
| 117 | +providers: providers, |
| 118 | +resizeToAvoidBottomInset: resizeToAvoidBottomInset, |
| 119 | +auth: auth, |
| 120 | +headerMaxExtent: headerMaxExtent, |
| 121 | +headerBuilder: headerBuilder, |
| 122 | +sideBuilder: sideBuilder, |
| 123 | +desktopLayoutDirection: desktopLayoutDirection, |
| 124 | +oauthButtonVariant: oauthButtonVariant, |
| 125 | +email: email, |
| 126 | +showAuthActionSwitch: showAuthActionSwitch, |
| 127 | +subtitleBuilder: subtitleBuilder, |
| 128 | +footerBuilder: footerBuilder, |
| 129 | +), |
96 | 130 | );
|
97 | 131 | }
|
98 | 132 | }
|
0 commit comments