Skip to content

Commit e6c4b95

Browse files
docs: expand code example
1 parent 9546c90 commit e6c4b95

File tree

1 file changed

+31
-15
lines changed

1 file changed

+31
-15
lines changed

example/lib/main.dart

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class MyApp extends StatelessWidget {
88
Widget build(BuildContext context) {
99
return LitAuthInit(
1010
authProviders: AuthProviders(
11-
emailAndPassword: true,
11+
emailAndPassword: true, // enabled by default
1212
google: true,
1313
anonymous: true,
1414
),
@@ -43,13 +43,19 @@ class SplashScreen extends StatelessWidget {
4343
child: Text('Sign out'),
4444
),
4545
unauthenticated: LitAuth(
46+
/// STANDARD
4647
config: AuthConfig.standard(
4748
title: Text(
4849
'🔥Welcome to Lit Firebase!🔥',
4950
textAlign: TextAlign.center,
5051
style: Theme.of(context).textTheme.headline4,
5152
),
5253
),
54+
55+
/// CUSTOM
56+
// config: AuthConfig.custom(
57+
// signIn: CustomSignInWidget(),
58+
// ),
5359
),
5460
),
5561
),
@@ -58,6 +64,7 @@ class SplashScreen extends StatelessWidget {
5864
}
5965
}
6066

67+
/// A custom Sign-in widget built with Lit Firebase components
6168
class CustomSignInWidget extends StatelessWidget {
6269
const CustomSignInWidget({Key key}) : super(key: key);
6370

@@ -66,31 +73,40 @@ class CustomSignInWidget extends StatelessWidget {
6673
return Column(
6774
children: [
6875
Text('Welcome', style: Theme.of(context).textTheme.headline4),
69-
RaisedButton(
70-
onPressed: () {
71-
context.signInAnonymously();
72-
},
73-
child: Text('Anony Sign In'),
74-
),
7576
SignInForm(
7677
formChild: Column(
7778
children: [
78-
Text(
79-
'This is my custom form',
80-
style: Theme.of(context).textTheme.headline5,
79+
Padding(
80+
padding: const EdgeInsets.all(8.0),
81+
child: Text(
82+
'A custom form',
83+
style: Theme.of(context).textTheme.headline5,
84+
),
8185
),
82-
EmailTextFormField(
83-
decoration: InputDecoration(labelText: 'My Email Label'),
86+
Padding(
87+
padding: const EdgeInsets.all(8.0),
88+
child: EmailTextFormField(
89+
decoration: InputDecoration(labelText: 'My Email Label'),
90+
),
8491
),
85-
PasswordTextFormField(
86-
decoration: InputDecoration(labelText: 'My Password Label'),
92+
Padding(
93+
padding: const EdgeInsets.all(8.0),
94+
child: PasswordTextFormField(
95+
decoration: InputDecoration(labelText: 'My Password Label'),
96+
),
8797
),
8898
RaisedButton(
8999
onPressed: () {
90100
context.signInWithEmailAndPassword();
91101
},
92102
child: Text('Sign In'),
93-
)
103+
),
104+
FlatButton(
105+
onPressed: () {
106+
context.signInAnonymously();
107+
},
108+
child: Text('Anony Sign In'),
109+
),
94110
],
95111
),
96112
),

0 commit comments

Comments
 (0)