TransWikia.com

How to make a new line in Wrap Widget

Stack Overflow Asked by Hưng Trịnh on November 24, 2021

I use the Wrap Widget to display chat messages, I’m having trouble getting show new line ‘n’ in Wrap Widgets

show text message:

a *bold*
`highlight`
```pre```
```pre1```
a ```pre2```
a *bold*

Extract to list widget:
enter image description here

and then wrap listWidget in Wrap Widget

Wrap(
  children: listWidgets,
)

enter image description here

but the Text widget (‘ n’) doesn’t go as expected

Does anyone have solution new line in Wrap Widget please help

2 Answers

You need to specify the direction property of your Wrap widget.

Wrap(
   direction: Axis.vertical,
   children: listWidgets,
)

Answered by SCcode on November 24, 2021

Try to use RichText widget:

RichText(
                text: TextSpan(
                  text: '26 Sep 2020nn',
                  style: TextStyle(
                    color: Colors.black,
                    fontSize: 12.0,
                  ),
                  children: <TextSpan>[
                    TextSpan(
                      text: 'blablabla',
                      style: TextStyle(
                        fontWeight: FontWeight.bold,
                        color: Colors.black,
                        fontSize: 16.0,
                      ),
                    ),
                  ],
                ),
              ),

Answered by Jim Chiu on November 24, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP