mobiletextdartflutter

Change Size And Behavior of Text Field


I am working to build a screen in my app with several text fields in it. I wish the user to be able to enter a large amount of text in each of them.

There are two problems:

  1. The standard TextField widget is only one line high. I would like it to be many lines high so the user can see all that they have typed.
  2. The standard TextField's behavior seems to act like a typwriter, where the text scrolls infinitely from right to left as the user types. I would like the text to wrap when it hits the edge of the screen.

In short, what I am looking for is your standarrd issue text entry box just like you would be typing into if you were asking a question here.

How do I go about implementing one in Flutter?


Solution

  • TextField Widget has maxLines property.

    You can use it like this.

    new TextField(
       maxLines: 5,
       textAlign: TextAlign.left,
       decoration: new InputDecoration(
          hintText: "Enter Something",
       ),
      )