![]() |
VOOZH | about |
Any UI developer that builds an application has to deal with fonts. Google Fonts provides a wide range of fonts that can be used to improve the fonts of the User Interface. Flutter provides a Google fonts package that can be used to implements various available fonts.
Some fonts that are available for use through the Google fonts package are listed below:
Use the Google fonts dependency in the pubspec.yaml as shown below:
dependencies:
google_fonts: ^6.2.1
Now run the below command in terminal.
flutter pub getTo import the dependency in the main.dart file as below:
import 'package:google_fonts/google_fonts.dart';Use the StatelessWidget to give a simple structure to the application as shown below:
To design, the homepage for the application makes use of the StatefulWidget. Initiate the state at 0 that counts the number of clicks on the button that we will be adding to the homepage.
The font that we will be Oswald font and Lato font. In the TextStyle property you can add the same as shown below:
To know more about Column in flutter refer this article: Flutter – Row and Column Widgets
Output: