Raf*_*fie 2 dart flutter flutter-layout
我有一个文本小部件,我在其中放置了一些文本(游戏标题),但某些游戏标题达到了屏幕的最大宽度(A RenderFlex overflowed by 77 pixels on the right.例如)。我怎样才能让文字继续在下面呢?
问题:
我想要这样的:
|Im a very long title |
|that does not fit. |
Run Code Online (Sandbox Code Playgroud)
编辑:
WidgetText位于RowWidget 中,而 Widget 又存在于ColumnWidget 中。
Row(
children: <Widget>[
SomeOtherWidget(),
Expanded( // add this
child: Text(
"This is a long text",
maxLines: 2, // you can change it accordingly
overflow: TextOverflow.ellipsis, // and this
),
),
],
)
Run Code Online (Sandbox Code Playgroud)
将您包裹Text起来Expanded并设置overflow属性。
| 归档时间: |
|
| 查看次数: |
2649 次 |
| 最近记录: |