美文网首页
flutter 使用第三方字体

flutter 使用第三方字体

作者: 朱慢慢 | 来源:发表于2020-07-13 11:27 被阅读0次

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,
    );
  }

相关文章

网友评论

      本文标题:flutter 使用第三方字体

      本文链接:https://www.haomeiwen.com/subject/itxacktx.html