How to remove the column space between Card
?
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Sample"),
),
body: Column(
children: <Widget>[
Card(
child: Padding(
padding: EdgeInsets.all(15),
child: Text("Card 1"),
)),
Card(
child: Padding(padding: EdgeInsets.all(15), child: Text("Card 2")),
)
],
),
);
}
Output
By default, the card
widget has a default margin
set to 4.0 logical pixels
, to eliminate the spaces, you can adjust the default margin
to your preference:
I added a demo using your widget tree as an example:
Column(
children: <Widget>[
Card(
// set the margin to zero
margin: EdgeInsets.zero,
child: Text("Card 1"),
),
Card(
// set the margin to zero
margin: EdgeInsets.zero,
child: Text(
"Card 2",
),
)
],
),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With