Sleep O'Clock is a minimalist bedside mobile application built in Flutter, engineered to simultaneously solve two key nocturnal challenges: adult sleep hygiene (minimizing blue light disruption to the circadian rhythm) and toddler sleep training (a zero-text visual trainer for preschoolers), featuring advanced hardware-aware protections for modern displays.
Software Architecture & Engineering
- Clean Architecture + DDD: Layered architecture strictly decoupling domain entities, use cases (
CheckWakeUpConditionUseCase), data sources, and presentation. The clock core feature manages its own isolated dependency injection container (clock_injection_container.dartviaget_it), ensuring low coupling and high testability. - Reactive State Management (BLoC): Powered by
flutter_blocwith immutable events for atomic mode switching (Adult/Child, Day/Night, Red Mode), brightness levels, and precision timer triggers. - Functional Error Handling: Rigorous functional approach with
dartz(Either<Failure, T>), ensuring uninterrupted stability throughout the night with zero silent crashes. - Declarative Routing: Configured with
go_routerfor clean transitions and deep-linking readiness.
Hardware-Aware UX Challenges & Innovation
Unlike generic clock apps, Sleep O'Clock was architected around the physical constraints of smartphone displays and human circadian biology:
- Intelligent Anti Burn-in Protection (OLED/AMOLED): Keeping displays illuminated overnight with static elements causes irreversible pixel degradation (burn-in). I engineered an imperceptible pixel-shift mechanism via
AnimatedAlignthat smoothly shifts display coordinates every minute, evenly distributing diode wear without distracting the sleeping user. - Red Mode (Melatonin Preservation): Instantly toggled via a double-tap gesture, the app suppresses blue and green wavelengths, switching to a soothing deep red spectrum that avoids suppressing melatonin secretion.
- Toddler Sleep Trainer (Zero-Text UX): For children aged 2 to 5 who cannot yet read digital clocks, the app functions as a visual circadian guide. It presents a gentle nocturnal theme (dark sky, pulsing moon and stars) and transitions smoothly at the scheduled hour into a daytime state (radiant sun and clouds), instinctively informing the child when it is time to wake up.
- Intuitive Gestures & Active Wakelock: Drag-to-dim brightness control (5% to 100%), full immersion hiding OS status/navigation bars, and continuous display stability using
wakelock_plus. - Product Telemetry: Anonymous Firebase Analytics integration (
com.jhh.solutions.sleep_oclock) monitoring feature adoption and session health.
Status: Continuously evolving product β Epic 1 (Toddler Sleep Routine & Anti Burn-in) delivered and validated by JHH Solutions.