Skip to main content

Flutter Set Letter Spacing on Text

 Letter spacing means the amount of space in logical pixels between each text letter. Flutter has a Text style property letterSpacing used to set letter spacing on text. It support double number format value. One more thing it also support negative value to bring each character close.

Flutter Set Letter Spacing on Text:

1. Defining a Text widget and applying letterSpacing on Text.
Text(
        'Sample Text for letter Spacing',
        style: TextStyle(fontSize: 24, letterSpacing: 5.5),
      )
Screenshot of app with letter spacing:
Flutter Set Letter Spacing on Text
Screenshot of app without letter spacing:
Without letter spacing text in flutter
2. Source code for main.dart file:
import 'package:flutter/material.dart';

void main() => runApp(App());

class App extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(
          body: Center(
              child: Text(
        'Sample Text for letter Spacing',
        style: TextStyle(fontSize: 24, letterSpacing: 5.5),
      ))),
    );
  }
}

Comments