@override Widget build(BuildContext context) { return DefaultTabController( length: 2, child: Scaffold( appBar: AppBar( title: TabBar( isScrollable: true, indicatorColor: Colors.red, labelColor: Colors.red, unselectedLabelColor: Colors.white, indicatorSize: TabBarIndicatorSize.label, tabs: [ Tab( text: '第一个界面', ), Tab( text: '第二个界面', ) ], ), ), body: TabBarView(children: [ ListView( children: [ ListTile( title: Text('第1个界面'), ), ListTile( title: Text('第1个界面'), ), ListTile( title: Text('第1个界面'), ), ], ), ListView( children: [ ListTile( title: Text('第2个界面'), ), ListTile( title: Text('第2个界面'), ), ListTile( title: Text('第2个界面'), ), ], ) ]), floatingActionButton: FloatingActionButton( child: Text('返回'), onPressed: () { Navigator.of(context).pop(); }, ), )); }