在Appbar上集成Tabbar切换卡
class StatePage extends StatelessWidget {
final title;
StatePage({this.title = ''});
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 11,
child: Scaffold(
appBar: AppBar(
title: Row(
children: <Widget>[
Expanded(
child: TabBar(
isScrollable: true,
tabs: <Widget>[
Tab(text: '直播'),
Tab(text: '推荐'),
Tab(text: '抢购'),
Tab(text: '热门'),
Tab(text: '追番'),
Tab(text: '影视'),
Tab(text: '70年'),
Tab(text: '热销'),
Tab(text: '影视'),
Tab(text: '70年'),
Tab(text: '热销'),
],
),
)
],
),
),
body: TabBarView(
children: <Widget>[
Text('影视'),
Text('推荐'),
Text('抢购'),
Text('热门'),
Text('追番'),
Text('影视'),
Text('70后'),
Text('80后'),
Text('影视'),
Text('70后'),
Text('80后'),
],
),
),
);
}
}