I have text in a row that is overflowing and it will not clip properly. Below is a simple hierarchy of my Widget with notes.
ListView
ListItem1
...
ListItemN
Padding
Row // mainAxisAlignment.spaceBetween
Row
IconWidget
Container
Padding
Image // 64px square
TitleWidget // overflowing but not clipping
Text // TextOverflow.fade
ScoreWidget
Container // boxDecoration, color & borderRadius
Padding
Text
I have tried wrapping TitleWidget
in Expanded
, Flexible
, and OverflowBox
and I keep getting infinite length errors. Here is a photo of the rendered content.
Steps to Wrap Text on Overflow in Flutter (Solution) To overcome the overflow error, wrap the Text widget inside the Expanded widget. The Expanded widget allows the Text widget to grow and fill the available space.
Ellipsis: Use an Ellipsis (. . .) to indicate that text is overflow.
Solved, the middle most Widget needs to be in an Expanded widget. Also cleaned it up a bit.
ListView
ListItem1
...
ListItemN
Container //padding
Row
IconWidget
Container // padding
Image // 64px square
TitleWidget
Expanded // added Expanded
Text // TextOverflow.fade
ScoreWidget
Container // boxDecoration, color & borderRadius, padding
Text
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With