budget tab: use M3 ListTile for group headers and category rows

This commit is contained in:
alexis 2026-07-11 22:34:07 +02:00
parent da74308bad
commit e677e7897e

View file

@ -57,34 +57,26 @@ class _CategoryGroupTile extends ConsumerWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
InkWell(
onTap: () => ref.read(_expandedGroupProvider(group.id).notifier).toggle(),
borderRadius: BorderRadius.circular(8),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 4),
child: Row(
children: [
Icon(
expanded ? Icons.keyboard_arrow_down : Icons.keyboard_arrow_right,
size: 18,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
const SizedBox(width: 8),
Text(group.name,
style: Theme.of(context)
.textTheme
.titleSmall
?.copyWith(fontWeight: FontWeight.w600)),
const Spacer(),
Text(
formatCurrency(
cats.fold(0.0, (s, c) => s + ref.watch(categoryRemainingProvider(c.id))),
),
style: Theme.of(context).textTheme.bodySmall,
),
],
),
ListTile(
dense: true,
contentPadding: EdgeInsets.zero,
leading: Icon(
expanded ? Icons.keyboard_arrow_down : Icons.keyboard_arrow_right,
size: 18,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
title: Text(group.name,
style: Theme.of(context)
.textTheme
.titleSmall
?.copyWith(fontWeight: FontWeight.w600)),
trailing: Text(
formatCurrency(
cats.fold(0.0, (s, c) => s + ref.watch(categoryRemainingProvider(c.id))),
),
style: Theme.of(context).textTheme.bodySmall,
),
onTap: () => ref.read(_expandedGroupProvider(group.id).notifier).toggle(),
),
if (expanded)
...cats.map((c) => _CategoryRow(categoryId: c.id)),
@ -165,20 +157,19 @@ class _CategoryRow extends ConsumerWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Expanded(
child: Text(category.name, style: Theme.of(context).textTheme.bodyMedium),
),
Text(
formatCurrency(remaining),
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
fontWeight: FontWeight.w600,
color: remaining >= 0 ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.error,
),
),
],
ListTile(
dense: true,
contentPadding: EdgeInsets.zero,
visualDensity: VisualDensity.compact,
title: Text(category.name, style: Theme.of(context).textTheme.bodyMedium),
trailing: Text(
formatCurrency(remaining),
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
fontWeight: FontWeight.w600,
color: remaining >= 0 ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.error,
),
),
),
const SizedBox(height: 4),
ClipRRect(
borderRadius: BorderRadius.circular(4),