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>
This commit is contained in:
19
client/lib/features/home/home_service.dart
Normal file
19
client/lib/features/home/home_service.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../core/api/api_client.dart';
|
||||
import '../../core/auth/auth_provider.dart';
|
||||
import '../../shared/models/home_summary.dart';
|
||||
|
||||
final homeServiceProvider = Provider<HomeService>((ref) {
|
||||
return HomeService(ref.read(apiClientProvider));
|
||||
});
|
||||
|
||||
class HomeService {
|
||||
final ApiClient _client;
|
||||
HomeService(this._client);
|
||||
|
||||
Future<HomeSummary> getSummary() async {
|
||||
final json = await _client.get('/home/summary');
|
||||
return HomeSummary.fromJson(json);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user