Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combine text + icon into a widget that will word wrap

Tags:

flutter

I'm trying to create a help page for my app and I'd like to simply write

"Press {ICON} to refresh scores (or enable auto-refresh in the settings drawer)"

Where {ICON} is Icons.refresh

and have the whole thing word wrap if it does not fit on the screen. If it were all text I would simple wrap it in a Flexible widget or something similar and it would be fine. At the moment I have it in a row

At the moment I have it in a row, which causes a RenderFlex overflow (see image).

Row(children: [Text("Press "), Icon(Icons.refresh), Text(" to refresh scores (or enable auto-refresh in the settings drawer)")])

overflow

Any ideas how I can include an icon in a chain of text and still have it word wrap when required?

like image 227
BGH Avatar asked Nov 17 '25 04:11

BGH


1 Answers

You Can use Wrap Widget instead of Row

Wrap(children: [
            Text("Press "),
            Icon(Icons.refresh),
            Text(
            " to refresh scores or enable auto-refresh"),
            Text(' in the settings drawer.........'),
          ]),
like image 57
Manpreet Kaur Avatar answered Nov 21 '25 09:11

Manpreet Kaur



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!