非一般tabview使用,tabview和页面一起竖向滚动
基础使用
NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[SliverAppBar(
expandedHeight: 230.0,
pinned: true,
flexibleSpace: FlexibleSpaceBar(
title: Text('复仇者联盟'),
background: Image.network(
'http://img.haote.com/upload/20180918/2018091815372344164.jpg',
fit: BoxFit.fitHeight,
),
),
)];
},
body: ListView.builder(itemBuilder: (BuildContext context,int index){
return Container(
height: 80,
color: Colors.primaries[index % Colors.primaries.length],
alignment: Alignment.center,
child: Text(
'$index',
style: TextStyle(color: Colors.white, fontSize: 20),
),
);
},itemCount: 20,),
)
可实现
伪代码
return Scaffold(
backgroundColor: Colors.white,
body: Container(
margin: EdgeInsets.only(top: ScreenUtil.statusBarHeight),
child: NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverList(
delegate: SliverChildBuilderDelegate((content, index) {
return XXX;
}, childCount: 1),
),
];
},
body: TabBarView(
controller: _tabController,
children: List.generate(catlist.length, (index) {
return XXX;
}),
),
),
),
);