Skip to main content

Flutter Change Text Font Size

The fontSize property of Text Style sets the size of font in pixels. It supports double means point value. Default font size is 14 logical pixels. To change the text font size in flutter all we have to do is pass the fontSize with our desired pixel size inside the style property.

Flutter Change Text Font Size:

1. Defining fontSize with 32.20 value on the Text widget. You can define your own value here. I'm using this value for just an example.
Text(
        'Demo Text',
        style: TextStyle(fontSize: 32.20),
      )
2. Complete 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(
        'Demo Text',
        style: TextStyle(fontSize: 32.20),
      ))),
    );
  }
}
Screenshot:
Flutter Change Text Font Size

Comments