英文:
Add multiple line in Row Widget
问题
I have wrapped 3 Text in Row, but get exceptions. How can I make them displayed multiple line ?
在Row中包装了3个文本,但出现了异常。如何使它们显示为多行?
Error
错误
A RenderFlex overflowed by 26 pixels on the right.
The relevant error-causing widget was
Row
RenderFlex在右侧溢出了26像素。
引发错误的相关小部件是Row。
英文:
I have wrapped 3 Text in Row, but get exceptions. How can I make them displayed multiple line ?
Row(children: [
Text("this is text 1 bla bla bla"),
Text("this is text 2 bla bla bla"),
Text("this is text 3 bla bla bla"),
],),
Error
════════ Exception caught by rendering library ═════════════════════════════════
A RenderFlex overflowed by 26 pixels on the right.
The relevant error-causing widget was
Row
答案1
得分: 0
你可以使用 Flexible
来解决这个问题
Row(children: [
Flexible(child: Text("这是文本 1 嗡嗡嗡")),
Flexible(child: Text("这是文本 2 嗡嗡嗡")),
Flexible(child: Text("这是文本 3 嗡嗡嗡")),
])
或者你可以使用 Wrap
来展示成一个网格
Wrap(children: [
Text("这是文本 1 嗡嗡嗡"),
Text("这是文本 2 嗡嗡嗡"),
Text("这是文本 3 嗡嗡嗡"),
])
英文:
You can use Flexible
to solve this
Row(children: [
Flexible(child: Text("this is text 1 bla bla bla")),
Flexible(child: Text("this is text 2 bla bla bla")),
Flexible(child: Text("this is text 3 bla bla bla")),
])
Or you can use Wrap
to show as a grid
Wrap(children: [
Text("this is text 1 bla bla bla"),
Text("this is text 2 bla bla bla"),
Text("this is text 3 bla bla bla"),
])
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论