feat: dish recognition UX, background mode, and backend bug fixes

Flutter client:
- Progress dialog: redesigned with pulsing animated icon, info hint about
  background mode, full-width Minimize button; dismiss signal via ValueNotifier
  so the dialog always closes regardless of widget lifecycle
- Background recognition: when user taps Minimize, wasMinimizedByUser flag is
  set; on completion a snackbar is shown instead of opening DishResultSheet
  directly; snackbar action opens the sheet on demand
- Fix dialog spinning forever: finally block guarantees dismissSignal=true on
  all exit paths including early returns from context.mounted checks
- Fix DishResultSheet not appearing: add ValueKey to _DailyMealsSection and
  meal card Padding so Flutter reuses elements when _TodayJobsWidget is
  inserted/removed from the SliverChildListDelegate list
- todayJobsProvider refresh: added refresh() method; called after job submit
  and on DishJobDone; all ref.read() calls guarded with context.mounted checks
- food_search_sheet: scan buttons replaced with full-width stacked OutlinedButtons
- app.dart: WidgetsBindingObserver refreshes scan providers on app resume
- L10n: added dishRecognitionHint and minimize keys to all 12 locales

Backend:
- migrations/003: ALTER TYPE recipe_source ADD VALUE 'recommendation' to fix
  22P02 error in GET /home/summary -> getRecommendations()
- item_enricher: normalizeProductCategory() validates AI-returned category
  against known slugs, falls back to "other" — fixes products_category_fkey
  FK violation during receipt recognition
- recognition prompt: enumerate valid categories so AI returns correct values

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
dbastrikin
2026-03-28 00:03:17 +02:00
parent 5c5ed25e5b
commit 180c741424
32 changed files with 416 additions and 64 deletions

View File

@@ -220,24 +220,24 @@ class _FoodSearchSheetState extends ConsumerState<FoodSearchSheet> {
),
),
// Quick action chips
// Scan action buttons — full-width, stacked vertically
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),
child: Wrap(
spacing: 8,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
if (widget.onScanDish != null)
ActionChip(
avatar:
const Icon(Icons.camera_alt_outlined, size: 18),
OutlinedButton.icon(
icon: const Icon(Icons.camera_alt_outlined, size: 18),
label: Text(l10n.scanDishPhoto),
onPressed: () {
Navigator.pop(context);
widget.onScanDish!();
},
),
ActionChip(
avatar: const Icon(Icons.qr_code_scanner, size: 18),
if (widget.onScanDish != null) const SizedBox(height: 8),
OutlinedButton.icon(
icon: const Icon(Icons.qr_code_scanner, size: 18),
label: Text(l10n.scanBarcode),
onPressed: _openBarcodeScanner,
),