Fixed custom list tile disabled

This commit is contained in:
Juan Gilsanz Polo 2023-02-04 20:50:14 +01:00
parent eebcec329b
commit cffdd6244e
2 changed files with 13 additions and 10 deletions

View file

@ -304,6 +304,7 @@ class _LogsFiltersModalWidgetState extends State<LogsFiltersModalWidget> {
onTap: logsProvider.clientsLoadStatus == 1
? openSelectClients
: null,
disabled: logsProvider.clientsLoadStatus != 1 ,
icon: Icons.smartphone_rounded,
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
trailing: logsProvider.clientsLoadStatus == 0

View file

@ -9,6 +9,7 @@ class CustomListTile extends StatelessWidget {
final Widget? trailing;
final EdgeInsets? padding;
final void Function()? onLongPress;
final bool? disabled;
const CustomListTile({
Key? key,
@ -19,7 +20,8 @@ class CustomListTile extends StatelessWidget {
this.icon,
this.trailing,
this.padding,
this.onLongPress
this.onLongPress,
this.disabled
}) : super(key: key);
@override
@ -42,9 +44,9 @@ class CustomListTile extends StatelessWidget {
Icon(
icon,
size: 24,
color: onTap != null || onLongPress != null
? Theme.of(context).listTileTheme.iconColor
: Theme.of(context).colorScheme.onSurface.withOpacity(0.38),
color: disabled == true
? Theme.of(context).colorScheme.onSurface.withOpacity(0.38)
: Theme.of(context).listTileTheme.iconColor,
),
const SizedBox(width: 16),
],
@ -57,9 +59,9 @@ class CustomListTile extends StatelessWidget {
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w400,
color: onTap != null || onLongPress != null
? Theme.of(context).colorScheme.onSurface
: Theme.of(context).colorScheme.onSurface.withOpacity(0.38),
color: disabled == true
? Theme.of(context).colorScheme.onSurface.withOpacity(0.38)
: Theme.of(context).colorScheme.onSurface,
),
),
if (subtitle != null || subtitleWidget != null) ...[
@ -68,9 +70,9 @@ class CustomListTile extends StatelessWidget {
if (subtitle != null && subtitleWidget == null) Text(
subtitle!,
style: TextStyle(
color: onTap != null || onLongPress != null
? Theme.of(context).colorScheme.onSurfaceVariant
: Theme.of(context).colorScheme.onSurfaceVariant.withOpacity(0.38),
color: disabled == true
? Theme.of(context).colorScheme.onSurfaceVariant.withOpacity(0.38)
: Theme.of(context).colorScheme.onSurfaceVariant,
fontSize: 14,
fontWeight: FontWeight.w400
),