A professional Flutter mobile application designed to help users improve their sleep quality through intelligent tracking, personalized insights, ambient sleep sounds, and smart reminders.
Built with Clean Architecture, Firebase, and Bloc (Cubit) state management.
- Start/Stop sleep tracking with a live timer
- Persistent tracking β survives app termination using local storage
- Ongoing notification while tracking is active
- Active session banner on dashboard with live elapsed time
- Automatic session recovery on app relaunch
- Sleep Score Algorithm based on duration + consistency + bedtime
- Weekly sleep trends with interactive charts (FL Charts)
- Average sleep duration with goal comparison
- Sleep debt detection and tracking
- Best sleep day identification
- Average bedtime & wake-up time statistics
- 12 ambient sounds (Rain, Ocean, Forest, Fireplace, White Noise, etc.)
- Auto-loop playback
- Sleep timer (15/30/60 min auto-stop)
- Integrated within Sleep Tracking screen via Bottom Sheet
- Sound automatically stops when sleep tracking ends
- Bedtime reminders using Android AlarmManager (works even when app is killed)
- Persistent sleep tracking notification
- Notification tap navigates to active tracking session
- Reminders automatically reschedule daily
- 6 achievement types (First Sleep, 7-Day Streak, Perfect Sleeper, etc.)
- Real-time progress tracking
- Animated unlock dialog
- Reactive calculation based on sleep history
- Edit profile (Name, Age, Sleep Goal)
- Theme switching (Light / Dark / System) with persistence
- Bedtime reminder configuration
- Account management (Sign Out / Delete Account)
- App info (Version, Privacy Policy, Contact)
- Email & Password (Sign Up / Sign In)
- Google Sign-In
- Firebase Authentication
- Auto-login on app restart
Clean Architecture + Feature-Based Structure
lib/
βββ core/
β βββ notifications/ # AlarmManager + Local Notifications
β βββ services/ # Sleep Session persistence
β βββ theme/ # Theme Cubit + Service
β βββ user/ # User Cubit (Global)
β βββ utils/ # Router, Theme, Colors, Assets
β βββ widgets/ # Shared widgets
β βββ firestore_service.dart
β
βββ features/
β βββ auth/ # Sign In / Sign Up / Auth Service
β βββ home/ # Dashboard + widgets
β βββ sleep_tracking/ # Tracking View + Sound Sheet
β βββ sleep/ # Insights + History + Score Calculator
β βββ relax/ # Sound Cubit + Models
β βββ achievements/ # Rules + Cubit + UI
β βββ profile/ # Profile + Edit + Settings
β βββ onbording/ # Onboarding screens
β βββ splash/ # Splash screen
β
βββ screens.dart # Main navigation shell
βββ main.dart # App entry point
| Technology | Usage |
|---|---|
| Flutter | Cross-platform UI framework |
| Firebase Auth | Authentication (Email + Google) |
| Cloud Firestore | Real-time database |
| Bloc / Cubit | State management |
| GoRouter | Declarative navigation |
| FL Charts | Data visualization |
| AudioPlayers | Ambient sound playback |
| Android AlarmManager | Scheduled notifications (survives app kill) |
| Flutter Local Notifications | Push notifications |
| SharedPreferences | Local persistence |
| ScreenUtil | Responsive design |
| Google Fonts | Typography |
| Package Info Plus | App version info |
- Flutter SDK (3.7.2+)
- Firebase project configured
- Android Studio / VS Code
# Clone the repository
git clone https://github.com/YOUR_USERNAME/slumber.git
# Navigate to project
cd slumber
# Install dependencies
flutter pub get
# Run the app
flutter run- Create a Firebase project at console.firebase.google.com
- Enable Authentication (Email/Password + Google)
- Enable Cloud Firestore
- Download
google-services.json(Android) andGoogleService-Info.plist(iOS) - Place them in the appropriate directories
users/{uid}
βββ id
βββ name
βββ email
βββ age
βββ sleepGoalHours
βββ bedtime
users/{uid}/sleepHistory/{docId}
βββ startTime
βββ endTime
βββ duration
- Persistent Sleep Tracking: Sessions survive app termination using SharedPreferences
- AlarmManager Integration: Bedtime reminders fire even when the app is completely killed
- Reactive Achievements: Auto-calculated based on real-time sleep data streams
- Sleep Score Algorithm: Multi-factor scoring (duration + consistency + bedtime timing)
- Audio Loop Management: Seamless ambient sound playback with auto-stop timer
- Live UI Updates: Active session banner updates every second across screens
- Theme Persistence: User theme preference saved and restored on app launch
To ensure the highest level of reliability and accuracy, the core business logic is heavily tested:
- Algorithms Tested:
SleepScoreCalculator,AchievementsRules, andSleepSessionService. - Test Coverage: Validates edge cases like day-overlapping sleep sessions, accurate sleep debt calculations, and precise achievement progress tracking.
- Status: 42/42 Tests Passing β .
This project is for portfolio/educational purposes.
Built with β€οΈ using Flutter






