2

Now I have a design drawing, the title of which is PingFangSC-Semibold, and the content is PingFangSC-Regular.

How to use PingFangSC-Regular and PingFangSC-Semibold in Flutter?

The default font in Flutter seems to be SF. Do I need to introduce these two fonts, or how?

enter image description here

Davide Casiraghi
  • 15,591
  • 9
  • 34
  • 56

1 Answers1

0

For us custom font you can use this pages:

1.flutter

2.StackOverflow

But for this font no need to added the TTF file. just call it like this :

 Text(
              '取消',
              style: TextStyle(
                  fontSize: 28,
                  fontWeight: FontWeight.w400,
                  fontFamily: 'PingFangSC-Regular,PingFang SC'),
            ),
  • 1
    thanks.I've tried to introduce Pingfang sc into the project, but it doesn't seem to change much. Are the two fonts Pingfang SC and. SF particularly similar? And this TTF file is actually 10m, which is too large. Some articles seem to say that flutter supports this font by default? – zerong jiang Dec 29 '20 at 10:07
  • Do not add the TTF file, i update my answer now. – Mohammad Mirshahbazi Dec 29 '20 at 10:42
  • 1
    I found that fontWeight really works, and setting the font PingFangSC-Regular or PingFangSC-Semibold will not change the font weight. – zerong jiang Dec 30 '20 at 06:24