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?
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.
Press Shift and Enter for a new line.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With