To make text display on multiple lines in Flutter, you can use the following methods:
-
Using the
softWrap
property: SetsoftWrap:
true in theText
widget to allow automatic line wrapping when the text exceeds the container’s width. -
Using the
maxLines
property: SetmaxLines
to a specific number to limit the number of lines. If the text exceeds this limit, it will be truncated with an ellipsis (…). -
Inserting explicit line breaks (
\n
): Manually add\n
within the text string to indicate where the text should break into a new line. -
Using layout constraints: Wrap the
Text
widget in aConstrainedBox
or aSizedBox
to restrict its width, causing the text to wrap automatically.