Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make TextField wrap to a new line, not overflow

I am using a simple TextField wrapped in a Container. When the user types a long string, I want it to automatically wrap to a new line.

It currently flows off the screen, on a single line. How do I fix this?

like image 933
haz Avatar asked Apr 06 '18 12:04

haz


People also ask

How do I wrap text in next line in CSS?

The word-break property in CSS is used to specify how a word should be broken or split when reaching the end of a line. The word-wrap property is used to split/break long words and wrap them into the next line. word-break: break-all; It is used to break the words at any character to prevent overflow.

How do you move the input to the next line?

Press Shift and Enter for a new line.


1 Answers

Unlimited number of lines

new TextField(..., maxLines: null)

or limited number of lines

new TextField(..., maxLines: 3)

This way it starts scrolling when the content exceeds the height of the input field

https://docs.flutter.io/flutter/material/TextField/maxLines.html

like image 192
Günter Zöchbauer Avatar answered Nov 14 '22 22:11

Günter Zöchbauer