creativecreatorormaybenot
creativecreatorormaybenot

Reputation: 126964

How to wrap Text in showModalBottomSheet?

My widget tree looks like this:

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
  ]
);

Above you can see the Modal Bottom Sheet.
As you can see, the Text does not expand over the next lines, like it does in other scenarios, but I get a RenderFlex OVERFLOWING error.

Upvotes: 0

Views: 561

Answers (2)

Rodg
Rodg

Reputation: 1

You can make this into a SingleChildScroolView with the scrollDirection to Axis.horizontal, like this:

SingleChildScrollView(
    scrollDirection: Axis.horizontal,
    child: Row(
        children [Text("Some text")]
    )
);

Upvotes: 0

anmol.majhail
anmol.majhail

Reputation: 51316

You can make use of the Wrap widget:

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

Upvotes: 1

Related Questions