ExpandableListTileButton.listTile constructor

ExpandableListTileButton.listTile({
  1. required Widget expanded,
  2. required Widget title,
  3. Widget? subtitle,
  4. Color? backgroundColor,
  5. Color? expandedColor,
  6. Color? trailingIconColor,
  7. Color? borderColor,
  8. double elevation = 4.0,
  9. Widget? leading,
})

Creates an ExpandableListTileButton with a default ListTileButton header.

Example usage:

ExpandableListTileButton.listTile(
  title: Text('Tap to expand'),
  expanded: Text('Expanded content here'),
);

Implementation

factory ExpandableListTileButton.listTile({
  required Widget expanded,
  required Widget title,
  Widget? subtitle,
  Color? backgroundColor,
  Color? expandedColor,
  Color? trailingIconColor,
  Color? borderColor,
  double elevation = 4.0,
  Widget? leading,
}) {
  return ExpandableListTileButton(
    expanded: expanded,
    title: title,
    subtitle: subtitle,
    backgroundColor: backgroundColor,
    expandedColor: expandedColor,
    trailingIconColor: trailingIconColor,
    borderColor: borderColor,
    elevation: elevation,
    leading: leading,
    customHeader: (toggleExpansion, isExpanded) => ListTileButton(
      onPressed: () => toggleExpansion.call(),
      leading: leading,
      body: title,
      subtitle: subtitle,
      trailing: Icon(
        isExpanded ? Icons.expand_less : Icons.expand_more,
        color: trailingIconColor,
      ),
      backgroundColor: backgroundColor,
    ),
  );
}