刚学flutter,对TabController的使用很迷茫,按照官网的描述做了,但是出现错误,不知道怎么解决。
我只想在更改选项卡时更改标题并从应用栏引导。
final List<ChangeTitleAndLeading> _data = [
new ChangeTitleAndLeading(title: "Home", leading: Icon(Icons.home)),
new ChangeTitleAndLeading(title: "Profile", leading: Icon(Icons.person)),
new ChangeTitleAndLeading(title: "Friends", leading: Icon(Icons.people))
];
ChangeTitleAndLeading _handler;
TabController _controller;
@override
void initState() {
super.initState();
_checkEmailVerification();
_controller = TabController(vsync: this, length: 3);
_handler = _data[0];
_controller.addListener(_handleSelected);
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
void _handleSelected() {
setState(() {
_handler = _data[_controller.index];
});
}
return MaterialApp(
theme: new ThemeData(
primarySwatch: Colors.teal,
),
home: new Scaffold(
appBar: new AppBar(
leading: Icon(Icons.home),
title: new Text("Home"), …Run Code Online (Sandbox Code Playgroud) 如何将 firestore 时间戳更改为“2 天前或 1 小时前”之类的内容?我尝试直接显示它,但出来的数据是像Timestamp(seconds=1556459022, nanosecond=0).
怎么做?