ExpandableListTileButton.listTile constructor

ExpandableListTileButton.listTile({
  1. Key? key,
  2. required Widget expanded,
  3. required Widget title,
  4. Widget? subtitle,
  5. Color? headerBackgroundColor,
  6. Color? expandedBodyColor,
  7. Color? backgroundColor,
  8. Color? expandedColor,
  9. Color? trailingIconColor,
  10. Color? borderColor,
  11. double elevation = 1,
  12. Widget? leading,
  13. EdgeInsetsGeometry? margin,
  14. BorderRadius borderRadius = const BorderRadius.all(Radius.circular(10)),
  15. bool disabled = false,
  16. AlignmentGeometry bodyAlignment = Alignment.center,
  17. 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,
        ),
  );
}