├── .gitignore
├── .metadata
├── .vscode
└── launch.json
├── README.md
├── analysis_options.yaml
├── android
├── .gitignore
├── app
│ ├── build.gradle
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── kotlin
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── flutter_chat_app
│ │ │ │ └── MainActivity.kt
│ │ └── res
│ │ │ ├── drawable-v21
│ │ │ └── launch_background.xml
│ │ │ ├── drawable
│ │ │ └── launch_background.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── values-night
│ │ │ └── styles.xml
│ │ │ └── values
│ │ │ └── styles.xml
│ │ └── profile
│ │ └── AndroidManifest.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
└── settings.gradle
├── assets
└── images
│ └── chat.png
├── ios
├── .gitignore
├── Flutter
│ ├── AppFrameworkInfo.plist
│ ├── Debug.xcconfig
│ └── Release.xcconfig
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ ├── IDEWorkspaceChecks.plist
│ │ └── WorkspaceSettings.xcsettings
└── Runner
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── Icon-App-1024x1024@1x.png
│ │ ├── Icon-App-20x20@1x.png
│ │ ├── Icon-App-20x20@2x.png
│ │ ├── Icon-App-20x20@3x.png
│ │ ├── Icon-App-29x29@1x.png
│ │ ├── Icon-App-29x29@2x.png
│ │ ├── Icon-App-29x29@3x.png
│ │ ├── Icon-App-40x40@1x.png
│ │ ├── Icon-App-40x40@2x.png
│ │ ├── Icon-App-40x40@3x.png
│ │ ├── Icon-App-60x60@2x.png
│ │ ├── Icon-App-60x60@3x.png
│ │ ├── Icon-App-76x76@1x.png
│ │ ├── Icon-App-76x76@2x.png
│ │ └── Icon-App-83.5x83.5@2x.png
│ └── LaunchImage.imageset
│ │ ├── Contents.json
│ │ ├── LaunchImage.png
│ │ ├── LaunchImage@2x.png
│ │ ├── LaunchImage@3x.png
│ │ └── README.md
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ └── Runner-Bridging-Header.h
├── lib
├── blocs
│ ├── auth
│ │ ├── auth_bloc.dart
│ │ ├── auth_bloc.freezed.dart
│ │ ├── auth_event.dart
│ │ └── auth_state.dart
│ ├── blocs.dart
│ ├── chat
│ │ ├── chat_bloc.dart
│ │ ├── chat_bloc.freezed.dart
│ │ ├── chat_event.dart
│ │ └── chat_state.dart
│ └── user
│ │ ├── user_bloc.dart
│ │ ├── user_bloc.freezed.dart
│ │ ├── user_event.dart
│ │ └── user_state.dart
├── cubits
│ ├── cubits.dart
│ └── guest
│ │ ├── guest_cubit.dart
│ │ ├── guest_cubit.freezed.dart
│ │ └── guest_state.dart
├── enums
│ ├── data_status.dart
│ └── enums.dart
├── main.dart
├── models
│ ├── app_response.dart
│ ├── app_response.g.dart
│ ├── chat_message_model.dart
│ ├── chat_message_model.freezed.dart
│ ├── chat_message_model.g.dart
│ ├── chat_model.dart
│ ├── chat_model.freezed.dart
│ ├── chat_model.g.dart
│ ├── chat_participant_model.dart
│ ├── chat_participant_model.freezed.dart
│ ├── chat_participant_model.g.dart
│ ├── models.dart
│ ├── requests
│ │ ├── create_chat_message_request.dart
│ │ ├── create_chat_message_request.freezed.dart
│ │ ├── create_chat_message_request.g.dart
│ │ ├── create_chat_request.dart
│ │ ├── create_chat_request.freezed.dart
│ │ ├── create_chat_request.g.dart
│ │ ├── login_request.dart
│ │ ├── login_request.freezed.dart
│ │ ├── login_request.g.dart
│ │ ├── register_request.dart
│ │ ├── register_request.freezed.dart
│ │ ├── register_request.g.dart
│ │ └── requests.dart
│ ├── user_model.dart
│ ├── user_model.freezed.dart
│ └── user_model.g.dart
├── repositories
│ ├── auth
│ │ ├── auth_repository.dart
│ │ └── base_auth_repository.dart
│ ├── chat
│ │ ├── base_chat_repository.dart
│ │ └── chat_respository.dart
│ ├── chat_message
│ │ ├── base_chat_message_repository.dart
│ │ └── chat_message_repository.dart
│ ├── core
│ │ └── endpoints.dart
│ ├── repositories.dart
│ └── user
│ │ ├── base_user_repository.dart
│ │ └── user_repository.dart
├── screens
│ ├── chat
│ │ ├── chat_screen.dart
│ │ └── data.dart
│ ├── chat_list
│ │ ├── chat_list_item.dart
│ │ └── chat_list_screen.dart
│ ├── guest
│ │ └── guest_screen.dart
│ ├── screens.dart
│ └── splash
│ │ └── splash_screen.dart
├── utils
│ ├── chat.dart
│ ├── dio_client
│ │ ├── app_interceptors.dart
│ │ └── dio_client.dart
│ ├── formatting.dart
│ ├── laravel_echo
│ │ └── laravel_echo.dart
│ ├── logger.dart
│ ├── onesignal
│ │ └── onesignal.dart
│ └── utils.dart
└── widgets
│ ├── blank_content.dart
│ ├── startup_container.dart
│ └── widgets.dart
├── linux
├── .gitignore
├── CMakeLists.txt
├── flutter
│ ├── CMakeLists.txt
│ ├── generated_plugin_registrant.cc
│ ├── generated_plugin_registrant.h
│ └── generated_plugins.cmake
├── main.cc
├── my_application.cc
└── my_application.h
├── macos
├── .gitignore
├── Flutter
│ ├── Flutter-Debug.xcconfig
│ ├── Flutter-Release.xcconfig
│ └── GeneratedPluginRegistrant.swift
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
└── Runner
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── app_icon_1024.png
│ │ ├── app_icon_128.png
│ │ ├── app_icon_16.png
│ │ ├── app_icon_256.png
│ │ ├── app_icon_32.png
│ │ ├── app_icon_512.png
│ │ └── app_icon_64.png
│ ├── Base.lproj
│ └── MainMenu.xib
│ ├── Configs
│ ├── AppInfo.xcconfig
│ ├── Debug.xcconfig
│ ├── Release.xcconfig
│ └── Warnings.xcconfig
│ ├── DebugProfile.entitlements
│ ├── Info.plist
│ ├── MainFlutterWindow.swift
│ └── Release.entitlements
├── pubspec.lock
├── pubspec.yaml
├── test
└── widget_test.dart
├── web
├── favicon.png
├── icons
│ ├── Icon-192.png
│ ├── Icon-512.png
│ ├── Icon-maskable-192.png
│ └── Icon-maskable-512.png
├── index.html
└── manifest.json
└── windows
├── .gitignore
├── CMakeLists.txt
├── flutter
├── CMakeLists.txt
├── generated_plugin_registrant.cc
├── generated_plugin_registrant.h
└── generated_plugins.cmake
└── runner
├── CMakeLists.txt
├── Runner.rc
├── flutter_window.cpp
├── flutter_window.h
├── main.cpp
├── resource.h
├── resources
└── app_icon.ico
├── runner.exe.manifest
├── utils.cpp
├── utils.h
├── win32_window.cpp
└── win32_window.h
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | **/doc/api/
26 | **/ios/Flutter/.last_build_id
27 | .dart_tool/
28 | .flutter-plugins
29 | .flutter-plugins-dependencies
30 | .packages
31 | .pub-cache/
32 | .pub/
33 | /build/
34 |
35 | # Symbolication related
36 | app.*.symbols
37 |
38 | # Obfuscation related
39 | app.*.map.json
40 |
41 | # Android Studio will place build artifacts here
42 | /android/app/debug
43 | /android/app/profile
44 | /android/app/release
45 |
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled.
5 |
6 | version:
7 | revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
8 | channel: stable
9 |
10 | project_type: app
11 |
12 | # Tracks metadata for the flutter migrate command
13 | migration:
14 | platforms:
15 | - platform: root
16 | create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
17 | base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
18 | - platform: android
19 | create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
20 | base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
21 | - platform: ios
22 | create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
23 | base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
24 | - platform: linux
25 | create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
26 | base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
27 | - platform: macos
28 | create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
29 | base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
30 | - platform: web
31 | create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
32 | base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
33 | - platform: windows
34 | create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
35 | base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
36 |
37 | # User provided section
38 |
39 | # List of Local paths (relative to this file) that should be
40 | # ignored by the migrate tool.
41 | #
42 | # Files that are not part of the templates will be ignored by default.
43 | unmanaged_files:
44 | - 'lib/main.dart'
45 | - 'ios/Runner.xcodeproj/project.pbxproj'
46 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": "flutter_chat_app",
9 | "request": "launch",
10 | "type": "dart"
11 | },
12 | {
13 | "name": "AndroidFirst",
14 | "request": "launch",
15 | "type": "dart",
16 | "deviceId": "emulator-5554"
17 | // "flutterMode": "profile"
18 | },
19 | {
20 | "name": "AndroidSecond",
21 | "request": "launch",
22 | "type": "dart",
23 | "deviceId": "emulator-5556"
24 | // "flutterMode": "release"
25 | }
26 | ],
27 | "compounds": [
28 | {
29 | "name": "All Devices",
30 | "configurations": ["AndroidFirst", "AndroidSecond"]
31 | }
32 | ]
33 | }
34 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # flutter_chat_app
2 |
3 | A new Flutter project.
4 |
5 | ## Getting Started
6 |
7 | This project is a starting point for a Flutter application.
8 |
9 | A few resources to get you started if this is your first Flutter project:
10 |
11 | - [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
12 | - [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
13 |
14 | For help getting started with Flutter development, view the
15 | [online documentation](https://docs.flutter.dev/), which offers tutorials,
16 | samples, guidance on mobile development, and a full API reference.
17 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | include: package:flutter_lints/flutter.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at
17 | # https://dart-lang.github.io/linter/lints/index.html.
18 | #
19 | # Instead of disabling a lint rule for the entire project in the
20 | # section below, it can also be suppressed for a single line of code
21 | # or a specific dart file by using the `// ignore: name_of_lint` and
22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
23 | # producing the lint.
24 | rules:
25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27 |
28 | # Additional information about this file can be found at
29 | # https://dart.dev/guides/language/analysis-options
30 | analyzer:
31 | errors:
32 | invalid_annotation_target: ignore
33 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply plugin: 'kotlin-android'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 |
28 | android {
29 | compileSdkVersion 33
30 | ndkVersion flutter.ndkVersion
31 |
32 | compileOptions {
33 | sourceCompatibility JavaVersion.VERSION_1_8
34 | targetCompatibility JavaVersion.VERSION_1_8
35 | }
36 |
37 | kotlinOptions {
38 | jvmTarget = '1.8'
39 | }
40 |
41 | sourceSets {
42 | main.java.srcDirs += 'src/main/kotlin'
43 | }
44 |
45 | defaultConfig {
46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
47 | applicationId "com.example.flutter_chat_app"
48 | // You can update the following values to match your application needs.
49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
50 | minSdkVersion flutter.minSdkVersion
51 | targetSdkVersion flutter.targetSdkVersion
52 | versionCode flutterVersionCode.toInteger()
53 | versionName flutterVersionName
54 | multiDexEnabled true
55 | }
56 |
57 | buildTypes {
58 | release {
59 | // TODO: Add your own signing config for the release build.
60 | // Signing with the debug keys for now, so `flutter run --release` works.
61 | signingConfig signingConfigs.debug
62 | }
63 | }
64 | }
65 |
66 | flutter {
67 | source '../..'
68 | }
69 |
70 | dependencies {
71 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
72 | }
73 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
16 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
31 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_chat_app/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_chat_app
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DumbDev168/flutter_chat_app/33695f23bd6547b794d2eee8838f5b71b25aa253/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DumbDev168/flutter_chat_app/33695f23bd6547b794d2eee8838f5b71b25aa253/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DumbDev168/flutter_chat_app/33695f23bd6547b794d2eee8838f5b71b25aa253/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DumbDev168/flutter_chat_app/33695f23bd6547b794d2eee8838f5b71b25aa253/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DumbDev168/flutter_chat_app/33695f23bd6547b794d2eee8838f5b71b25aa253/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.6.10'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.1.2'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | mavenCentral()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | task clean(type: Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
6 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/assets/images/chat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DumbDev168/flutter_chat_app/33695f23bd6547b794d2eee8838f5b71b25aa253/assets/images/chat.png
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | **/dgph
2 | *.mode1v3
3 | *.mode2v3
4 | *.moved-aside
5 | *.pbxuser
6 | *.perspectivev3
7 | **/*sync/
8 | .sconsign.dblite
9 | .tags*
10 | **/.vagrant/
11 | **/DerivedData/
12 | Icon?
13 | **/Pods/
14 | **/.symlinks/
15 | profile
16 | xcuserdata
17 | **/.generated/
18 | Flutter/App.framework
19 | Flutter/Flutter.framework
20 | Flutter/Flutter.podspec
21 | Flutter/Generated.xcconfig
22 | Flutter/ephemeral/
23 | Flutter/app.flx
24 | Flutter/app.zip
25 | Flutter/flutter_assets/
26 | Flutter/flutter_export_environment.sh
27 | ServiceDefinitions.json
28 | Runner/GeneratedPluginRegistrant.*
29 |
30 | # Exceptions to above rules.
31 | !default.mode1v3
32 | !default.mode2v3
33 | !default.pbxuser
34 | !default.perspectivev3
35 |
--------------------------------------------------------------------------------
/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 11.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
41 |
42 |
52 |
54 |
60 |
61 |
62 |
63 |
69 |
71 |
77 |
78 |
79 |
80 |
82 |
83 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DumbDev168/flutter_chat_app/33695f23bd6547b794d2eee8838f5b71b25aa253/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DumbDev168/flutter_chat_app/33695f23bd6547b794d2eee8838f5b71b25aa253/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DumbDev168/flutter_chat_app/33695f23bd6547b794d2eee8838f5b71b25aa253/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DumbDev168/flutter_chat_app/33695f23bd6547b794d2eee8838f5b71b25aa253/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DumbDev168/flutter_chat_app/33695f23bd6547b794d2eee8838f5b71b25aa253/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DumbDev168/flutter_chat_app/33695f23bd6547b794d2eee8838f5b71b25aa253/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DumbDev168/flutter_chat_app/33695f23bd6547b794d2eee8838f5b71b25aa253/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DumbDev168/flutter_chat_app/33695f23bd6547b794d2eee8838f5b71b25aa253/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DumbDev168/flutter_chat_app/33695f23bd6547b794d2eee8838f5b71b25aa253/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DumbDev168/flutter_chat_app/33695f23bd6547b794d2eee8838f5b71b25aa253/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DumbDev168/flutter_chat_app/33695f23bd6547b794d2eee8838f5b71b25aa253/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DumbDev168/flutter_chat_app/33695f23bd6547b794d2eee8838f5b71b25aa253/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DumbDev168/flutter_chat_app/33695f23bd6547b794d2eee8838f5b71b25aa253/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DumbDev168/flutter_chat_app/33695f23bd6547b794d2eee8838f5b71b25aa253/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DumbDev168/flutter_chat_app/33695f23bd6547b794d2eee8838f5b71b25aa253/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DumbDev168/flutter_chat_app/33695f23bd6547b794d2eee8838f5b71b25aa253/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DumbDev168/flutter_chat_app/33695f23bd6547b794d2eee8838f5b71b25aa253/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DumbDev168/flutter_chat_app/33695f23bd6547b794d2eee8838f5b71b25aa253/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | Flutter Chat App
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | flutter_chat_app
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(FLUTTER_BUILD_NUMBER)
25 | LSRequiresIPhoneOS
26 |
27 | UILaunchStoryboardName
28 | LaunchScreen
29 | UIMainStoryboardFile
30 | Main
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 | UIViewControllerBasedStatusBarAppearance
45 |
46 | CADisableMinimumFrameDurationOnPhone
47 |
48 | UIApplicationSupportsIndirectInputEvents
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/lib/blocs/auth/auth_bloc.dart:
--------------------------------------------------------------------------------
1 | import 'package:freezed_annotation/freezed_annotation.dart';
2 | import 'package:hydrated_bloc/hydrated_bloc.dart';
3 | import 'package:flutter_chat_app/models/models.dart';
4 |
5 | part 'auth_event.dart';
6 | part 'auth_state.dart';
7 | part 'auth_bloc.freezed.dart';
8 |
9 | class AuthBloc extends HydratedBloc {
10 | AuthBloc() : super(AuthState.initial()) {
11 | on((event, emit) {
12 | emit(state.copyWith(
13 | isAuthenticated: event.isAuthenticated,
14 | user: event.user,
15 | token: event.token,
16 | ));
17 | });
18 | }
19 |
20 | @override
21 | AuthState? fromJson(Map json) {
22 | return AuthState(
23 | isAuthenticated: json['isAuthenticated'],
24 | user: json['user'] != null ? UserEntity.fromJson(json['user']) : null,
25 | token: json['token'],
26 | );
27 | }
28 |
29 | @override
30 | Map? toJson(AuthState state) {
31 | return {
32 | 'isAuthenticated': state.isAuthenticated,
33 | 'token': state.token,
34 | 'user': state.user != null ? state.user!.toJson() : null,
35 | };
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/lib/blocs/auth/auth_event.dart:
--------------------------------------------------------------------------------
1 | part of 'auth_bloc.dart';
2 |
3 | @freezed
4 | class AuthEvent with _$AuthEvent {
5 | const factory AuthEvent.authenticate({
6 | UserEntity? user,
7 | String? token,
8 | required bool isAuthenticated,
9 | }) = Authenticated;
10 | }
11 |
--------------------------------------------------------------------------------
/lib/blocs/auth/auth_state.dart:
--------------------------------------------------------------------------------
1 | part of 'auth_bloc.dart';
2 |
3 | @freezed
4 | class AuthState with _$AuthState {
5 | const factory AuthState({
6 | required bool isAuthenticated,
7 | UserEntity? user,
8 | String? token,
9 | }) = _AuthState;
10 |
11 | factory AuthState.initial() {
12 | return const AuthState(
13 | isAuthenticated: false,
14 | user: null,
15 | token: null,
16 | );
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/lib/blocs/blocs.dart:
--------------------------------------------------------------------------------
1 | export "auth/auth_bloc.dart";
2 |
--------------------------------------------------------------------------------
/lib/blocs/chat/chat_bloc.dart:
--------------------------------------------------------------------------------
1 | import 'package:dash_chat_2/dash_chat_2.dart';
2 | import 'package:flutter_bloc/flutter_bloc.dart';
3 | import 'package:flutter_chat_app/models/requests/requests.dart';
4 | import 'package:flutter_chat_app/repositories/chat_message/chat_message_repository.dart';
5 | import 'package:freezed_annotation/freezed_annotation.dart';
6 | import 'package:flutter_chat_app/enums/enums.dart';
7 | import 'package:flutter_chat_app/models/models.dart';
8 | import 'package:flutter_chat_app/repositories/chat/chat_respository.dart';
9 |
10 | part 'chat_event.dart';
11 | part 'chat_state.dart';
12 | part 'chat_bloc.freezed.dart';
13 |
14 | class ChatBloc extends Bloc {
15 | final ChatRepository _chatRepository;
16 | final ChatMessageRepository _chatMessageRepository;
17 |
18 | ChatBloc({
19 | required ChatRepository chatRepository,
20 | required ChatMessageRepository chatMessageRepository,
21 | }) : _chatRepository = chatRepository,
22 | _chatMessageRepository = chatMessageRepository,
23 | super(ChatState.initial()) {
24 | on((event, emit) async {
25 | if (state.status.isLoading) return;
26 |
27 | emit(state.copyWith(status: DataStatus.loading));
28 |
29 | final result = await _chatRepository.getChats();
30 |
31 | emit(state.copyWith(
32 | status: DataStatus.loaded,
33 | chats: result.success ? result.data ?? [] : [],
34 | ));
35 | });
36 | on((event, emit) {
37 | emit(state.copyWith(
38 | chatMessages: [],
39 | message: '',
40 | status: DataStatus.initial,
41 | selectedChat: null,
42 | otherUserId: null,
43 | isLastPage: false,
44 | page: 1,
45 | notificationChatId: null,
46 | chats: (event.shouldResetChat != null && event.shouldResetChat!)
47 | ? []
48 | : state.chats,
49 | ));
50 | });
51 | on((event, emit) {
52 | emit(state.copyWith(
53 | otherUserId: event.user.id,
54 | ));
55 | });
56 | on((event, emit) async {
57 | if (state.status.isFetching) return;
58 |
59 | emit(state.copyWith(status: DataStatus.fetching));
60 |
61 | ChatEntity? chat;
62 |
63 | if (state.isSearchChat) {
64 | final chatResult = await _chatRepository.createChat(
65 | CreateChatRequest(userId: state.otherUserId!),
66 | );
67 |
68 | if (chatResult.success) {
69 | chat = chatResult.data;
70 | }
71 | } else if (state.isListChat) {
72 | chat = state.selectedChat;
73 | } else if (state.isNotificationChat) {
74 | final chatResult =
75 | await _chatRepository.getSingleChat(state.notificationChatId!);
76 |
77 | if (chatResult.success) {
78 | chat = chatResult.data;
79 | }
80 | }
81 |
82 | if (chat == null) {
83 | emit(state.copyWith(
84 | chatMessages: [],
85 | status: DataStatus.loaded,
86 | ));
87 | return;
88 | }
89 |
90 | final result = await _chatMessageRepository.getChatMessages(
91 | chatId: chat.id,
92 | page: 1,
93 | );
94 |
95 | if (result.success) {
96 | emit(state.copyWith(
97 | chatMessages: result.data ?? [],
98 | status: DataStatus.loaded,
99 | selectedChat: chat,
100 | ));
101 | } else {
102 | emit(state.copyWith(
103 | chatMessages: [],
104 | status: DataStatus.error,
105 | message: result.message,
106 | ));
107 | }
108 | });
109 | on((event, emit) async {
110 | if (state.status.isSubmitting) return;
111 | emit(state.copyWith(status: DataStatus.submitting));
112 |
113 | final result = await _chatMessageRepository.createChatMessage(
114 | CreateChatMessageRequest(
115 | chatId: event.chatId,
116 | message: event.message.text,
117 | ),
118 | event.socketId,
119 | );
120 |
121 | if (result.success) {
122 | final messages = [result.data!, ...state.chatMessages];
123 |
124 | emit(
125 | state.copyWith(
126 | chatMessages: messages,
127 | status: DataStatus.loaded,
128 | ),
129 | );
130 | } else {
131 | emit(state.copyWith(
132 | status: DataStatus.loaded,
133 | ));
134 | }
135 | });
136 |
137 | on((event, emit) async {
138 | if (state.status.isLoadingMore || state.isLastPage) return;
139 |
140 | emit(state.copyWith(status: DataStatus.loadingMore));
141 |
142 | final newPage = state.page + 1;
143 | final result = await _chatMessageRepository.getChatMessages(
144 | chatId: state.selectedChat!.id,
145 | page: newPage,
146 | );
147 |
148 | if (result.success) {
149 | final newMessages = result.data ?? [];
150 |
151 | if (newMessages.isNotEmpty) {
152 | emit(state.copyWith(
153 | chatMessages: [...state.chatMessages, ...newMessages],
154 | status: DataStatus.loaded,
155 | page: newPage,
156 | ));
157 | } else {
158 | emit(state.copyWith(
159 | status: DataStatus.loaded,
160 | isLastPage: true,
161 | ));
162 | }
163 | } else {
164 | emit(state.copyWith(
165 | message: result.message,
166 | status: DataStatus.error,
167 | ));
168 | }
169 | });
170 |
171 | on((event, emit) {
172 | emit(state.copyWith(selectedChat: event.chat));
173 | });
174 | on((event, emit) {
175 | emit(state.copyWith(
176 | chatMessages: [event.message, ...state.chatMessages],
177 | ));
178 | });
179 | on((event, emit) {
180 | emit(state.copyWith(notificationChatId: event.chatId));
181 | });
182 | }
183 | }
184 |
--------------------------------------------------------------------------------
/lib/blocs/chat/chat_event.dart:
--------------------------------------------------------------------------------
1 | part of 'chat_bloc.dart';
2 |
3 | @freezed
4 | class ChatEvent with _$ChatEvent {
5 | const factory ChatEvent.started() = ChatStarted;
6 | const factory ChatEvent.reset({bool? shouldResetChat}) = ChatReset;
7 | const factory ChatEvent.userSelected(UserEntity user) = UserSelected;
8 | const factory ChatEvent.getChatMessage() = GetChatMessage;
9 | const factory ChatEvent.loadMoreChatMessage() = LoadMoreChatMessage;
10 | const factory ChatEvent.sendMessage(
11 | int chatId,
12 | ChatMessage message, {
13 | required String socketId,
14 | }) = SendMessage;
15 | const factory ChatEvent.chatSelected(ChatEntity chat) = ChatSelected;
16 | const factory ChatEvent.addNewMessage(ChatMessageEntity message) =
17 | AddNewMessage;
18 | const factory ChatEvent.chatNotificationOpened(int chatId) =
19 | ChatNotificationOpened;
20 | }
21 |
--------------------------------------------------------------------------------
/lib/blocs/chat/chat_state.dart:
--------------------------------------------------------------------------------
1 | part of 'chat_bloc.dart';
2 |
3 | @freezed
4 | class ChatState with _$ChatState {
5 | const ChatState._();
6 |
7 | const factory ChatState({
8 | required List chats,
9 | required List chatMessages,
10 | ChatEntity? selectedChat,
11 | required DataStatus status,
12 | required String message,
13 | int? otherUserId,
14 | required bool isLastPage,
15 | required int page,
16 | int? notificationChatId,
17 | }) = _ChatState;
18 |
19 | factory ChatState.initial() {
20 | return const ChatState(
21 | chats: [],
22 | selectedChat: null,
23 | status: DataStatus.initial,
24 | message: "",
25 | otherUserId: null,
26 | chatMessages: [],
27 | isLastPage: false,
28 | page: 1,
29 | notificationChatId: null,
30 | );
31 | }
32 |
33 | bool get isSearchChat => otherUserId != null && selectedChat == null;
34 |
35 | bool get isListChat => otherUserId == null && selectedChat != null;
36 |
37 | bool get isNotificationChat =>
38 | otherUserId == null && selectedChat == null && notificationChatId != null;
39 |
40 | List get uiChatMessages {
41 | return chatMessages.map((e) => e.toChatMessage).toList();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/lib/blocs/user/user_bloc.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_bloc/flutter_bloc.dart';
2 | import 'package:freezed_annotation/freezed_annotation.dart';
3 | import 'package:flutter_chat_app/models/models.dart';
4 | import 'package:flutter_chat_app/repositories/user/user_repository.dart';
5 |
6 | part 'user_event.dart';
7 | part 'user_state.dart';
8 | part 'user_bloc.freezed.dart';
9 |
10 | class UserBloc extends Bloc {
11 | final UserRepository _userRepository;
12 |
13 | UserBloc({
14 | required UserRepository userRepository,
15 | }) : _userRepository = userRepository,
16 | super(const Initial()) {
17 | on((event, emit) async {
18 | final result = await _userRepository.getUsers();
19 | emit(Loaded(result.data ?? []));
20 | });
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/lib/blocs/user/user_event.dart:
--------------------------------------------------------------------------------
1 | part of 'user_bloc.dart';
2 |
3 | @freezed
4 | class UserEvent with _$UserEvent {
5 | const factory UserEvent.started() = UserStarted;
6 | }
7 |
--------------------------------------------------------------------------------
/lib/blocs/user/user_state.dart:
--------------------------------------------------------------------------------
1 | part of 'user_bloc.dart';
2 |
3 | @freezed
4 | class UserState with _$UserState {
5 | const factory UserState.initial() = Initial;
6 | const factory UserState.loaded(List users) = Loaded;
7 | }
8 |
--------------------------------------------------------------------------------
/lib/cubits/cubits.dart:
--------------------------------------------------------------------------------
1 | export "guest/guest_cubit.dart";
2 |
--------------------------------------------------------------------------------
/lib/cubits/guest/guest_cubit.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_bloc/flutter_bloc.dart';
2 | import 'package:flutter_chat_app/models/requests/login_request.dart';
3 | import 'package:flutter_chat_app/models/requests/register_request.dart';
4 | import 'package:freezed_annotation/freezed_annotation.dart';
5 | import 'package:flutter_chat_app/blocs/blocs.dart';
6 | import 'package:flutter_chat_app/repositories/auth/auth_repository.dart';
7 | import 'package:flutter_login/flutter_login.dart';
8 |
9 | part 'guest_state.dart';
10 | part 'guest_cubit.freezed.dart';
11 |
12 | class GuestCubit extends Cubit {
13 | final AuthRepository _authRepository;
14 | final AuthBloc _authBloc;
15 |
16 | GuestCubit({
17 | required AuthRepository authRepository,
18 | required AuthBloc authBloc,
19 | }) : _authRepository = authRepository,
20 | _authBloc = authBloc,
21 | super(
22 | const GuestState.initial(),
23 | );
24 |
25 | Future signIn(LoginData data) async {
26 | final response = await _authRepository.login(
27 | LoginRequest(email: data.name, password: data.password),
28 | );
29 | if (response.success) {
30 | _authBloc.add(Authenticated(
31 | isAuthenticated: true,
32 | token: response.data!.token,
33 | user: response.data!.user,
34 | ));
35 |
36 | return null;
37 | }
38 |
39 | return response.message;
40 | }
41 |
42 | Future signUp(SignupData data) async {
43 | final response = await _authRepository.register(
44 | RegisterRequest(
45 | email: data.name!,
46 | password: data.password!,
47 | passwordConfirmation: data.password!),
48 | );
49 | if (response.success) {
50 | _authBloc.add(Authenticated(
51 | isAuthenticated: true,
52 | token: response.data!.token,
53 | user: response.data!.user,
54 | ));
55 |
56 | return null;
57 | }
58 |
59 | return response.message;
60 | }
61 |
62 | Future signOut() async {
63 | _authRepository.logout();
64 | _authBloc.add(const Authenticated(
65 | isAuthenticated: false,
66 | user: null,
67 | token: null,
68 | ));
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/lib/cubits/guest/guest_cubit.freezed.dart:
--------------------------------------------------------------------------------
1 | // coverage:ignore-file
2 | // GENERATED CODE - DO NOT MODIFY BY HAND
3 | // ignore_for_file: type=lint
4 | // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
5 |
6 | part of 'guest_cubit.dart';
7 |
8 | // **************************************************************************
9 | // FreezedGenerator
10 | // **************************************************************************
11 |
12 | T _$identity(T value) => value;
13 |
14 | final _privateConstructorUsedError = UnsupportedError(
15 | 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
16 |
17 | /// @nodoc
18 | mixin _$GuestState {
19 | @optionalTypeArgs
20 | TResult when({
21 | required TResult Function() initial,
22 | }) =>
23 | throw _privateConstructorUsedError;
24 | @optionalTypeArgs
25 | TResult? whenOrNull({
26 | TResult Function()? initial,
27 | }) =>
28 | throw _privateConstructorUsedError;
29 | @optionalTypeArgs
30 | TResult maybeWhen({
31 | TResult Function()? initial,
32 | required TResult orElse(),
33 | }) =>
34 | throw _privateConstructorUsedError;
35 | @optionalTypeArgs
36 | TResult map({
37 | required TResult Function(_Initial value) initial,
38 | }) =>
39 | throw _privateConstructorUsedError;
40 | @optionalTypeArgs
41 | TResult? mapOrNull({
42 | TResult Function(_Initial value)? initial,
43 | }) =>
44 | throw _privateConstructorUsedError;
45 | @optionalTypeArgs
46 | TResult maybeMap({
47 | TResult Function(_Initial value)? initial,
48 | required TResult orElse(),
49 | }) =>
50 | throw _privateConstructorUsedError;
51 | }
52 |
53 | /// @nodoc
54 | abstract class $GuestStateCopyWith<$Res> {
55 | factory $GuestStateCopyWith(
56 | GuestState value, $Res Function(GuestState) then) =
57 | _$GuestStateCopyWithImpl<$Res>;
58 | }
59 |
60 | /// @nodoc
61 | class _$GuestStateCopyWithImpl<$Res> implements $GuestStateCopyWith<$Res> {
62 | _$GuestStateCopyWithImpl(this._value, this._then);
63 |
64 | final GuestState _value;
65 | // ignore: unused_field
66 | final $Res Function(GuestState) _then;
67 | }
68 |
69 | /// @nodoc
70 | abstract class _$$_InitialCopyWith<$Res> {
71 | factory _$$_InitialCopyWith(
72 | _$_Initial value, $Res Function(_$_Initial) then) =
73 | __$$_InitialCopyWithImpl<$Res>;
74 | }
75 |
76 | /// @nodoc
77 | class __$$_InitialCopyWithImpl<$Res> extends _$GuestStateCopyWithImpl<$Res>
78 | implements _$$_InitialCopyWith<$Res> {
79 | __$$_InitialCopyWithImpl(_$_Initial _value, $Res Function(_$_Initial) _then)
80 | : super(_value, (v) => _then(v as _$_Initial));
81 |
82 | @override
83 | _$_Initial get _value => super._value as _$_Initial;
84 | }
85 |
86 | /// @nodoc
87 |
88 | class _$_Initial implements _Initial {
89 | const _$_Initial();
90 |
91 | @override
92 | String toString() {
93 | return 'GuestState.initial()';
94 | }
95 |
96 | @override
97 | bool operator ==(dynamic other) {
98 | return identical(this, other) ||
99 | (other.runtimeType == runtimeType && other is _$_Initial);
100 | }
101 |
102 | @override
103 | int get hashCode => runtimeType.hashCode;
104 |
105 | @override
106 | @optionalTypeArgs
107 | TResult when({
108 | required TResult Function() initial,
109 | }) {
110 | return initial();
111 | }
112 |
113 | @override
114 | @optionalTypeArgs
115 | TResult? whenOrNull({
116 | TResult Function()? initial,
117 | }) {
118 | return initial?.call();
119 | }
120 |
121 | @override
122 | @optionalTypeArgs
123 | TResult maybeWhen({
124 | TResult Function()? initial,
125 | required TResult orElse(),
126 | }) {
127 | if (initial != null) {
128 | return initial();
129 | }
130 | return orElse();
131 | }
132 |
133 | @override
134 | @optionalTypeArgs
135 | TResult map({
136 | required TResult Function(_Initial value) initial,
137 | }) {
138 | return initial(this);
139 | }
140 |
141 | @override
142 | @optionalTypeArgs
143 | TResult? mapOrNull({
144 | TResult Function(_Initial value)? initial,
145 | }) {
146 | return initial?.call(this);
147 | }
148 |
149 | @override
150 | @optionalTypeArgs
151 | TResult maybeMap({
152 | TResult Function(_Initial value)? initial,
153 | required TResult orElse(),
154 | }) {
155 | if (initial != null) {
156 | return initial(this);
157 | }
158 | return orElse();
159 | }
160 | }
161 |
162 | abstract class _Initial implements GuestState {
163 | const factory _Initial() = _$_Initial;
164 | }
165 |
--------------------------------------------------------------------------------
/lib/cubits/guest/guest_state.dart:
--------------------------------------------------------------------------------
1 | part of 'guest_cubit.dart';
2 |
3 | @freezed
4 | class GuestState with _$GuestState {
5 | const factory GuestState.initial() = _Initial;
6 | }
7 |
--------------------------------------------------------------------------------
/lib/enums/data_status.dart:
--------------------------------------------------------------------------------
1 | enum DataStatus {
2 | initial,
3 | fetching,
4 | loading,
5 | loaded,
6 | refreshing,
7 | submitting,
8 | deleting,
9 | success,
10 | error,
11 | loadingMore,
12 | updating;
13 |
14 | bool get isLoading => this == DataStatus.loading;
15 | bool get isFetching => this == DataStatus.fetching;
16 | bool get isLoaded => this == DataStatus.loaded;
17 | bool get isRefreshing => this == DataStatus.refreshing;
18 | bool get isSubmitting => this == DataStatus.submitting;
19 | bool get isDeleting => this == DataStatus.deleting;
20 | bool get isUpdating => this == DataStatus.updating;
21 | bool get isError => this == DataStatus.error;
22 | bool get isSuccess => this == DataStatus.success;
23 | bool get isInitial => this == DataStatus.initial;
24 | bool get isLoadingMore => this == DataStatus.loadingMore;
25 | }
26 |
--------------------------------------------------------------------------------
/lib/enums/enums.dart:
--------------------------------------------------------------------------------
1 | export "data_status.dart";
2 |
--------------------------------------------------------------------------------
/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:dash_chat_2/dash_chat_2.dart';
2 | import 'package:flutter/foundation.dart';
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter_bloc/flutter_bloc.dart';
5 | import 'package:flutter_chat_app/blocs/blocs.dart';
6 | import 'package:flutter_chat_app/blocs/chat/chat_bloc.dart';
7 | import 'package:flutter_chat_app/blocs/user/user_bloc.dart';
8 | import 'package:flutter_chat_app/cubits/cubits.dart';
9 | import 'package:flutter_chat_app/repositories/auth/auth_repository.dart';
10 | import 'package:flutter_chat_app/repositories/chat/chat_respository.dart';
11 | import 'package:flutter_chat_app/repositories/chat_message/chat_message_repository.dart';
12 | import 'package:flutter_chat_app/repositories/user/user_repository.dart';
13 | import 'package:flutter_chat_app/screens/chat/chat_screen.dart';
14 | import 'package:flutter_chat_app/screens/guest/guest_screen.dart';
15 | import 'package:flutter_chat_app/screens/screens.dart';
16 | import 'package:flutter_chat_app/screens/splash/splash_screen.dart';
17 | import 'package:hydrated_bloc/hydrated_bloc.dart';
18 | import 'package:path_provider/path_provider.dart';
19 |
20 | void main() async {
21 | WidgetsFlutterBinding.ensureInitialized();
22 | HydratedBloc.storage = await HydratedStorage.build(
23 | storageDirectory: kIsWeb
24 | ? HydratedStorage.webStorageDirectory
25 | : await getTemporaryDirectory(),
26 | );
27 | runApp(const MyApp());
28 | }
29 |
30 | class MyApp extends StatelessWidget {
31 | const MyApp({super.key});
32 |
33 | // This widget is the root of your application.
34 | @override
35 | Widget build(BuildContext context) {
36 | return MultiRepositoryProvider(
37 | providers: [
38 | RepositoryProvider(
39 | create: (_) => AuthRepository(),
40 | ),
41 | RepositoryProvider(
42 | create: (_) => ChatRepository(),
43 | ),
44 | RepositoryProvider(
45 | create: (_) => ChatMessageRepository(),
46 | ),
47 | RepositoryProvider(
48 | create: (_) => UserRepository(),
49 | ),
50 | ],
51 | child: MultiBlocProvider(
52 | providers: [
53 | BlocProvider(create: (_) => AuthBloc()),
54 | BlocProvider(
55 | create: (context) => GuestCubit(
56 | authRepository: context.read(),
57 | authBloc: context.read(),
58 | ),
59 | ),
60 | BlocProvider(
61 | create: (context) => ChatBloc(
62 | chatRepository: context.read(),
63 | chatMessageRepository: context.read(),
64 | ),
65 | ),
66 | BlocProvider(
67 | create: (context) =>
68 | UserBloc(userRepository: context.read()),
69 | ),
70 | ],
71 | child: MaterialApp(
72 | debugShowCheckedModeBanner: false,
73 | title: 'Chat App',
74 | theme: ThemeData(
75 | primarySwatch: Colors.blue,
76 | ),
77 | initialRoute: SplashScreen.routeName,
78 | routes: {
79 | SplashScreen.routeName: (_) => const SplashScreen(),
80 | GuestScreen.routeName: (_) => const GuestScreen(),
81 | ChatListScreen.routeName: (_) => const ChatListScreen(),
82 | ChatScreen.routeName: (_) => const ChatScreen(),
83 | },
84 | ),
85 | ),
86 | );
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/lib/models/app_response.dart:
--------------------------------------------------------------------------------
1 | import 'package:equatable/equatable.dart';
2 | import 'package:json_annotation/json_annotation.dart';
3 |
4 | part 'app_response.g.dart';
5 |
6 | @JsonSerializable(explicitToJson: true, genericArgumentFactories: true)
7 | class AppResponse extends Equatable {
8 | /// The boolean indicates the AppResponse is success or failed
9 | final bool success;
10 |
11 | /// The message of AppResponse description
12 | final String message;
13 |
14 | /// The AppResponse data
15 | final T? data;
16 |
17 | /// StatusCode added by response status code (Not from server)
18 | final int statusCode;
19 |
20 | /// statusMessage added by http response (Not from server)
21 | final String statusMessage;
22 |
23 | const AppResponse._({
24 | required this.success,
25 | required this.message,
26 | required this.statusCode,
27 | required this.statusMessage,
28 | this.data,
29 | });
30 |
31 | factory AppResponse({
32 | required bool success,
33 | required String message,
34 | int? statusCode,
35 | String? statusMessage,
36 | T? data,
37 | }) {
38 | return AppResponse._(
39 | success: success,
40 | message: message,
41 | statusCode: statusCode ?? 200,
42 | statusMessage: statusMessage ?? "The request has succeeded.",
43 | data: data,
44 | );
45 | }
46 |
47 | @override
48 | List