e495a4b38e
- Introduced MealPlanApiPaths for handling meal plan related API endpoints. - Added MealPlanScreen for displaying and managing meal plans. - Implemented MealPlanRepository for fetching and updating meal plan data. - Created data models: MealPlanEntry, MealPlanRecipe, InventoryCompareItem, ShoppingItem, and MealPlanDashboard. - Integrated meal plan functionality into the app router and UI. - Updated localization files for meal plan related strings in English and Swedish. - Added state management for meal plan using Riverpod.
26 lines
752 B
Dart
26 lines
752 B
Dart
import 'inventory_compare_item.dart';
|
|
import 'meal_plan_entry.dart';
|
|
import 'shopping_item.dart';
|
|
|
|
class MealPlanDashboard {
|
|
final List<MealPlanEntry> entries;
|
|
final List<ShoppingItem> shoppingItems;
|
|
final List<InventoryCompareItem> inventoryCompareItems;
|
|
|
|
const MealPlanDashboard({
|
|
required this.entries,
|
|
required this.shoppingItems,
|
|
required this.inventoryCompareItems,
|
|
});
|
|
|
|
MealPlanEntry? entryForDate(DateTime date) {
|
|
final normalized = DateTime(date.year, date.month, date.day);
|
|
for (final entry in entries) {
|
|
final entryDate = DateTime(entry.date.year, entry.date.month, entry.date.day);
|
|
if (entryDate == normalized) {
|
|
return entry;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
} |