This Flutter project is a simple Task Management app that allows users to add, edit, and delete tasks even when offline. The app uses Firebase and Firestore as the backend and Bloc for state management. It supports both Android and desktop versions.
Before setting up and running the project, ensure you have the following installed on your machine:
- Flutter SDK (version 3.0.0 or later)
- Dart SDK
- Android Studio or Visual Studio Code (with Flutter and Dart plugins)
- Firebase account and project setup
- Local server setup for Firestore (if needed)
The project uses the following dependencies:
flutter_screenutil: ^5.9.3google_fonts: ^6.2.1flutter_svg: ^2.0.10+1intl: ^0.19.0flutter_bloc: ^8.1.5meta: ^1.12.0uuid: ^4.4.0firebase_core: ^3.0.0cloud_firestore: ^5.0.0connectivity_plus: ^6.0.3hive: ^2.2.3hive_flutter: ^1.1.0
Clone the repository to your local machine using the following command:
git clone https://github.com/AymanYehia23/task.git
cd taskRun the following command to install the required Flutter dependencies:
flutter pub get-
Create a Firebase Project:
- Go to the Firebase Console.
- Click on "Add project" and follow the instructions to create a new Firebase project.
-
Add Firebase to Your Flutter App:
- Click on the Android icon to add Firebase to your Android app. Follow the instructions to download the
google-services.jsonfile. - Place the
google-services.jsonfile in theandroid/appdirectory of your Flutter project. - Modify the
android/build.gradleandandroid/app/build.gradlefiles according to Firebase setup instructions.
- Click on the Android icon to add Firebase to your Android app. Follow the instructions to download the
-
Enable Firestore:
- In the Firebase Console, go to "Firestore Database" and click on "Create database".
- Choose the appropriate settings and complete the setup.
Ensure you have added the Firebase dependencies in your pubspec.yaml file:
dependencies:
flutter:
sdk: flutter
flutter_screenutil: ^5.9.3
google_fonts: ^6.2.1
flutter_svg: ^2.0.10+1
intl: ^0.19.0
flutter_bloc: ^8.1.5
meta: ^1.12.0
uuid: ^4.4.0
firebase_core: ^3.0.0
cloud_firestore: ^5.0.0
connectivity_plus: ^6.0.3
hive: ^2.2.3
hive_flutter: ^1.1.0Connect your device or start an emulator, and use the following command to run the application:
flutter run- Open the app.
- Tap the "Create Task" button.
- Enter the task title, due date and save.
- Swipe the task you want to delete to the left or right.
- The app allows you to add, edit, and delete tasks even when offline.
- Changes made while offline will be synced with the Firebase backend once the connection is restored.
- Tap on the task you want to finish to mark it as completed.
To build and run the desktop version of the app:
flutter build windows(Note: Ensure you have set up Flutter for desktop development as per the official documentation.)
- Make sure your Firebase Firestore rules are set to allow read and write operations for anonymous users if required for development.
- Keep your Firebase configuration secure and do not expose sensitive information in the repository.
You have now successfully set up and configured the Task Management app. You can start adding, editing, and deleting tasks, and enjoy the offline-first capability with automatic sync to Firebase. Happy coding!