import 'package:flutter/material.dart'; void main() { runApp( new MaterialApp( home: new TestPage2(), ), ); } class TestPage2 extends StatefulWidget { @override _TestPageState2 createState() => new _TestPageState2(); } class _TestPageState2 extends State { Widget _buildItem(BuildContext context, int index) { return new ListTile( title: new Text('Title $index'), subtitle: new Text('Subtitle $index'), ); } Widget _buildTab(int listSize) { return new Builder( builder: (BuildContext context) { return new CustomScrollView( slivers: [ new SliverOverlapInjector( handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), ), new SliverPersistentHeader( pinned: true, delegate: new FixedHeader( height: 48.0, child: new Material( elevation: 4.0, color: Colors.white, child: new Container( child: new Center( child: const Text('Here my fixed header 1'), ), ), ), ), ), new SliverList( delegate: new SliverChildBuilderDelegate( _buildItem, childCount: listSize, ), ), ], ); }, ); } @override Widget build(BuildContext context) { return new RefreshIndicator( onRefresh: () {}, child: new DefaultTabController( length: 2, child: new Scaffold( body: new NestedScrollView( headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { return [ new SliverOverlapAbsorber( handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), child: new SliverAppBar( backgroundColor: Colors.black26, title: new Text('Here title'), pinned: true, floating: true, bottom: new TabBar( tabs: [ new Tab(text: 'Tab1'), new Tab(text: 'Tab2'), ], ), ), ), ]; }, body: new TabBarView( children: [ _buildTab(30), _buildTab(5), ], ), ), ), ), ); } } class FixedHeader extends SliverPersistentHeaderDelegate { const FixedHeader({ this.height, this.child }); final double height; final Widget child; @override double get minExtent => height; @override double get maxExtent => height; @override Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) { return child; } @override bool shouldRebuild(FixedHeader oldDelegate) { return height != oldDelegate.height || child != oldDelegate.child; } }