ExpandableListTileButton constructor

const ExpandableListTileButton({
  1. Key? key,
  2. required Widget expanded,
  3. Widget customHeaderBuilder(
    1. dynamic tapAction(),
    2. bool isExpanded,
    3. bool isDisabled
    )?,
  4. Widget? title,
  5. Widget? subtitle,
  6. Color? headerBackgroundColor,
  7. Color? expandedBodyColor,
  8. Color? backgroundColor,
  9. Color? expandedColor,
  10. Color? iconColor,
  11. Color? trailingIconColor,
  12. Color? borderColor,
  13. double elevation = 1,
  14. EdgeInsetsGeometry? margin,
  15. double? leadingSizeFactor,
  16. Widget? leading,
  17. IconData? icon,
  18. BorderRadius borderRadius = const BorderRadius.all(Radius.circular(10)),
  19. bool disabled = false,
  20. AlignmentGeometry bodyAlignment = Alignment.center,
  21. ExpandableController? controller,
  22. Size? trailingSize,
  23. bool overlay = false,
})

Creates an ExpandableListTileButton with the given properties.

Use this constructor when providing a customHeaderBuilder. At least one of customHeaderBuilder or title must be non-null.

Accepts both headerBackgroundColor/expandedBodyColor (preferred) and backgroundColor/expandedColor (for backward compatibility).

Implementation

const ExpandableListTileButton({
  super.key,
  required this.expanded,
  this.customHeaderBuilder,
  this.title,
  this.subtitle,
  this.headerBackgroundColor,
  this.expandedBodyColor,
  this.backgroundColor,
  this.expandedColor,
  this.iconColor,
  this.trailingIconColor,
  this.borderColor,
  this.elevation = 1,
  this.margin,
  this.leadingSizeFactor,
  this.leading,
  this.icon,
  this.borderRadius = const BorderRadius.all(Radius.circular(10)),
  this.disabled = false,
  this.bodyAlignment = Alignment.center,
  this.controller,
  this.trailingSize,
  bool overlay = false,
}) : _finalHeaderBackgroundColor = headerBackgroundColor ?? backgroundColor,
     _finalExpandedBodyColor = expandedBodyColor ?? expandedColor,
     _useOverlay = overlay,
     assert(
       customHeaderBuilder != null || title != null,
       'Either customHeaderBuilder or title must be provided for the header.',
     );