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