在我的 Flutter 任務應用程式中,我的專案有一個網格視圖,如果文本很長,它會縮短字串值。全文視圖的任何解決方案?

uj5u.com熱心網友回復:
你應該使用auto_size_textfrom pub.dev,
AutoSizeText(
'A really long String',
style: TextStyle(fontSize: 12),
minFontSize: 4,
maxLines: 1,
overflow: TextOverflow.ellipsis,
)
uj5u.com熱心網友回復:
你可以用FittedBox包裹你的Text Widget并給出最大寬度。
在Text小部件中將 maxLines設定為 1 。
SizedBox(
height: size.height * 0.1,
width: size.width * 0.28,
child: FittedBox(
child: Text(
"$number ",
maxLines: 1,
),
),
)
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/402074.html
