Skip to content

Ahmed-Hany-saad/ChatApp

Repository files navigation

Flutter Chat App

This is a Flutter chat application with three main pages: Login, Register, and Chat. The app allows users to log in, register, and communicate with others in a chat room. The user's data is securely stored in Firebase Authentication, and the chat messages are stored in Firestore.

Features

Login Page

The Login page allows users to enter their email and password to log in. It includes the following elements:

  • Email text form field
  • Password text form field
  • Login button
  • Register button (for users who don't have an account)

Upon submitting the login credentials, the app performs the following checks:

  • If the email entered is not registered, a snackbar message appears, notifying the user with "User not found."
  • If the email is found but the password is incorrect, a snackbar message appears, notifying the user with "Wrong password."
  • If the email and password are correct, a snackbar message appears, notifying the user with "Login has been completed successfully," and the user is redirected to the Chat page.

Register Page

The Register page allows users to create a new account by providing their email and password. It includes the following elements:

  • Email text form field
  • Password text form field
  • Register button
  • Login button (for users who already have an account)

Upon submitting the registration details, the app performs the following checks:

  • If an invalid email is entered, a snackbar message appears, notifying the user with "An error occurred during registration."
  • If the email is already in use, a snackbar message appears, notifying the user with "Email already in use."
  • If a weak password is entered, a snackbar message appears, notifying the user with "Weak password."
  • If a valid email and password are entered, a snackbar message appears, notifying the user with "Registration has been completed successfully." The user is then redirected to the Chat page, and their registration data is saved in Firebase Authentication for future logins.

Chat Page

The Chat page allows users to send and receive messages in a stylized format. If the user closes the app and reopens it, they will find their previous messages retrieved from the Firestore database.

Getting Started

To run this application locally, follow these steps:

  1. Clone this repository.
  2. Ensure you have Flutter and Dart installed on your machine.
  3. Set up Firebase Authentication and Firestore for your project.
  4. Replace the necessary Firebase configuration files in the project.
  5. Run flutter pub get to fetch the required dependencies.
  6. Connect your device/emulator and run flutter run to launch the app.

Dependencies

This project uses the following dependencies:

  • firebase_auth: ^4.6.3 - Provides Firebase authentication services for user login and registration.
  • flutter: sdk: flutter - The Flutter SDK.
  • cupertino_icons: ^1.0.2 - Provides the Cupertino icons used in the app's UI.
  • firebase_core: ^2.14.0 - Provides the core functionality for Firebase integration in Flutter.
  • modal_progress_hud_nsn: ^0.4.0 - Displays a modal progress indicator during login and registration processes.
  • cloud_firestore: ^4.8.2 - Enables integration with Firestore for storing and retrieving chat messages.

Conclusion

This Flutter chat app provides a simple and intuitive user interface for logging in, registering, and engaging in chat conversations. It leverages Firebase Authentication for secure user authentication and Firestore for storing chat messages. Feel free to explore and customize the code to fit your requirements.

Happy chatting!