

TextTheme: GoogleFonts.latoTextTheme(baseTheme.textTheme), Var baseTheme = ThemeData(brightness: brightness) You can also use GoogleFonts.latoTextTheme() to make or modify an entire text theme to use the "Lato" font. TextStyle: Theme.of(context).textTheme.headline4, To override the fontSize, fontWeight, or fontStyle: Text( Style: GoogleFonts.lato(textStyle: Theme.of(context).textTheme.headline4), TextStyle: TextStyle(color: Colors.blue, letterSpacing. To use GoogleFonts with an existing TextStyle: Text( Or, if you want to load the font dynamically: Text( To use GoogleFonts with the default TextStyle: Text( To import GoogleFonts: import 'package:google_fonts/google_fonts.dart' Useful for offline-first apps.įor example, say you want to use the Lato font from Google Fonts in your Flutter app.įirst, add the google_fonts package to your pubspec dependencies. Matching font files found in assets are prioritized over HTTP fetching. Font file caching, on device file system.Can also be used in production to reduce app size HTTP fetching at runtime, ideal for development.

Cause I had the same problem and the solution on top did not work for me.A Flutter package to use fonts from. From now, refer to this font by its font-family name in your styles.Save the file and move it at its final place and write the corresponding CSS tag to import these in your HTML page.woff file you got on path you write should be according to your server doc_root Edit desiredfontname.css and replace any url within it with the corresponding converted.zip file you downloaded (.ttf should be extracted) Do "File > Save page as." and name it "desiredfontname.css" (replace accordingly).Copy it on address bar in a new tab and go there.Select and copy the url between 'url(' and ')'.Slowly scroll the page until you see the 3 tabs Click tab.Click on "zip file" on the the popup message that appears.Click the download button on top with a down arrow image.Click the 'Use' tab button on bottom right of the page.Click the "See all styles" button near "Remove from collection" button and make sure that you have selected other styles you may also need such as 'bold'.Add the desired one to your collection using "Add to collection" blue button.Then just change the links in url() to your path to font files.Īnd then replace your example string with: įound a step-by-step way to achieve this (for 1 font): ( as of Sep-9 2013) Just change the url address to the local link on the font file, you've downloaded. Src: local('Open Sans Light'), local('OpenSans-Light'), url() format('woff') And then just use the to connect this font to your web page.ītw, if you open the link you are using, you'll see an example of using Just go to Google Fonts -, add the font you like to your collection, and press the download button.
