Flutter - Custom Font not displaying

前端 未结 12 2096
感动是毒
感动是毒 2021-01-03 20:11

This is an excerpt of my pubspec.yaml file:

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


        
相关标签:
12条回答
  • 2021-01-03 20:53

    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.

    0 讨论(0)
  • 2021-01-03 20:54

    Just Uninstall previous flutter app apk from your android device and again run application. This will resolve your problem. If this not working then clear device cache and try again.

    0 讨论(0)
  • 2021-01-03 20:56

    I had the other reason. Consider removing spaces from family name. For example, use "MavenPro" instead of "Maven Pro".

    Also check you put fonts section into flutter section.

    0 讨论(0)
  • 2021-01-03 21:00

    I tried everything but the changes in pubspec.yaml just did not make any difference. I then created a new project. copied font files to respective folder, made all changes to pubspec.yaml, pasted code into my main.dart file. I ensured everything was in place and then ran project in simulator and viola all fonts appeared in full glory.

    0 讨论(0)
  • 2021-01-03 21:03

    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

    0 讨论(0)
  • 2021-01-03 21:03

    Idek, sometimes I've found you need to totally kill your simulator or device and re-install to get some fonts to work. I've also found that some font just refuse to work. Try a different font to to confirm your sanity that your pubspec and TextThemes are actually correct with known working font.

    0 讨论(0)
提交回复
热议问题