ExpansionTileController class

Enables control over a single ExpansionTile's expanded/collapsed state.

It can be useful to expand or collapse an ExpansionTile programmatically, for example to reconfigure an existing expansion tile based on a system event. To do so, create an ExpansionTile with an ExpansionTileController that's owned by a stateful widget or look up the tile's automatically created ExpansionTileController with ExpansionTileController.of

The controller's expand and collapse methods cause the the ExpansionTile to rebuild, so they may not be called from a build method.

Constructors

ExpansionTileController()
Create a controller to be used with ExpansionTile.controller.

Properties

hashCode int
The hash code for this object.
no setterinherited
isExpanded bool
Whether the ExpansionTile built with this controller is in expanded state.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

collapse() → void
Collapses the ExpansionTile that was built with this controller.
expand() → void
Expands the ExpansionTile that was built with this controller;
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

maybeOf(BuildContext context) ExpansionTileController?
Finds the ExpansionTile from the closest instance of this class that encloses the given context and returns its ExpansionTileController.
of(BuildContext context) ExpansionTileController
Finds the ExpansionTileController for the closest ExpansionTile instance that encloses the given context.