如何在showModalBottomSheet中包装Text?

时间:2018-09-12 19:06:10

标签: dart flutter

我的小部件树如下:

showModalBottomSheet(... => WidgetTree()); // this symbolizes that I pass exactly what you can see below into the builder function

// WidgetTree
Row(
  children: [
    Text('some string') // if this string is long enough, it will overflow instead of displaying on a second line
  ]
);

上方,您可以看到模态底页
如您所见,Text并没有像其他情况下那样扩展到下一行,但是出现了RenderFlex OVERFLOWING错误。

1 个答案:

答案 0 :(得分:1)

您可以使用Wrap小部件:

// WidgetTree
Wrap(
  children: [
    Text('some string') // if this string is long enough, it will overflow instead of displaying on a second line
  ]
);