-
Notifications
You must be signed in to change notification settings - Fork 117
/
Copy pathregister_screen.dart
137 lines (119 loc) · 4.31 KB
/
register_screen.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:firebase_ui_auth/firebase_ui_auth.dart';
import 'package:flutter/material.dart';
import 'internal/login_screen.dart';
import 'internal/multi_provider_screen.dart';
/// A screen displaying a fully styled Registration flow for Authentication.
///
/// {@subCategory service:auth}
/// {@subCategory type:screen}
/// {@subCategory description:A screen displaying a fully styled Registration flow for Authentication.}
/// {@subCategory img:https://place-hold.it/400x150}
class RegisterScreen extends MultiProviderScreen {
/// {@macro ui.auth.screens.responsive_page.header_max_extent}
final double? headerMaxExtent;
/// {@macro ui.auth.screens.responsive_page.header_builder}
final HeaderBuilder? headerBuilder;
/// {@macro ui.auth.screens.responsive_page.side_builder}
final SideBuilder? sideBuilder;
/// Indicates whether icon-only or icon and text OAuth buttons should be used.
/// Icon-only buttons are placed in a row.
final OAuthButtonVariant? oauthButtonVariant;
/// {@macro ui.auth.screens.responsive_page.desktop_layout_direction}
final TextDirection? desktopLayoutDirection;
/// [RegisterScreen] could invoke these actions:
///
/// * [EmailLinkSignInAction]
/// * [VerifyPhoneAction]
/// * [AuthStateChangeAction]
///
/// These actions could be used to trigger route transtion or display
/// a dialog.
///
/// ```dart
/// SignInScreen(
/// actions: [
/// VerifyPhoneAction((context, _) {
/// Navigator.pushNamed(context, '/phone');
/// }),
/// AuthStateChangeAction<SignedIn>((context, state) {
/// if (!state.user!.isEmailVerified) {
/// Navigator.pushNamed(context, '/verify-email');
/// } else {
/// Navigator.pushReplacementNamed(context, '/profile');
/// }
/// }),
/// EmailLinkSignInAction((context) {
/// Navigator.pushReplacementNamed(context, '/email-link-sign-in');
/// }),
/// ],
/// )
/// ```
final List<FirebaseUIAction>? actions;
/// An email that [EmailForm] should be pre-filled with.
final String? email;
/// See [Scaffold.resizeToAvoidBottomInset]
final bool? resizeToAvoidBottomInset;
/// Whether the "Login/Register" link should be displayed. The link changes
/// the type of the [AuthAction] from [AuthAction.signIn]
/// and [AuthAction.signUp] and vice versa.
final bool? showAuthActionSwitch;
/// {@macro ui.auth.views.login_view.subtitle_builder}
final AuthViewContentBuilder? subtitleBuilder;
/// {@macro ui.auth.views.login_view.footer_builder}
final AuthViewContentBuilder? footerBuilder;
/// {@macro ui.auth.screens.responsive_page.breakpoint}
final double breakpoint;
/// A set of styles that are provided to the descendant widgets.
///
/// Possible styles are:
/// * [EmailFormStyle]
final Set<FirebaseUIStyle>? styles;
/// {@macro ui.auth.screens.responsive_page.max_width}
final double? maxWidth;
const RegisterScreen({
super.key,
super.auth,
super.providers,
this.actions,
this.headerMaxExtent,
this.headerBuilder,
this.sideBuilder,
this.oauthButtonVariant = OAuthButtonVariant.icon_and_text,
this.desktopLayoutDirection,
this.email,
this.resizeToAvoidBottomInset = false,
this.showAuthActionSwitch,
this.subtitleBuilder,
this.footerBuilder,
this.breakpoint = 800,
this.styles,
this.maxWidth,
});
@override
Widget build(BuildContext context) {
return FirebaseUIActions(
actions: actions ?? [],
child: LoginScreen(
styles: styles,
action: AuthAction.signUp,
providers: providers,
resizeToAvoidBottomInset: resizeToAvoidBottomInset,
auth: auth,
headerMaxExtent: headerMaxExtent,
headerBuilder: headerBuilder,
sideBuilder: sideBuilder,
desktopLayoutDirection: desktopLayoutDirection,
oauthButtonVariant: oauthButtonVariant,
email: email,
showAuthActionSwitch: showAuthActionSwitch,
subtitleBuilder: subtitleBuilder,
footerBuilder: footerBuilder,
breakpoint: breakpoint,
maxWidth: maxWidth,
),
);
}
}