expands property Null safety

bool expands

Whether this widget's height will be sized to fill its parent.

If set to true and wrapped in a parent widget like Expanded or SizedBox, the input will expand to fill the parent.

maxLines and minLines must both be null when this is set to true, otherwise an error is thrown.

Defaults to false.

See the examples in maxLines for the complete picture of how maxLines, minLines, and expands interact to produce various behaviors.

Input that matches the height of its parent:

Expanded(
  child: TextField(maxLines: null, expands: true),
)

Implementation

bool get expands => _expands;
void expands=(bool value)

Implementation

set expands(bool value) {
  assert(value != null);
  if (expands == value) {
    return;
  }
  _expands = value;
  markNeedsTextLayout();
}