flutter pad code example

Example 1: flutter margins

Container (
	// Even Margin On All Sides
    margin: EdgeInsets.all(10.0),
    // Symetric Margin
    margin: EdgeInsets.symmetric(vertical: 10.0, horizontal: 5.0),
    // Different Margin For All Sides
    margin: EdgeInsets.fromLTRB(1.0, 2.0, 3.0, 4.0);
    
    child: Child
    (
    	...
    ),
)

Example 2: flutter padding

const Card(
  child: Padding(
    padding: EdgeInsets.all(16.0),
    child: Text('Hello World!'),
  ),
)

Example 3: online dart compiler

Just go on dartpad.dev, designed by Google to run Dart code online!

Example 4: flutter listview top padding

you should wrap the ListView with a MediaQuery.removePadding widget (with removeTop: true).

Tags:

Cpp Example