feat: Add location display and category chips in pantry and inventory screens
Test Suite / test (24.15.0) (push) Has been cancelled

This commit is contained in:
Nils-Johan Gynther
2026-05-11 20:53:11 +02:00
parent 68476142c1
commit 2281df3716
3 changed files with 90 additions and 22 deletions
@@ -219,6 +219,9 @@ class _PantryScreenState extends ConsumerState<PantryScreen> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final colorScheme = theme.colorScheme;
final textTheme = theme.textTheme;
final pantryAsync = ref.watch(pantryProvider);
if (pantryAsync.isLoading) {
@@ -370,15 +373,43 @@ class _PantryScreenState extends ConsumerState<PantryScreen> {
if (index == 1) return headerSection;
final item = filteredItems[index - 2];
final l1Category = _resolveL1Category(item);
final location = item.location?.trim();
final hasLocation = location != null && location.isNotEmpty;
return ListTile(
title: Text(item.displayName),
subtitle: Text(
[
'L1: $l1Category',
if (item.location != null && item.location!.trim().isNotEmpty)
'Plats: ${item.location}',
].join(''),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
if (hasLocation)
Text(
'Plats: $location',
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 6),
Row(
children: [
Flexible(
child: Chip(
label: Text(
'L1: $l1Category',
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
padding: EdgeInsets.zero,
visualDensity: VisualDensity.compact,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
side: BorderSide(color: colorScheme.outlineVariant),
backgroundColor: colorScheme.surface,
labelStyle: textTheme.bodySmall?.copyWith(
color: colorScheme.onSurfaceVariant,
),
),
),
],
),
],
),
trailing: Row(
mainAxisSize: MainAxisSize.min,