【发布时间】:2022-01-02 16:28:53
【问题描述】:
【问题讨论】:
【问题讨论】:
你应该使用pub.dev中的auto_size_text,
AutoSizeText(
'A really long String',
style: TextStyle(fontSize: 12),
minFontSize: 4,
maxLines: 1,
overflow: TextOverflow.ellipsis,
)
【讨论】:
您可以用 FittedBox 包裹您的 Text Widget 并提供最大 width。
在 Text 小部件中将 maxLines 设置为 1。
SizedBox(
height: size.height * 0.1,
width: size.width * 0.28,
child: FittedBox(
child: Text(
"$number ",
maxLines: 1,
),
),
)
【讨论】: