首页 > 解决方案 > 行小部件中的文本换行

问题描述

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

    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',
          ),
        ],
      ),
    ],
  )

当有空间时,我希望行并排(当前行为):

在此处输入图像描述

目前,当它溢出时,文本会像这样被切断:

嵌套行

当没有空间时,有没有办法将第二行强制换行,所以它看起来像这样?

新线

标签: dartflutter

解决方案


尝试这个!它对我有用。

new Flexible(child: new Text('Auto wrap'))

推荐阅读