如何设置溢出的长度: TextOverflow.ellipsis因为它会截断文本,就像你在img中看到的那样。文本“This is the first...”之间有一个空格。和数字“#1520”。溢出将截断“first...”之后的文本。单词。
我希望“现在发牌”这几个字能在行中显示出来。怎么解决呢?谢谢
Container(
color: Colors.grey,
child: ListTile(
title: Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(child: Text('This is the first card now its time sad sad sad sads ad sdsadsads dsa dsad asdasdasd', overflow: TextOverflow.ellipsis, style: TextStyle(color: Colors.white),)),
Flexible(child: Text('#1520', overflow: TextOverflow.ellipsis, style: TextStyle(color: Colors.white),)),
],
),
),
),
),

我不希望我的所有文本都可见,我只想在一行中显示一些单词。如果你看一下img,你会看到文本和#1520之间有一个空格。我想使用overflow和show:这是现在的第一张牌..#1520
发布于 2021-02-21 01:04:37
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Flexible(child: Text("This is the first card now its time sad sad sad sads ad sdsadsads dsa dsad asdasdasd", maxLines: 2, overflow: TextOverflow.ellipsis,)),
Flexible(child: Text("#1520"))
],
),发布于 2022-01-19 06:29:00
这是文本小工具处理溢出的默认行为-如果它检测到文本宽度大于它可以接受的宽度,它将截断带有单词的句子。正因为如此,有时它会导致截断文本和容器边缘之间出现意外的额外空间。
如果你不介意单词的一部分被覆盖,这里有一个简单的解决方案:
只需将softWrap: false应用于文本小部件即可。
Text(
'Long long long long long long text text text text text',
softWrap: false,
maxLines: 1,
overflow: TextOverflow.fade,
)https://stackoverflow.com/questions/66293818
复制相似问题