A comprehensive habit tracking application built with Flutter, designed to help users build and maintain positive daily habits. This project demonstrates modern mobile development practices, clean architecture, and comprehensive Agile user story development.
- User Stories - Complete user stories for all features
- Product Backlog - Prioritized development backlog
- Issue Template - Template for creating GitHub issues
- Contributing Guide - Learn how to contribute
- Changelog - Version history and release notes
- User Authentication: Secure registration and login system with personalized user accounts
- Habit Management: Create, customize, and delete habits with color personalization
- Progress Tracking: Monitor daily and weekly habit completion with visual indicators
- Weekly Reports: Comprehensive analytics with charts and completion percentages
- Smart Notifications: Customizable reminders (morning, afternoon, evening) for habit tracking
- Profile Management: Update personal information with real-time synchronization
- Intuitive Navigation: Easy-to-use menu system for seamless app navigation
- Cross-Platform: Works on iOS, Android, Web, Windows, macOS, and Linux
<svg width="800" height="600" xmlns="http://www.w3.org/2000/svg">
<!-- Background -->
<rect width="800" height="600" fill="#f5f5f5"/>
<!-- Phone Frame -->
<rect x="250" y="50" width="300" height="500" rx="20" fill="#ffffff" stroke="#333" stroke-width="2"/>
<!-- Status Bar -->
<rect x="250" y="50" width="300" height="30" rx="20" fill="#6366f1"/>
<text x="400" y="72" text-anchor="middle" fill="#ffffff" font-family="Arial" font-size="12">Habit Tracker</text>
<!-- Welcome Message -->
<text x="280" y="110" fill="#1f2937" font-family="Arial" font-size="16" font-weight="bold">Welcome, User!</text>
<!-- Weekly Progress Section -->
<rect x="270" y="130" width="260" height="120" rx="10" fill="#f0f9ff" stroke="#3b82f6" stroke-width="1"/>
<text x="280" y="150" fill="#1e40af" font-family="Arial" font-size="14" font-weight="bold">Weekly Progress</text>
<!-- Progress Bars -->
<rect x="280" y="165" width="200" height="8" rx="4" fill="#e5e7eb"/>
<rect x="280" y="165" width="150" height="8" rx="4" fill="#10b981"/>
<text x="490" y="172" fill="#6b7280" font-family="Arial" font-size="10">75%</text>
<rect x="280" y="185" width="200" height="8" rx="4" fill="#e5e7eb"/>
<rect x="280" y="185" width="180" height="8" rx="4" fill="#8b5cf6"/>
<text x="490" y="192" fill="#6b7280" font-family="Arial" font-size="10">90%</text>
<rect x="280" y="205" width="200" height="8" rx="4" fill="#e5e7eb"/>
<rect x="280" y="205" width="120" height="8" rx="4" fill="#f59e0b"/>
<text x="490" y="212" fill="#6b7280" font-family="Arial" font-size="10">60%</text>
<!-- Habits List -->
<text x="280" y="280" fill="#1f2937" font-family="Arial" font-size="14" font-weight="bold">Today's Habits</text>
<!-- Habit Items -->
<rect x="270" y="290" width="260" height="40" rx="8" fill="#ffffff" stroke="#d1d5db" stroke-width="1"/>
<circle cx="290" cy="310" r="8" fill="#10b981" stroke="#059669" stroke-width="1"/>
<text x="310" y="315" fill="#1f2937" font-family="Arial" font-size="12">Morning Exercise</text>
<rect x="270" y="340" width="260" height="40" rx="8" fill="#ffffff" stroke="#d1d5db" stroke-width="1"/>
<circle cx="290" cy="360" r="8" fill="#8b5cf6" stroke="#7c3aed" stroke-width="1"/>
<text x="310" y="365" fill="#1f2937" font-family="Arial" font-size="12">Read for 30 minutes</text>
<rect x="270" y="390" width="260" height="40" rx="8" fill="#ffffff" stroke="#d1d5db" stroke-width="1"/>
<circle cx="290" cy="410" r="8" fill="#f59e0b" stroke="#d97706" stroke-width="1"/>
<text x="310" y="415" fill="#1f2937" font-family="Arial" font-size="12">Drink 8 glasses of water</text>
<!-- Bottom Navigation -->
<rect x="250" y="520" width="300" height="30" fill="#ffffff" stroke="#e5e7eb" stroke-width="1"/>
<text x="290" y="540" fill="#6366f1" font-family="Arial" font-size="11">Home</text>
<text x="360" y="540" fill="#6b7280" font-family="Arial" font-size="11">Habits</text>
<text x="430" y="540" fill="#6b7280" font-family="Arial" font-size="11">Reports</text>
<text x="490" y="540" fill="#6b7280" font-family="Arial" font-size="11">Profile</text>
</svg>- Flutter - v3.0+ (Cross-platform UI framework)
- Dart - v3.0+ (Programming language)
- Material Design 3 - Modern UI components and theming
- SQLite - Local database for data persistence
- flutter_local_notifications - Smart notification system
- fl_chart - Beautiful charts for progress visualization
habit_tracker/
βββ lib/
β βββ main.dart # Application entry point
β βββ screens/ # UI screens
β β βββ login_screen.dart # Login and registration
β β βββ home_screen.dart # Homepage with progress overview
β β βββ habits_screen.dart # Habit management
β β βββ profile_screen.dart # User profile management
β β βββ reports_screen.dart # Weekly reports and analytics
β βββ models/ # Data models
β β βββ user.dart # User model
β β βββ habit.dart # Habit model
β βββ services/ # Business logic and services
β β βββ auth_service.dart # Authentication service
β β βββ database_service.dart # SQLite database operations
β β βββ notification_service.dart # Notification management
β βββ widgets/ # Reusable UI components
βββ test/ # Unit and widget tests
βββ android/ # Android-specific configuration
βββ ios/ # iOS-specific configuration
βββ web/ # Web-specific configuration
βββ habit_tracker_user_stories.md # Complete user stories documentation
βββ product_backlog.md # Prioritized product backlog
βββ pubspec.yaml # Dependencies and configuration
Before you begin, make sure you have the following installed:
- Flutter SDK (>= 3.0)
- Dart SDK (>= 3.0)
- Android Studio or VS Code with Flutter extensions
- iOS development tools (for macOS users)
- Git for version control
Follow these steps to get your development environment running:
-
Clone the repository:
git clone https://github.com/mohammadfirmansyah/habit_tracker.git cd habit_tracker -
Install dependencies:
flutter pub get
-
Verify Flutter installation:
flutter doctor
-
Run the application in development mode:
# For web (recommended for testing) flutter run -d chrome # For Android emulator or device flutter run -d android # For iOS simulator or device (macOS only) flutter run -d ios # For Windows desktop flutter run -d windows # For macOS desktop flutter run -d macos # For Linux desktop flutter run -d linux
-
Run tests:
# Run all tests flutter test # Run tests with coverage flutter test --coverage
-
Build for production:
# Android APK flutter build apk --release # Android App Bundle (for Play Store) flutter build appbundle --release # iOS (macOS only) flutter build ios --release # Web flutter build web --release # Windows flutter build windows --release
The app uses a simple authentication system with local storage. Here's how user registration works:
// lib/services/auth_service.dart
// Register new user with validation
Future<bool> registerUser(String name, String username, int age, String country, String password) async {
// Validate input fields before saving
if (name.isEmpty || username.isEmpty || age <= 0 || country.isEmpty) {
return false;
}
// Check if username already exists to ensure uniqueness
final existingUser = await _database.getUserByUsername(username);
if (existingUser != null) {
return false;
}
// Create user model and save to database
final user = User(
name: name,
username: username,
age: age,
country: country,
password: _hashPassword(password), // Never store plain text passwords
);
return await _database.insertUser(user);
}This design pattern ensures data validation and security by hashing passwords before storage.
Here's how the app tracks weekly progress for habits:
// lib/services/habit_service.dart
// Calculate weekly completion percentage for a specific habit
Future<double> getWeeklyCompletion(String habitId) async {
final now = DateTime.now();
final weekStart = now.subtract(Duration(days: now.weekday - 1));
// Fetch completion records for the past 7 days
final completions = await _database.getCompletionsByDateRange(
habitId,
weekStart,
now,
);
// Calculate percentage: (completed days / total days) * 100
return (completions.length / 7) * 100;
}This approach allows for efficient progress tracking and provides real-time updates to the user interface.
The notification system reminds users at customizable times:
// lib/services/notification_service.dart
// Schedule daily notifications for a habit at specified times
Future<void> scheduleHabitReminders(Habit habit, List<TimeOfDay> times) async {
for (var time in times) {
await flutterLocalNotificationsPlugin.zonedSchedule(
habit.id.hashCode + time.hour, // Unique notification ID
'Habit Reminder',
'Time to complete: ${habit.name}',
_nextInstanceOfTime(time), // Calculate next occurrence
const NotificationDetails(
android: AndroidNotificationDetails(
'habit_reminders',
'Habit Reminders',
importance: Importance.high,
priority: Priority.high,
),
),
androidAllowWhileIdle: true,
uiLocalNotificationDateInterpretation:
UILocalNotificationDateInterpretation.absoluteTime,
matchDateTimeComponents: DateTimeComponents.time, // Repeat daily
);
}
}This implementation ensures users receive timely reminders without draining battery life.
This project is an excellent way to learn and practice:
- β Agile Development: Writing comprehensive user stories and managing product backlog
- β Flutter Framework: Building cross-platform applications with a single codebase
- β State Management: Using Provider or Riverpod for reactive UI updates
- β Local Database: Implementing SQLite for data persistence across sessions
- β Authentication: Building secure login and registration systems
- β Notification System: Scheduling and managing local notifications
- β Data Visualization: Creating charts and progress indicators with fl_chart
- β Clean Architecture: Separating concerns with models, services, and UI layers
- β Material Design 3: Implementing modern UI patterns and theming
- β Git Workflow: Managing version control and GitHub issues
This project follows a comprehensive Agile approach with:
- 23 detailed user stories covering all major features
- Priority-based backlog organized into 7 development sprints
- Acceptance criteria for each feature to ensure quality
- Story point estimation using Fibonacci sequence for planning
- GitHub Issues integration for tracking progress
See the User Stories and Product Backlog for complete details.
We welcome contributions! Please see our Contributing Guide for more details on how to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'feat: add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Write meaningful commit messages following Conventional Commits
- Add tests for new features
- Update documentation when adding new functionality
- Follow the existing code style and architecture patterns
- Ensure all tests pass before submitting PR:
flutter test
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
- Mohammad Firman Syah
- GitHub: @mohammadfirmansyah
- Project Link: https://github.com/mohammadfirmansyah/habit_tracker
Built with β€οΈ using Flutter & Dart
Note: For production use, consider implementing backend authentication, cloud synchronization, and enhanced security features.
flutter build apk --release
flutter build ios --release
flutter build web --release
## π Code Highlights
### Main Application Entry Point
The app follows Flutter's standard structure with a clean main entry point:
```dart
// lib/main.dart
// Initialize the Flutter application
void main() {
runApp(const MyApp());
}
// Root widget of the application
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Habit Tracker',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(),
);
}
}
This structure provides a solid foundation for scalable app development.
This project is a great way to learn and practice:
- β Flutter Framework: Building cross-platform applications
- β Dart Programming: Modern language features and best practices
- β State Management: Managing application state effectively
- β UI/UX Design: Creating beautiful and responsive interfaces
- β Testing: Writing unit and widget tests
We welcome contributions! Please see our Contributing Guide for more details on how to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License. See the LICENSE file for details.
- Mohammad Firman Syah
- Project Link: https://github.com/mohammadfirmansyah/habit_tracker
Built with β€οΈ using Flutter & Dart