uiListTile method
- required void onTap(),
- Key? key,
- bool enabled = true,
- dynamic leading,
- Widget? title,
- Widget? subtitle,
- dynamic trailing,
- ListTileThemeData? style,
Creates a selectable widget to be part of a view of selectable items.
Implementation
Widget uiListTile({
required void Function() onTap,
Key? key,
bool enabled = true,
dynamic leading,
Widget? title,
Widget? subtitle,
dynamic trailing,
ListTileThemeData? style,
}) {
// Make sure we are using things properly
assert(
leading is IconData || leading is Image || leading == null,
"leading can only be an Image, IconData, or null type",
);
assert(
trailing is IconData || trailing is Image || trailing == null,
"trailing can only be an Image, IconData, or null type",
);
// Create a return the widget.
final w = ListTile(
key: key,
leading: leading is IconData ? Icon(leading) : leading,
title: title,
subtitle: subtitle,
trailing: trailing is IconData ? Icon(trailing) : trailing,
onTap: enabled ? onTap : null,
);
return style != null
? ListTileTheme(
key: key,
data: style,
child: w,
)
: w;
}