Advertisement
Guest User

Untitled

a guest
Jul 16th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 1.12 KB | None | 0 0
  1. new ListTile(
  2.               title: new Text("Log In"),
  3.               leading: new Icon(Icons.account_box),
  4.               onTap: () => _signIn()
  5.                   .then((FirebaseUser user) => print(user))
  6.                   .catchError((e) => print(e)),
  7.               subtitle: StreamBuilder(
  8.                 stream: FirebaseAuth.instance.onAuthStateChanged,
  9.                 builder: (BuildContext context, AsyncSnapshot<FirebaseUser> snapshot) {
  10.                   var username='';
  11.                   if (snapshot.connectionState == ConnectionState.waiting) {
  12.                     return Text('loading');
  13.                   } else if (!snapshot.hasData) {
  14.                     username= 'you are not logged in';
  15.                     return Text(username);
  16.                   } else {
  17.                     username = snapshot.data.displayName;
  18.                     return Text(username);
  19.                   }
  20.                 },
  21.               )
  22.             ),
  23.             new ListTile(
  24.               title: new Text("Log Out"),
  25.               leading: new Icon(Icons.account_circle),
  26.               onTap: () => _signOut(),
  27.             ),
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement