效果:


非常的简单。
.ttf的文件,即字体文件。

pubspec.yaml文件中配置字体...
flutter:
fonts:
- family: mononoki
fonts:
- asset: fonts/mononoki-Regular.ttf
weight: 500 child: Text(
"wanandroid_flutter V1.0",
style: TextStyle(fontSize: 25, fontFamily: 'mononoki'),
),Text的style中有一个fontFamily属性,参数即字体的名称。
官方文档:https://flutter.dev/docs/cookbook/design/fonts#from-packages