Padding Widget

You can use Padding widget instead of Container widget with padding argument. There is not any difference at all. If you use Container widget with padding argument it will make the Container widget to make a Padding widget for you internally.

Container doesn't inplement its properties directly, instead Container combines a number of simple widgets and wraps them into a convenient package. For example, the Container.padding property causes the Container to build a Padding widget and the Container.decoration property causes the Container to build a DecoratedBox widget. Here is an example of Padding widget :

const Card(
	child : Padding(
		padding : EdgeInsets.all(8.0),
		child : Text("Hello world"),
	),
)

EdgeInsets for Padding

You need to use EdgeInsets class in order to specify padding or margin. This method has following three methods :

EdgeInsets.all()

The method all() is used to provide padding in all four sides equally. You can use double value which specifies the amount in pixel.

padding : EdgeInsets.all(8.0),

The above example, provides padding of 8.0 pixel to all four sides left, top, right and bottom.

EdgeInsets.symmentric()

This method provides padding vertically or horizontally or both.

padding : EdgeInsets.symmentric(horizontal:8.0),

The above example provides 8.0 pixel padding on left and right side.

padding : EdgeInsets.symmentric(vertical: 10.5),

The above example provides 10.0 pixel padding on top and bottom side.

padding : EdgeInsets.symmetric(horizontal: 3.0, vertical: 2.0),

The above example provides 3.0 pixel padding on left and right side and 2.0 pixel padding on top and bottom side. The order of the argument doesn't matter. Hence, the following example is also valid :

padding : EdgeInsets.symmetric(vertical: 2.0, horizontal : 3.0),

EdgeInsets.only()

When you want to explicitily provide padding to all four sides, you can use the method only()

padding : EdgeInsets.only(left:3.0, top: 4.0, right: 5, bottom : 6),
padding : EdgeInsets.only(left: 5, bottom: 7.3),

EdgeInsets.fromLTRB()

The term fromLTRB means "from Left Top Right Bottom", that means, the padding starts from left and it goes clockwise to bottom side. You must provide all four value to use this method. For example,

EdgeInsets.fromLTRB(10, 5.0, 5.0, 10),