maintainAnimation property

bool maintainAnimation

Whether to maintain animations within the child subtree when it is not visible.

To set this, maintainState must also be set.

Keeping animations active when the widget is not visible is even more expensive than only maintaining the state.

One example when this might be useful is if the subtree is animating its layout in time with an AnimationController, and the result of that layout is being used to influence some other logic. If this flag is false, then any AnimationControllers hosted inside the child subtree will be muted while the visible flag is false.

If this property is true, no TickerMode widget is used.

If this property is false, then maintainSize 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 maintainAnimation