How aau-giraf/foodplanner works
Purpose and Runtime
GIRAF Foodplanner is a Flutter client for meal planning in the GIRAF ecosystem, optimized for iOS but also carrying web and macOS targets. It consumes a separately deployed ASP.NET backend, which persists data in PostgreSQL and stores food images in Minio. Flutter project/runtime metadata is rooted at foodplanner/pubspec.yaml, foodplanner/ios/Runner/AppDelegate.swift, and foodplanner/web/index.html.
Application Bootstrap and Navigation
foodplanner/lib/main.dart initializes the application. Navigation is centralized through GoRouter route definitions in foodplanner/lib/routes/index.dart and foodplanner/lib/routes/paths.dart, creating the boundary between app-wide navigation/auth state and feature pages. Landing, login, signup, and unauthorized screens establish entry and access flows.
Authentication and Role-Specific Experience
Authentication is represented by foodplanner/lib/auth/auth_provider.dart and networked through foodplanner/lib/services/fetch_auth.dart. User and role domain types live in foodplanner/lib/models/user.dart and foodplanner/lib/models/user_roles.dart. Pages divide workflows for guardians, teachers, children, and administrators, including foodplanner/lib/pages/landing_page_guardian.dart, foodplanner/lib/pages/landing_page_teacher.dart, and foodplanner/lib/pages/settings/admin_approve_page.dart.
Meal Planning Domain
Meal planning is the primary feature: users create, edit, list, and inspect meal plans via foodplanner/lib/pages/meal_list_page.dart, foodplanner/lib/pages/add_meal_form_page.dart, and foodplanner/lib/pages/edit_meal_page.dart. Core entities are foodplanner/lib/models/meal.dart, foodplanner/lib/models/ingredient.dart, and foodplanner/lib/models/packed_ingredient.dart. Shared meal state/change propagation is handled by foodplanner/lib/services/meal_notifier.dart.
Data Access and Generated API Boundary
Service classes encapsulate calls from pages/widgets to the backend: foodplanner/lib/services/meal_services.dart, foodplanner/lib/services/ingredient_services.dart, and foodplanner/lib/services/user_service.dart. API base configuration is isolated in foodplanner/lib/services/api_config.dart. Generated OpenAPI client configuration is under foodplanner/lib/api/generator/openapi_config.dart; generation depends on a running backend and foodplanner/openapi_generator_config.json. This is the main client/server contract boundary.
Supporting Workflows: Pupils, Classes, Feedback, Images
Pupil and school-class administration uses foodplanner/lib/services/pupil_service.dart, foodplanner/lib/services/school_class_service.dart, and pages such as foodplanner/lib/pages/pupil_page.dart. Feedback chat is accessed through foodplanner/lib/services/fetch_feedback_messages.dart and foodplanner/lib/pages/feedback_chat_page.dart. Food image retrieval/upload-facing behavior is separated in foodplanner/lib/services/food_image_service.dart and foodplanner/lib/components/image.dart, crossing to the Minio image service rather than the core relational API.
UI Composition and Platform Delivery
Feature pages compose reusable Flutter controls from foodplanner/lib/components/, with meal-specific presentation concentrated in foodplanner/lib/components/meal_box.dart and foodplanner/lib/components/meal_list_element.dart. iOS packaging, signing, and native integration are maintained in foodplanner/ios/Runner.xcodeproj and foodplanner/ios/Runner/Info.plist; web can be launched through foodplanner/run_flutter_web.bat.
Main entry points: meal_services.dart Meal and ingredient services · meal_list_page.dart Meal planning pages · main.dart App bootstrap · index.dart Navigation and access
Components 19
Flutter client
- Flutter runtime · iOS-first client with web and macOS targets.
foodplanner/pubspec.yaml - App bootstrap
foodplanner/lib/main.dart - Navigation and access · Central route and authentication-state boundary.
foodplanner/lib/routes/index.dart - Authentication state
foodplanner/lib/auth/auth_provider.dart - Auth transport
foodplanner/lib/services/fetch_auth.dart - Meal and ingredient services
foodplanner/lib/services/meal_services.dart - Reusable UI components · Includes meal presentation controls.
foodplanner/lib/components/meal_box.dart - Generated API contract · Generated against the running backend.
foodplanner/lib/api/generator/openapi_config.dart - API endpoint config
foodplanner/lib/services/api_config.dart - iOS delivery
foodplanner/ios/Runner.xcodeproj
Feature workflows
- Role-specific pages · Guardian, teacher, child, and administrator workflows.
foodplanner/lib/pages/landing_page_guardian.dart - Meal planning pages · Create, edit, list, and inspect meal plans.
foodplanner/lib/pages/meal_list_page.dart - Meal change state
foodplanner/lib/services/meal_notifier.dart - Pupil and class services
foodplanner/lib/services/pupil_service.dart - Feedback chat
foodplanner/lib/pages/feedback_chat_page.dart - Food images · Retrieval and upload-facing image behavior.
foodplanner/lib/services/food_image_service.dart
Deployed services
- ASP.NET backend
- PostgreSQL
- Minio image storage
Connections 18
- Flutter runtime → App bootstrap: launches
- App bootstrap → Navigation and access: initializes
- App bootstrap → Authentication state: provides state
- Navigation and access → Role-specific pages: routes by access
- Navigation and access → Meal planning pages: routes to
- Authentication state → Auth transport: authenticates via
- Auth transport → ASP.NET backend: calls
- Meal planning pages → Meal change state: reads and updates
- Meal planning pages → Meal and ingredient services: uses
- Meal planning pages → Reusable UI components: composes
- Meal and ingredient services → API endpoint config: uses endpoint
- Meal and ingredient services → Generated API contract: uses contract
- Meal and ingredient services → ASP.NET backend: calls
- Pupil and class services → ASP.NET backend: calls
- Feedback chat → ASP.NET backend: loads messages
- Food images → Minio image storage: retrieves images
- ASP.NET backend → PostgreSQL: persists data
- iOS delivery → Flutter runtime: packages