@@ -5,3 +5,126 @@ export 'package:firebase_ui_oauth/firebase_ui_oauth.dart'
55
66export 'src/provider.dart' show OidcProvider, OidcToken;
77export 'src/theme.dart' show OidcProviderButtonStyle;
8+
9+
10+ class AppleSignInButton extends _AppleSignInButton {
11+ const AppleSignInButton ({
12+ Key ? key,
13+ required Widget loadingIndicator,
14+ AuthAction ? action,
15+ FirebaseAuth ? auth,
16+ bool ? isLoading,
17+ String ? label,
18+ DifferentProvidersFoundCallback ? onDifferentProvidersFound,
19+ SignedInCallback ? onSignedIn,
20+ void Function ()? onTap,
21+ bool ? overrideDefaultTapAction,
22+ double ? size,
23+ void Function (Exception exception)? onError,
24+ VoidCallback ? onCanceled,
25+ }) : super (
26+ key: key,
27+ action: action,
28+ auth: auth,
29+ isLoading: isLoading ?? false ,
30+ loadingIndicator: loadingIndicator,
31+ label: label,
32+ onDifferentProvidersFound: onDifferentProvidersFound,
33+ onSignedIn: onSignedIn,
34+ onTap: onTap,
35+ overrideDefaultTapAction: overrideDefaultTapAction,
36+ size: size,
37+ onError: onError,
38+ onCanceled: onCanceled,
39+ );
40+ }
41+
42+ class AppleSignInIconButton extends _AppleSignInButton {
43+ const AppleSignInIconButton ({
44+ Key ? key,
45+ required Widget loadingIndicator,
46+ AuthAction ? action,
47+ FirebaseAuth ? auth,
48+ bool ? isLoading,
49+ DifferentProvidersFoundCallback ? onDifferentProvidersFound,
50+ SignedInCallback ? onSignedIn,
51+ void Function ()? onTap,
52+ bool ? overrideDefaultTapAction,
53+ double ? size,
54+ void Function (Exception exception)? onError,
55+ VoidCallback ? onCanceled,
56+ }) : super (
57+ key: key,
58+ action: action,
59+ auth: auth,
60+ isLoading: isLoading ?? false ,
61+ loadingIndicator: loadingIndicator,
62+ label: '' ,
63+ onDifferentProvidersFound: onDifferentProvidersFound,
64+ onSignedIn: onSignedIn,
65+ onTap: onTap,
66+ overrideDefaultTapAction: overrideDefaultTapAction,
67+ size: size,
68+ onError: onError,
69+ onCanceled: onCanceled,
70+ );
71+ }
72+
73+ class _AppleSignInButton extends StatelessWidget {
74+ final String label;
75+ final Widget loadingIndicator;
76+ final void Function ()? onTap;
77+ final bool overrideDefaultTapAction;
78+ final bool isLoading;
79+
80+ /// {@macro ui.auth.auth_action}
81+ final AuthAction ? action;
82+
83+ /// {@macro ui.auth.auth_controller.auth}
84+ final FirebaseAuth ? auth;
85+ final DifferentProvidersFoundCallback ? onDifferentProvidersFound;
86+ final SignedInCallback ? onSignedIn;
87+ final double size;
88+ final void Function (Exception exception)? onError;
89+ final VoidCallback ? onCanceled;
90+
91+ const _AppleSignInButton ({
92+ Key ? key,
93+ required this .loadingIndicator,
94+ String ? label,
95+ bool ? overrideDefaultTapAction,
96+ this .onTap,
97+ this .isLoading = false ,
98+ this .action = AuthAction .signIn,
99+ this .auth,
100+ this .onDifferentProvidersFound,
101+ this .onSignedIn,
102+ double ? size,
103+ this .onError,
104+ this .onCanceled,
105+ }) : label = label ?? 'Sign in with Apple' ,
106+ overrideDefaultTapAction = overrideDefaultTapAction ?? false ,
107+ size = size ?? 19 ,
108+ super (key: key);
109+
110+ AppleProvider get provider => AppleProvider ();
111+
112+ @override
113+ Widget build (BuildContext context) {
114+ return OAuthProviderButtonBase (
115+ provider: provider,
116+ label: label,
117+ onTap: onTap,
118+ loadingIndicator: loadingIndicator,
119+ isLoading: isLoading,
120+ action: action,
121+ auth: auth ?? FirebaseAuth .instance,
122+ onDifferentProvidersFound: onDifferentProvidersFound,
123+ onSignedIn: onSignedIn,
124+ overrideDefaultTapAction: overrideDefaultTapAction,
125+ size: size,
126+ onError: onError,
127+ onCancelled: onCanceled,
128+ );
129+ }
130+ }
0 commit comments