Flutter-自定义字体不显示

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.