ZdsExpansionTile class

A tile that can be expanded and collapsed to reveal further information.

Typically used to hide information that could clutter the page, like detailed information.

When using this component in a ZdsCard, the semantics of all widgets will be grouped together (expected Card behaviour to be read in one go). This means that when in a card, reading the expanded children using TalkBack or VoiceOver is difficult. For accessibility purposes, if you want to use this widget within a card, we instead recommend wrapping the ZdsExpansionTile in a container with custom decoration so the children remain individually accessible through TalkBack like so:

Container(
  decoration: CustomDecoration(),
  child: ZdsExpansionTile(
    title: const Text('Tile outside of a card'),
    child: Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Text('Child'),
        Text('Another child'),
      ],
    ),
  ),
)
Inheritance
Available Extensions

Constructors

ZdsExpansionTile({Key? key, required Widget title, required Widget child, Widget? subtitle, Widget? bottom, bool initiallyExpanded = false, bool maintainState = true, EdgeInsets contentPadding = const EdgeInsets.symmetric(horizontal: 24, vertical: 2), EdgeInsets titlePadding = const EdgeInsets.symmetric(horizontal: 24, vertical: 16), VoidCallback? onExpanded, VoidCallback? onCollapse, VoidCallback? onCollapsed, bool showDivider = true, bool expandWithIconOnly = false, bool hideExpansionSemantics = false, bool isExpandable = true, Color titleColor = Colors.transparent})
A tile that can be expanded and collapsed to reveal further information.
const
ZdsExpansionTile.selectable({Key? key, required Widget title, required Widget child, Widget? subtitle, Widget? bottom, bool initiallyExpanded = false, bool maintainState = true, EdgeInsets contentPadding = const EdgeInsets.symmetric(horizontal: 24, vertical: 2), EdgeInsets titlePadding = const EdgeInsets.symmetric(horizontal: 24, vertical: 16), VoidCallback? onExpanded, VoidCallback? onCollapse, VoidCallback? onCollapsed, bool selected = false, void onSelected(bool)?, bool showDivider = true, bool expandWithIconOnly = false, bool hideExpansionSemantics = false, bool isExpandable = true, Color titleColor = Colors.transparent})
A selectable tile that can be expanded and collapsed to reveal further information.
const

Properties

bottom Widget?
The bottom widget similiar to list tile so the widgets do not interfere with expansion button
final
child Widget
The widget to show when the tile is in the expanded state.
final
contentPadding EdgeInsets
Empty space to inscribe inside this widget.
final
expandWithIconOnly bool
If true, tapping the down chevron will toggle the tile expansion, if false tapping anywhere on the tile will.
final
expansionTileType ExpansionTileType
Type of expansion tile.
final
hashCode int
The hash code for this object.
no setterinherited
hideExpansionSemantics bool
If true, a semantics service such as Talkback / VoiceOver will ignore the expand button.
final
initiallyExpanded bool
Whether the tile is expanded when it's first drawn or not.
final
isExpandable bool
Determines if the user can expand the tile, or if it should behave like a regular tile.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maintainState bool
Specifies whether the state of the children is maintained when the tile expands and collapses.
final
onCollapse VoidCallback?
A function called whenever the tile is toggled to its collapsed state.
final
onCollapsed VoidCallback?
A function called whenever the tile is toggled to its collapsed state and animation is finished.
final
onExpanded VoidCallback?
A function called whenever the tile is toggled to its expanded state.
final
onSelected → (void Function(bool)?)
A function called whenever an item is selected.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selected bool
Whether the expansion tile is selected or not. Defaults to false.
final
showDivider bool
Boolean to show divider between expansion tiles.
final
subtitle Widget?
Additional content displayed below the title.
final
title Widget
The title of this expansion tile. This title will always be shown.
final
titleColor Color
Determines the background color of the title part of the expansion tile.
final
titlePadding EdgeInsets
Padding surrounding the title of the widget.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() ZdsExpansionTileState
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