flutter

TextField Widget Padding in Flutter

In Flutter, if you want to add padding in the TextField Widget you can use the contentPadding property. You can assign EdgeInserts to it to add a padding.

TextField(
    decoration: InputDecoration(
        contentPadding: EdgeInsets.symmetric(
            horizontal: 15.0, 
            vertical: 20.0
        ),
        hintText: 'Write your message...',
    ),
),

If you want to add a padding of 15px to the TextField widget then you can use the below code example.

TextField(
    decoration: InputDecoration(
        contentPadding: EdgeInsets.all(15.0),
        hintText: 'Placeholder Text...',
    ),
),
Was this helpful?