This is how to set top margin:
Container(
color: Colors.blue,
margin: EdgeInsets.only(top: 20.0),
child: Text(
"My widget",
))
In a similar way you set the bottom margin like so:
Container(
color: Colors.blue,
margin: EdgeInsets.only(top: 20.0),
child: Text(
"My widget",
))
To set the left or right margin simply just change top to left or right inside the EdgeInsets.only function.
Set the left margin
EdgeInsets.only(left: 20.0)
Set the right margin
EdgeInsets.only(right: 20.0)
To set margin for all sides use the .all
Container(
color: Colors.blue,
margin: EdgeInsets.all(20.0),
child: Text(
"My widget",
))