我正在嘗試創建一個通用組件,左側是影像,右側是介紹。介紹長的時候,組件渲染不好。
我知道有一種眾所周知的包裝小部件的方法,Text并且Flexible已經嘗試過。那沒有用。
我在 dartpad 上有一個例子。誰能告訴我如何讓它在這里顯示而不會溢位?
https://dartpad.dev/?id=ee205a74591b34665c04abecc5012211
uj5u.com熱心網友回復:
在列小部件中添加一行。然后,如果您添加一個靈活的小部件,文本將在溢位時下降
Column(
children : [
Text("some small text here"),
Row(
children : [
Flexible(
child : Text("Really long text here"),
)
]
)
]
}
uj5u.com熱心網友回復:
return GestureDetector(
child: Row(children: [
// alt image component
SizedBox(
height: 100,
width: 100,
child: Container(
color: Colors.red,
),
),
// item description
Expanded(
child: Column(
children: [
Text("user name"),
Text(
"user comment text: jump jump jump high jump high jump big jump big jump choo choo choo ya ya ya ri ri ri uh uh uh user comment text: jump jump jump high jump high jump big jump big jump choo choo choo ya ya ya ri ri ri uh uh uh"),
],
),
),
]));
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/497922.html
上一篇:顫振錯誤:位置引數太多:預期為0,但在流構建器中找到1
下一篇:如何用圓形設定背景顏色?
