- Rewrite receipt OCR prompt: completes truncated names, preserves fat% and flavour attributes, extracts weight/volume from line, infers typical package sizes for solid goods with quantity_confidence field - Add quantity_confidence to RecognizedItem, EnrichedItem, and ProductJobResultItem; propagate through item enricher and worker - Replace per-item create loop with single POST /user-products/batch call from RecognitionConfirmScreen - Rebuild RecognitionConfirmScreen: amber qty border for low quantity_confidence, tappable product name → catalog picker, sort items by confidence, full L10n (no hardcoded strings) - Add timestamps (HH:mm / d MMM HH:mm) to recent scan chips - Show close-app hint on ProductJobWatchScreen (queued + processing) - Refresh recentProductJobsProvider on watch screen init so new job appears without a manual pull-to-refresh - App-level WidgetsBindingObserver refreshes product and dish job lists on resume, fixing stale lists after background/foreground transitions - Add 9 new L10n keys across all 12 locales Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
55 lines
1.5 KiB
Dart
55 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:food_ai/l10n/app_localizations.dart';
|
|
|
|
import 'core/locale/language_provider.dart';
|
|
import 'core/router/app_router.dart';
|
|
import 'core/theme/app_theme.dart';
|
|
import 'features/home/home_provider.dart';
|
|
import 'features/products/product_job_provider.dart';
|
|
|
|
class App extends ConsumerStatefulWidget {
|
|
const App({super.key});
|
|
|
|
@override
|
|
ConsumerState<App> createState() => _AppState();
|
|
}
|
|
|
|
class _AppState extends ConsumerState<App> with WidgetsBindingObserver {
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
WidgetsBinding.instance.addObserver(this);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
WidgetsBinding.instance.removeObserver(this);
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
void didChangeAppLifecycleState(AppLifecycleState lifecycleState) {
|
|
if (lifecycleState == AppLifecycleState.resumed) {
|
|
ref.read(recentProductJobsProvider.notifier).refresh();
|
|
ref.read(todayJobsProvider.notifier).load();
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final router = ref.watch(routerProvider);
|
|
final languageCode = ref.watch(languageProvider);
|
|
|
|
return MaterialApp.router(
|
|
title: 'FoodAI',
|
|
theme: appTheme(),
|
|
routerConfig: router,
|
|
debugShowCheckedModeBanner: false,
|
|
locale: Locale(languageCode),
|
|
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
|
supportedLocales: AppLocalizations.supportedLocales,
|
|
);
|
|
}
|
|
}
|