How klisard/pomodoro_timer works
1. This repository is a cross-platform Flutter app centered on a Pomodoro timer. The shared application logic lives in lib/, while platform shells exist for Android, iOS, macOS, Windows, Linux, and Web.
2. The core UI is a small screen set in lib/screens/: home_screen.dart for the timer itself, history_screen.dart for past sessions, and settings_screen.dart for configuration. These screens are the top of the app’s dependency chain and should be drawn as the presentation layer.
3. State is organized with providers in lib/providers/: timer_provider.dart, settings_provider.dart, and history_provider.dart. They act as the app’s coordination layer, exposing timer state, user preferences, and session history to the screens.
4. The app’s data model is minimal and local-first. lib/models/app_settings.dart and lib/models/session_record.dart define the persisted configuration and the session history entries that flow through the providers and storage layer.
5. Persistent storage is handled by lib/services/storage_service.dart. This is the app’s long-term data boundary: settings and session records are stored locally and reloaded into the providers at startup or when the app resumes.
6. Timer behavior is split out from the UI into lib/services/background_timer_service.dart. This suggests the countdown continues independently of the visible screen lifecycle, and the timer provider delegates timing work to this service rather than owning it directly.
7. User feedback services are separated by concern: lib/services/notification_service.dart handles user notifications, lib/services/audio_service.dart handles sound cues, and lib/services/now_bar_service.dart manages a live “now bar”/ongoing-timer style display. These services are invoked from the timer flow when state changes or milestones are reached.
8. Android has the most explicit native integration. android/app/src/main/kotlin/com/example/pomodoro_timer/TimerDisplayService.kt and NowBarManager.kt indicate a platform-specific mechanism for persistent timer display and notification UI on Android, supported by custom notification layouts in android/app/src/main/res/layout/.
9. The native layer is otherwise thin. iOS, macOS, Windows, Linux, and Web are standard Flutter host projects with generated or minimal runner code, so the shared Dart code remains the main application architecture across platforms.
10. The likely runtime flow is: UI screen action -> provider state change -> service invocation -> storage/notification/audio/native display updates. That makes the important architectural boundaries: Flutter UI, app state providers, local persistence, background/timing services, and Android-only native presentation.
11. There are no obvious backend APIs or cloud dependencies in this repo. The architecture appears fully on-device, with local state and platform notifications as the primary integrations.
12. The graphify-out/ directory is an analysis artifact, not part of the product runtime. It can be ignored in a system diagram.
Main entry points: timer_provider.dart Timer state · home_screen.dart Home · settings_provider.dart Settings state · history_provider.dart History state
Components 18
Shared Flutter App
Cross-platform Dart application logic and UI.
- App entry · Initializes the Flutter app and wires the root widget tree.
lib/main.dart - Home · Primary Pomodoro timer screen.
lib/screens/home_screen.dart - History · Shows past session records.
lib/screens/history_screen.dart - Settings · Controls app and timer configuration.
lib/screens/settings_screen.dart - Timer state · Coordinates countdown state and timer lifecycle.
lib/providers/timer_provider.dart - Settings state · Exposes persisted user preferences to the UI.
lib/providers/settings_provider.dart - History state · Manages session history read/write flow.
lib/providers/history_provider.dart - App settings · Persisted configuration model.
lib/models/app_settings.dart - Session record · Single completed Pomodoro session entry.
lib/models/session_record.dart - Storage · Local long-term storage for settings and session data.
lib/services/storage_service.dart - Background timer · Runs countdown behavior outside the visible screen lifecycle.
lib/services/background_timer_service.dart - Notifications · Emits user-facing alerts when timer milestones occur.
lib/services/notification_service.dart - Audio cues · Plays sound feedback for timer events.
lib/services/audio_service.dart - Now bar · Maintains live ongoing-timer display behavior.
lib/services/now_bar_service.dart
Android Native
Platform-specific timer and notification integration.
- MainActivity · Android Flutter entry activity.
android/app/src/main/kotlin/com/example/pomodoro_timer/MainActivity.kt - Timer display · Native Android persistent timer and notification service.
android/app/src/main/kotlin/com/example/pomodoro_timer/TimerDisplayService.kt - Now bar mgr · Builds and updates Android now-bar and notification presentation.
android/app/src/main/kotlin/com/example/pomodoro_timer/NowBarManager.kt
Platform Shells
Thin Flutter host projects for desktop, mobile, and web.
- Other hosts · Standard iOS, macOS, Linux, Windows, and Web shell projects.
Connections 19
- App entry → Home: launches · Bootstraps the UI around the main timer screen.
- Home → Timer state: reads/writes · Timer screen drives and observes timer state.
- Home → History state: reads · Home may surface recent session context.
- Home → Settings state: reads · Uses settings for timer behavior and display.
- History → History state: reads · History screen consumes session history.
- Settings → Settings state: reads/writes · Settings screen edits persisted preferences.
- Timer state → Background timer: delegates · Provider offloads countdown execution.
- Timer state → Storage: persists · Timer state changes may update local storage.
- Timer state → Notifications: alerts · Triggers notifications on timer events.
- Timer state → Audio cues: sounds · Plays cues when phases change.
- Timer state → Now bar: updates · Keeps the live now-bar presentation in sync.
- Settings state → App settings: uses · Maps provider state to persisted settings model.
- Settings state → Storage: loads/saves · Reads and writes app settings locally.
- History state → Session record: uses · History provider manages session entries.
- History state → Storage: loads/saves · Persists session history locally.
- Background timer → Storage: syncs · Can reload or checkpoint timer-related state.
- Now bar → Now bar mgr: bridges · Shared now-bar logic connects to Android implementation.
- Notifications → Timer display: integrates · Timer flow can route into Android foreground/display service.
- Other hosts → MainActivity: hosts · Represents the thin native shells around the shared app.