ConstrainedBox(
constraints: BoxConstraints(
maxHeight: 250.h,
),
child: Container(
color: Colors.white,
child: ListView(
shrinkWrap: true,
children: [
Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
margin: EdgeInsets.only(top: 10.h),
),
Wrap(
alignment: WrapAlignment.start,
runAlignment: WrapAlignment.start,
crossAxisAlignment: WrapCrossAlignment.start,
runSpacing: 10.w,
spacing: 7.w,
children: List.generate(
widget.listSmallTempIndData.length,
(index) {
return buildButton(index);
},
)),
],
),
],
),
),
),
主要是红字代码字段
首先假如限制控制最大显示高度控件 ,再让listview 对高度 自适应