Chrome Extension

Change text style in flutter

Text(
    'Here will be the text',
    style: TextStyle(
        color: Colors.blue,
        fontWeight: FontWeight.bold,
        fontSize: 30.0,
        fontStyle: FontStyle.italic,
        fontFamily: 'cursive'
    ),
),
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool

You can change text styles of fonts in Flutter by using TextStyle and pass the required properties to it. Here, we are changing color, font weight, font size, font style and font family of text. The description of properties used in the code snippet to change text style is as below

Color

You can change the color of the text in a flutter by using color property and by assigning proper value to it. For example, you can pass the below values.

Colors.blue

Color(0xffFF0000)

fontWeight

If you want to change the font-weight of text means you want to make it bold or thin you can use fontWeight property for that and pass FontWeight.bold to make it bold FontWeight.normal to make it look as it is by default. Some of the option to be passed in fontWeight are found as below

FontWeight.bold

FontWeight.normal

FontWeight.w100

fontSize

To change the size of fonts you can use fontSize property. You can pass any value that you want in it but it must be an int or float type. We have passed 30.0 to it.

fontStyle

You can use fontStyle property to change the style of the font. You can pass the below values to it as a reference.

FontStyle.italic

FontStyle.normal

fontFamily

To change the font family of text, fontFamily property is used and you can add and apply it value to it. We have used the 'cursive' value as an example.

Was this helpful?
0 Comments
Join Devsheet Ask a Question