Skip to content

Instantly share code, notes, and snippets.

@HelgeSverre
Created October 19, 2023 12:41
Show Gist options
  • Save HelgeSverre/db64490f836348654ca5fdab6b2d5e54 to your computer and use it in GitHub Desktop.
Save HelgeSverre/db64490f836348654ca5fdab6b2d5e54 to your computer and use it in GitHub Desktop.
Adding Inter font to Flutter
# The package "google_fonts" has a bug related to font weights,
# dont bother using it, just do this instead:
# Click "Download Family" on https://fonts.google.com/specimen/Inter
# Unzip the file and throw the .ttf files into assets/fonts/
# Specify the Font family in your code like so:
# MaterialApp(theme: ThemeData(fontFamily: "Inter"));
## Then add this config to your pubspec.yaml file
flutter:
assets:
- assets/fonts/
fonts:
- family: Inter
fonts:
- asset: assets/fonts/Inter-Thin.ttf
weight: 100
- asset: assets/fonts/Inter-ExtraLight.ttf
weight: 200
- asset: assets/fonts/Inter-Light.ttf
weight: 300
- asset: assets/fonts/Inter-Regular.ttf
weight: 400
- asset: assets/fonts/Inter-Medium.ttf
weight: 500
- asset: assets/fonts/Inter-SemiBold.ttf
weight: 600
- asset: assets/fonts/Inter-Bold.ttf
weight: 700
- asset: assets/fonts/Inter-ExtraBold.ttf
weight: 800
- asset: assets/fonts/Inter-Black.ttf
weight: 900
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment