Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/193.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 颤栗:ListView里的一行给了我权利溢出_Flutter - Fatal编程技术网

Flutter 颤栗:ListView里的一行给了我权利溢出

Flutter 颤栗:ListView里的一行给了我权利溢出,flutter,Flutter,我想修复我的图标容器,然后使卡容器可滚动。然而,我得到了正确的溢出错误。我认为这是因为图标容器的宽度。如何使图标固定在适当的位置,同时使ListView垂直滚动 return Row( children: [ Container( height: 150, color: Colors.amber, child: Column( mainAxisAlignment: MainAxisAl

我想修复我的
图标容器
,然后使
卡容器
可滚动。然而,我得到了正确的溢出错误。我认为这是因为
图标容器的宽度。如何使图标固定在适当的位置,同时使ListView垂直滚动

return Row(
      children: [
        Container(
          height: 150,
          color: Colors.amber,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: [
              IconButton(
                iconSize: 20,
                icon: Icon(Icons.add_circle_outline),
                onPressed: () {
                  print('hello');
                },
              ),
            ],
          ),
        ),
        Container(
          color: Colors.white,
          height: 150,
          child: ListView(
            shrinkWrap: true,
            scrollDirection: Axis.horizontal,
            children: [
              Card(
                child: Container(
                    color: Colors.grey,
                    width: 150,
                    child: Text('hello'),
                  ),
                ),
              ),
              Card(
                child: Container(
                    color: Colors.grey,
                    width: 150,
                  ),
                ),
              ),
            ],
          ),
        ),
      ],
    );
-----编辑

上面代码的结果是这样的。我想做的是

  • 图标按钮位于固定位置
  • 卡片可以水平滚动
没有
右溢出
警告


尝试用展开的:

return Row(
      children: [
        Container(
          height: 150,
          color: Colors.amber,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: [
              IconButton(
                iconSize: 20,
                icon: Icon(Icons.add_circle_outline),
                onPressed: () {
                  print('hello');
                },
              ),
            ],
          ),
        ),
        Expanded(child:
        Container(
          color: Colors.white,
          height: 150,
          child: ListView(
            shrinkWrap: true,
            scrollDirection: Axis.horizontal,
            children: [
              Card(
                child: Container(
                    color: Colors.grey,
                    width: 150,
                    child: Text('hello'),
                  ),
                ),
              ),
              Card(
                child: Container(
                    color: Colors.grey,
                    width: 150,
                  ),
                ),
              ),
            ],
          ),),
        ),
      ],
    );

在您的代码中,您必须将滚动方向定义为水平,改进您的问题,并清楚地写下您到底想做什么?请也改进您提交的代码,以便我们能够找到问题。对不起,各位。我以为照片包括在内了。我刚刚编辑过