ExpandableListTileButton.iconListTile constructor

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

Creates an ExpandableListTileButton with a default header using an icon on the left.

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

Implementation

factory ExpandableListTileButton.iconListTile({
  Key? key,
  required Widget expanded,
  required IconData icon,
  required Widget title,
  Widget? subtitle,
  Color? headerBackgroundColor,
  Color? expandedBodyColor,
  Color? backgroundColor,
  Color? expandedColor,
  EdgeInsetsGeometry? leadingPadding,
  Color? iconColor,
  Color? trailingIconColor,
  Color? borderColor,
  double elevation = 1,
  double? leadingSizeFactor,
  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,
    icon: icon,
    iconColor: iconColor,
    trailingIconColor: trailingIconColor,
    borderColor: borderColor,
    elevation: elevation,
    margin: margin,
    leadingSizeFactor: leadingSizeFactor,
    borderRadius: borderRadius,
    disabled: disabled,
    bodyAlignment: bodyAlignment,
    controller: controller,
    customHeaderBuilder: (toggleExpansion, isExpanded, isDisabled) =>
        IconListTileButton(
          icon: icon,
          iconColor: iconColor,
          leadingSizeFactor: leadingSizeFactor ?? 1.0,
          leadingPadding: leadingPadding,
          title: title,
          subtitle: subtitle,
          trailing: Icon(
            isExpanded ? Icons.expand_less : Icons.expand_more,
            color: trailingIconColor,
          ),
          onPressed: toggleExpansion,
          backgroundColor: Colors.transparent,
          disabled: isDisabled,
        ),
  );
}