You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+72-20Lines changed: 72 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
<b>⚠️ Attention: This package is at an early stage. A lot of features are missing. Eventually this package will be "lit", but for now, use at your own risk.</b>
6
6
7
-
Pre-lit Firebase authentication. It provides a set of convenient utilities and widgets to easily add Firebase auth to a Flutter app.
7
+
Pre-lit Firebase authentication. It provides a set of convenient utilities and widgets to easily add Firebase authentication to a Flutter app.
8
8
9
9
10
10
## Features
@@ -27,8 +27,8 @@ Pre-lit Firebase authentication. It provides a set of convenient utilities and w
27
27
## Getting started
28
28
29
29
See the [example](example/) project to get up and running fast.
@@ -96,6 +96,7 @@ Below is an example of a Flutter Web `index.html` with Firebase Auth enabled:
96
96
<!-- CONTINUE TO INITIALIZE FLUTTER WEB -->
97
97
...
98
98
```
99
+
</details>
99
100
100
101
## Usage
101
102
The two most important widgets are
@@ -130,16 +131,16 @@ class MyApp extends StatelessWidget {
130
131
131
132
### Standard Sign-in widget
132
133
You can either create your own custom Sign-in widget, or make use of the standard built in one.
133
-
To use the standard widget:
134
-
134
+
To use the standard sign-in form with no changes:
135
135
136
136
```dart
137
137
LitAuth(
138
-
config: AuthConfig.standard(),
138
+
config: AuthConfig(),
139
139
);
140
140
```
141
141
142
142
This will use the default configuration and UI theming. See the section on decoration and theming for customization.
143
+
143
144
**NOTE**: This widget needs to be below a `Scaffold` widget.
144
145
145
146
### Handle auth state changes
@@ -165,7 +166,6 @@ You can provide optional callbacks in `LitAuth` to handle success and failure wh
165
166
166
167
```dart
167
168
LitAuth(
168
-
config: AuthConfig.standard(),
169
169
onAuthFailure: (failure) {
170
170
print('Auth failed.'); // show error message
171
171
},
@@ -176,13 +176,12 @@ LitAuth(
176
176
```
177
177
**Note**: these handlers will not be called if `LitAuth` is already disposed.
178
178
179
-
For example, if you were to wrap this widget in `LitAuthState`, such as:
179
+
For example, if you were to wrap this `LitAuth` in `LitAuthState`, such as:
180
180
```dart
181
181
LitAuthState(
182
182
authenticated: () =>
183
183
Text('Authenticated'), // Login widget, or sign in button
184
184
unauthenticated: () => LitAuth(
185
-
config: AuthConfig.standard(),
186
185
onAuthFailure: (failure) {
187
186
print('Auth failed.'); // show error message
188
187
},
@@ -192,7 +191,7 @@ LitAuthState(
192
191
),
193
192
);
194
193
```
195
-
Then in this instance the `onAuthSuccess` handler may not be called. As the *`authenticated`* state will be triggered and `LitAuth` widget disposed.*Depending on the platform, behaviour may be different. For web it may take longer for `LitAuthState` to receive a new auth value and push changes. Thus resulting in `onAuthSuccess` being called.*
194
+
Then in this instance the `onAuthSuccess` handler may not be called. As the `authenticated` state will be triggered and the `LitAuth` widget disposed.
196
195
197
196
### Sign out
198
197
To sign out the current user, make use of the `signOut` extension method on `BuildContext`. For example:
@@ -221,17 +220,18 @@ For example, to override the standard email `InputDecoration` just provide a cus
For now dialogs are rendered using the `flushbar` package to show dialog messages.
246
+
For now dialog nessage are rendered using the `flushbar` package.
247
247
248
248
**todo**: provide additional theming/overrides for dialogs.
249
249
250
250
### Additional Customization
251
251
252
-
For further customization you can directly make use of the Lit Firebase components to build a completely custom Sign-in widget. Legos fitting together.
252
+
For further customization you can directly make use of the Lit Firebase components to build a completely custom sign-in widget.
253
253
254
254
Instead of using the standard `AuthConfig`, set it to custom and provide your custom Sign-in widget:
255
255
```dart
256
-
LitAuth(
257
-
config: AuthConfig.custom(
258
-
signIn: CustomSignInWidget(),
259
-
),
256
+
LitAuth.custom(
257
+
child: YourCustomSignInWidget(),
260
258
);
261
259
```
262
260
263
-
Tutorials and code samples will be added soon on how to create a custom Sign-in widget. For now, see the example project for more information.
261
+
You can build any form you want, for example:
262
+
263
+
```dart
264
+
class YourCustomSignInWidget extends StatelessWidget {
0 commit comments