简体   繁体   English

控制 Flutter 中 Text 小部件的字体大小

[英]Control the font size of Text widget in Flutter

Widgets become messy after changing the device font setting to the largest.将设备字体设置更改为最大后,小部件变得凌乱。 Any trick to control this behaviour so that I can change the device font settings, but widgets don't get messy?控制此行为的任何技巧,以便我可以更改设备字体设置,但小部件不会变得混乱?

You can adjust your widgets size with the help of textScale factor.您可以在 textScale 因子的帮助下调整小部件的大小。 The default value is 1.0.默认值为 1.0。

double height = MediaQuery.of(context).textScaleFactor;

Use this in you widgets to adjust some overflowing widgets you might have.在您的小部件中使用它来调整您可能拥有的一些溢出的小部件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM