Expander constructor

const Expander({
  1. Key? key,
  2. required Widget child,
  3. required Widget header,
  4. double gapPadding = 8,
  5. CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.start,
  6. bool initiallyExpanded = false,
  7. ExpanderController? controller,
  8. Duration duration = const Duration(milliseconds: 250),
  9. Duration reverseDuration = const Duration(milliseconds: 250),
  10. Curve curve = Curves.easeOutCirc,
  11. AlignmentGeometry alignment = Alignment.topCenter,
  12. Widget? overrideSeparator,
})

Creates an Expander widget.

The child and header parameters are required. The child is the content that will be shown when expanded. The header is always visible and toggles expansion when clicked.

Example:

Expander(
  header: Text("Click to expand", style: TextStyle(fontWeight: FontWeight.bold)),
  child: Padding(
    padding: EdgeInsets.symmetric(vertical: 8.0),
    child: Text("This is the expandable content."),
  ),
)

Implementation

const Expander({
  super.key,
  required this.child,
  required this.header,
  this.gapPadding = 8,
  this.crossAxisAlignment = CrossAxisAlignment.start,
  this.initiallyExpanded = false,
  this.controller,
  this.duration = const Duration(milliseconds: 250),
  this.reverseDuration = const Duration(milliseconds: 250),
  this.curve = Curves.easeOutCirc,
  this.alignment = Alignment.topCenter,
  this.overrideSeparator,
});