Letter Spacing in TextFieldForm in Flutter

Viewed 12447

How to add letter spacing in textfieldform widget just like in Text widget there is an option of letter spacing.

2 Answers

If you want letter spacing in normal text, use style property as shown below:

TextFormField(
  style: TextStyle(
    letterSpacing: 2.0,
  ),
),

If you want letter spacing in label text, use labelstyle property in input decoration as shown below

TextFormField(
  decoration: InputDecoration(
    labelText: 'Test',
    labelStyle: TextStyle(
       letterSpacing: 2.0,
    ),
 ),
),

In the same way you can style hint text too using hint style property.

Use the TextStyle widget:

TextFormField(
  style : TextStyle(letterSpacing : 2.0),
  // The validator receives the text that the user has entered.
  validator: (value) {
    if (value.isEmpty) {
      return 'Please enter some text';
    }
    return null;
  },
),
Related