[英]Flutter: Dynamic sized Widget in ListView
I would like to create a page with a ListView with a dynamically sized widget to archive this behavior:我想创建一个带有 ListView 的页面,其中包含一个动态大小的小部件来存档此行为:
The dynamically sized widget (shown in red) has a minimal and maximal size.动态大小的小部件(以红色显示)具有最小和最大尺寸。
How can I archive this behavior in flutter?如何在颤振中存档此行为?
You can use SliverAppBar with a flexibleSpace all inside a CustomScrollView您可以在CustomScrollView 中使用带有灵活空间的 SliverAppBar
CustomScrollView(
slivers: <Widget>[
SliverAppBar(
floating: false,
pinned: true,
snap: false,
expandedHeight: 150.0,
flexibleSpace: FlexibleSpaceBar(
title: Text("SliverAppBar Widget"),
),
),
SliverFixedExtentList(
itemExtent: 50.0,
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return Container(
alignment: Alignment.center,
color: Colors.lightBlue[100 * (index % 9)],
child: Text('List Item $index'),
);
},
),
),
],
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.