pubspec.yarm中配置字体
fonts:
- family: iconfont
fonts:
- asset: assets/font/iconfont.ttf
- family: Roboto
fonts:
- asset: assets/font/Roboto-Regular.ttf
- asset: assets/font/Roboto-Medium.ttf
- asset: assets/font/Roboto-Bold.ttf
使用
final fontFamily = 'Roboto';
static TextStyle textStyle({ FontWeight fontWeight = FontWeight.normal ,Color color = Colors.black,double fontSize = 15}){
return TextStyle(
fontSize: fontSize,
color: color,
fontFamily: fontFamily,
fontWeight: fontWeight,
);
}
网友评论