问题:
如何在列表滚动时隐藏 AppBar ?
解决方法:
使用NestedScrollView
:
new Scaffold( body: new NestedScrollView( controller: _scrollViewController, headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { return <Widget>[ new SliverAppBar( title: new Text(widget.title), pinned: true, floating: true, forceElevated: innerBoxIsScrolled, bottom: new TabBar( tabs: <Tab>[ new Tab(text: "STATISTICS"), new Tab(text: "HISTORY"), ], controller: _tabController, ), ), ]; }, body: new TabBarView( children: <Widget>[ new StatisticsPage(), new HistoryPage(), ], controller: _tabController, ), ), );