首页 > 解决方案 > 如何在 Flutter 中根据屏幕大小调整测试大小?

问题描述

我正在 Flutter 上开发一个应用程序,我的主页中有一个包含两个文本小部件的列。问题是在手机上,文字大小正常,但在平板电脑上,文字太小看不清。您能否建议一种根据屏幕尺寸动态放大文本的方法?

小部件:

Column(
    children: [
      Text(
        widget.label,
        style: TextStyle(
            fontFamily: 'Roboto',
            color: Colors.white,
            fontWeight: FontWeight.bold),
      ),
      Text(
        widget.description,
        style: TextStyle(
            fontFamily: 'Roboto',
            color: Colors.white,
            fontWeight: FontWeight.w100),
      )
    ],
  ),

谢谢

标签: androidflutterdartmobile

解决方案


这个包在这里:

auto_size_text, https://pub.dev/packages/auto_size_text

有助于。


推荐阅读