Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter - Custom Font not displaying

This is an excerpt of my pubspec.yaml file:

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

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")), 

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.

like image 964
OhMad Avatar asked Jun 05 '17 10:06

OhMad


People also ask

Does OTF work on Flutter?

The flutter recent version v1.12.13 does not support the open type font(otf) directly. You have to convert the otf to true type font(ttf) somehow. You can use this third-party website to covert the font to ttf before using it in your project.


2 Answers

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.

like image 115
Collin Jackson Avatar answered Oct 05 '22 12:10

Collin Jackson


I had the same issue. If you're testing via an emulator, you just need to stop and restart it. Via VSCode you can just stop the run process (Red square in the top right) and then run -> Run without debugging or Start Debugging

like image 39
Rockinoutt Avatar answered Oct 05 '22 12:10

Rockinoutt