flutter text padding code example

Example 1: how to add padding flutter

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

Example 2: content padding field text flutter

TextField(
          textAlign: TextAlign.left,
          decoration: new InputDecoration(hintText: "Enter Something", contentPadding: const EdgeInsets.all(20.0))
          )

Example 3: change padding in text field flutter

decoration: InputDecoration(
				contentPadding: const EdgeInsets.all(12), isDense: true,
			)

Example 4: flutter padding

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

Example 5: padding flutter top

new Container(
    margin: const EdgeInsets.only(top: 10.0),
    child : new RaisedButton(
                onPressed: _submit,
                child: new Text('Login'),
              ),

Tags:

Dart Example