How do I make a Text widget wrap long text into multiple lines?

This might not be the best solution but this is the only thing working for me.

Surround the Text widget with a Container and set the maximum width of it based on Screen size.

Screen size - 84 seems to be the minimum value to avoid overflow. I've tested it on 2 devices and is working fine.

steps: widget.questions
  .map(
    (String q) => Step(
      title: new Container(
        constraints: new BoxConstraints(
          maxWidth: MediaQuery.of(context).size.width - 84),
        child: Text(q),
      ),
      content: new Container(),
    ),
  )
  .toList(),

Use flexible if you just wanna make multiple lines:

Flexible (child: Text('Some text here'))

Tags:

Dart

Flutter