mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 19:14:42 +08:00
@@ -7,7 +7,7 @@ class NormalItem extends StatefulWidget {
|
||||
final String? subtitle;
|
||||
final ValueGetter<String>? getSubtitle;
|
||||
final Widget? leading;
|
||||
final ValueGetter<Widget?>? getTrailing;
|
||||
final Widget Function(ThemeData theme)? getTrailing;
|
||||
final void Function(BuildContext context, VoidCallback setState)? onTap;
|
||||
final EdgeInsetsGeometry? contentPadding;
|
||||
final TextStyle? titleStyle;
|
||||
@@ -33,6 +33,15 @@ class _NormalItemState extends State<NormalItem> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
late final theme = Theme.of(context);
|
||||
Widget? subtitle;
|
||||
if ((widget.subtitle ?? widget.getSubtitle?.call()) case final text?) {
|
||||
subtitle = Text(
|
||||
text,
|
||||
style: theme.textTheme.labelMedium!.copyWith(
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
);
|
||||
}
|
||||
return ListTile(
|
||||
contentPadding: widget.contentPadding,
|
||||
onTap: widget.onTap == null
|
||||
@@ -42,16 +51,9 @@ class _NormalItemState extends State<NormalItem> {
|
||||
widget.title ?? widget.getTitle!(),
|
||||
style: widget.titleStyle ?? theme.textTheme.titleMedium!,
|
||||
),
|
||||
subtitle: widget.subtitle != null || widget.getSubtitle != null
|
||||
? Text(
|
||||
widget.subtitle ?? widget.getSubtitle!(),
|
||||
style: theme.textTheme.labelMedium!.copyWith(
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
)
|
||||
: null,
|
||||
subtitle: subtitle,
|
||||
leading: widget.leading,
|
||||
trailing: widget.getTrailing?.call(),
|
||||
trailing: widget.getTrailing?.call(theme),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user