Sie sind auf Seite 1von 2

Adding Fonts to Project Assets

○ Download the Ubuntu Font Family


▻ https://fonts.google.com/download?family=Ubuntu
○ Place in ./fonts/
▻ Ubuntu-Bold.ttf
▻ Ubuntu-Regular.ttf

fonts:
- family: Ubuntu
fonts:
- asset: fonts/Ubuntu-Regular.ttf
- asset: fonts/Ubuntu-Bold.ttf
Use Font Assets in Code

○ To use a font, simply call its name with


the fontFamily attribute style: new TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 132.0,
),
class CatBoxApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
theme: new ThemeData(
primarySwatch: Colors.blue,
accentColor: Colors.pinkAccent, Temporary increase
fontFamily: 'Ubuntu' font so we can view it
),
home: new CatList(),
easier
);
}
}

Das könnte Ihnen auch gefallen