ExpandableListTileButton.iconListTile constructor

ExpandableListTileButton.iconListTile({
  1. required Widget expanded,
  2. required IconData icon,
  3. required Widget title,
  4. Widget? subtitle,
  5. Color? backgroundColor,
  6. Color? expandedColor,
  7. Color? iconColor,
  8. Color? trailingIconColor,
  9. Color? borderColor,
  10. double elevation = 4.0,
  11. double sizeFactor = 1.0,
})

Creates an ExpandableListTileButton with a default IconListTileButton header.

Example usage:

ExpandableListTileButton.iconListTile(
  icon: Icons.info,
  title: Text('Tap to expand'),
  expanded: Text('Expanded content here'),
);

Implementation

factory ExpandableListTileButton.iconListTile({
  required Widget expanded,
  required IconData icon,
  required Widget title,
  Widget? subtitle,
  Color? backgroundColor,
  Color? expandedColor,
  Color? iconColor,
  Color? trailingIconColor,
  Color? borderColor,
  double elevation = 4.0,
  double sizeFactor = 1.0,
}) {
  return ExpandableListTileButton(
    expanded: expanded,
    title: title,
    subtitle: subtitle,
    backgroundColor: backgroundColor,
    expandedColor: expandedColor,
    icon: icon,
    iconColor: iconColor,
    trailingIconColor: trailingIconColor,
    borderColor: borderColor,
    elevation: elevation,
    customHeader: (toggleExpansion, isExpanded) => IconListTileButton(
      icon: icon,
      title: title,
      subtitle: subtitle,
      trailing: Icon(
        isExpanded ? Icons.expand_less : Icons.expand_more,
        color: trailingIconColor,
      ),
      onPressed: () => toggleExpansion.call(),
      backgroundColor: backgroundColor,
      iconColor: iconColor,
      leadingSizeFactor: sizeFactor,
    ),
  );
}