Files
food-ai/client/lib/features/home/home_provider.dart
dbastrikin 9530dc6ff9 feat: implement Iteration 5 — home screen dashboard
Backend:
- internal/home: GET /home/summary endpoint
  - Today's meal plan from menu_plans/menu_items
  - Logged calories sum from meal_diary
  - Daily goal from user profile (default 2000)
  - Expiring products within 3 days
  - Last 3 saved recommendations (no AI call on home load)
- Wire homeHandler in server.go and main.go

Flutter:
- shared/models/home_summary.dart: HomeSummary, TodaySummary,
  TodayMealPlan, ExpiringSoon, HomeRecipe
- features/home/home_service.dart + home_provider.dart
- features/home/home_screen.dart: greeting, calorie progress bar,
  today's meals card, expiring banner, quick actions row,
  recommendations horizontal list

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 15:25:28 +02:00

23 lines
607 B
Dart

import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../shared/models/home_summary.dart';
import 'home_service.dart';
class HomeNotifier extends StateNotifier<AsyncValue<HomeSummary>> {
final HomeService _service;
HomeNotifier(this._service) : super(const AsyncValue.loading()) {
load();
}
Future<void> load() async {
state = const AsyncValue.loading();
state = await AsyncValue.guard(() => _service.getSummary());
}
}
final homeProvider =
StateNotifierProvider<HomeNotifier, AsyncValue<HomeSummary>>(
(ref) => HomeNotifier(ref.read(homeServiceProvider)),
);