feat: aggrega duplicati nella lista della spesa con quantità
Quando si genera la lista dal piano pasti, gli alimenti ripetuti in più giorni o slot vengono aggregati in un unico elemento con contatore. Es. zucchine lunedì + mercoledì → "zucchine (x2)". - ShoppingItem: aggiunto campo quantity (default 1, persistito in JSON) - ShoppingListProvider.addAll: conta le occorrenze per nome (case-insensitive) e crea un ShoppingItem con quantity = conteggio - ShoppingItemTile: mostra "(xN)" colorato in primary quando quantity > 1, diventa muted insieme al nome quando l'elemento è completato Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -32,14 +32,33 @@ class ShoppingItemTile extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
item.name,
|
||||
style: item.checked
|
||||
? theme.textTheme.bodyMedium?.copyWith(
|
||||
decoration: TextDecoration.lineThrough,
|
||||
color: muted,
|
||||
)
|
||||
: theme.textTheme.bodyMedium,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
item.name,
|
||||
style: item.checked
|
||||
? theme.textTheme.bodyMedium?.copyWith(
|
||||
decoration: TextDecoration.lineThrough,
|
||||
color: muted,
|
||||
)
|
||||
: theme.textTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
if (item.quantity > 1)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 6),
|
||||
child: Text(
|
||||
'(x${item.quantity})',
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: item.checked
|
||||
? muted
|
||||
: theme.colorScheme.primary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
|
||||
Reference in New Issue
Block a user