maintainSize property Null safety

bool maintainSize

Whether to maintain space for where the widget would have been.

To set this, maintainAnimation and maintainState must also be set.

Maintaining the size when the widget is not visible is not notably more expensive than just keeping animations running without maintaining the size, and may in some circumstances be slightly cheaper if the subtree is simple and the visible property is frequently toggled, since it avoids triggering a layout change when the visible property is toggled. If the child subtree is not trivial then it is significantly cheaper to not even keep the state (see maintainState).

If this property is true, Opacity is used instead of Offstage.

If this property is false, then maintainSemantics and maintainInteractivity must also be false.

Dynamically changing this value may cause the current state of the subtree to be lost (and a new instance of the subtree, with new State objects, to be immediately created if visible is true).

See also:


final bool maintainSize;