How can I change every text of my app to use a specific font? I can change them individually by using the TextStyle()
but how can I make my app default to a specific font? Can you show me how?
Asked
Active
Viewed 1.2e+01k times
68

Hussein Al-Mosawi
- 1,464
- 3
- 17
- 37
-
this link may solve your problem: https://stackoverflow.com/a/64549111 – Saeqa Feb 07 '21 at 19:14
-
What is the syntax to do this for CupertinoApp? – C RICH Feb 01 '23 at 01:19
4 Answers
108
You can change the default font family of your Flutter app by following the below steps:
1. Add your font files into your project folder. Say Project Folder > assets > fonts > hind
.
2. Declare the font family with font files with style in your project's pubspec.yaml
file as (An example):
- In the
MaterialApp
widget of your main class file, define the default font family as:

OMi Shah
- 5,768
- 3
- 25
- 34
-
-
-
1
-
-
-
1@OMiShah yeah I done everything correctly, but now it fixed I uninstalled app and then install it again :))) Thank you bro – Rasoul707 Mar 17 '22 at 22:08
48
If you want to use one of these Google fonts then use the official google_fonts package from the material team.
- add to pubspec.yaml
dependencies:
google_fonts: ^2.1.0
- Override the default font like this
MaterialApp(
theme: ThemeData(
textTheme: GoogleFonts.latoTextTheme(
Theme.of(context).textTheme,
),
),
);

Mahesh Jamdade
- 17,235
- 8
- 110
- 131
-
1There seems to be an issue with google_fonts it doesn't work with fontWeights that well. – UTKARSH Sharma Jul 11 '22 at 03:34
7
add google fonts to pubspec.yaml
dependencies:
google_fonts: ^2.1.0
use fontFamily function
MaterialApp(
theme: ThemeData(
fontFamily: GoogleFonts.lato().fontFamily,
),
);
remember to import google fonts
import 'package:google_fonts/google_fonts.dart';

Rohan Arora
- 303
- 2
- 12
1
For me it worked with all text widgets just when I wrote it twice -
ThemeData(
fontFamily: 'Varela', // <-- 1
textTheme: Theme.of(context)
.textTheme
.apply(fontFamily: 'Varela'), // <-- 2
),

ינון רחמים
- 566
- 1
- 5
- 12