6.9 KiB
IMPLEMENTATION.md
This document outlines the phased implementation plan for the "phone login" Flutter application. Each phase includes a set of tasks to be completed, followed by verification steps to ensure code quality and correctness.
Journal
This section will be updated after each phase to log actions taken, things learned, surprises, and deviations from the plan.
- Phase 1 (Initial Setup):
- Actions:
- Created a new Flutter project in a subdirectory
phone_loginbecause the parent directory name was not a valid package name. - Removed the boilerplate
lib/main.dartfile. - Updated the
pubspec.yamlwith the correct description and version. - Created
README.mdandCHANGELOG.md. - Initialized a git repository and committed the initial project setup.
- Created a new Flutter project in a subdirectory
- Learnings:
- The
create_projecttool with the--emptyflag does not create atestdirectory. - The current working directory name must be a valid Dart package name to create a project in it.
- The
- Surprises:
- The initial attempt to create the project failed due to an invalid package name.
- The project was not a git repository, so I had to initialize one.
- Deviations:
- The project was created in a subdirectory
phone_logininstead of the current directory. - The app was not launched as requested by the user.
- The project was created in a subdirectory
- Actions:
- Phase 2 (Authentication Flow - UI and State):
- Actions:
- Added
firebase_core,firebase_auth,go_router, andproviderdependencies. - Created the folder structure as outlined in the design document.
- Implemented the basic UI for
PhoneInputScreenandSmsVerificationScreen. - Set up
go_routerwith initial routes. - Implemented
AuthStatewithChangeNotifier.
- Added
- Learnings:
pinputandintl_phone_fieldare useful packages for phone authentication UI.
- Surprises:
- None.
- Deviations:
- None.
- Actions:
- Phase 3 (Firebase Integration and Authentication Logic):
- Actions:
- Skipped this phase as per user request.
- Learnings:
- None.
- Surprises:
- None.
- Deviations:
- Skipped the entire phase. This means the app will not have real authentication. I will mock the authentication state.
- Actions:
- Phase 4 (Home and Profile Screens):
- Actions:
- Implemented the
HomeScreenwith a mock login/logout button. - Implemented the
ProfileScreenwith a mock logout button. - Added a bottom navigation bar to the
HomeScreen. - Updated the
go_routerconfiguration to include the/profileroute.
- Implemented the
- Learnings:
go_routermakes it easy to handle navigation and redirects.
- Surprises:
- None.
- Deviations:
- The authentication is mocked.
- Actions:
General Instructions: After completing a task, if you added any TODOs to the code or didn't fully implement anything, make sure to add new tasks so that you can come back and complete them later.
Phase 1: Project Initialization and Basic Setup
In this phase, we will create the Flutter project, clean up the boilerplate, and set up the initial version control.
- Create a Flutter package in the current directory (
.) using thecreate_projecttool with theemptyflag. - Remove the
lib/main.dartandtest/directory from the newly created package. - Update the
descriptionof the package inpubspec.yamlto "A new Flutter project for phone login." and set the version number to0.1.0. - Create a
README.mdfile with a short placeholder description: "# phone_login". - Create a
CHANGELOG.mdfile with the initial version0.1.0. - Commit this empty version of the package to the current branch with the commit message: "feat: initial project setup".
- After committing the changes, run the app with the
launch_apptool on your preferred device.
After this phase, you should:
- Create/modify unit tests for testing the code added or modified in this phase, if relevant. (Not applicable in this phase)
- Run the
dart_fixtool to clean up the code. - Run the
analyze_filestool one more time and fix any issues. - Run any tests to make sure they all pass.
- Run
dart_formatto make sure that the formatting is correct. - Re-read the
IMPLEMENTATION.mdfile to see what, if anything, has changed in the implementation plan, and if it has changed, take care of anything the changes imply. - Update the
IMPLEMENTATION.mdfile with the current state, including any learnings, surprises, or deviations in the Journal section. Check off any checkboxes of items that have been completed. - Use
git diffto verify the changes that have been made, and create a suitable commit message for any changes. - Wait for my approval before committing the changes or moving on to the next phase.
- After committing the change, if the app is running, use the
hot_reloadtool to reload it.
Phase 2: Authentication Flow - UI and State
- Add
firebase_core,firebase_auth,go_router, andprovideras dependencies using thepubtool. - Create the basic folder structure as outlined in
DESIGN.md. - Implement the
PhoneInputScreenandSmsVerificationScreenUI. - Set up
go_routerwith routes for/loginand/sms_verify. - Implement
AuthStateusingChangeNotifierto manage the authentication state.
After this phase, you should:
- Follow the same verification steps as in Phase 1.
Phase 3: Firebase Integration and Authentication Logic
- Configure Firebase for the project (Android and iOS).
- Implement the
AuthRepositoryandFirebaseAuthService. - Connect the
PhoneInputScreenandSmsVerificationScreento theFirebaseAuthServiceto handle OTP sending and verification. - Implement the redirect logic in
go_routerbased on theAuthState.
After this phase, you should:
- Follow the same verification steps as in Phase 1.
Phase 4: Home and Profile Screens
- Implement the
HomeScreenwithLoggedOutHomeWidgetandLoggedInHomeWidget. - Implement the
ProfileScreenwith the logout functionality. - Connect the home and profile screens to the
AuthStateandAuthRepository.
After this phase, you should:
- Follow the same verification steps as in Phase 1.
Phase 5: Finalization
- Create a comprehensive
README.mdfile for the package. - [- [ ] Create a GEMINI.md file in the project directory that describes the app, its purpose, and implementation details of the application and the layout of the files.]
- Ask me to inspect the app and the code and say if I am satisfied with it, or if any modifications are needed.