简体   繁体   English

如何在 Flutter 中制作响应式文本

[英]How to make responsive text in Flutter

What should I do to make responsive text in Flutter?我应该怎么做才能在 Flutter 中制作响应式文本? I mean texts that look good in different screen resolutions.我的意思是在不同屏幕分辨率下看起来不错的文本。

通过使用flutter_screenutil包使其负责。

You can make it responsive by using auto_size_text , AutoSizeText behaves exactly like a Text.您可以使用auto_size_text使其具有响应性,AutoSizeText 的行为与文本完全相同。 The only difference is that it resizes text to fit within its bounds.唯一的区别是它调整文本大小以适应其范围。

AutoSizeText( 'The text to display', style: TextStyle(fontSize: 20), maxLines: 2,)

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

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