How ryoga404/flutterprojects works
1. Repository shape
- This is a Flutter/Dart desktop/mobile/web app called a CBT-style learning system.
- The architecture is overwhelmingly local-first: there is no backend service directory, and the app appears to manage questions, history, backups, and exports on the device.
2. Primary user-facing subsystems
- The main workflows are split into separate screens under lib/screens:
- Question registration: register_screen.dart
- Exercise mode: exercise_menu_screen.dart, exercise_screen.dart
- Mock exam mode: mock_exam_screen.dart, score_screen.dart
- Question browsing: question_list_screen.dart
- Settings: settings/settings_screen.dart
- AI learning analysis: ml/model_training_screen.dart
- Entry/home navigation: home_screen.dart
- These screens are the top of the dependency stack and drive all app actions.
3. Domain model layer
- Core app data lives in lib/models:
- question.dart, question_set.dart, question_set_model.dart
- answer_history.dart
- exercise_progress.dart
- ai_learning_data.dart
- These files define the data structures that move through the app: question content, grouped sets, user progress, answer history, and analysis inputs.
4. Application/service layer
- Business logic is concentrated in lib/services:
- question_service.dart and question_service_tail.dart
- history_service.dart
- backup_service.dart
- pdf_service.dart
- share_service.dart
- ai_learning_service.dart
- This layer likely orchestrates reading/writing question data, tracking attempts, generating backups, creating PDF score reports, sharing outputs, and producing the AI-style “weakness analysis” described in the README.
5. Platform abstraction layer
- The lib/platform folder is a key architectural boundary.
- It contains paired implementations for native and web targets:
- storage, file picking, file saving
- backup I/O
- image widget rendering
- PDF image loading and PDF I/O
- question service I/O
- This indicates the app uses a single app logic layer with platform-specific adapters to handle differences between web and native OS behavior.
6. UI composition and reusable widgets
- Shared UI pieces live in lib/widgets, especially answer_widgets.dart.
- This suggests answer-type rendering is reused across exercise and exam flows, supporting the different question modes described in the README: true/false, single choice, multiple choice, and descriptive answers.
7. State and app-wide settings
- lib/providers contains app_settings_provider.dart and theme_provider.dart.
- These providers manage cross-screen state such as theme and user preferences, separating global app state from individual screen logic.
8. Data flow from authoring to practice
- The app’s main loop is:
- user creates or edits questions in the registration flow,
- question data is persisted locally through service + platform I/O,
- exercises and mock exams load filtered question sets,
- user responses are stored in history/progress models,
- results feed into score and analysis screens.
- Tag-based filtering and randomized choice ordering described in the README are likely implemented in the service/model layers and consumed by exercise screens.
9. Reporting and export path
- Mock exam mode has a distinct output path: after completion, the app generates a PDF score report with explanations.
- The pdf_service.dart, share_service.dart, and PDF-related platform files show that report generation and file output are first-class parts of the architecture, not afterthoughts.
10. AI learning mode
- The “AI learning” feature is currently analysis-focused, not a full ML pipeline.
- ai_learning_service.dart and the ml/model_training_screen.dart imply the app computes simple difficulty/weakness summaries from local answer history and progress data, then renders those results in the UI.
11. Cross-platform shell structure
- The repo contains full Flutter host projects for Android, iOS, Linux, macOS, Windows, and Web.
- The host folders are mostly generated platform shells that embed the shared Dart app; the real product logic remains in lib/.
- This matters architecturally because the platform-specific code is mostly integration glue, not business logic.
12. Build and automation
- .github/workflows/build.yml indicates CI build automation.
- pubspec.yaml, analysis_options.yaml, and pubspec.lock define Dart dependencies and static analysis rules.
- These files support repeatable multi-platform builds for a local/offline app.
13. Infra and persistence assumptions
- The README emphasizes local usage and offline study, which aligns with the presence of storage, file picker/saver, backup, and PDF export abstractions.
- There is no evidence of cloud persistence; the system boundary is primarily the local filesystem and OS-native file dialogs.
14. How to draw the architecture
- A good diagram would place screens at the top, feeding into services, which operate on models and delegate to platform adapters for storage/files/PDF/image I/O.
- Surround that with theme/settings providers and the cross-platform host shells.
- The only major external boundaries are the local filesystem, OS-specific file pickers/savers, and platform UI/tooling for Android/iOS/Desktop/Web.
Main entry points: main.dart App entry · home_screen.dart Home · question_service.dart Question service · mock_exam_screen.dart Mock exam
Components 34
UI flows
User-facing screens and reusable widgets
- App entry · Bootstraps the app and wires shared providers/navigation.
hello_world/lib/main.dart - Home · Top-level navigation hub into the app's main learning modes.
hello_world/lib/screens/home_screen.dart - Register · Creates and edits question content for local study data.
hello_world/lib/screens/register_screen.dart - Question list · Displays stored questions and supports browsing/filtering.
hello_world/lib/screens/question_list_screen.dart - Exercise menu · Selects exercise variants and routes into practice flows.
hello_world/lib/screens/exercise_menu_screen.dart - Exercise · Runs question-answer practice using reusable answer widgets.
hello_world/lib/screens/exercise_screen.dart - Mock exam · Drives timed exam-style sessions and result capture.
hello_world/lib/screens/mock_exam_screen.dart - Score · Shows exam outcome, explanation output, and report handoff.
hello_world/lib/screens/score_screen.dart - Settings · Exposes app preferences and theme-related controls.
hello_world/lib/screens/settings/settings_screen.dart - AI learning · Presents weakness and difficulty analysis from local history.
hello_world/lib/screens/ml/model_training_screen.dart - Answer UI · Reusable answer renderers shared by practice and exam flows.
hello_world/lib/widgets/answer_widgets.dart
Domain
Core question, history, progress, and analysis data
- Questions · Question content and set structures used across the app.
hello_world/lib/models/question.dart - Progress · Tracks answer history, exercise progress, and analysis inputs.
hello_world/lib/models/exercise_progress.dart - History · Stores answer history for reviews, scoring, and learning analysis.
hello_world/lib/models/answer_history.dart - AI data · Derived data structures used to summarize weaknesses and learning state.
hello_world/lib/models/ai_learning_data.dart
Services
Local-first business logic and reporting
- Question service · Coordinates question retrieval, filtering, and persistence behavior.
hello_world/lib/services/question_service.dart - History service · Records and queries attempts, scores, and review history.
hello_world/lib/services/history_service.dart - Backup · Creates and restores local backups of study data.
hello_world/lib/services/backup_service.dart - PDF report · Builds score report PDFs and related explanation output.
hello_world/lib/services/pdf_service.dart - Share · Hands off generated files and reports to OS sharing flows.
hello_world/lib/services/share_service.dart - Learning analysis · Computes local weakness summaries from history and progress.
hello_world/lib/services/ai_learning_service.dart
Platform adapters
Web/native abstractions for storage, files, PDF, and rendering
- Storage · Abstracts local storage access across web and native targets.
hello_world/lib/platform/app_storage.dart - File picker · Abstracts opening local file selection dialogs.
hello_world/lib/platform/app_file_picker.dart - File saver · Abstracts saving files to the local device or browser downloads.
hello_world/lib/platform/app_file_saver.dart - Backup I/O · Handles backup file access on web and native platforms.
hello_world/lib/platform/backup_io_native.dart - Image widget · Provides platform-specific image rendering support.
hello_world/lib/platform/image_widget.dart - PDF I/O · Loads images and writes PDF output in a platform-specific way.
hello_world/lib/platform/pdf_io_native.dart - Question I/O · Bridges question service persistence to native or web storage.
hello_world/lib/platform/question_service_io_native.dart
Host shells
Flutter platform launchers and generated runners
- Android shell · Android platform launcher and embedding layer.
hello_world/android/app/src/main/kotlin/com/example/hello_world/MainActivity.kt - iOS shell · iOS runner and native entry integration.
hello_world/ios/Runner/AppDelegate.swift - Linux shell · Linux desktop runner and window integration.
hello_world/linux/runner/main.cc - macOS shell · macOS runner and window integration.
hello_world/macos/Runner/AppDelegate.swift - Windows shell · Windows runner and window integration.
hello_world/windows/runner/main.cpp - Web shell · Web host page and manifest for browser deployment.
hello_world/web/index.html
Connections 42
- App entry → Home: opens · Bootstraps the main navigation surface.
- Home → Register: routes to · Entry into question authoring.
- Home → Question list: routes to · Entry into question browsing.
- Home → Exercise menu: routes to · Entry into practice modes.
- Home → Mock exam: routes to · Entry into exam mode.
- Home → Settings: routes to · Entry into app preferences.
- Home → AI learning: routes to · Entry into learning analysis.
- Exercise menu → Exercise: starts · Launches a selected practice session.
- Mock exam → Score: finishes at · Transitions to results after exam completion.
- Exercise → Answer UI: uses · Renders question-specific answer controls.
- Mock exam → Answer UI: uses · Shares answer rendering with practice flow.
- Register → Question service: writes via · Persists authored questions.
- Question list → Question service: reads via · Loads stored question sets.
- Exercise → Question service: loads via · Fetches questions for practice sessions.
- Mock exam → Question service: loads via · Fetches exam question sets.
- Exercise → History service: records · Stores attempts and progression.
- Mock exam → History service: records · Stores exam answers and outcomes.
- Score → PDF report: generates · Creates the exam report PDF.
- Score → Share: shares · Hands off the generated report.
- AI learning → Learning analysis: queries · Requests weakness and difficulty summaries.
- Learning analysis → History: analyzes · Uses answer history as input.
- Learning analysis → Progress: analyzes · Uses exercise progress as input.
- Learning analysis → AI data: produces · Creates local learning-analysis data.
- Question service → Questions: operates on · Manipulates question and set entities.
- History service → History: stores · Persists attempt history records.
- History service → Progress: updates · Maintains progress state across sessions.
- Backup → Backup I/O: uses · Delegates backup read/write to platform I/O.
- Question service → Question I/O: uses · Delegates question persistence to platform adapters.
- PDF report → PDF I/O: uses · Delegates PDF creation and image loading.
- PDF report → Image widget: uses · Relies on platform-specific image rendering support.
- Share → File saver: uses · Saves or exports generated files.
- Register → File picker: imports · May select local source files for question data.
- Question service → Storage: uses · Reads and writes local app data.
- Backup → Storage: uses · Persists backup state locally.
- Settings → Storage: updates · Persists user preferences and theme settings.
- App entry → Android shell: runs on · Embedded by the Android host shell.
- App entry → iOS shell: runs on · Embedded by the iOS host shell.
- App entry → Linux shell: runs on · Embedded by the Linux host shell.
- App entry → macOS shell: runs on · Embedded by the macOS host shell.
- App entry → Windows shell: runs on · Embedded by the Windows host shell.
- App entry → Web shell: runs on · Delivered through the web host shell.
- Settings → App entry: influences · Global preferences affect app-wide behavior.