Text( 'Here will be the text', style: TextStyle( color: Colors.blue, fontWeight: FontWeight.bold, fontSize: 30.0, fontStyle: FontStyle.italic, fontFamily: 'cursive' ), ),
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
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.
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
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.
You can use fontStyle property to change the style of the font. You can pass the below values to it as a reference.
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.