Vertical viewport was given unbounded height

发布时间:2022-02-03 23:33:49

先可以使用下列方式

ListView.builder(
    scrollDirection: Axis.vertical,
    shrinkWrap: true,

出现以下错误信息可以使用Expanded

Viewports expand in the scrolling direction to fill their container. In this case, a vertical viewport was given an unlimited amount of vertical space in which to expand. T his situation typically happens when a scrollable widget is nested inside another scrollable widget.

If this widget is always nested in a scrollable widget there is no need to use a viewport because there will always be enough vertical space for the children. In this case, consider using a Column instead. Otherwise, consider using the "shrinkWrap" property (or a ShrinkWrappingViewport) to size the height of the viewport to the sum of the heights of its children.

使用
 Expanded(
          child:

Card image cap
APP STORE
Card image cap
应用宝
Card image cap
小米
Card image cap
华为