Expander class

The Expander control lets you show or hide less important content that's related to a piece of primary content that's always visible. Items contained in the Header are always visible. The user can expand and collapse the Content area, where secondary content is displayed, by interacting with the header. When the content area is expanded, it pushes other UI elements out of the way; it does not overlay other UI. The Expander can expand upwards or downwards.

Both the Header and Content areas can contain any content, from simple text to complex UI layouts. For example, you can use the control to show additional options for an item.

Expander Preview

See also:

Inheritance
Available Extensions

Constructors

Expander({Key? key, Widget? leading, required Widget header, required Widget content, Widget? icon, Widget? trailing, Curve? animationCurve, Duration? animationDuration, ExpanderDirection direction = ExpanderDirection.down, bool initiallyExpanded = false, ValueChanged<bool>? onStateChanged, ButtonState<Color>? headerBackgroundColor, ExpanderShapeBuilder? headerShape, Color? contentBackgroundColor, EdgeInsetsGeometry? contentPadding = const EdgeInsets.all(16.0), ExpanderShapeBuilder? contentShape})
Creates a fluent-styled expander.
const

Properties

animationCurve Curve?
The expand-collapse animation curve.
final
animationDuration Duration?
The expand-collapse animation duration.
final
content Widget
The expander content
final
contentBackgroundColor Color?
The content color of the content.
final
contentPadding EdgeInsetsGeometry?
The padding of the content.
final
contentShape ExpanderShapeBuilder?
The shape of the content
final
direction ExpanderDirection
The expand direction.
final
hashCode int
The hash code for this object.
no setterinherited
The expander header
final
headerBackgroundColor ButtonState<Color>?
The background color of the header.
final
headerShape ExpanderShapeBuilder?
The shape of the header.
final
icon Widget?
The expander icon. If null, defaults to a chevron down or up, depending on the direction.
final
initiallyExpanded bool
Whether the Expander is initially expanded.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
leading Widget?
The leading widget.
final
onStateChanged ValueChanged<bool>?
A callback called when the current state is changed.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
trailing Widget?
The trailing widget. It's positioned at the right of header and before icon.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<Expander>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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