Uncategorized

[Flutter]ListViewの中にGridViewを入れ子にする

ListViewの中に、GridViewをそのまま入れると、エラーになります。

The following assertion was thrown during performResize():
Vertical viewport was given unbounded height.

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. This 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.

これの解決方法です。

解決方法

入れ子の中にいれるGridViewに以下のプロパティを設定することで解決します。

shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),

 

-Uncategorized

© 2024 かずのアプリときどきキャンプ飯 Powered by AFFINGER5