feat: unified food calendar — extend home screen to future dates + planned meals
Phase 1: date strip now covers today + 7 future days; right chevron enabled; future pills rendered in lighter style. Phase 2: home screen shows DateContext (past/today/future): - future dates: hide calorie ring + macros, show PlanningBanner - plannedMealsProvider derives from cached menuProvider (no extra API call) - _MealCard shows ghost PlannedSlotTile for unconfirmed menu slots - "Mark as eaten" creates a diary entry (source: menu_plan) via existing API New l10n keys (12 locales): planningForDate, markAsEaten, plannedMealLabel Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,8 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../features/scan/recognition_service.dart';
|
||||
import '../../shared/models/home_summary.dart';
|
||||
import '../../shared/models/menu.dart';
|
||||
import '../menu/menu_provider.dart';
|
||||
import 'home_service.dart';
|
||||
|
||||
// ── Selected date (persists while app is open) ────────────────
|
||||
@@ -76,3 +78,21 @@ final allJobsProvider =
|
||||
StateNotifierProvider<AllJobsNotifier, AsyncValue<List<DishJobSummary>>>(
|
||||
(ref) => AllJobsNotifier(ref.read(recognitionServiceProvider)),
|
||||
);
|
||||
|
||||
// ── Planned meals from menu ────────────────────────────────────
|
||||
|
||||
/// Returns planned [MealSlot]s from the menu plan for [dateString].
|
||||
/// Derives from the already-cached weekly menu — no extra network call.
|
||||
/// Returns an empty list when no plan exists for that week.
|
||||
final plannedMealsProvider =
|
||||
Provider.family<List<MealSlot>, String>((ref, dateString) {
|
||||
final date = DateTime.parse(dateString);
|
||||
final weekString = isoWeekString(date);
|
||||
final menuState = ref.watch(menuProvider(weekString));
|
||||
final plan = menuState.valueOrNull;
|
||||
if (plan == null) return [];
|
||||
for (final day in plan.days) {
|
||||
if (day.date == dateString) return day.meals;
|
||||
}
|
||||
return [];
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user