Skip to main content

Create Bold Style Text in Flutter

 Hello guys, The text widget the Style property has a sub property TextStyleTextStyle contains all the text styling options and one of them is fontWeightfontWeight create bold style text in flutter. It has 11 sub properties which can make text bold in 11 different ways.

Properties of fontWeight in flutter:

  1. FontWeight.bold
  2. FontWeight.normal
  3. FontWeight.w100
  4. FontWeight.w200
  5. FontWeight.w300
  6. FontWeight.w400
  7. FontWeight.w500
  8. FontWeight.w600
  9. FontWeight.w700
  10. FontWeight.w800
  11. FontWeight.w900

How to Create Bold Style Text in Flutter:

1. Open your flutter project's main.dart file and create Text widget with fontWeight.
Text(
        'Sample Text',
        style: TextStyle(fontWeight: FontWeight.bold),
      )
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(
        'Sample Text',
        style: TextStyle(fontWeight: FontWeight.bold),
      ))),
    );
  }
}
Screenshot of flutter app:
Create Bold Style Text in Flutter

Comments