Emil Walser
Emil Walser

Reputation: 652

How do I make a EditableText or TextField in flutter multiline and wrapping?

I want a way to make a TextField or EditableText's text wrap onto another line. And how to make them multiline.

I don't know if it matters, but the EditableText sits inside a ListTile > Card > Container.

This is my code:

return ListTile(
  title: Card(
    child: Container(
      padding: EdgeInsets.all(10.0),
      child: EditableText(
        textAlign: TextAlign.start,
        focusNode: _focusNode,
        controller: _textEditingController,
        style: TextStyle(
          color: Colors.black,
          fontSize: 18.0,
        ),
        keyboardType: TextInputType.multiline,
        cursorColor: Colors.blue,
      ),
    ),
  ),
);

It doesn't work please help. I have searched everywhere now!

I'm running flutter version: 0.4.4 and dart version: 2.0.0-dev.54.0

Upvotes: 3

Views: 4791

Answers (1)

Rémi Rousselet
Rémi Rousselet

Reputation: 276951

You need to set the property maxLines to either null (for infinite growth) or a fixed number.

By default maxLines is equal to 1.

Upvotes: 6

Related Questions