行小部件中的文本换行

S.D*_*.D. 4 dart flutter

我使用以下代码嵌套了行:

    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)


abs*_*sin 3

这些方面的一些东西会起作用:

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)