A full-stack to-do list application built with Flutter (frontend) and PHP (backend) with MySQL database.
- ✅ Add new tasks with title and optional description
- ✅ Mark tasks as completed/incomplete
- ✅ Edit existing tasks
- ✅ Delete tasks with confirmation
- ✅ Swipe to delete functionality
- ✅ Beautiful and modern UI
- ✅ Real-time updates
- ✅ Error handling and loading states
- ✅ Responsive design
to-do list/
├── backend/
│ └── api/
│ ├── config.php
│ ├── get_tasks.php
│ ├── add_task.php
│ ├── update_task.php
│ ├── update_task_content.php
│ └── delete_task.php
├── frontend/
│ ├── lib/
│ │ ├── main.dart
│ │ ├── models/
│ │ │ └── task.dart
│ │ ├── providers/
│ │ │ └── task_provider.dart
│ │ ├── screens/
│ │ │ └── main_screen.dart
│ │ ├── services/
│ │ │ └── api_service.dart
│ │ └── widgets/
│ │ ├── task_list.dart
│ │ ├── add_task_dialog.dart
│ │ └── edit_task_dialog.dart
│ └── pubspec.yaml
├── db.sql
└── README.md
- Flutter SDK (latest stable version)
- PHP (7.4 or higher)
- MySQL (5.7 or higher)
- Web Server (Apache/Nginx) or Laragon/XAMPP
-
Database Setup:
-- Run the SQL commands in db.sql CREATE DATABASE todo_db; USE todo_db; CREATE TABLE tasks ( id INT AUTO_INCREMENT PRIMARY KEY, title VARCHAR(255) NOT NULL, description TEXT, completed BOOLEAN DEFAULT FALSE, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
-
Configure Database Connection:
- Edit
backend/api/config.php - Update database credentials:
$host = 'localhost'; $dbname = 'todo_db'; $user = 'your_username'; $password = 'your_password';
- Edit
-
Web Server Setup:
- Place the
backendfolder in your web server's document root - Ensure PHP has PDO and MySQL extensions enabled
- Test API endpoints:
http://localhost/backend/api/get_tasks.php
- Place the
-
Install Dependencies:
cd frontend flutter pub get -
Configure API Base URL:
- Edit
frontend/lib/services/api_service.dart - Update the
baseUrlto match your server:static const String baseUrl = 'http://localhost/backend/api/';
- Edit
-
Run the App:
flutter run
| Method | Endpoint | Description |
|---|---|---|
| GET | /get_tasks.php |
Fetch all tasks |
| POST | /add_task.php |
Add new task |
| GET | /update_task.php?id=X&completed=Y |
Toggle task completion |
| POST | /update_task_content.php |
Update task title/description |
| GET | /delete_task.php?id=X |
Delete task |
-
Adding Tasks:
- Tap the + button
- Enter task title (required)
- Add description (optional)
- Tap "Add Task"
-
Completing Tasks:
- Tap the checkbox next to any task
- Task will be marked as completed with strikethrough
-
Editing Tasks:
- Tap the edit icon (pencil) next to any task
- Modify title and/or description
- Tap "Save"
-
Deleting Tasks:
- Tap the delete icon (trash) next to any task
- Confirm deletion in the dialog
- Or swipe left on any task to delete
-
Database Connection Error:
- Verify database credentials in
config.php - Ensure MySQL service is running
- Check if database
todo_dbexists
- Verify database credentials in
-
API Connection Error:
- Verify the
baseUrlinapi_service.dart - Ensure web server is running
- Check if PHP files are accessible via browser
- Verify the
-
CORS Issues:
- All API endpoints include CORS headers
- If issues persist, check web server configuration
-
Flutter Build Issues:
- Run
flutter cleanthenflutter pub get - Ensure Flutter SDK is up to date
- Run
- Use browser developer tools to test API endpoints
- Check Flutter console for detailed error messages
- Enable debug mode for more verbose logging
- Frontend: Flutter, Provider (state management)
- Backend: PHP, MySQL, PDO
- Architecture: RESTful API, MVC pattern
This project is open source and available under the MIT License.