Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 在CustomScrollView中使用PageView_Flutter_Dart - Fatal编程技术网

Flutter 在CustomScrollView中使用PageView

Flutter 在CustomScrollView中使用PageView,flutter,dart,Flutter,Dart,我有一个CustomScrollView,其中包含:- 1-具有小部件树的SliveToboxAdapter 2-切片列表 问题发生在我使用PageView包装SliverList时 这很正常,因为CustomScrollView只接受条子 代码片段 运行结果 RenderViewport需要RenderShiver类型的子项,但收到RenderPaintBoundary类型的子项。RenderObjects需要特定类型的子对象,因为它们在布局和绘制期间与其子对象进行协调。例如,RenderSh

我有一个CustomScrollView,其中包含:-

1-具有小部件树的SliveToboxAdapter

2-切片列表

问题发生在我使用PageView包装SliverList时 这很正常,因为CustomScrollView只接受条子

代码片段

运行结果


RenderViewport需要RenderShiver类型的子项,但收到RenderPaintBoundary类型的子项。RenderObjects需要特定类型的子对象,因为它们在布局和绘制期间与其子对象进行协调。例如,RenderShiver不能是RenderBox的子级,因为RenderShiver不理解RenderBox布局协议。

我使用NestedScrollView解决了此问题:-

header属性具有SliverToBoxAdapter,它接受碎片


body属性有PageView它不接受碎片

我使用NestedScrollView解决了这个问题:-

header属性具有SliverToBoxAdapter,它接受碎片


body属性具有PageView它不接受片段

如果PageView是SliverToBoxAdapter``CustomScrollView片段:[SliverToBoxAdapterchild:PageViewchildren:[SliverList],]``我以前考虑过这个解决方案,但它似乎不是最佳实践方法@Tomrobinson页面视图应该是SliverToBoxAdapter的子级`` CustomScrollView片段:[SliverToBoxAdapterchild:PageViewchildren:[SliverList],]“我以前考虑过这个解决方案,但它似乎不是最佳实践方法@TomRobinson
        CustomScrollView(
          slivers: <Widget>[
            SliverToBoxAdapter(child : ),
        PageView(children: <Widget>[SliverList()])]