PrismAccordion class

A stack of collapsible sections.

Two behaviours matter and are easy to get wrong: only one section may be open at a time when singleExpansion is set (the settings-screen pattern), and each header must announce whether it is expanded — otherwise a screen reader user hears a list of mysterious buttons.

PrismAccordion(
  singleExpansion: true,
  sections: const [
    PrismAccordionSection(title: 'Delivery', child: Text('…')),
    PrismAccordionSection(title: 'Returns', child: Text('…')),
  ],
)
Inheritance

Constructors

PrismAccordion({Key? key, required List<PrismAccordionSection> sections, bool singleExpansion = false, Set<int>? expandedIndices, void onExpansionChanged(Set<int> expanded)?, bool divider = true})
Creates an accordion.
const

Properties

divider → bool
Whether to draw a hairline between sections.
final
expandedIndices → Set<int>?
Overrides the initial expansion state. When null, each section's own PrismAccordionSection.initiallyExpanded is used.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onExpansionChanged → void Function(Set<int> expanded)?
Called with the new set of expanded indices.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sections → List<PrismAccordionSection>
The sections, top to bottom.
final
singleExpansion → bool
Whether opening one section closes the others.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<PrismAccordion>
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.
inherited
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, int wrapWidth = 65}) → 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