通過查看以下螢屏截圖,很容易理解我想要做什么。
當沒有太多文本時,我希望標簽依偎在它上面。

當文本不完全適合一行時,我希望它像螢屏截圖中那樣溢位。

有沒有人遇到過類似的問題并知道如何以正確的方式解決?
更新 1 我已經嘗試過什么?
- 富文本
RichText(
overflow: TextOverflow.ellipsis,
text: TextSpan(
children: [
TextSpan(...),
WidgetSpan(
child: ...,
),
],
),
)
展開的行。結果,正如預期的那樣,標簽不再固定在文本上。
行(孩子:[擴展(孩子:文本(文本,溢位:TextOverflow.ellipsis,),),標簽(),],),
uj5u.com熱心網友回復:
我正在使用RowwithFlexible<Text>來處理這種情況。
Row(
children: [
Flexible(
child: Text(
"Left most text that overflows the screen and creates an ellipsis",
maxLines: 1,
overflow: TextOverflow.ellipsis,
softWrap: false,
),
),
Container(
width: 40,
height: 40,
color: Colors.amber,
)
],
),

轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/427315.html
