How yussefz99/qalam works
1. This repository is a Flutter mobile app called “qalam,” focused on Arabic handwriting practice and early literacy. There is no obvious server-side component; the app appears to run fully on-device, with local persistence, asset-based curriculum, and optional ML-based recognition.
2. The runtime boundary starts at lib/main.dart, which boots the Flutter app, applies theming, and hands off to the router. The Android folder is just the platform shell for Flutter, with the standard MainActivity.kt and Android manifests.
3. Navigation is centralized in lib/router/app_router.dart and related route definitions. The route layer likely separates onboarding, home, practice, journey, demo, and settings flows, and tests indicate there is an onboarding gate and demo route handling.
4. The main product surfaces are split into feature modules:
- lib/features/onboarding for initial user setup
- lib/screens/home_screen.dart, practice_screen.dart, and settings_screen.dart for primary app entry points
- lib/features/journey for progression visualization
- lib/features/practice for the handwriting session experience
5. The handwriting practice flow is the core functional subsystem. It is composed of a canvas for stroke capture, visual guidance, ghost comparison, tutor/praise/feedback panels, stroke-order animation, and mastery celebration. This suggests an interaction loop of “show target -> capture ink -> evaluate -> give feedback -> progress state.”
6. Scoring and recognition are isolated in lib/core. The scoring pipeline includes stroke normalization, resampling, tolerance rules, geometric stroke scoring, and letter-level scoring. Recognition is separated into a recognizer abstraction plus an ML Kit-backed implementation, which implies the app can compare user input against reference paths and potentially use device ML for input interpretation.
7. Curriculum and learning content are asset-driven. assets/curriculum/letters.json and lessons.json are the source of lesson and letter definitions, while lib/data/curriculum_repository.dart and the models/lesson.dart, letter.dart, and lesson_progression.dart files turn that content into app-ready domain objects.
8. User and progress state are persisted locally. lib/data/app_database.dart plus Drift-generated files, along with repositories for child profiles and progress, indicate an offline-first local database layer. The repositories are the boundary between UI/state management and storage.
9. State management is provider-based. The lib/providers package contains providers for audio, journey, practice, profile, and progression, with generated Riverpod code. This layer mediates between UI screens and repositories/services, and likely coordinates session state, selected lesson/letter, and progression updates.
10. There is a service boundary for model downloads. lib/services/model_download_service.dart suggests the app can fetch or manage recognition models on-device, which is the main place where external network or device-managed model infrastructure could appear.
11. The app has a strong demo and presentation subsystem under lib/demo and docs/presentation. Demo screens like watch, trace, feedback, home, and celebration indicate a scripted user journey used for showcasing or stakeholder review, separate from the production learning flow.
12. lib/dev contains authoring and audit tools embedded in the app itself, such as glyph audit and authoring screens. This implies an internal content-validation workflow alongside the learner-facing app, probably used to inspect reference paths, glyph correctness, or curriculum content.
13. The UI is heavily themed and branded. lib/theme, lib/widgets/arabic_text.dart, and lib/widgets/qalam_mascot.dart form the shared presentation layer, while the docs/design tree contains the design system, previews, and UI kits that informed the app’s visual language.
14. The test suite mirrors the architecture closely: core scoring, curriculum validation, repositories, routing, onboarding, journey, practice, demo screens, themes, widgets, and golden tests. That layout is a good guide for diagramming boundaries, because it reflects the app’s actual subsystem decomposition.
15. The .claude and .planning directories are not runtime architecture; they are workflow, planning, and agent-instruction infrastructure for building and maintaining the app. They matter for development process, but not for the deployed product diagram.
Main entry points: app_router.dart App router · practice_screen.dart Practice loop · practice_providers.dart Providers · curriculum_repository.dart Curriculum repo
Components 24
App runtime
Flutter app shell, routing, screens, and shared presentation
- main.dart · Bootstraps the app, theme, and router
lib/main.dart - App router · Central route definitions and flow gating
lib/router/app_router.dart - Home · Primary landing screen for the app
lib/screens/home_screen.dart - Practice screen · Top-level practice entry screen
lib/screens/practice_screen.dart - Settings · App settings and preferences screen
lib/screens/settings_screen.dart - Onboarding · Initial profile setup and first-run experience
lib/features/onboarding/onboarding_screen.dart - Journey · Progression map and learning path visualization
lib/features/journey/journey_screen.dart - Theme · Shared colors, typography, dimensions, and brand extensions
lib/theme/app_theme.dart - Shared widgets · Reusable Arabic text and mascot presentation widgets
lib/widgets/arabic_text.dart
Learning domain
Practice, curriculum, scoring, recognition, and persistence
- Practice loop · Handwriting session experience and feedback loop
lib/features/practice/practice_screen.dart - Stroke canvas · Captures user ink and stroke input
lib/features/practice/widgets/stroke_canvas.dart - Feedback panels · Tutor, praise, ghost comparison, and mastery celebration
lib/features/practice/widgets/feedback_panel.dart - Scoring core · Normalization, resampling, tolerance, and letter scoring
lib/core/scoring/letter_scorer.dart - Recognizer · Handwriting recognition interface and ML Kit-backed implementation
lib/core/recognition/handwriting_recognizer.dart - Curriculum repo · Loads lesson and letter curriculum from assets into domain models
lib/data/curriculum_repository.dart - Curriculum assets · JSON lesson and letter definitions
assets/curriculum/letters.json - Domain models · Lesson, letter, progression, and journey state objects
lib/models/lesson.dart - Local database · Drift-backed persistence for profiles and progress
lib/data/app_database.dart - Data repos · Child profile and progress repositories bridging UI and storage
lib/data/child_profile_repository.dart - Providers · Riverpod providers coordinating UI, repositories, and session state
lib/providers/practice_providers.dart - Model download · Manages on-device recognition model acquisition and availability
lib/services/model_download_service.dart
Demo and tools
Demo flows, authoring utilities, and external presentation assets
- Demo suite · Scripted showcase journey for watch, trace, feedback, home, and celebration
lib/demo/screens/demo_home_screen.dart - Dev tools · In-app glyph audit and authoring screens for content validation
lib/dev/authoring_screen.dart - Design docs · Presentation and design-system assets supporting the app UI
docs/design/README.md
Connections 26
- main.dart → App router: boots · App entry hands off to centralized routing
- main.dart → Theme: applies · Global app theme is configured at startup
- App router → Home: routes to · Primary home flow
- App router → Onboarding: gates · First-run onboarding and profile setup
- App router → Practice screen: routes to · Practice entry point
- App router → Journey: routes to · Progress visualization flow
- App router → Settings: routes to · Settings and preferences flow
- App router → Demo suite: routes to · Demo and showcase routes
- Home → Providers: reads state · Home screen consumes app state and progress
- Practice screen → Practice loop: hosts · Practice screen contains the handwriting loop
- Practice loop → Stroke canvas: captures · Ink input and stroke capture
- Practice loop → Feedback panels: shows · Guidance, praise, and celebration UI
- Practice loop → Scoring core: evaluates · User strokes are normalized and scored
- Practice loop → Recognizer: interprets · Optional recognition path for input comparison
- Practice loop → Providers: updates · Session state and progression updates flow through providers
- Providers → Data repos: loads/saves · State layer mediates access to persistence
- Data repos → Local database: persists · Local offline storage for profiles and progress
- Curriculum repo → Curriculum assets: reads · Asset-backed lesson and letter definitions
- Curriculum repo → Domain models: builds · Converts curriculum content into domain objects
- Journey → Providers: reads state · Journey view renders progression from provider state
- Providers → Curriculum repo: uses · Providers combine curriculum with progress state
- Model download → Recognizer: supplies models · Service supports device-side recognition model management
- Dev tools → Curriculum repo: audits · Authoring and glyph tools inspect curriculum content
- Demo suite → Shared widgets: reuses · Demo screens share branded presentation widgets
- Theme → Shared widgets: styles · Shared presentation layer is themed consistently
- Design docs → Theme: informs · Design system docs shape the app visual language