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 颤振:使两个列表视图可以作为一个滚动_Flutter_Dart - Fatal编程技术网

Flutter 颤振:使两个列表视图可以作为一个滚动

Flutter 颤振:使两个列表视图可以作为一个滚动,flutter,dart,Flutter,Dart,我想让屏幕像整个屏幕一样可以滚动 这就是我所知道的: Column( children: <Widget>[ Expanded( child: ListView( scrollDirection: Axis.horizontal, children: posts2b)), Expanded(child: ListVi

我想让屏幕像整个屏幕一样可以滚动

这就是我所知道的:

Column(
          children: <Widget>[

                 Expanded(
                    child: ListView(
                        scrollDirection: Axis.horizontal, children: posts2b)),

            Expanded(child: ListView(children: posts2a)),
          ],
        );
这一切都是可行的,但我希望这些列表视图作为一个滚动。因此,如果向下滚动,水平列表视图将“消失”

可能吗

谢谢大家!

像这样的

SingleChildScrollView(
  child: Column(
    mainAxisSize: MainAxisSize.min,
    children: <Widget>[
      SizedBox(
        height: 200,
        child: ListView(
          scrollDirection: Axis.horizontal,
          children: posts2b,
        ),
      ),
      Flexible(
        child: ListView(
          physics: NeverScrollableScrollPhysics(),
          shrinkWrap: true,
          children: posts2a,
        ),
      ),
    ],
  ),
)
使用SingleChildScrollView包装列,设置水平列表的高度,并通过添加物理来禁用垂直列表的滚动:NeverScrollableScrollPhysics

像这样的

SingleChildScrollView(
  child: Column(
    mainAxisSize: MainAxisSize.min,
    children: <Widget>[
      SizedBox(
        height: 200,
        child: ListView(
          scrollDirection: Axis.horizontal,
          children: posts2b,
        ),
      ),
      Flexible(
        child: ListView(
          physics: NeverScrollableScrollPhysics(),
          shrinkWrap: true,
          children: posts2a,
        ),
      ),
    ],
  ),
)

使用SingleChildScrollView包装列,设置水平列表的高度,并通过添加物理来禁用垂直列表的滚动:NeverScrollableScrollPhysics

所以若你们在其中一个列表上滚动,另一个应该会自动滚动,这有点奇怪?我相信你们在这个stackoverflow帖子中寻找的东西已经被修复了,所以若你们在其中一个列表上滚动,另一个应该会自动滚动,这有点奇怪?我相信你要找的已经在这个stackoverflow帖子中修复了谢谢,我试过了,但是有一个错误:底部的RenderFlex溢出了743像素。整个屏幕不会滚动…在我的例子中,物理:NeverScrollableScrollPhysics,有效。NeverScrollableScrollPhysics工作得非常好。谢谢,我试过了,但有一个错误:底部的RenderFlex溢出了743个像素。整个屏幕不会滚动…在我的例子中,物理:NeverscrollableScroll物理,有效。NeverscrollableScroll物理非常有效。