feat: Refactor inventory screens with category selection and product handling improvements
Test Suite / test (24.15.0) (push) Has been cancelled
Test Suite / test (24.15.0) (push) Has been cancelled
This commit is contained in:
@@ -7,6 +7,7 @@ import '../../../core/api/api_error_mapper.dart';
|
||||
import '../../../core/forms/form_options.dart';
|
||||
import '../../../core/l10n/l10n.dart';
|
||||
import '../../../core/ui/async_state_views.dart';
|
||||
import '../../../core/utils/display_labels.dart';
|
||||
import '../../auth/data/auth_providers.dart';
|
||||
import '../../inventory/data/inventory_providers.dart';
|
||||
import '../data/pantry_providers.dart';
|
||||
@@ -373,8 +374,7 @@ 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;
|
||||
final location = normalizedOptionalText(item.location);
|
||||
|
||||
return ListTile(
|
||||
title: Text(item.displayName),
|
||||
@@ -382,32 +382,29 @@ class _PantryScreenState extends ConsumerState<PantryScreen> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (hasLocation)
|
||||
if (location != null)
|
||||
Text(
|
||||
'Plats: $location',
|
||||
locationLabel('${context.l10n.locationLabel}: ', 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,
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Chip(
|
||||
label: Text(
|
||||
l1CategoryChipLabel('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,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user