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),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -93,14 +93,14 @@ class _SetSwitchItemState extends State<SetSwitchItem> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
TextStyle titleStyle =
|
||||
final titleStyle =
|
||||
widget.titleStyle ??
|
||||
theme.textTheme.titleMedium!.copyWith(
|
||||
color: widget.onTap != null && !val
|
||||
? theme.colorScheme.outline
|
||||
: null,
|
||||
);
|
||||
TextStyle subTitleStyle = theme.textTheme.labelMedium!.copyWith(
|
||||
final subTitleStyle = theme.textTheme.labelMedium!.copyWith(
|
||||
color: theme.colorScheme.outline,
|
||||
);
|
||||
return ListTile(
|
||||
@@ -113,8 +113,8 @@ class _SetSwitchItemState extends State<SetSwitchItem> {
|
||||
: null,
|
||||
leading: widget.leading,
|
||||
trailing: Transform.scale(
|
||||
alignment: Alignment.centerRight,
|
||||
scale: 0.8,
|
||||
alignment: .centerRight,
|
||||
child: Switch(
|
||||
value: val,
|
||||
onChanged: switchChange,
|
||||
|
||||
Reference in New Issue
Block a user