maintainSize property

bool maintainSize

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

To set this, maintainAnimation must also be set.

Maintaining the size when the sliver 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 sliver subtree is not trivial then it is significantly cheaper to not even keep the state (see maintainState).

If this property is false, SliverOffstage is used.

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).


final bool maintainSize;