Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Text will not overflow in row

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.

enter image description here

like image 503
Luke Pighetti Avatar asked Jun 18 '18 14:06

Luke Pighetti


People also ask

How can I make text appear on next line instead of overflowing flutter?

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.

How do you text overflow in flutter?

Ellipsis: Use an Ellipsis (. . .) to indicate that text is overflow.


1 Answers

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
like image 134
Luke Pighetti Avatar answered Jan 01 '23 03:01

Luke Pighetti