expansionCallback property

ExpansionPanelCallback? expansionCallback
final

The callback that gets called whenever one of the expand/collapse buttons is pressed. The arguments passed to the callback are the index of the pressed panel and whether the panel is currently expanded or not.

If ExpansionPanelList.radio is used, the callback may be called a second time if a different panel was previously open. The arguments passed to the second callback are the index of the panel that will close and false, marking that it will be closed.

For ExpansionPanelList, the callback should call State.setState when it is notified about the closing/opening panel. On the other hand, the callback for ExpansionPanelList.radio is intended to inform the parent widget of changes, as the radio panels' open/close states are managed internally.

This callback is useful in order to keep track of the expanded/collapsed panels in a parent widget that may need to react to these changes.

Implementation

final ExpansionPanelCallback? expansionCallback;