I created a Container with red color as background, and another one with white color as its child. I think the red one will be fully covered by the white one. Instead, I see two red lines on top and bottom of the container. Its like the Container has top and bottom padding, and I can't remove it.
How to remove it (the top and bottom padding?) so that the white fully cover the red one?
The red line shows like the container has top and bottom padding
update: Just tested it on a new project, and it shows perfectly, no padding. Any idea what causing this?
class Test extends StatefulWidget {
Test(Object args);
@override
State<StatefulWidget> createState() {
return ContainerTest();
}
}
class ContainerTest extends State<Test>{
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Container(
color: Colors.white,
alignment: Alignment.center,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: Text("some text"),
),
Container(
width: 200,
height: 200,
color: Colors.red,
child: Container(
color: Colors.white,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text("some text"),
),
],
),
),
);
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.