- Flutter(75):Sliver组件之SliverFixed
- Flutter(70):Sliver组件之CustomScrol
- Flutter(74):Sliver组件之SliverPaddi
- Flutter(77):Sliver组件之SliverToBox
- Flutter(71):Sliver组件之SliverAppBa
- Flutter(72):Sliver组件之SliverList
- Flutter(76):Sliver组件之SliverProto
- Flutter(78):Sliver组件之SliverPersi
- Flutter(73):Sliver组件之SliverGrid
- flutter之Sliver
Flutter教学目录持续更新中
Github源代码持续更新中
1.SliverFixedExtentList
可以固定Item高度的SliverList
2.SliverFixedExtentList
- delegate:SliverChildDelegate
- itemExtent:item高度
3.使用
这个就是比SliverList多了item高度控制:Flutter(72):Sliver组件之SliverList
这里item内子控件高度是200,但是我们SliverFixedExtentList约束为100,那么item高度就会是100,如果内部高度小于100也一样会强制变为100
_mySliverAppBar() {
return SliverAppBar(
title: Text('SliverFixedExtentList'),
expandedHeight: 250,
flexibleSpace: FlexibleSpaceBar(
background: Image.network(
ImageUrlConstant.imageUrl1,
fit: BoxFit.cover,
),
collapseMode: CollapseMode.parallax,
),
);
}
_mySliverChildBuilderDelegate() {
return SliverChildBuilderDelegate(
(BuildContext context, int index) {
return Container(
height: 200,
color: Colors.primaries[index % 11],
);
},
childCount: 30,
);
}
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
child: CustomScrollView(
slivers: [
SliverFixedExtentList(
delegate: _mySliverChildBuilderDelegate(),
itemExtent: 100,
),
],
),
);
}

下一节:Sliver组件之SliverPrototypeExtentList
网友评论