SingleChildScrollView 和 StaggeredGridView嵌套使用和报错

来源:16-5 实现旅拍瀑布流布局-2

qq_大风吹_0

2019-09-19

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

如果在StaggeredGridView父级Container给定一个固定的高度能解决这个问题,但StaggeredGridView模块高度不确定改怎么解决呢~
要实现如下图中的效果 老师有没有更好的解决方案
图片描述

写回答

1回答

CrazyCodeBoy

2019-09-23

对于两个都是垂直滚动的组件需要设置下其中一个的高度

0
0

Flutter从入门到进阶 实战携程网App 一网打尽核心技术

解锁Flutter开发新姿势,,系统掌握Flutter开发核心技术。

4788 学习 · 3274 问题

查看课程