Created
April 5, 2018 00:09
-
-
Save timsneath/a884bf996b3f667681dc4d36a5d36498 to your computer and use it in GitHub Desktop.
Adding a font to existing Flutter code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// declaring a text style based on custom font | |
const jokeTextStyle = const TextStyle( | |
fontFamily: 'Patrick Hand', | |
fontSize: 34.0, | |
color: Colors.black87, | |
letterSpacing: -0.5, | |
fontStyle: FontStyle.normal, | |
fontWeight: FontWeight.normal); | |
// now all we have to do is add a style to the Text widget | |
final decoded = json.decode(snapshot.data); | |
if (decoded['status'] == 200) { | |
return new Text(decoded['joke'], style: jokeTextStyle); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment