Container(
margin: EdgeInsets.all(40.0),
child: Text(
'Hello world'
),
),
If you want to add margin or some space around a Container widget in Flutter, you can use margin property for that and apply value to it by using 'EdgeInserts'. In the above code snippet, we have added a '40.0' margin around the Container. 'EdgeInserts.all' is used to add margin around all-sided uniformly.
To add different margins from specific sides use below code
To add padding horizontally or vertically in symmetric, use