Multi-line Textfield in flutter

后端 未结 11 1758
夕颜
夕颜 2020-12-13 07:54

It may sound easy but How can we do a multi-line editable textfield in flutter? TextField works only with a single line.

Edit: some precisions beca

11条回答
  •  悲哀的现实
    2020-12-13 08:18

    If you want that your TextField should adapt to the user input then do this:

    TextField(
        keyboardType: TextInputType.multiline,
        minLines: 1,//Normal textInputField will be displayed
        maxLines: 5,// when user presses enter it will adapt to it
        );
    

    here set the max lines to whatever you want and you are good to go. In my opinion setting the maxlines to null is not a good choice we should set it to some value.

提交回复
热议问题