Flutter-自定义字体不显示 [英] Flutter - Custom Font not displaying

查看:593
本文介绍了Flutter-自定义字体不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的pubspec.yaml文件的摘录:

This is an excerpt of my pubspec.yaml file:

flutter:
  uses-material-design: true
  fonts:
   - family: Coiny
     fonts:
       - asset: fonts/Coiny-Regular.ttf

我正在尝试使用Google字体页面中名为 Coiny的字体。我在根目录下创建了一个fonts文件夹,并将其放在其中。

I am trying to use the font called "Coiny" from the Google Fonts page. I created a fonts folder inside my root directory and put it in there.

在我的代码中,我这样做:

In my code, I do this:

new Text("Testtext", style: new TextStyle(fontFamily: "Coiny")),

但是没有效果。我过去在Barrio字体中遇到过类似的问题。

But it has no effect. I have encountered a similar problem in the past with the Barrio font. But it seemed to work after some time, which is not the case with this one.

推荐答案

您可能想尝试删除设备上的应用程序并重新安装。根据您的启动方式,它可能不会覆盖旧的安装文件。

You might want to try removing the app from the device and reinstalling it. Depending on how you're launching, it might not be writing over the old install file.

这篇关于Flutter-自定义字体不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆