简单一个小例子:
class _OrderPageState extends State<OrderPage>{
final List<Tab> titleTabs = <Tab>[
Tab(
text: '全部',
),
Tab(
text: '待付款',
),
Tab(
text: '待发货',
),
];
child: Scaffold(
appBar: AppBar(
...
elevation: 0.0,
backgroundColor: Color.fromRGBO(26, 172, 255, 1),
title: TabBar(
isScrollable: true,
indicator: UnderlineTabIndicator(
borderSide: BorderSide(style: BorderStyle.none)),
tabs: titleTabs
),
),
body: Container(
color: Color.fromRGBO(26, 172, 255, 1),
child: TabBarView(
//TabBarView 默认支持手势滑动,若要禁止设置 NeverScrollableScrollPhysics
physics: NeverScrollableScrollPhysics(),
children: <Widget>[
Center(child:Text('view1')),