A beautiful, feature-rich TODO application built with Flutter, featuring a modern UI design, local database storage, and scalable architecture ready for cloud integration.
- Modern UI Design: Beautiful, animated interface with smooth transitions
- User Authentication: Local user creation and profile management
- Category Management: Organize tasks by customizable categories
- Task Management: Create, edit, complete, and delete tasks
- Date Tracking: Due dates and calendar integration
- Progress Tracking: Visual progress charts and statistics
- Consistent Data: SQLite database with Drift ORM
- Scalable Architecture: Ready for cloud integration (Firebase, Supabase, etc.)
The app features a clean, modern design with:
- Animated side drawer navigation
- Category-based task organization
- Beautiful color-coded categories
- Intuitive task completion interface
- Progress tracking with visual charts
- Provider: For reactive state management across the app
- Repository Pattern: Clean separation of data layer
- Drift: Type-safe SQL database access
- SQLite: Local database storage
- Migration Ready: Prepared for cloud database integration
lib/
βββ database/
β βββ database.dart # Main database configuration
β βββ tables/ # Database table definitions
β βββ database_exception.dart # Custom exception handling
βββ models/
β βββ user.dart # User model
β βββ todo.dart # Todo model
β βββ category.dart # Category model
βββ providers/
β βββ auth_provider.dart # Authentication logic
β βββ todo_provider.dart # Todo management
β βββ category_provider.dart # Category management
βββ screens/
β βββ auth/ # Authentication screens
β βββ widgets/ # Reusable UI components
β βββ home_screen.dart # Main dashboard
β βββ add_todo_screen.dart # Task creation
β βββ category_detail_screen.dart
β βββ settings_screen.dart
βββ utils/
βββ colors.dart # App color scheme
βββ app_constants.dart # Application constants
βββ date_utils.dart # Date utilities
- Flutter SDK (>=3.0.0)
- Dart SDK
- Android Studio / VS Code
- Android/iOS device or emulator
-
Clone the repository
git clone <your-repo-url> cd todo_app
-
Install dependencies
flutter pub get
-
Generate database code
flutter packages pub run build_runner build
-
Run the app
flutter run
# Clean and get dependencies
flutter clean && flutter pub get
# Generate database files
flutter packages pub run build_runner build --delete-conflicting-outputs
# Build APK
flutter build apk --release
# Build iOS
flutter build ios --release
The app uses Drift with SQLite for local storage. The database is automatically initialized on first run with default categories.
Default categories are defined in lib/utils/app_constants.dart
. To add new categories:
static const List<Map<String, dynamic>> defaultCategories = [
{
'name': 'Your Category',
'color': '0xFF2196F3',
'icon': '59404', // MaterialIcons code point
},
];
The app is architected for easy cloud integration:
- Add Firebase configuration files
- Update providers to use Firebase Auth
- Replace Drift tables with Firestore collections
- Add real-time listeners
- Add Supabase configuration
- Update auth provider with Supabase Auth
- Replace local database with Supabase tables
- Add real-time subscriptions
The repository pattern makes it easy to add REST API support:
- Update providers to call API endpoints
- Add network error handling
- Implement offline-first architecture
Update lib/utils/colors.dart
to customize the app's color scheme:
class AppColors {
static const Color kGradientStart = Color(0xFFF92B7B);
static const Color kGradientEnd = Color(0xFF882BF9);
// Add your custom colors...
}
The app uses Google Fonts (Poppins). To change fonts:
- Update
pubspec.yaml
with new Google Fonts - Modify the theme in
main.dart
flutter
: Flutter SDKprovider
: State managementdrift
: Database ORMpath_provider
: File system pathsdrift_flutter
: Flutter-specific Drift integration
flutter_zoom_drawer
: Animated side drawergoogle_fonts
: Typographyintl
: Internationalization and date formatting
drift_dev
: Code generation for databasebuild_runner
: Code generation runnerflutter_lints
: Linting rules
# Run all tests
flutter test
# Run with coverage
flutter test --coverage
test/
βββ unit/
β βββ providers/
β βββ models/
β βββ utils/
βββ widget/
β βββ screens/
βββ integration/
βββ app_test.dart
-
Configure signing
# Generate keystore keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
-
Update android/app/build.gradle
android { signingConfigs { release { keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null storePassword keystoreProperties['storePassword'] } } }
-
Build release APK
flutter build apk --release flutter build appbundle --release
- Configure signing in Xcode
- Build release
flutter build ios --release
// Export existing data before migration
Future<Map<String, dynamic>> exportData() async {
final todos = await database.select(database.todos).get();
final categories = await database.select(database.categories).get();
final users = await database.select(database.users).get();
return {
'todos': todos.map((e) => e.toJson()).toList(),
'categories': categories.map((e) => e.toJson()).toList(),
'users': users.map((e) => e.toJson()).toList(),
};
}
// Example: Firebase integration
class TodoProviderCloud extends ChangeNotifier {
final FirebaseFirestore _firestore = FirebaseFirestore.instance;
Future<void> addTodo(Todo todo) async {
await _firestore.collection('todos').add(todo.toJson());
}
Stream<List<Todo>> getTodos() {
return _firestore.collection('todos')
.snapshots()
.map((snapshot) => snapshot.docs
.map((doc) => Todo.fromJson(doc.data()))
.toList());
}
}
// Add cloud-friendly methods to models
class Todo {
// existing code...
Map<String, dynamic> toJson() {
return {
'id': id,
'title': title,
'dueDate': dueDate.toIso8601String(),
'categoryId': categoryId,
'isCompleted': isCompleted,
};
}
factory Todo.fromJson(Map<String, dynamic> json) {
return Todo(
id: json['id'],
title: json['title'],
dueDate: DateTime.parse(json['dueDate']),
categoryId: json['categoryId'],
isCompleted: json['isCompleted'] ?? false,
);
}
}
-
Database generation fails
flutter packages pub run build_runner clean flutter packages pub run build_runner build --delete-conflicting-outputs
-
Import errors after generation
- Check that all imports in database files are correct
- Ensure models are properly exported
- Run
flutter clean
andflutter pub get
-
Provider not updating UI
- Ensure
notifyListeners()
is called after state changes - Check that widgets are wrapped with
Consumer
or usecontext.watch()
- Ensure
-
Date formatting issues
- Add
intl
dependency for proper date formatting - Use
DateFormat
for consistent date display
- Add
-
Database Queries
// Use indexed queries Future<List<Todo>> getTodaysTodos() async { final today = DateTime.now(); return await (select(todos) ..where((t) => t.dueDate.isBiggerOrEqualValue(today)) ..orderBy([(t) => OrderingTerm.asc(t.dueDate)])) .get(); }
-
Widget Rebuilds
// Use Selector for specific property listening Selector<TodoProvider, int>( selector: (context, provider) => provider.todayTodos.length, builder: (context, count, child) { return Text('$count tasks today'); }, )
- Fork the project
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Flutter team for the amazing framework
- Material Design for the design system
- Drift team for the excellent database ORM
- All contributors and testers
Happy Coding! π
For questions or support, please open an issue in the repository.