我使用以下代码嵌套了行:
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Row(
children: <Widget>[
Icon(Icons.fiber_manual_record),
Text(
'the text in the first row',
),
],
),
Row(
children: <Widget>[
Icon(Icons.fiber_manual_record),
Text(
'the text in the second row',
),
],
),
],
)
Run Code Online (Sandbox Code Playgroud)
当有空间时,我希望行并排(当前行为):
目前,当它溢出时,文本会像这样被截断:
当没有空间时,有没有办法强制第二行到新行,所以它看起来像这样?
小智 9
尝试这个!它对我有用。
new Flexible(child: new Text('Auto wrap'))
Run Code Online (Sandbox Code Playgroud)
这些方面的一些东西会起作用:
Wrap(
direction: Axis.horizontal,
children: <Widget>[
Wrap(
children: <Widget>[
Icon(Icons.fiber_manual_record),
Text(
'the text ',
),
],
),
Wrap(
children: <Widget>[
Icon(Icons.fiber_manual_record),
Text(
'more the text in the first row',
),
],
),
Wrap(
children: <Widget>[
Icon(Icons.fiber_manual_record),
Text(
'the text in the second row',
),
],
),
Wrap(
children: <Widget>[
Icon(Icons.fiber_manual_record),
Text(
'more text in the second row',
),
],
),
Wrap(
children: <Widget>[
Icon(Icons.fiber_manual_record),
Text(
'the text in the third row',
),
],
),
],
)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6572 次 |
| 最近记录: |