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),
child: Row(
children: [
Icon(
expanded ? Icons.keyboard_arrow_down : Icons.keyboard_arrow_right, expanded ? Icons.keyboard_arrow_down : Icons.keyboard_arrow_right,
size: 18, size: 18,
color: Theme.of(context).colorScheme.onSurfaceVariant, color: Theme.of(context).colorScheme.onSurfaceVariant,
), ),
const SizedBox(width: 8), title: Text(group.name,
Text(group.name,
style: Theme.of(context) style: Theme.of(context)
.textTheme .textTheme
.titleSmall .titleSmall
?.copyWith(fontWeight: FontWeight.w600)), ?.copyWith(fontWeight: FontWeight.w600)),
const Spacer(), trailing: Text(
Text(
formatCurrency( formatCurrency(
cats.fold(0.0, (s, c) => s + ref.watch(categoryRemainingProvider(c.id))), cats.fold(0.0, (s, c) => s + ref.watch(categoryRemainingProvider(c.id))),
), ),
style: Theme.of(context).textTheme.bodySmall, 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,19 +157,18 @@ 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(