flutter column remove children between space

80 views Asked by At

I wanted to stack multiple children together without gaps But they add up and there's a white gap in the middle I don't know why

this is my sample code

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 running on a phone Screenshot this is screenshot I don't know why there are white lines between children

1

There are 1 answers

1
Liao On

This white line doesn't have to be there. The same code runs on two devices, one with only one, and the other with two enter image description here