lib/
│
├── main.dart // App entry point
│
├── core/ // Core utilities (constants, helpers, theme)
│ ├── constants/
│ │ ├── app_colors.dart
│ │ ├── app_strings.dart
│ │ └── api_endpoints.dart
│ ├── theme/
│ │ └── app_theme.dart
│ └── utils/
│ ├── date_time_helper.dart
│ └── notification_helper.dart
│
├── data/ // Data layer (API + Local DB)
│ ├── models/
│ │ ├── task_model.dart
│ │ └── quote_model.dart
│ ├── services/
│ │ ├── api_service.dart // Uses Dio for API calls
│ │ ├── quote_api.dart // Fetch motivational quote
│ │ └── local_db_service.dart // (Hive/SQLite)
│ └── repositories/
│ ├── task_repository.dart
│ └── quote_repository.dart
│
├── providers/ // State management (Provider/ChangeNotifier)
│ ├── task_provider.dart
│ └── quote_provider.dart
│
├── ui/ // Presentation layer
│ ├── screens/
│ │ ├── home_screen.dart
│ │ ├── add_task_screen.dart
│ │ ├── task_detail_screen.dart
│ │ └── settings_screen.dart
│ ├── widgets/
│ │ ├── task_tile.dart
│ │ └── custom_button.dart
│ └── dialogs/
│ └── add_task_dialog.dart
│
└── routes/
└── app_routes.dart // Centralized route management
🏗️ Layered Explanation
1. Core Layer
constants/
→ Strings, colors, endpoints (no hardcoding).
utils/
→ Helpers like date formatting, notification scheduler.
theme/
→ Centralized app theme.
2. Data Layer
models/
→ Defines the data structure (e.g., TaskModel {id, title, description, dueDate, isCompleted}
).
services/
→ Handles external I/O:
- api_service.dart → Wrapper around Dio (base URL, headers, error handling).
- quote_api.dart → Calls a quotes API (like ZenQuotes) for daily motivation.
- local_db_service.dart → Manages local persistence (Hive or SQLite).
repositories/
→ Acts as a bridge: combines services
logic and prepares data for Providers.
3. Providers (State Management Layer)
- task_provider.dart
- Manages tasks: add, edit, delete, mark complete, load from DB.
- Holds task list state.
- quote_provider.dart
- Fetches and stores daily motivational quote from API.
4. UI Layer
- screens/
home_screen.dart
→ Shows today’s tasks + motivational quote.
add_task_screen.dart
→ Add/edit tasks with due date.
task_detail_screen.dart
→ View details, set reminders.
settings_screen.dart
→ Manage notifications, theme, etc.