ListItemComponent constructor
ListItemComponent({
- required String title,
- String? subtitle,
- Sprite? icon,
- PositionComponent? action,
- VoidCallback? onPressed,
- EdgeInsets padding = const EdgeInsets.all(2),
- double spacing = 4,
- TextStyle titleStyle = const TextStyle(fontSize: 10, color: Colors.white),
- TextStyle subtitleStyle = const TextStyle(fontSize: 8, color: Colors.white70),
- Vector2? size,
- Vector2? position,
- Vector2? iconSize,
Creates a ListItemComponent with the given parameters.
title is required and specifies the main text of the list item.
subtitle is optional and specifies additional text below the title.
icon is optional and specifies an icon to display on the left.
action is optional and specifies a component to display on the right.
onPressed is optional and specifies a callback for tap events.
padding specifies the padding around the content (default is 2).
spacing specifies the spacing between elements (default is 4).
titleStyle specifies the text style for the title.
subtitleStyle specifies the text style for the subtitle.
size and position specify the size and position of the component.
iconSize specifies the size of the icon (optional).
Implementation
ListItemComponent({
required this.title,
this.subtitle,
this.icon,
this.action,
this.onPressed,
this.padding = const EdgeInsets.all(2),
this.spacing = 4,
this.titleStyle = const TextStyle(fontSize: 10, color: Colors.white),
this.subtitleStyle = const TextStyle(fontSize: 8, color: Colors.white70),
super.size,
super.position,
this.iconSize,
});