Expander constructor
const
Expander({
- Key? key,
- required Widget child,
- required Widget header,
- double gapPadding = 8,
- CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.start,
- bool initiallyExpanded = false,
- ExpanderController? controller,
- Duration duration = const Duration(milliseconds: 250),
- Duration reverseDuration = const Duration(milliseconds: 250),
- Curve curve = Curves.easeOutCirc,
- AlignmentGeometry alignment = Alignment.topCenter,
- 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,
});