【发布时间】:2019-09-19 07:38:57
【问题描述】:
我在圆形容器中有一个文本,该文本来自 API。所以我无法控制文本的长度。我通过使用 FittedBox 缩小它来显示容器内的文本,不管它有多长。
Container(
height: 44,
width: 44,
padding: EdgeInsets.all(3),
alignment: Alignment.center,
child: Row(
children: [
Flexible(
child: FittedBox(
child: Text('Best Seller'),
),
),
],
),
decoration: BoxDecoration(shape: BoxShape.circle, color: Color(0xFFF37C43)),
)
我的问题是如何在新行中显示文本的所有单词,同时缩小它们。我正在考虑使用 Column 并从文本的每个单词生成子小部件。但这似乎不是很直观。如果需要,我愿意更改我的布局设计。
【问题讨论】:
-
为什么投反对票?
标签: flutter dart flutter-layout