您好,我在一个列内使用水平滚动的 Listview,该列位于 singleChildScrollView 内,实际上我需要用一个固定高度的容器/大小的框来包装它,因为它的默认行为是占据整个屏幕的高度。
有没有可能使 ListView 只需要所需的高度(类似于收缩包装,但对于 crossAxis)?还是有任何其他小部件可以帮助实现这一目标?
return SingleChildScrollView(
child: Column(children: [
//Some other widgets
Container(
height: size.height / 2,
child: ListView.builder(
physics: BouncingScrollPhysics(),
itemCount: offersProvider.offers.length,
scrollDirection: Axis.horizontal,
shrinkWrap: true,
itemBuilder: (context, index) => OfferListItem(
offerItem: offersProvider.offers[index],
),
),
),
],),
);