How to use Google Fonts and Text Themes in Flutter

July 28, 2020

Stop letting your Flutter projects look like everyone else’s! What’s the easiest way to fix it you may ask? Fonts. They’re such a simple form of customization but they can go a long way in helping an app or a website feel different than the norm. Luckily, Flutter makes it really easy to use Google Fonts, the king of free, open source font hosting.

The process is fairly straight forward.

  1. Add the Google Fonts plugin to your pubspec.yaml file
  2. Use the Material Text Scaling tool to generate your TextTheme data in dart code
  3. Paste the dart code into your main.dart file
  4. Import the google_fonts plugin to your main.dart
  5. That’s it! Now you can use your TextTheme data wherever you’d like in your app

Here’s 👇 a tutorial I created where I go a little more in depth on the steps above

Source code from the video