[英]How to nest a TabBarView's ListView in a CustomScrollView?
The thing I want to layout is like this我要布局的东西是这样的
Because I want the ListView scroll with outside, So I want to make the ListView to the SliverListView.
因为我想让 ListView 滚动到外面,所以我想让 ListView 变成 SliverListView。
But this will make the error:但这会产生错误:
A RenderRepaintBoundary expected a child of type RenderBox but received a child of type RenderSliverList.
RenderRepaintBoundary 需要 RenderBox 类型的子级,但接收到 RenderSliverList 类型的子级。
What's the best practice to do this kind of layout?做这种布局的最佳做法是什么? do I have to change CustomScrollView to NestedScrollView?
是否必须将 CustomScrollView 更改为 NestedScrollView?
Since SliverListView
is a Sliver
widget, it can only be the direct child of CustomScrollView
.由于
SliverListView
是一个Sliver
小部件,它只能是CustomScrollView
的直接子级。 Use it inside the TabBarView
will cause the above error since TabBarView
expect a RenderBox
widget, not a Sliver
.在
TabBarView
中使用它会导致上述错误,因为TabBarView
需要一个RenderBox
小部件,而不是Sliver
。
In order to sync the scroll with the CustomScrollView
, you can use this property:为了使滚动与
CustomScrollView
同步,您可以使用此属性:
ListView(
physics: NeverScrollableScrollPhysics(),
// ... other lines
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.