Skip to content

Commit 9947805

Browse files
docs: add documentation comments and updates
1 parent dbd4ec2 commit 9947805

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,12 @@ Pre-lit Firebase authentication. It provides a set of convenient utilities and w
2727
## Getting started
2828

2929
See the [example](example/) project to get up and running fast.
30+
31+
Or take a look at a [live demo](https://funwithflutter.github.io/lit_firebase_example/).
32+
33+
## Platform Configuration
3034
<details>
31-
<summary><h2>Platform Configuration</h2></summary>
35+
<summary>...</summary>
3236

3337
### Android integration
3438

@@ -130,7 +134,7 @@ class MyApp extends StatelessWidget {
130134
```
131135

132136
### Standard Sign-in widget
133-
You can either create your own custom Sign-in widget, or make use of the standard built in one.
137+
You can either create your own custom sign-in widget, or make use of the standard built in one.
134138
To use the standard sign-in form with no changes:
135139

136140
```dart
@@ -139,9 +143,9 @@ LitAuth(
139143
);
140144
```
141145

142-
This will use the default configuration and UI theming. See the section on decoration and theming for customization.
146+
This will use the default configuration and UI theming. See the section on [decoration and theming](#decoration-and-theming) for customization.
143147

144-
**NOTE**: This widget needs to be below a `Scaffold` widget.
148+
**NOTE**: This widget needs to be a child of a `Scaffold` widget.
145149

146150
### Handle auth state changes
147151
To determine the current auth state, make use of `LitAuthState`:
@@ -213,7 +217,7 @@ context.getSignedInUser()
213217
## Decoration and theming
214218
The UI can be as customizable as you need. But for simple usage it's fairly straight forward.
215219

216-
It's easy to provide custom decoration/configuration for the sign-in elements. You can either customize the elements of the standard Sign-in widget, or create an entirely custom Sign-in widget from scratch. Up to you.
220+
It's easy to provide custom decoration/configuration for the sign-in elements. You can either customize the elements of the standard sign-in widget, or create an entirely custom sign-in widget from scratch. Up to you.
217221

218222
### Standard Sign-in widget customization
219223
For example, to override the standard email `InputDecoration` just provide a custom `InputDecoration` for the `emailTextFormField`:
@@ -251,7 +255,7 @@ For now dialog nessage are rendered using the `flushbar` package.
251255

252256
For further customization you can directly make use of the Lit Firebase components to build a completely custom sign-in widget.
253257

254-
Instead of using the standard `AuthConfig`, set it to custom and provide your custom Sign-in widget:
258+
Instead of using the standard `AuthConfig`, set it to custom and provide your custom sign-in widget:
255259
```dart
256260
LitAuth.custom(
257261
child: YourCustomSignInWidget(),

lib/src/presentation/core/extensions.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,48 @@ import '../../domain/auth/i_auth_facade.dart';
66
import '../../domain/auth/user.dart';
77

88
extension AuthContext on BuildContext {
9+
/// Signs out the current user. Also signs out Google Sign-In.
910
Future<void> signOut() async {
1011
Provider.of<AuthFacade>(this, listen: false).signOut();
1112
}
1213

14+
/// Registers the user with email specified by [EmailTextFormField]
15+
/// and password specified by [PasswordTextFormField].
16+
///
17+
/// Should only ever be used if you're creating your own custom sign-in
18+
/// form
1319
Future<void> registerWithEmailAndPassword() async {
1420
Provider.of<SignInHandlerStateNotifier>(this, listen: false)
1521
.registerWithEmailAndPassword();
1622
}
1723

24+
/// Sign-in the user with email specified by [EmailTextFormField]
25+
/// and password specified by [PasswordTextFormField].
26+
///
27+
/// Should only ever be used if you're creating your own custom sign-in
28+
/// form
1829
Future<void> signInWithEmailAndPassword() async {
1930
Provider.of<SignInHandlerStateNotifier>(this, listen: false)
2031
.signInWithEmailAndPassword();
2132
}
2233

34+
/// Perform sign-in with Google.
35+
///
36+
/// Should only be used if you're creating your own custom sign-in form
2337
Future<void> signInWithGoogle() async {
2438
Provider.of<SignInHandlerStateNotifier>(this, listen: false)
2539
.signInWithGoogle();
2640
}
2741

42+
/// Perform Firebase anonymous sign-in
43+
///
44+
/// Should only be used if you're creating your own custom sign-in form
2845
Future<void> signInAnonymously() async {
2946
Provider.of<SignInHandlerStateNotifier>(this, listen: false)
3047
.signInAnonymously();
3148
}
3249

50+
/// Retrieves the currently signed in user
3351
User getSignedInUser() {
3452
return Provider.of<User>(this, listen: false);
3553
}

0 commit comments

Comments
 (0)