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

查看:47
本文介绍了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天全站免登陆