Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- new ListTile(
- title: new Text("Log In"),
- leading: new Icon(Icons.account_box),
- onTap: () => _signIn()
- .then((FirebaseUser user) => print(user))
- .catchError((e) => print(e)),
- subtitle: StreamBuilder(
- stream: FirebaseAuth.instance.onAuthStateChanged,
- builder: (BuildContext context, AsyncSnapshot<FirebaseUser> snapshot) {
- var username='';
- if (snapshot.connectionState == ConnectionState.waiting) {
- return Text('loading');
- } else if (!snapshot.hasData) {
- username= 'you are not logged in';
- return Text(username);
- } else {
- username = snapshot.data.displayName;
- return Text(username);
- }
- },
- )
- ),
- new ListTile(
- title: new Text("Log Out"),
- leading: new Icon(Icons.account_circle),
- onTap: () => _signOut(),
- ),
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement