Vertical viewport was given unbounded height


報錯

I/flutter ( 5510): Vertical viewport was given unbounded height.
I/flutter ( 5510): Viewports expand in the scrolling direction to fill their container. In this case, a vertical
I/flutter ( 5510): viewport was given an unlimited amount of vertical space in which to expand. This situation
I/flutter ( 5510): typically happens when a scrollable widget is nested inside another scrollable widget.
I/flutter ( 5510): If this widget is always nested in a scrollable widget there is no need to use a viewport because
I/flutter ( 5510): there will always be enough vertical space for the children. In this case, consider using a Column
I/flutter ( 5510): instead. Otherwise, consider using the "shrinkWrap" property (or a ShrinkWrappingViewport) to size
I/flutter ( 5510): the height of the viewport to the sum of the heights of its children.

 

 

在使用ListView報錯

 

解決方案

return ListView(
        shrinkWrap: true, // 加上這個就不會因為高度問題報錯
        children: navs,
      );

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM