【发布时间】:2018-09-06 18:29:09
【问题描述】:
用户已使用 firebase 电子邮件登录方式登录应用。 如何让 appbar 标题成为当前用户的邮箱?
class _HomePageState extends State<HomePage> {
final Future<String> userEmail = FirebaseAuth.instance.currentUser().then((FirebaseUser user) => user.email);
var e = "";
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
backgroundColor: Colors.black,
title: Text('userEmail'),
actions: <Widget>[
new FlatButton(
onPressed: _signOut,
child: new Text('logout', style: new TextStyle(fontSize: 17.0, color: Colors.white))
),
],
),
body: new Center(
child: new Text(
e,
style: new TextStyle(fontSize: 32.0),
),
)
);
}
}
【问题讨论】:
标签: firebase firebase-authentication flutter