@override
Widget build(BuildContext context) {
return Scaffold(
body: CustomScrollView(
slivers: [
///头部
SliverToBoxAdapter(
child: Container(color: Colors.blue, width: ScreenUtils.screenWidth, height: 200,),
),
// SliverList(
// delegate: SliverChildBuilderDelegate(
// (context, index) {
// return Container(color: index % 2 == 0 ? Colors.yellow : Colors.red, height: 55,);
// },
// childCount: 20,
// ),
// ),
///列表
SliverGrid.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 1, mainAxisExtent: 55,),
itemBuilder: (BuildContext context, int index){
return Container(color: index%2 == 0 ? Colors.red: Colors.yellow,);
},
itemCount: 20,
),
///尾部
SliverToBoxAdapter(child: Container(color: Colors.blue, width: ScreenUtils.screenWidth, height: 200,),),
],
),
);
}
网友评论