如何在showModalBottomSheet中包装Text?

问题描述 投票:0回答:1

我的小部件树看起来像这样:

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错误。

dart flutter
1个回答
1
投票

您可以使用Wrap小部件:

// WidgetTree
Wrap(
  children: [
    Text('some string') // if this string is long enough, it will overflow instead of displaying on a second line
  ]
);
© www.soinside.com 2019 - 2024. All rights reserved.