CollapsibleContent constructor

const CollapsibleContent({
  1. Key? key,
  2. bool collapsible = true,
  3. required Widget child,
})

Creates a CollapsibleContent with the specified child widget.

Parameters:

  • collapsible (bool, default: true): Whether to respond to collapsible state.
  • child (Widget, required): The content widget to show/hide.

Behavior

  • When collapsible is true and parent is collapsed: Content is hidden via Offstage
  • When collapsible is true and parent is expanded: Content is visible
  • When collapsible is false: Content is always visible regardless of parent state

Example:

CollapsibleContent(
  collapsible: true,
  child: Padding(
    padding: EdgeInsets.symmetric(vertical: 16),
    child: Text('This content can be collapsed'),
  ),
);

Implementation

const CollapsibleContent({
  super.key,
  this.collapsible = true,
  required this.child,
});