[英]flutter listTile with a long text for the Title
我有一個帶有長文本的 listTile 標題。
我希望標題盡可能多地顯示文字,在一行中......
如果我使用softWrap:true,溢出:TextOverflow.ellipsis,則文本在4個字符后被剪切
比如:例如……
如果我不使用 softWrap:true,溢出:TextOverflow.ellipsis,文本顯示為 3 或 4 行
我嘗試使用 FittedBox,但文字真的很小.. 無法閱讀....
任何想法如何得到這個?
標題:文本(inc.descricao,樣式:TextStyle(顏色:Colors.white,fontFamily:“Roboto”,fontSize:16,),
softWrap: true,
overflow: TextOverflow.ellipsis,
),
謝謝你羅克
使用帶有文本溢出的布局靈活/容器:
Flexible(
child: Container(
child: Text(
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 13.0,),
),
),
),
實際上, overflow: TextOverflow.ellipsis
應該可以工作。 我的猜測是 Text 小部件容器使 Text 小部件更短
嘗試將 Text 小部件包裝在具有最大寬度的容器中
Container(
width: double.infinity,
child: Text(
'reaaaaaly long text, like reaaaaaaaaaaaaaly long',
overflow: TextOverflow.ellipsis,
),
您可以使用文本屬性Overflow.elipsis。
ListTile(
shape: RoundedRectangleBorder(
minLeadingWidth: 0,
title: Text(
"Hello Overflow",
style: const TextStyle(
fontFamily: 'Open Sans',
fontSize: 15,
color: Color(0xff23233c),
letterSpacing: -0.44999999999999996,
fontWeight: FontWeight.w500,
),
softWrap: true,
overflow: TextOverflow.ellipsis,
),
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.