ExpandableListTileButton.listTile constructor
ExpandableListTileButton.listTile({
- Key? key,
- required Widget expanded,
- required Widget title,
- Widget? subtitle,
- Color? headerBackgroundColor,
- Color? expandedBodyColor,
- Color? backgroundColor,
- Color? expandedColor,
- Color? trailingIconColor,
- Color? borderColor,
- double elevation = 1,
- Widget? leading,
- EdgeInsetsGeometry? margin,
- BorderRadius borderRadius = const BorderRadius.all(Radius.circular(10)),
- bool disabled = false,
- AlignmentGeometry bodyAlignment = Alignment.center,
- ExpandableController? controller,
Creates an ExpandableListTileButton with a default header based on ListTile.
Accepts both headerBackgroundColor/expandedBodyColor (preferred) and
backgroundColor/expandedColor (for backward compatibility).
Implementation
factory ExpandableListTileButton.listTile({
Key? key,
required Widget expanded,
required Widget title,
Widget? subtitle,
Color? headerBackgroundColor,
Color? expandedBodyColor,
Color? backgroundColor,
Color? expandedColor,
Color? trailingIconColor,
Color? borderColor,
double elevation = 1,
Widget? leading,
EdgeInsetsGeometry? margin,
BorderRadius borderRadius = const BorderRadius.all(Radius.circular(10)),
bool disabled = false,
AlignmentGeometry bodyAlignment = Alignment.center,
ExpandableController? controller,
}) {
return ExpandableListTileButton(
key: key,
expanded: expanded,
title: title,
subtitle: subtitle,
headerBackgroundColor: headerBackgroundColor,
backgroundColor: backgroundColor,
expandedBodyColor: expandedBodyColor,
expandedColor: expandedColor,
trailingIconColor: trailingIconColor,
borderColor: borderColor,
elevation: elevation,
margin: margin,
leading: leading,
borderRadius: borderRadius,
disabled: disabled,
bodyAlignment: bodyAlignment,
controller: controller,
customHeaderBuilder: (toggleExpansion, isExpanded, isDisabled) =>
ListTileButton(
onPressed: toggleExpansion,
leading: leading,
body: title,
subtitle: subtitle,
trailing: Icon(
isExpanded ? Icons.expand_less : Icons.expand_more,
color: trailingIconColor,
),
backgroundColor: Colors.transparent,
disabled: isDisabled,
),
);
}