class _HomeViewState extends State<HomeView with SingleTickerProviderStateMixin{
TabController _tabController;
@override
void initState() {
super.initState();
_tabController = TabController(length: 2, vsync: this);
}
...
appBar: AppBar(
title: TabBar(
isScrollable: true,
controller: _tabController,
tabs: <Widget>[
Text('HomeList 1'),
Text('HomeList 2'),
],
),
),
body: TabBarView(
controller: _tabController,
children: <Widget>[
HomeList(data: '1'),
HomeList(data: '2'),
],
),
...
}
# tabBar的一些属性
this.controller,
this.isScrollable = false,
this.indicatorColor,
this.indicatorWeight = 2.0,
this.indicatorPadding = EdgeInsets.zero,
this.indicator,
this.indicatorSize,
this.labelColor,
this.labelStyle,
this.labelPadding,
this.unselectedLabelColor,
this.unselectedLabelStyle,