颤振柱删除空间之间的子项

时间:2020-09-24 11:14:59

标签: flutter dart flutter-layout

我想无间隙地堆叠多个孩子 但是它们加起来,中间有一个空白 我不知道为什么

这是我的示例代码

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      home: Scaffold(
        appBar: AppBar(title: Text('Title')),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: <Widget>[
              Container(
                width: 120,
                height: 50,
                color: Color(0xcc000000),
              ),
              Container(
                width: 120,
                height: 50,
                color: Color(0xcc000000),
              ),
              Container(
                width: 120,
                height: 50,
                color: Color(0xcc000000),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

这正在手机上运行屏幕截图 this is screenshot 我不知道为什么孩子之间会有白线

1 个答案:

答案 0 :(得分:0)

此白线不必一定存在。相同的代码在两个设备上运行,一个只有一个,而另一个只有两个 enter image description here

相关问题