maxLines property

int? maxLines
final

The maximum number of lines for the text to span, wrapping if necessary.

If this is 1 (the default), the text will not wrap, but will scroll vertically instead.

If this is null, there is no limit to the number of lines, and the text container will start with enough horizontal space for one line and automatically grow to accommodate additional lines as they are entered.

If this is not null, the value must be greater than zero, and it will lock the input to the given number of lines and take up enough vertical space to accommodate that number of lines. Setting minLines as well allows the input to grow between the indicated range.

The full set of behaviors possible with minLines and maxLines are as follows. These examples apply equally to MongolTextField, MongolTextFormField, and MongolEditableText.

Input that occupies a single line and scrolls vertically as needed.

MongolTextField()

Input whose width grows from one line up to as many lines as needed for the text that was entered. If a width limit is imposed by its parent, it will scroll horizontally when its width reaches that limit.

MongolTextField(maxLines: null)

The input's width is large enough for the given number of lines. If additional lines are entered the input scrolls horizontally.

MongolTextField(maxLines: 2)

Input whose width grows with content between a min and max. An infinite max is possible with maxLines: null.

MongolTextField(minLines: 2, maxLines: 4)

Implementation

final int? maxLines;