Flutter-如何获得默认系统字体?
我在flutter应用程序中使用自定义字体:
return MaterialApp (
theme: ThemeData(
fontFamily: "MyFont"
)
)
但是在一个应用程序中,我需要使用“系统字体”。这对于iOS(SF Pro)尤其重要。如果我正确理解,这是iOS的系统字体。但是,如果我已经在应用程序级别使用“自定义字体”,我该如何使用“系统字体”?
我尝试了:
final fontFamily = DefaultTextStyle.of(context).style!.fontFamily;
但是此代码返回“ myfont”。
另外,我尝试从苹果网站。但是图像中只有一个大SF-pro.ttf(8MB)文件。不-sfpro-regular.ttf,sfpro-semibold.ttf ... flutter不支持.otf文件。
如何解决这个问题?我会感激的任何建议
I using custom font for my Flutter app:
return MaterialApp (
theme: ThemeData(
fontFamily: "MyFont"
)
)
but in one place of application I need to use "system font". this is especially important for iOS (Sf Pro). If I understand correctly, this is the system font for iOS. But how can I use "system font" if I already use "custom font" at application level?
I tried:
final fontFamily = DefaultTextStyle.of(context).style!.fontFamily;
But this code return "MyFont".
also I tried importing from apple site. but there is only one big SF-Pro.ttf(8Mb) file inside the image. Not - SFPro-Regular.ttf, SFPro-SemiBold.ttf ... Flutter does not support .otf files.
How to solve this problem? any advice I will be grateful
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论