├── linux ├── .gitignore ├── main.cc ├── flutter │ ├── generated_plugin_registrant.h │ ├── generated_plugin_registrant.cc │ ├── generated_plugins.cmake │ └── CMakeLists.txt ├── my_application.h └── my_application.cc ├── ios ├── Flutter │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── AppFrameworkInfo.plist ├── Runner │ ├── Runner-Bridging-Header.h │ ├── Assets.xcassets │ │ ├── LaunchImage.imageset │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ ├── README.md │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ ├── 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-1024x1024@1x.png │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ └── Contents.json │ ├── AppDelegate.swift │ ├── GoogleService-Info.plist │ ├── Base.lproj │ │ ├── Main.storyboard │ │ └── LaunchScreen.storyboard │ └── Info.plist ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── WorkspaceSettings.xcsettings │ │ └── IDEWorkspaceChecks.plist ├── firebase_app_id_file.json └── .gitignore ├── macos ├── Flutter │ ├── Flutter-Debug.xcconfig │ ├── Flutter-Release.xcconfig │ └── GeneratedPluginRegistrant.swift ├── Runner │ ├── Configs │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ ├── Warnings.xcconfig │ │ └── AppInfo.xcconfig │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_64.png │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_512.png │ │ │ └── Contents.json │ ├── AppDelegate.swift │ ├── Release.entitlements │ ├── DebugProfile.entitlements │ ├── MainFlutterWindow.swift │ └── Info.plist ├── .gitignore ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── Runner.xcodeproj │ ├── project.xcworkspace │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ └── xcschemes │ └── Runner.xcscheme ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── manifest.json └── index.html ├── lib ├── utils │ ├── common │ │ ├── enums │ │ │ ├── swipe_direction.dart │ │ │ └── message_type.dart │ │ ├── providers │ │ │ ├── current_user_provider.dart │ │ │ └── reply_message_provider.dart │ │ ├── config │ │ │ └── agora_config.dart │ │ ├── widgets │ │ │ ├── loader.dart │ │ │ ├── error_viewer.dart │ │ │ ├── helper_widgets.dart │ │ │ └── round_button.dart │ │ ├── screens │ │ │ ├── loading_screen.dart │ │ │ └── error_screen.dart │ │ ├── repositories │ │ │ └── firebase_storage_repository.dart │ │ └── helper_methods │ │ │ └── util_methods.dart │ └── constants │ │ ├── assets_constants.dart │ │ ├── routes_constants.dart │ │ ├── string_constants.dart │ │ ├── colors_constants.dart │ │ └── theme_constants.dart ├── screens │ ├── chat │ │ └── widgets │ │ │ ├── pop_up_menu_item.dart │ │ │ ├── material_icon_button.dart │ │ │ ├── no_chat.dart │ │ │ ├── audio_player_item.dart │ │ │ ├── display_message.dart │ │ │ ├── video_player_item.dart │ │ │ ├── reply_message_preview.dart │ │ │ └── chats_list.dart │ ├── call │ │ ├── screens │ │ │ ├── calls_screen.dart │ │ │ ├── call_screen.dart │ │ │ └── call_pickup_screen.dart │ │ ├── repositories │ │ │ └── call_repository.dart │ │ └── controllers │ │ │ └── call_controller.dart │ ├── group │ │ ├── controllers │ │ │ └── group_controller.dart │ │ ├── repositories │ │ │ └── group_repository.dart │ │ ├── widgets │ │ │ └── group_contacts_list.dart │ │ └── screens │ │ │ └── group_chats_screen.dart │ ├── status │ │ ├── screens │ │ │ ├── confirm_status_screen.dart │ │ │ ├── watch_status_screen.dart │ │ │ └── status_screen.dart │ │ └── controllers │ │ │ └── status_controller.dart │ ├── auth │ │ ├── controllers │ │ │ └── auth_controller.dart │ │ ├── repositories │ │ │ └── auth_repository.dart │ │ └── screens │ │ │ └── otp_screen.dart │ ├── contact │ │ ├── controllers │ │ │ └── select_receiver_contacts_controller.dart │ │ ├── widgets │ │ │ └── contacts_list.dart │ │ ├── repositories │ │ │ └── select_receiver_contact_repository.dart │ │ └── state │ │ │ └── contacts_list_state_notifier.dart │ ├── sender_info │ │ ├── controllers │ │ │ └── sender_user_data_controller.dart │ │ └── repositories │ │ │ └── sender_user_data_repository.dart │ ├── landing │ │ └── screens │ │ │ └── landing_screen.dart │ └── home │ │ └── widgets │ │ └── home_fab.dart ├── models │ ├── chat.dart │ ├── user.dart │ ├── call.dart │ ├── status.dart │ ├── group.dart │ └── message.dart ├── main.dart ├── firebase_options.dart └── router │ └── router.dart ├── assets └── images │ ├── ic_menu.png │ ├── ic_phone.png │ ├── ic_video.png │ ├── ic_no_chat.png │ ├── ic_landing1.png │ ├── ic_landing2.png │ └── ic_user_not_selected.png ├── android ├── gradle.properties ├── app │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── 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 │ │ │ │ ├── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable-v21 │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── values │ │ │ │ │ └── styles.xml │ │ │ │ └── values-night │ │ │ │ │ └── styles.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── usamamuzaffar │ │ │ │ │ └── i_chat_instant │ │ │ │ │ └── MainActivity.kt │ │ │ └── AndroidManifest.xml │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── database.rules.json │ ├── google-services.json │ └── build.gradle ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── .gitignore ├── settings.gradle └── build.gradle ├── windows ├── runner │ ├── resources │ │ └── app_icon.ico │ ├── resource.h │ ├── utils.h │ ├── runner.exe.manifest │ ├── flutter_window.h │ ├── main.cpp │ ├── CMakeLists.txt │ ├── utils.cpp │ ├── flutter_window.cpp │ ├── Runner.rc │ └── win32_window.h ├── .gitignore └── flutter │ ├── generated_plugin_registrant.h │ ├── generated_plugin_registrant.cc │ ├── generated_plugins.cmake │ └── CMakeLists.txt ├── .gitignore ├── test └── widget_test.dart ├── analysis_options.yaml ├── .metadata └── README.md /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/web/favicon.png -------------------------------------------------------------------------------- /lib/utils/common/enums/swipe_direction.dart: -------------------------------------------------------------------------------- 1 | enum SwipeDirection { 2 | left, 3 | right, 4 | } 5 | -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/web/icons/Icon-512.png -------------------------------------------------------------------------------- /assets/images/ic_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/assets/images/ic_menu.png -------------------------------------------------------------------------------- /assets/images/ic_phone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/assets/images/ic_phone.png -------------------------------------------------------------------------------- /assets/images/ic_video.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/assets/images/ic_video.png -------------------------------------------------------------------------------- /assets/images/ic_no_chat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/assets/images/ic_no_chat.png -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /assets/images/ic_landing1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/assets/images/ic_landing1.png -------------------------------------------------------------------------------- /assets/images/ic_landing2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/assets/images/ic_landing2.png -------------------------------------------------------------------------------- /macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /assets/images/ic_user_not_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/assets/images/ic_user_not_selected.png -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/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/mrusamamuzaffar/lets_chat/HEAD/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/mrusamamuzaffar/lets_chat/HEAD/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/mrusamamuzaffar/lets_chat/HEAD/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/mrusamamuzaffar/lets_chat/HEAD/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/mrusamamuzaffar/lets_chat/HEAD/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/mrusamamuzaffar/lets_chat/HEAD/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/mrusamamuzaffar/lets_chat/HEAD/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/mrusamamuzaffar/lets_chat/HEAD/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/mrusamamuzaffar/lets_chat/HEAD/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/mrusamamuzaffar/lets_chat/HEAD/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/mrusamamuzaffar/lets_chat/HEAD/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/mrusamamuzaffar/lets_chat/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrusamamuzaffar/lets_chat/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /lib/utils/common/providers/current_user_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 2 | import '../../../models/user.dart' as app; 3 | 4 | Provider? currentUserProvider; 5 | -------------------------------------------------------------------------------- /android/app/database.rules.json: -------------------------------------------------------------------------------- 1 | { 2 | /* Visit https://firebase.google.com/docs/database/security to learn more about security rules. */ 3 | "rules": { 4 | ".read": false, 5 | ".write": false 6 | } 7 | } -------------------------------------------------------------------------------- /linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/usamamuzaffar/i_chat_instant/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.usamamuzaffar.i_chat_instant 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/firebase_app_id_file.json: -------------------------------------------------------------------------------- 1 | { 2 | "file_generated_by": "FlutterFire CLI", 3 | "purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory", 4 | "GOOGLE_APP_ID": "1:278875593512:ios:7cb48fdbc6e0ec228e8e1d", 5 | "FIREBASE_PROJECT_ID": "i-chat-instant", 6 | "GCM_SENDER_ID": "278875593512" 7 | } -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.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/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib/utils/common/config/agora_config.dart: -------------------------------------------------------------------------------- 1 | class AgoraConfig { 2 | static const String token = ''; 3 | static const String appId = '1d314449ddda4e2ea9bdf0bc1342b910'; 4 | static const String appCertificate = '9f833d0abe0745b5a2a30662be89c6d7'; 5 | static const String tokenBaseUrl = 6 | 'https://lets-chat-mateendev3.herokuapp.com'; 7 | } 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/screens/chat/widgets/pop_up_menu_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | PopupMenuItem buildPopUpMenuItem( 4 | IconData icon, 5 | String text, 6 | VoidCallback onPressed, 7 | ) { 8 | return PopupMenuItem( 9 | child: ListTile( 10 | leading: Icon(icon), 11 | title: Text(text), 12 | onTap: onPressed, 13 | ), 14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /lib/utils/common/widgets/loader.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../../constants/colors_constants.dart'; 3 | 4 | class Loader extends StatelessWidget { 5 | const Loader({super.key}); 6 | 7 | @override 8 | Widget build(BuildContext context) { 9 | return const Center( 10 | child: CircularProgressIndicator( 11 | color: AppColors.black, 12 | ), 13 | ); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 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 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /lib/utils/common/screens/loading_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../../constants/colors_constants.dart'; 3 | 4 | class LoadingScreen extends StatelessWidget { 5 | const LoadingScreen({super.key}); 6 | 7 | @override 8 | Widget build(BuildContext context) { 9 | return const Scaffold( 10 | body: Center( 11 | child: CircularProgressIndicator( 12 | color: AppColors.black, 13 | ), 14 | ), 15 | ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/utils/common/widgets/error_viewer.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class ErrorViewer extends StatelessWidget { 4 | const ErrorViewer({super.key, required this.error}); 5 | 6 | final String error; 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return Padding( 11 | padding: const EdgeInsets.all(16.0), 12 | child: Text( 13 | error, 14 | style: Theme.of(context).textTheme.bodyMedium, 15 | ), 16 | ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/utils/common/providers/reply_message_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 2 | import '../enums/message_type.dart'; 3 | 4 | final replyMessageProvider = StateProvider((ref) => null); 5 | 6 | class ReplyMessage { 7 | ReplyMessage({ 8 | required this.message, 9 | required this.isMe, 10 | required this.messageType, 11 | required this.isSender, 12 | }); 13 | final String message; 14 | final bool isMe; 15 | final MessageType messageType; 16 | final bool isSender; 17 | } 18 | -------------------------------------------------------------------------------- /lib/utils/constants/assets_constants.dart: -------------------------------------------------------------------------------- 1 | const String _basePath = 'assets/images/'; 2 | 3 | class ImagesConsts { 4 | static const icPhone = '${_basePath}ic_phone.png'; 5 | static const icVideo = '${_basePath}ic_video.png'; 6 | static const icMenu = '${_basePath}ic_menu.png'; 7 | static const icLanding1 = '${_basePath}ic_landing1.png'; 8 | static const icLanding2 = '${_basePath}ic_landing2.png'; 9 | static const icUserNotSelected = '${_basePath}ic_user_not_selected.png'; 10 | static const icNoChat = '${_basePath}ic_no_chat.png'; 11 | } 12 | -------------------------------------------------------------------------------- /lib/utils/common/widgets/helper_widgets.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | /// To add space b/w widgets vertically. 4 | Widget addVerticalSpace(double space) => SizedBox(height: space); 5 | 6 | /// To add space b/w widgets horizontally. 7 | Widget addHorizontalSpace(double space) => SizedBox(width: space); 8 | 9 | /// To show Snackbar 10 | void showSnackBar( 11 | BuildContext context, { 12 | required String content, 13 | }) => 14 | ScaffoldMessenger.of(context).showSnackBar( 15 | SnackBar( 16 | content: Text(content), 17 | ), 18 | ); 19 | -------------------------------------------------------------------------------- /lib/screens/call/screens/calls_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import '../../../utils/constants/colors_constants.dart'; 4 | 5 | class CallsScreen extends ConsumerWidget { 6 | const CallsScreen({Key? key}) : super(key: key); 7 | 8 | @override 9 | Widget build(BuildContext context, WidgetRef ref) { 10 | return const Center( 11 | child: Text( 12 | 'Calls', 13 | style: TextStyle( 14 | fontSize: 48.0, 15 | fontWeight: FontWeight.bold, 16 | color: AppColors.primary, 17 | ), 18 | ), 19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /lib/screens/chat/widgets/material_icon_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../../../utils/constants/colors_constants.dart'; 3 | 4 | Widget buildMaterialIconButton({ 5 | required IconData icon, 6 | required VoidCallback onTap, 7 | }) { 8 | return Material( 9 | clipBehavior: Clip.antiAlias, 10 | color: Colors.transparent, 11 | shape: RoundedRectangleBorder( 12 | borderRadius: BorderRadius.circular(100.0), 13 | ), 14 | child: IconButton( 15 | onPressed: onTap, 16 | splashColor: AppColors.grey, 17 | icon: Icon( 18 | icon, 19 | color: AppColors.chatScreenGrey, 20 | ), 21 | ), 22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /lib/screens/chat/widgets/no_chat.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../../../utils/constants/assets_constants.dart'; 3 | 4 | class NoChat extends StatelessWidget { 5 | const NoChat({super.key}); 6 | 7 | @override 8 | Widget build(BuildContext context) { 9 | return Center( 10 | child: SizedBox( 11 | width: MediaQuery.of(context).size.width * 0.9, 12 | height: MediaQuery.of(context).size.width * 0.9, 13 | child: Opacity( 14 | opacity: 0.8, 15 | child: Image.asset( 16 | ImagesConsts.icNoChat, 17 | fit: BoxFit.cover, 18 | ), 19 | ), 20 | ), 21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/utils/common/screens/error_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class ErrorScreen extends StatelessWidget { 4 | const ErrorScreen({super.key, required this.error}); 5 | 6 | final String error; 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return Scaffold( 11 | appBar: AppBar( 12 | title: const Text( 13 | 'Error Screen', 14 | ), 15 | ), 16 | body: Center( 17 | child: Text( 18 | error, 19 | style: const TextStyle( 20 | fontSize: 14.0, 21 | fontWeight: FontWeight.bold, 22 | ), 23 | ), 24 | ), 25 | ); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = i_chat_instant 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.usamamuzaffar.iChatInstant 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.usamamuzaffar. All rights reserved. 15 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/utils/common/enums/message_type.dart: -------------------------------------------------------------------------------- 1 | enum MessageType { 2 | text('text'), 3 | image('image'), 4 | gif('gif'), 5 | audio('audio'), 6 | video('video'); 7 | 8 | final String type; 9 | const MessageType(this.type); 10 | } 11 | 12 | extension ConvertMessageType on String { 13 | MessageType toEnum() { 14 | switch (this) { 15 | case 'text': 16 | return MessageType.text; 17 | case 'image': 18 | return MessageType.image; 19 | case 'gif': 20 | return MessageType.gif; 21 | case 'audio': 22 | return MessageType.audio; 23 | case 'video': 24 | return MessageType.video; 25 | default: 26 | return MessageType.text; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /lib/utils/constants/routes_constants.dart: -------------------------------------------------------------------------------- 1 | class AppRoutes { 2 | static const String homeScreen = '/'; 3 | static const String chatScreen = '/chat'; 4 | static const String landingScreen = '/landing'; 5 | static const String phoneLoginScreen = '/phone-login'; 6 | static const String otpScreen = '/otp'; 7 | static const String userInformationScreen = '/user-information'; 8 | static const String selectContactScreen = '/select-contact'; 9 | static const String statusScreen = '/status'; 10 | static const String confirmStatusScreen = '/confirm-status'; 11 | static const String watchStatusScreen = '/watch-status'; 12 | static const String createGroupScreen = '/create-group'; 13 | static const String groupChatsScreen = '/group-chats'; 14 | static const String errorScreen = '/error'; 15 | } 16 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | void RegisterPlugins(flutter::PluginRegistry* registry) { 14 | AudioplayersWindowsPluginRegisterWithRegistrar( 15 | registry->GetRegistrarForPlugin("AudioplayersWindowsPlugin")); 16 | EmojiPickerFlutterPluginCApiRegisterWithRegistrar( 17 | registry->GetRegistrarForPlugin("EmojiPickerFlutterPluginCApi")); 18 | PermissionHandlerWindowsPluginRegisterWithRegistrar( 19 | registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); 20 | } 21 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | 12 | void fl_register_plugins(FlPluginRegistry* registry) { 13 | g_autoptr(FlPluginRegistrar) audioplayers_linux_registrar = 14 | fl_plugin_registry_get_registrar_for_plugin(registry, "AudioplayersLinuxPlugin"); 15 | audioplayers_linux_plugin_register_with_registrar(audioplayers_linux_registrar); 16 | g_autoptr(FlPluginRegistrar) emoji_picker_flutter_registrar = 17 | fl_plugin_registry_get_registrar_for_plugin(registry, "EmojiPickerFlutterPlugin"); 18 | emoji_picker_flutter_plugin_register_with_registrar(emoji_picker_flutter_registrar); 19 | } 20 | -------------------------------------------------------------------------------- /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 | // START: FlutterFire Configuration 11 | classpath 'com.google.gms:google-services:4.3.10' 12 | // END: FlutterFire Configuration 13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | mavenCentral() 21 | } 22 | } 23 | 24 | rootProject.buildDir = '../build' 25 | subprojects { 26 | project.buildDir = "${rootProject.buildDir}/${project.name}" 27 | } 28 | subprojects { 29 | project.evaluationDependsOn(':app') 30 | } 31 | 32 | task clean(type: Delete) { 33 | delete rootProject.buildDir 34 | } 35 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | audioplayers_linux 7 | emoji_picker_flutter 8 | ) 9 | 10 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 11 | ) 12 | 13 | set(PLUGIN_BUNDLED_LIBRARIES) 14 | 15 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 16 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 17 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 20 | endforeach(plugin) 21 | 22 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 23 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 24 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 25 | endforeach(ffi_plugin) 26 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | audioplayers_windows 7 | emoji_picker_flutter 8 | permission_handler_windows 9 | ) 10 | 11 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 12 | ) 13 | 14 | set(PLUGIN_BUNDLED_LIBRARIES) 15 | 16 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 17 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 18 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 20 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 21 | endforeach(plugin) 22 | 23 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 24 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 25 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 26 | endforeach(ffi_plugin) 27 | -------------------------------------------------------------------------------- /windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /lib/models/chat.dart: -------------------------------------------------------------------------------- 1 | class Chat { 2 | Chat({ 3 | required this.name, 4 | required this.profilePic, 5 | required this.userId, 6 | required this.time, 7 | required this.lastMessage, 8 | }); 9 | 10 | final String name; 11 | final String profilePic; 12 | final String userId; 13 | final DateTime time; 14 | final String lastMessage; 15 | 16 | Map toMap() { 17 | return { 18 | 'name': name, 19 | 'profilePic': profilePic, 20 | 'userId': userId, 21 | 'time': time.millisecondsSinceEpoch, 22 | 'lastMessage': lastMessage, 23 | }; 24 | } 25 | 26 | factory Chat.fromMap(Map map) { 27 | return Chat( 28 | name: map['name'] as String, 29 | profilePic: map['profilePic'] as String, 30 | userId: map['userId'] as String, 31 | time: DateTime.fromMillisecondsSinceEpoch(map['time'] as int), 32 | lastMessage: map['lastMessage'] as String, 33 | ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/utils/constants/string_constants.dart: -------------------------------------------------------------------------------- 1 | class StringsConsts { 2 | // app name. 3 | static const String appName = 'LetsChat'; 4 | 5 | // firestore 6 | static const String usersCollection = 'users'; 7 | static const String groupsCollection = 'groups'; 8 | static const String statusCollection = 'status'; 9 | static const String chatsCollection = 'chats'; 10 | static const String callsCollection = 'calls'; 11 | static const String messagesCollection = 'messages'; 12 | 13 | // chat 14 | static const String userId = 'userId'; 15 | static const String username = 'username'; 16 | static const String profilePic = 'profilePic'; 17 | static const String isGroupChat = 'isGroupChat'; 18 | 19 | // GIF 20 | static const String giphyApiKey = 'XNWLf5zhEEFFuOpXcj61QtnliI4pYH3p'; 21 | static const String staticGiphyUrlStart = 'https://i.giphy.com/media/'; 22 | static const String staticGiphyUrlEnd = '/200.gif'; 23 | 24 | // Audio Player 25 | static const String audiosSavingPath = '/flutter_sound.aac'; 26 | } 27 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "i_chat_instant", 3 | "short_name": "i_chat_instant", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A Flutter chat app project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /lib/utils/common/repositories/firebase_storage_repository.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:firebase_storage/firebase_storage.dart'; 4 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 5 | 6 | final firebaseStorageRepositoryProvider = Provider( 7 | (ref) => FirebaseStorageRepository(FirebaseStorage.instance), 8 | ); 9 | 10 | class FirebaseStorageRepository { 11 | FirebaseStorageRepository(FirebaseStorage storage) 12 | : _firebaseStorage = storage; 13 | 14 | final FirebaseStorage _firebaseStorage; 15 | 16 | /// To upload file to firebase storage 17 | Future storeFileToFirebaseStorage( 18 | BuildContext context, { 19 | required File file, 20 | required String path, 21 | required String fileName, 22 | }) async { 23 | try { 24 | UploadTask imageUploadTask = 25 | _firebaseStorage.ref().child(path).child(fileName).putFile(file); 26 | TaskSnapshot snapshot = await imageUploadTask; 27 | return await snapshot.ref.getDownloadURL(); 28 | } catch (e) { 29 | throw 'Image not found'; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility in the flutter_test package. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:i_chat_instant/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(const MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /lib/utils/common/widgets/round_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class RoundButton extends StatelessWidget { 4 | const RoundButton({ 5 | super.key, 6 | required this.text, 7 | required this.onPressed, 8 | }); 9 | 10 | final String text; 11 | final VoidCallback onPressed; 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | Size size = MediaQuery.of(context).size; 16 | return SizedBox( 17 | width: size.width, 18 | child: Padding( 19 | padding: EdgeInsets.only( 20 | bottom: size.width * 0.05, 21 | left: size.width * 0.05, 22 | right: size.width * 0.05, 23 | ), 24 | child: ElevatedButton( 25 | onPressed: onPressed, 26 | style: ElevatedButton.styleFrom( 27 | shape: RoundedRectangleBorder( 28 | borderRadius: BorderRadius.circular(100.0), 29 | ), 30 | ), 31 | child: Text( 32 | text, 33 | style: Theme.of(context).textTheme.displaySmall?.copyWith( 34 | fontSize: size.width * 0.04, 35 | ), 36 | ), 37 | ), 38 | ), 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /lib/models/user.dart: -------------------------------------------------------------------------------- 1 | class User { 2 | User({ 3 | required this.name, 4 | required this.uid, 5 | this.profilePic, 6 | required this.isOnline, 7 | required this.phoneNumber, 8 | required this.groupId, 9 | }); 10 | 11 | final String name; 12 | final String uid; 13 | final String? profilePic; 14 | final bool isOnline; 15 | final String phoneNumber; 16 | final List groupId; 17 | 18 | Map toMap() { 19 | return { 20 | 'name': name, 21 | 'uid': uid, 22 | 'profilePic': profilePic, 23 | 'isOnline': isOnline, 24 | 'phoneNumber': phoneNumber, 25 | 'groupId': groupId, 26 | }; 27 | } 28 | 29 | factory User.fromMap(Map map) { 30 | return User( 31 | name: map['name'] as String, 32 | uid: map['uid'] as String, 33 | profilePic: 34 | map['profilePic'] != null ? map['profilePic'] as String : null, 35 | isOnline: map['isOnline'] as bool, 36 | phoneNumber: map['phoneNumber'] as String, 37 | groupId: (map['groupId'] as List).map((e) => e.toString()).toList(), 38 | ); 39 | } 40 | 41 | @override 42 | String toString() { 43 | return 'User(name: $name, uid: $uid, profilePic: $profilePic, isOnline: $isOnline, phoneNumber: $phoneNumber, groupId: $groupId)'; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lib/utils/constants/colors_constants.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class AppColors { 4 | // App main colors 5 | static const primary = Color(0xFFFB7F6B); 6 | static const onPrimary = Colors.white; 7 | static const secondary = Color(0xFFFB7F6B); 8 | static const onSecondary = Color(0xFFFFFFFF); 9 | static const onError = Color(0xFFFF0000); 10 | 11 | // Scaffold colors 12 | static const scaffoldBG = Colors.white; 13 | static const scaffoldBGChat = Color.fromARGB(255, 247, 245, 245); 14 | 15 | // AppBar 16 | static const appBar = Color(0xFFFB7F6B); 17 | static const appBarTitle = Colors.white; 18 | static const appBarActionIcon = Colors.white; 19 | static const chatAppBar = Colors.white; 20 | 21 | // TabBar 22 | static const tabIndicator = Colors.white; 23 | static const sTabLabel = Colors.white; 24 | static const uTabLabel = Colors.white70; 25 | 26 | /// General 27 | static const white = Colors.white; 28 | static const grey = Colors.grey; 29 | static const black = Colors.black; 30 | static const lightBlack = Color.fromARGB(255, 45, 45, 45); 31 | 32 | // Chat Screen 33 | static const chatTFFill = Colors.white; 34 | static const chatScreenGrey = Color(0xFFACACAC); 35 | static const chatOffWhite = Colors.white70; 36 | 37 | static const green = Colors.green; 38 | static const red = Colors.red; 39 | } 40 | -------------------------------------------------------------------------------- /macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import audioplayers_darwin 9 | import cloud_firestore 10 | import emoji_picker_flutter 11 | import firebase_auth 12 | import firebase_core 13 | import firebase_storage 14 | import path_provider_macos 15 | import shared_preferences_macos 16 | import sqflite 17 | 18 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 19 | AudioplayersDarwinPlugin.register(with: registry.registrar(forPlugin: "AudioplayersDarwinPlugin")) 20 | FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin")) 21 | EmojiPickerFlutterPlugin.register(with: registry.registrar(forPlugin: "EmojiPickerFlutterPlugin")) 22 | FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin")) 23 | FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) 24 | FLTFirebaseStoragePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseStoragePlugin")) 25 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 26 | SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) 27 | SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) 28 | } 29 | -------------------------------------------------------------------------------- /ios/Runner/GoogleService-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CLIENT_ID 6 | 278875593512-lgd78flp7kjmof9e2kb0ur460d7d6n9o.apps.googleusercontent.com 7 | REVERSED_CLIENT_ID 8 | com.googleusercontent.apps.278875593512-lgd78flp7kjmof9e2kb0ur460d7d6n9o 9 | API_KEY 10 | AIzaSyDuzWvQgS_Tlig1USupOKFDwhfWMR1FVP8 11 | GCM_SENDER_ID 12 | 278875593512 13 | PLIST_VERSION 14 | 1 15 | BUNDLE_ID 16 | com.usamamuzaffar.iChatInstant 17 | PROJECT_ID 18 | i-chat-instant 19 | STORAGE_BUCKET 20 | i-chat-instant.appspot.com 21 | IS_ADS_ENABLED 22 | 23 | IS_ANALYTICS_ENABLED 24 | 25 | IS_APPINVITE_ENABLED 26 | 27 | IS_GCM_ENABLED 28 | 29 | IS_SIGNIN_ENABLED 30 | 31 | GOOGLE_APP_ID 32 | 1:278875593512:ios:7cb48fdbc6e0ec228e8e1d 33 | DATABASE_URL 34 | https://i-chat-instant-default-rtdb.firebaseio.com 35 | 36 | -------------------------------------------------------------------------------- /lib/models/call.dart: -------------------------------------------------------------------------------- 1 | class Call { 2 | Call({ 3 | required this.callerId, 4 | required this.callerName, 5 | required this.callerPic, 6 | required this.receiverId, 7 | required this.receiverName, 8 | required this.receiverPic, 9 | required this.callId, 10 | required this.hasDialled, 11 | }); 12 | 13 | final String callerId; 14 | final String callerName; 15 | final String callerPic; 16 | final String receiverId; 17 | final String receiverName; 18 | final String receiverPic; 19 | final String callId; 20 | final bool hasDialled; 21 | 22 | Map toMap() { 23 | return { 24 | 'callerId': callerId, 25 | 'callerName': callerName, 26 | 'callerPic': callerPic, 27 | 'receiverId': receiverId, 28 | 'receiverName': receiverName, 29 | 'receiverPic': receiverPic, 30 | 'callId': callId, 31 | 'hasDialled': hasDialled, 32 | }; 33 | } 34 | 35 | factory Call.fromMap(Map map) { 36 | return Call( 37 | callerId: map['callerId'] as String, 38 | callerName: map['callerName'] as String, 39 | callerPic: map['callerPic'] as String, 40 | receiverId: map['receiverId'] as String, 41 | receiverName: map['receiverName'] as String, 42 | receiverPic: map['receiverPic'] as String, 43 | callId: map['callId'] as String, 44 | hasDialled: map['hasDialled'] as bool, 45 | ); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /lib/screens/group/controllers/group_controller.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:flutter/cupertino.dart'; 3 | import 'package:flutter_contacts/contact.dart'; 4 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 5 | import '../../../utils/common/providers/current_user_provider.dart'; 6 | import '../repositories/group_repository.dart'; 7 | import '../../../models/user.dart' as app; 8 | 9 | final groupControllerProvider = Provider( 10 | (ref) { 11 | return GroupController( 12 | groupRepository: ref.read(groupRepositoryProvider), 13 | ref: ref, 14 | ); 15 | }, 16 | ); 17 | 18 | class GroupController { 19 | GroupController({ 20 | required GroupRepository groupRepository, 21 | required ProviderRef ref, 22 | }) : _groupRepository = groupRepository, 23 | _ref = ref; 24 | 25 | final GroupRepository _groupRepository; 26 | final ProviderRef _ref; 27 | 28 | Future createGroup( 29 | BuildContext context, 30 | bool mounted, { 31 | required String groupName, 32 | required File groupProfilePic, 33 | required List selectedContacts, 34 | }) async { 35 | app.User user = _ref.read(currentUserProvider!); 36 | _groupRepository.createGroup( 37 | mounted, 38 | context, 39 | currentUserId: user.uid, 40 | groupName: groupName, 41 | groupProfilePic: groupProfilePic, 42 | selectedContacts: selectedContacts, 43 | ); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"i_chat_instant", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /lib/screens/status/screens/confirm_status_screen.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | import '../controllers/status_controller.dart'; 5 | 6 | class ConfirmStatusScreen extends ConsumerWidget { 7 | const ConfirmStatusScreen({Key? key}) : super(key: key); 8 | 9 | @override 10 | Widget build(BuildContext context, WidgetRef ref) { 11 | final File imageFile = ModalRoute.of(context)?.settings.arguments as File; 12 | 13 | return Scaffold( 14 | appBar: AppBar( 15 | title: const Text('Want to add to status?'), 16 | ), 17 | body: Padding( 18 | padding: const EdgeInsets.all(8.0), 19 | child: Center( 20 | child: AspectRatio( 21 | aspectRatio: 16 / 9, 22 | child: Image.file( 23 | imageFile, 24 | ), 25 | ), 26 | ), 27 | ), 28 | floatingActionButton: FloatingActionButton( 29 | child: const Icon( 30 | Icons.done, 31 | color: Colors.white, 32 | ), 33 | onPressed: () => addStatus(context, ref, imageFile), 34 | ), 35 | ); 36 | } 37 | 38 | void addStatus(BuildContext context, WidgetRef ref, File imageFile) { 39 | ref.read(statusControllerProvider).uploadStatus( 40 | context, 41 | currentUserStatusImage: imageFile, 42 | ); 43 | Navigator.pop(context); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lib/models/status.dart: -------------------------------------------------------------------------------- 1 | class Status { 2 | Status({ 3 | required this.uid, 4 | required this.username, 5 | required this.phoneNumber, 6 | required this.profilePic, 7 | required this.statusId, 8 | required this.photoUrls, 9 | required this.whoCanSee, 10 | required this.time, 11 | }); 12 | 13 | final String uid; 14 | final String username; 15 | final String? phoneNumber; 16 | final String? profilePic; 17 | final String statusId; 18 | final List photoUrls; 19 | final List whoCanSee; 20 | final DateTime time; 21 | 22 | Map toMap() { 23 | return { 24 | 'uid': uid, 25 | 'username': username, 26 | 'phoneNumber': phoneNumber, 27 | 'profilePic': profilePic, 28 | 'statusId': statusId, 29 | 'photoUrls': photoUrls, 30 | 'whoCanSee': whoCanSee, 31 | 'time': time.millisecondsSinceEpoch, 32 | }; 33 | } 34 | 35 | factory Status.fromMap(Map map) { 36 | return Status( 37 | uid: map['uid'] as String, 38 | username: map['username'] as String, 39 | phoneNumber: map['phoneNumber'] as String, 40 | profilePic: map['profilePic'] as String, 41 | statusId: map['statusId'] as String, 42 | photoUrls: List.from(map['photoUrls'] as List), 43 | whoCanSee: List.from(map['whoCanSee'] as List), 44 | time: DateTime.fromMillisecondsSinceEpoch(map['time'] as int), 45 | ); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /lib/models/group.dart: -------------------------------------------------------------------------------- 1 | class Group { 2 | Group({ 3 | required this.groupName, 4 | required this.groupId, 5 | required this.groupProfilePic, 6 | required this.lastMessage, 7 | required this.lastMessageUserSenderId, 8 | required this.time, 9 | required this.selectedMembersUIds, 10 | }); 11 | 12 | final String groupName; 13 | final String groupId; 14 | final String groupProfilePic; 15 | final String lastMessage; 16 | final String lastMessageUserSenderId; 17 | final DateTime time; 18 | final List selectedMembersUIds; 19 | 20 | Map toMap() { 21 | return { 22 | 'groupName': groupName, 23 | 'groupId': groupId, 24 | 'groupProfilePic': groupProfilePic, 25 | 'lastMessage': lastMessage, 26 | 'lastMessageUserSenderId': lastMessageUserSenderId, 27 | 'time': time.millisecondsSinceEpoch, 28 | 'selectedMembersUIds': selectedMembersUIds, 29 | }; 30 | } 31 | 32 | factory Group.fromMap(Map map) { 33 | return Group( 34 | groupName: map['groupName'] as String, 35 | groupId: map['groupId'] as String, 36 | groupProfilePic: map['groupProfilePic'] as String, 37 | lastMessage: map['lastMessage'] as String, 38 | lastMessageUserSenderId: map['lastMessageUserSenderId'] as String, 39 | time: DateTime.fromMillisecondsSinceEpoch(map['time'] as int), 40 | selectedMembersUIds: 41 | List.from(map['selectedMembersUIds'] as List), 42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/screens/auth/controllers/auth_controller.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import '../repositories/auth_repository.dart'; 4 | import '../../../models/user.dart' as app; 5 | 6 | final authControllerProvider = Provider( 7 | (ref) { 8 | final authRepository = ref.watch(authRepositoryProvider); 9 | return AuthController(authRepository); 10 | }, 11 | ); 12 | 13 | class AuthController { 14 | AuthController(AuthRepository authRepository) 15 | : _authRepository = authRepository; 16 | 17 | final AuthRepository _authRepository; 18 | 19 | /// Invoke to signIn user with phone number. 20 | Future signInWithPhone( 21 | BuildContext context, { 22 | required String phoneNumber, 23 | }) async => 24 | await _authRepository.signInWithPhone( 25 | context, 26 | phoneNumber: phoneNumber, 27 | ); 28 | 29 | /// Invoke to signIn user with phone number. 30 | Future verifyOTP( 31 | BuildContext context, 32 | bool mounted, { 33 | required String verificationId, 34 | required String smsCode, 35 | }) async => 36 | await _authRepository.verifyOTP( 37 | context, 38 | mounted, 39 | verificationId: verificationId, 40 | smsCode: smsCode, 41 | ); 42 | 43 | /// invoke to get user data form firestore. 44 | Stream getReceiverUserData(String receiverUserId) { 45 | return _authRepository.getReceiverUserData(receiverUserId); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /android/app/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "278875593512", 4 | "firebase_url": "https://i-chat-instant-default-rtdb.firebaseio.com", 5 | "project_id": "i-chat-instant", 6 | "storage_bucket": "i-chat-instant.appspot.com" 7 | }, 8 | "client": [ 9 | { 10 | "client_info": { 11 | "mobilesdk_app_id": "1:278875593512:android:45e1a5a2c65d16f18e8e1d", 12 | "android_client_info": { 13 | "package_name": "com.usamamuzaffar.i_chat_instant" 14 | } 15 | }, 16 | "oauth_client": [ 17 | { 18 | "client_id": "278875593512-i2f0fna574cbauv88t3sbihac492quat.apps.googleusercontent.com", 19 | "client_type": 3 20 | } 21 | ], 22 | "api_key": [ 23 | { 24 | "current_key": "AIzaSyAdYzXavjDY5cvWsmwdIpleA6Xps0B6XnA" 25 | } 26 | ], 27 | "services": { 28 | "appinvite_service": { 29 | "other_platform_oauth_client": [ 30 | { 31 | "client_id": "278875593512-i2f0fna574cbauv88t3sbihac492quat.apps.googleusercontent.com", 32 | "client_type": 3 33 | }, 34 | { 35 | "client_id": "278875593512-lgd78flp7kjmof9e2kb0ur460d7d6n9o.apps.googleusercontent.com", 36 | "client_type": 2, 37 | "ios_info": { 38 | "bundle_id": "com.usamamuzaffar.iChatInstant" 39 | } 40 | } 41 | ] 42 | } 43 | } 44 | } 45 | ], 46 | "configuration_version": "1" 47 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/screens/chat/widgets/audio_player_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:audioplayers/audioplayers.dart'; 2 | import 'package:flutter/material.dart'; 3 | import '../../../utils/constants/colors_constants.dart'; 4 | 5 | class AudioPlayerItem extends StatefulWidget { 6 | const AudioPlayerItem({ 7 | Key? key, 8 | required this.audioUrl, 9 | required this.isSender, 10 | }) : super(key: key); 11 | 12 | final String audioUrl; 13 | final bool isSender; 14 | 15 | @override 16 | State createState() => _AudioPlayerItemState(); 17 | } 18 | 19 | class _AudioPlayerItemState extends State { 20 | late final AudioPlayer _audioPlayer; 21 | bool _isPlayingAudio = false; 22 | 23 | @override 24 | void initState() { 25 | super.initState(); 26 | _audioPlayer = AudioPlayer(); 27 | } 28 | 29 | @override 30 | void dispose() { 31 | _audioPlayer.dispose(); 32 | super.dispose(); 33 | } 34 | 35 | @override 36 | Widget build(BuildContext context) { 37 | return IconButton( 38 | iconSize: 36.0, 39 | color: widget.isSender ? AppColors.white : AppColors.primary, 40 | constraints: const BoxConstraints(minWidth: 100.0), 41 | onPressed: () { 42 | if (!_isPlayingAudio) { 43 | _audioPlayer.play(UrlSource(widget.audioUrl)); 44 | } else { 45 | _audioPlayer.pause(); 46 | } 47 | 48 | setState(() => _isPlayingAudio = !_isPlayingAudio); 49 | }, 50 | icon: Icon(_isPlayingAudio ? Icons.pause_circle : Icons.play_circle), 51 | ); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /lib/screens/status/screens/watch_status_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:story_view/story_view.dart'; 3 | import '../../../models/status.dart'; 4 | import '../../../utils/common/widgets/loader.dart'; 5 | 6 | class WatchStatusScreen extends StatefulWidget { 7 | const WatchStatusScreen({required this.status, super.key}); 8 | final Status status; 9 | 10 | @override 11 | State createState() => _WatchStatusScreenState(); 12 | } 13 | 14 | class _WatchStatusScreenState extends State { 15 | late final StoryController _storyController; 16 | final List _storyItems = []; 17 | 18 | @override 19 | void initState() { 20 | super.initState(); 21 | _storyController = StoryController(); 22 | initStoryPageItems(); 23 | } 24 | 25 | void initStoryPageItems() { 26 | for (var photoUrl in widget.status.photoUrls) { 27 | _storyItems.add( 28 | StoryItem.pageImage( 29 | url: photoUrl, 30 | controller: _storyController, 31 | ), 32 | ); 33 | } 34 | } 35 | 36 | @override 37 | Widget build(BuildContext context) { 38 | return Scaffold( 39 | body: _storyItems.isEmpty 40 | ? const Loader() 41 | : StoryView( 42 | storyItems: _storyItems, 43 | controller: _storyController, 44 | onVerticalSwipeComplete: _onVerticalSwipeComplete, 45 | ), 46 | ); 47 | } 48 | 49 | _onVerticalSwipeComplete(Direction? direction) { 50 | if (direction == Direction.down) { 51 | Navigator.pop(context); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /lib/screens/contact/controllers/select_receiver_contacts_controller.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_contacts/contact.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | import '../repositories/select_receiver_contact_repository.dart'; 5 | 6 | final selectReceiverContactsControllerProvider = 7 | FutureProvider.family, BuildContext>( 8 | (ref, context) { 9 | final selectReceiverContactsRepository = 10 | ref.watch(selectReceiverContactsRepositoryProvider); 11 | return selectReceiverContactsRepository.getReceiverContacts(context); 12 | }, 13 | ); 14 | 15 | final selectReceiverContactControllerProvider = Provider( 16 | (ref) { 17 | final selectReceiverContactsRepository = 18 | ref.watch(selectReceiverContactsRepositoryProvider); 19 | return SelectReceiverContactController( 20 | repository: selectReceiverContactsRepository); 21 | }, 22 | ); 23 | 24 | class SelectReceiverContactController { 25 | SelectReceiverContactController({ 26 | required SelectReceiverContactsRepository repository, 27 | }) : _selectContactsRepository = repository; 28 | 29 | final SelectReceiverContactsRepository _selectContactsRepository; 30 | 31 | /// invoke to select specific user if it exists 32 | Future selectReceiverContact( 33 | bool mounted, 34 | BuildContext context, { 35 | required Contact contact, 36 | }) async { 37 | String number = contact.phones[0].number.replaceAll(' ', ''); 38 | return await _selectContactsRepository.selectReceiverContact( 39 | mounted, 40 | context, 41 | number: number, 42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/screens/status/controllers/status_controller.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | import '../../../models/status.dart'; 5 | import '../../../models/user.dart' as app; 6 | import '../../../utils/common/providers/current_user_provider.dart'; 7 | import '../repositories/status_repository.dart'; 8 | 9 | final statusControllerProvider = Provider( 10 | (ref) { 11 | return StatusController( 12 | statusRepository: ref.read(statusRepositoryProvider), 13 | ref: ref, 14 | ); 15 | }, 16 | ); 17 | 18 | class StatusController { 19 | final StatusRepository _statusRepository; 20 | final ProviderRef _ref; 21 | StatusController({ 22 | required StatusRepository statusRepository, 23 | required ProviderRef ref, 24 | }) : _statusRepository = statusRepository, 25 | _ref = ref; 26 | 27 | Future uploadStatus( 28 | BuildContext context, { 29 | required File currentUserStatusImage, 30 | }) async { 31 | if (currentUserProvider != null) { 32 | app.User user = _ref.read(currentUserProvider!); 33 | 34 | _statusRepository.uploadStatus( 35 | context, 36 | currentUsername: user.name, 37 | currentUserId: user.uid, 38 | currentUserProfilePic: user.profilePic ?? '', 39 | currentUserPhoneNumber: user.phoneNumber, 40 | currentUserStatusImage: currentUserStatusImage, 41 | ); 42 | } 43 | } 44 | 45 | Future> getStatuses(BuildContext context) { 46 | app.User currentUser = _ref.watch(currentUserProvider!); 47 | return _statusRepository.getStatuses(context, currentUser); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /lib/screens/chat/widgets/display_message.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter/material.dart'; 3 | import '../../../utils/common/enums/message_type.dart'; 4 | import '../../../utils/constants/colors_constants.dart'; 5 | import 'audio_player_item.dart'; 6 | import 'video_player_item.dart'; 7 | 8 | class DisplayMessage extends StatelessWidget { 9 | const DisplayMessage({ 10 | super.key, 11 | required this.message, 12 | required this.messageType, 13 | required this.isSender, 14 | }); 15 | final String message; 16 | final MessageType messageType; 17 | final bool isSender; 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | return getMessage(context); 22 | } 23 | 24 | Widget getMessage(BuildContext context) { 25 | switch (messageType) { 26 | case MessageType.text: 27 | return Text( 28 | textAlign: TextAlign.left, 29 | message, 30 | style: Theme.of(context).textTheme.labelMedium?.copyWith( 31 | color: isSender ? AppColors.white : AppColors.black, 32 | ), 33 | ); 34 | case MessageType.image: 35 | return CachedNetworkImage(imageUrl: message); 36 | case MessageType.audio: 37 | return AudioPlayerItem(audioUrl: message, isSender: isSender); 38 | case MessageType.gif: 39 | return CachedNetworkImage(imageUrl: message); 40 | case MessageType.video: 41 | return VideoPlayerItem(videoUrl: message); 42 | default: 43 | return Text( 44 | textAlign: TextAlign.left, 45 | message, 46 | style: Theme.of(context).textTheme.labelMedium?.copyWith( 47 | color: isSender ? AppColors.white : AppColors.black, 48 | ), 49 | ); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /.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: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 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: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 17 | base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 18 | - platform: android 19 | create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 20 | base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 21 | - platform: ios 22 | create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 23 | base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 24 | - platform: linux 25 | create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 26 | base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 27 | - platform: macos 28 | create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 29 | base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 30 | - platform: web 31 | create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 32 | base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 33 | - platform: windows 34 | create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 35 | base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 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 | -------------------------------------------------------------------------------- /windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Add preprocessor definitions for the build version. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") 25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") 26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") 27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") 28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") 29 | 30 | # Disable Windows macros that collide with C++ standard library functions. 31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 32 | 33 | # Add dependency libraries and include directories. Add any application-specific 34 | # dependencies here. 35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 36 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 37 | 38 | # Run the Flutter tool portions of the build. This must not be removed. 39 | add_dependencies(${BINARY_NAME} flutter_assemble) 40 | -------------------------------------------------------------------------------- /lib/screens/sender_info/controllers/sender_user_data_controller.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | import '../repositories/sender_user_data_repository.dart'; 5 | import '../../../models/user.dart' as app; 6 | 7 | /// provider to provide UserDataController instance 8 | final senderUserDataControllerProvider = 9 | Provider((ref) { 10 | final senderUserDataRepository = ref.watch(senderUserDataRepositoryProvider); 11 | return SenderUserDataController(senderUserDataRepository); 12 | }); 13 | 14 | /// future provider to provide User? instance 15 | final senderUserDataAuthProvider = FutureProvider( 16 | (ref) { 17 | final senderUserDataController = 18 | ref.watch(senderUserDataControllerProvider); 19 | return senderUserDataController.getSenderUserData(); 20 | }, 21 | ); 22 | 23 | class SenderUserDataController { 24 | SenderUserDataController(SenderUserDataRepository senderUserDataRepository) 25 | : _senderUserDataRepository = senderUserDataRepository; 26 | 27 | final SenderUserDataRepository _senderUserDataRepository; 28 | 29 | /// Invoke method to get current user data 30 | Future getSenderUserData() async { 31 | return await _senderUserDataRepository.getSenderUserData(); 32 | } 33 | 34 | /// invoke to save user data to Firebase. 35 | Future saveSenderUserDataToFirebase( 36 | BuildContext context, 37 | bool mounted, { 38 | required String userName, 39 | File? imageFile, 40 | }) async => 41 | await _senderUserDataRepository.saveSenderUserDataToFirebase( 42 | context, 43 | mounted, 44 | userName: userName, 45 | imageFile: imageFile, 46 | ); 47 | 48 | Future setSenderUserState(bool isOnline) async { 49 | _senderUserDataRepository.setSenderUserState(isOnline); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | I Chat Instant 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | i_chat_instant 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 | -------------------------------------------------------------------------------- /lib/screens/contact/widgets/contacts_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_contacts/contact.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | import '../controllers/select_receiver_contacts_controller.dart'; 5 | 6 | class ContactsList extends ConsumerStatefulWidget { 7 | const ContactsList({ 8 | super.key, 9 | required this.contactsList, 10 | }); 11 | 12 | final List contactsList; 13 | 14 | @override 15 | ConsumerState createState() => _ContactsListState(); 16 | } 17 | 18 | class _ContactsListState extends ConsumerState { 19 | @override 20 | Widget build(BuildContext context) { 21 | return ListView.builder( 22 | itemCount: widget.contactsList.length, 23 | itemBuilder: (context, index) => getListItem( 24 | widget.contactsList[index], 25 | ), 26 | ); 27 | } 28 | 29 | Widget getListItem(Contact contact) { 30 | String name = contact.displayName; 31 | return Column( 32 | mainAxisAlignment: MainAxisAlignment.start, 33 | mainAxisSize: MainAxisSize.min, 34 | crossAxisAlignment: CrossAxisAlignment.start, 35 | children: [ 36 | ListTile( 37 | onTap: () => _selectContact(contact), 38 | title: Text(name), 39 | leading: contact.photo == null 40 | ? null 41 | : CircleAvatar( 42 | backgroundImage: MemoryImage(contact.photo!), 43 | ), 44 | ), 45 | const Divider( 46 | indent: 50.0, 47 | endIndent: 50.0, 48 | height: 1.0, 49 | ), 50 | ], 51 | ); 52 | } 53 | 54 | void _selectContact(Contact contact) async { 55 | await ref 56 | .read(selectReceiverContactControllerProvider) 57 | .selectReceiverContact( 58 | mounted, 59 | context, 60 | contact: contact, 61 | ); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | std::string utf8_string; 52 | if (target_length == 0 || target_length > utf8_string.max_size()) { 53 | return utf8_string; 54 | } 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:firebase_core/firebase_core.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | import 'package:i_chat_instant/utils/common/providers/current_user_provider.dart'; 5 | import 'firebase_options.dart'; 6 | import 'router/router.dart'; 7 | import 'screens/sender_info/controllers/sender_user_data_controller.dart'; 8 | import 'utils/common/screens/error_screen.dart'; 9 | import 'screens/home/screens/home_screen.dart'; 10 | import 'screens/landing/screens/landing_screen.dart'; 11 | import 'utils/common/screens/loading_screen.dart'; 12 | import 'utils/constants/string_constants.dart'; 13 | import 'utils/constants/theme_constants.dart'; 14 | import './models/user.dart' as app; 15 | 16 | void main(List args) async { 17 | WidgetsFlutterBinding.ensureInitialized(); 18 | await Firebase.initializeApp( 19 | options: DefaultFirebaseOptions.currentPlatform, 20 | ); 21 | 22 | runApp( 23 | const ProviderScope( 24 | child: MyApp(), 25 | ), 26 | ); 27 | } 28 | 29 | class MyApp extends ConsumerWidget { 30 | const MyApp({Key? key}) : super(key: key); 31 | 32 | @override 33 | Widget build(BuildContext context, WidgetRef ref) { 34 | return MaterialApp( 35 | debugShowCheckedModeBanner: false, 36 | title: StringsConsts.appName, 37 | theme: appTheme, 38 | home: _getHomeWidget(ref), 39 | onGenerateRoute: AppRouter.onGenerateRoute, 40 | ); 41 | } 42 | 43 | Widget _getHomeWidget(WidgetRef ref) { 44 | return ref.watch(senderUserDataAuthProvider).when( 45 | data: (app.User? user) { 46 | if (user == null) return const LandingScreen(); 47 | currentUserProvider ??= Provider((ref) => user); 48 | return const HomeScreen(); 49 | }, 50 | error: (error, stackTrace) => ErrorScreen( 51 | error: error.toString(), 52 | ), 53 | loading: () => const LoadingScreen(), 54 | ); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /lib/models/message.dart: -------------------------------------------------------------------------------- 1 | import '../utils/common/enums/message_type.dart'; 2 | 3 | class Message { 4 | Message({ 5 | required this.senderUserId, 6 | required this.receiverUserId, 7 | required this.messageId, 8 | required this.isSeen, 9 | required this.lastMessage, 10 | required this.messageType, 11 | required this.time, 12 | required this.repliedMessage, 13 | required this.repliedTo, 14 | required this.repliedMessageType, 15 | }); 16 | 17 | final String senderUserId; 18 | final String receiverUserId; 19 | final String messageId; 20 | final bool isSeen; 21 | final String lastMessage; 22 | final MessageType messageType; 23 | final DateTime time; 24 | final String repliedMessage; 25 | final String repliedTo; 26 | final MessageType repliedMessageType; 27 | 28 | Map toMap() { 29 | return { 30 | 'senderUserId': senderUserId, 31 | 'receiverUserId': receiverUserId, 32 | 'messageId': messageId, 33 | 'isSeen': isSeen, 34 | 'lastMessage': lastMessage, 35 | 'messageType': messageType.type, 36 | 'time': time.millisecondsSinceEpoch, 37 | 'repliedMessage': repliedMessage, 38 | 'repliedTo': repliedTo, 39 | 'repliedMessageType': repliedMessageType.type, 40 | }; 41 | } 42 | 43 | factory Message.fromMap(Map map) { 44 | return Message( 45 | senderUserId: map['senderUserId'] as String, 46 | receiverUserId: map['receiverUserId'] as String, 47 | messageId: map['messageId'] as String, 48 | isSeen: map['isSeen'] as bool, 49 | lastMessage: map['lastMessage'] as String, 50 | messageType: (map['messageType'] as String).toEnum(), 51 | time: DateTime.fromMillisecondsSinceEpoch(map['time'] as int), 52 | repliedMessage: map['repliedMessage'] as String, 53 | repliedTo: map['repliedTo'] as String, 54 | repliedMessageType: (map['repliedMessageType'] as String).toEnum(), 55 | ); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | i_chat_instant 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /lib/utils/common/helper_methods/util_methods.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:giphy_picker/giphy_picker.dart'; 4 | import 'package:image_picker/image_picker.dart'; 5 | import '../../constants/string_constants.dart'; 6 | import '../enums/message_type.dart'; 7 | import '../widgets/helper_widgets.dart'; 8 | 9 | /// Invoke to pick image from gallery. 10 | Future pickImageFromGallery(BuildContext context) async { 11 | File? imageFile; 12 | 13 | try { 14 | XFile? xFile = await ImagePicker().pickImage( 15 | source: ImageSource.gallery, 16 | imageQuality: 80, 17 | ); 18 | 19 | if (xFile != null) { 20 | imageFile = File(xFile.path); 21 | } 22 | } catch (e) { 23 | showSnackBar(context, content: e.toString()); 24 | } 25 | 26 | return imageFile; 27 | } 28 | 29 | /// Invoke to pick video from gallery. 30 | Future pickVideoFromGallery(BuildContext context) async { 31 | File? videoFile; 32 | 33 | try { 34 | XFile? xFile = await ImagePicker().pickVideo( 35 | source: ImageSource.gallery, 36 | maxDuration: const Duration(minutes: 1), 37 | ); 38 | 39 | if (xFile != null) { 40 | videoFile = File(xFile.path); 41 | } 42 | } catch (e) { 43 | showSnackBar(context, content: e.toString()); 44 | } 45 | 46 | return videoFile; 47 | } 48 | 49 | /// Invoke to pick GIF. 50 | Future pickGIG(BuildContext context) async { 51 | GiphyGif? gif; 52 | try { 53 | gif = await GiphyPicker.pickGif( 54 | title: const Text('Pick GIF'), 55 | context: context, 56 | apiKey: StringsConsts.giphyApiKey, 57 | ); 58 | } catch (e) { 59 | showSnackBar(context, content: e.toString()); 60 | } 61 | return gif; 62 | } 63 | 64 | /// Invoke to get file type which you are going to send. 65 | String getFileType(MessageType messageType) { 66 | switch (messageType) { 67 | case MessageType.image: 68 | return '📷 Photo'; 69 | case MessageType.gif: 70 | return 'GIF'; 71 | case MessageType.audio: 72 | return '🎵 Audio'; 73 | case MessageType.video: 74 | return '📸 Video'; 75 | default: 76 | return 'GIF'; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /lib/screens/call/repositories/call_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | import '../../../models/call.dart'; 5 | import '../../../utils/common/providers/current_user_provider.dart'; 6 | import '../../../utils/constants/string_constants.dart'; 7 | import '../screens/call_screen.dart'; 8 | 9 | final callRepositoryProvider = Provider((ref) { 10 | return CallRepository(FirebaseFirestore.instance, ref); 11 | }); 12 | 13 | class CallRepository { 14 | CallRepository( 15 | FirebaseFirestore firestore, 16 | ProviderRef ref, 17 | ) : _firestore = firestore, 18 | _ref = ref; 19 | final FirebaseFirestore _firestore; 20 | final ProviderRef _ref; 21 | 22 | Stream get callDocsSnapshotsStream { 23 | return _firestore 24 | .collection(StringsConsts.callsCollection) 25 | .doc(_ref.read(currentUserProvider!).uid) 26 | .snapshots(); 27 | } 28 | 29 | Future createCall( 30 | BuildContext context, { 31 | required Call senderCall, 32 | required Call receiverCall, 33 | }) async { 34 | await _firestore 35 | .collection(StringsConsts.callsCollection) 36 | .doc(senderCall.callerId) 37 | .set(senderCall.toMap()); 38 | 39 | await _firestore 40 | .collection(StringsConsts.callsCollection) 41 | .doc(receiverCall.receiverId) 42 | .set(receiverCall.toMap()); 43 | 44 | // ignore: use_build_context_synchronously 45 | Navigator.push( 46 | context, 47 | MaterialPageRoute( 48 | builder: (_) => CallScreen( 49 | channelId: senderCall.callId, 50 | call: senderCall, 51 | isGroupChat: false, 52 | ), 53 | ), 54 | ); 55 | } 56 | 57 | Future endCall( 58 | BuildContext context, { 59 | required String callerId, 60 | required String receiverId, 61 | }) async { 62 | await _firestore 63 | .collection(StringsConsts.callsCollection) 64 | .doc(callerId) 65 | .delete(); 66 | 67 | await _firestore 68 | .collection(StringsConsts.callsCollection) 69 | .doc(receiverId) 70 | .delete(); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /lib/screens/status/screens/status_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:intl/intl.dart'; 4 | import '../../../models/status.dart'; 5 | import '../../../utils/common/widgets/loader.dart'; 6 | import '../../../utils/constants/routes_constants.dart'; 7 | import '../../chat/widgets/no_chat.dart'; 8 | import '../controllers/status_controller.dart'; 9 | 10 | class StatusScreen extends ConsumerWidget { 11 | const StatusScreen({Key? key}) : super(key: key); 12 | 13 | @override 14 | Widget build(BuildContext context, WidgetRef ref) { 15 | return FutureBuilder>( 16 | future: ref.watch(statusControllerProvider).getStatuses(context), 17 | builder: (context, snapshot) { 18 | if (!snapshot.hasData) { 19 | return const Loader(); 20 | } 21 | 22 | return snapshot.data!.isEmpty 23 | ? const NoChat() 24 | : ListView.builder( 25 | itemCount: snapshot.data!.length, 26 | itemBuilder: (context, index) { 27 | Status status = snapshot.data![index]; 28 | return _buildChatListItem(context, index, status); 29 | }, 30 | ); 31 | }, 32 | ); 33 | } 34 | 35 | Widget _buildChatListItem(BuildContext context, int index, Status status) { 36 | Size size = MediaQuery.of(context).size; 37 | 38 | return Padding( 39 | padding: const EdgeInsets.only(top: 8.0), 40 | child: ListTile( 41 | onTap: () { 42 | Navigator.pushNamed( 43 | context, 44 | AppRoutes.watchStatusScreen, 45 | arguments: status, 46 | ); 47 | }, 48 | title: Text( 49 | status.username, 50 | style: Theme.of(context).textTheme.bodyLarge?.copyWith( 51 | fontSize: size.width * 0.045, 52 | ), 53 | ), 54 | leading: CircleAvatar( 55 | radius: 30.0, 56 | backgroundImage: NetworkImage( 57 | status.profilePic!, 58 | ), 59 | ), 60 | trailing: Text( 61 | DateFormat.Hm().format(status.time), 62 | style: Theme.of(context).textTheme.bodySmall?.copyWith( 63 | fontSize: size.width * 0.030, 64 | ), 65 | ), 66 | ), 67 | ); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /lib/screens/chat/widgets/video_player_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:video_player/video_player.dart'; 4 | import '../../../utils/constants/colors_constants.dart'; 5 | 6 | class VideoPlayerItem extends ConsumerStatefulWidget { 7 | const VideoPlayerItem({ 8 | Key? key, 9 | required this.videoUrl, 10 | }) : super(key: key); 11 | 12 | final String videoUrl; 13 | 14 | @override 15 | ConsumerState createState() => 16 | _VideoPlayerItemState(); 17 | } 18 | 19 | class _VideoPlayerItemState extends ConsumerState { 20 | late final VideoPlayerController _videoPlayerController; 21 | bool isPlaying = false; 22 | 23 | @override 24 | void initState() { 25 | super.initState(); 26 | _videoPlayerController = VideoPlayerController.network(widget.videoUrl) 27 | ..initialize().then((_) { 28 | _videoPlayerController.setVolume(1.0); 29 | }); 30 | } 31 | 32 | @override 33 | void dispose() { 34 | _videoPlayerController.dispose(); 35 | super.dispose(); 36 | } 37 | 38 | @override 39 | Widget build(BuildContext context) { 40 | return AspectRatio( 41 | aspectRatio: 16 / 9, 42 | child: Stack( 43 | children: [ 44 | VideoPlayer(_videoPlayerController), 45 | Align( 46 | alignment: Alignment.center, 47 | child: IconButton( 48 | onPressed: () { 49 | if (isPlaying) { 50 | _videoPlayerController.pause(); 51 | } else { 52 | _videoPlayerController.play(); 53 | } 54 | setState(() { 55 | isPlaying = !isPlaying; 56 | }); 57 | }, 58 | icon: isPlaying 59 | ? const Opacity( 60 | opacity: 0.6, 61 | child: Icon( 62 | Icons.pause_circle, 63 | color: AppColors.white, 64 | size: 36.0, 65 | ), 66 | ) 67 | : const Icon( 68 | Icons.play_circle, 69 | color: AppColors.white, 70 | size: 36.0, 71 | ), 72 | ), 73 | ) 74 | ], 75 | ), 76 | ); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /lib/screens/chat/widgets/reply_message_preview.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import '../../../utils/common/providers/reply_message_provider.dart'; 4 | import '../../../utils/common/widgets/helper_widgets.dart'; 5 | import '../../../utils/constants/colors_constants.dart'; 6 | import 'display_message.dart'; 7 | 8 | class ReplyMessagePreview extends ConsumerWidget { 9 | const ReplyMessagePreview({Key? key}) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context, WidgetRef ref) { 13 | ReplyMessage? replyMessage = ref.read(replyMessageProvider); 14 | return Container( 15 | width: double.infinity, 16 | padding: const EdgeInsets.all(8.0), 17 | decoration: BoxDecoration( 18 | color: replyMessage!.isMe ? AppColors.primary : AppColors.white, 19 | borderRadius: const BorderRadius.only( 20 | topLeft: Radius.circular(8.0), 21 | topRight: Radius.circular(8.0), 22 | ), 23 | ), 24 | child: Column( 25 | crossAxisAlignment: CrossAxisAlignment.start, 26 | children: [ 27 | Row( 28 | mainAxisAlignment: MainAxisAlignment.start, 29 | crossAxisAlignment: CrossAxisAlignment.center, 30 | children: [ 31 | Expanded( 32 | child: Text( 33 | replyMessage.isMe ? 'Me' : 'Opposite', 34 | style: replyMessage.isMe 35 | ? Theme.of(context).textTheme.headlineSmall 36 | : Theme.of(context) 37 | .textTheme 38 | .headlineSmall! 39 | .copyWith(color: AppColors.black), 40 | ), 41 | ), 42 | IconButton( 43 | onPressed: () => _cancelReply(ref), 44 | icon: Icon( 45 | Icons.close, 46 | color: replyMessage.isMe ? AppColors.white : AppColors.black, 47 | ), 48 | ) 49 | ], 50 | ), 51 | addVerticalSpace(8.0), 52 | DisplayMessage( 53 | message: replyMessage.message, 54 | messageType: replyMessage.messageType, 55 | isSender: replyMessage.isMe, 56 | ), 57 | ], 58 | ), 59 | ); 60 | } 61 | 62 | void _cancelReply(WidgetRef ref) { 63 | ref.read(replyMessageProvider.state).state = null; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/utils/constants/theme_constants.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:google_fonts/google_fonts.dart'; 3 | import 'colors_constants.dart'; 4 | 5 | final ThemeData appTheme = ThemeData( 6 | brightness: Brightness.light, 7 | primaryColor: AppColors.white, 8 | scaffoldBackgroundColor: AppColors.scaffoldBG, 9 | appBarTheme: _getAppBarTheme(), 10 | colorScheme: _getCustomColorScheme(), 11 | textTheme: GoogleFonts.poppinsTextTheme( 12 | _getTextTheme(), 13 | ), 14 | ); 15 | 16 | AppBarTheme _getAppBarTheme() { 17 | return AppBarTheme( 18 | backgroundColor: AppColors.appBar, 19 | titleTextStyle: GoogleFonts.poppins( 20 | color: AppColors.appBarTitle, 21 | fontSize: 20.0, 22 | ), 23 | iconTheme: const IconThemeData(color: AppColors.white), 24 | actionsIconTheme: const IconThemeData(color: AppColors.white), 25 | ); 26 | } 27 | 28 | TextTheme _getTextTheme() { 29 | return TextTheme( 30 | headlineSmall: GoogleFonts.poppins( 31 | color: AppColors.white, 32 | fontSize: 16.0, 33 | fontWeight: FontWeight.w600, 34 | ), 35 | headlineLarge: GoogleFonts.poppins( 36 | color: AppColors.black, 37 | fontSize: 22.0, 38 | fontWeight: FontWeight.w600, 39 | ), 40 | bodyLarge: GoogleFonts.poppins( 41 | color: AppColors.black, 42 | fontSize: 14.0, 43 | fontWeight: FontWeight.w500, 44 | ), 45 | bodyMedium: GoogleFonts.poppins( 46 | color: AppColors.lightBlack, 47 | fontSize: 14.0, 48 | fontWeight: FontWeight.normal, 49 | ), 50 | bodySmall: GoogleFonts.poppins( 51 | color: AppColors.lightBlack, 52 | fontSize: 10.0, 53 | fontWeight: FontWeight.normal, 54 | ), 55 | labelMedium: GoogleFonts.poppins( 56 | color: AppColors.white, 57 | fontSize: 14.0, 58 | fontWeight: FontWeight.w400, 59 | ), 60 | labelSmall: GoogleFonts.poppins( 61 | color: AppColors.chatOffWhite, 62 | fontSize: 12.0, 63 | fontWeight: FontWeight.w400, 64 | ), 65 | displaySmall: GoogleFonts.poppins( 66 | color: AppColors.white, 67 | fontSize: 12.0, 68 | fontWeight: FontWeight.w500, 69 | ), 70 | ); 71 | } 72 | 73 | ColorScheme _getCustomColorScheme() { 74 | return const ColorScheme.light( 75 | primary: AppColors.primary, 76 | onPrimary: AppColors.primary, 77 | onError: AppColors.onError, 78 | background: AppColors.primary, 79 | secondary: AppColors.secondary, 80 | onSecondary: AppColors.onSecondary, 81 | ); 82 | } 83 | -------------------------------------------------------------------------------- /lib/screens/call/controllers/call_controller.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | import 'package:uuid/uuid.dart'; 5 | import '../../../models/call.dart'; 6 | import '../../../models/user.dart' as app; 7 | import '../../../utils/common/providers/current_user_provider.dart'; 8 | import '../repositories/call_repository.dart'; 9 | 10 | final callControllerProvider = Provider( 11 | (ref) { 12 | return CallController( 13 | callRepository: ref.read(callRepositoryProvider), 14 | ref: ref, 15 | ); 16 | }, 17 | ); 18 | 19 | class CallController { 20 | CallController({ 21 | required CallRepository callRepository, 22 | required ProviderRef ref, 23 | }) : _callRepository = callRepository, 24 | _ref = ref; 25 | 26 | final CallRepository _callRepository; 27 | final ProviderRef _ref; 28 | 29 | Stream get callDocsSnapshotsStream { 30 | return _callRepository.callDocsSnapshotsStream; 31 | } 32 | 33 | Future createCall( 34 | bool mounted, 35 | BuildContext context, { 36 | required String receiverName, 37 | required String receiverId, 38 | required String receiverProfilePic, 39 | required bool isGroupChat, 40 | }) async { 41 | final String callId = const Uuid().v1(); 42 | app.User user = _ref.read(currentUserProvider!); 43 | 44 | final Call senderCall = Call( 45 | callerId: user.uid, 46 | callerName: user.name, 47 | callerPic: user.profilePic!, 48 | receiverId: receiverId, 49 | receiverName: receiverName, 50 | receiverPic: receiverProfilePic, 51 | callId: callId, 52 | hasDialled: true, 53 | ); 54 | 55 | final Call receiverCall = Call( 56 | callerId: user.uid, 57 | callerName: user.name, 58 | callerPic: user.profilePic!, 59 | receiverId: receiverId, 60 | receiverName: receiverName, 61 | receiverPic: receiverProfilePic, 62 | callId: callId, 63 | hasDialled: false, 64 | ); 65 | 66 | _callRepository.createCall( 67 | context, 68 | senderCall: senderCall, 69 | receiverCall: receiverCall, 70 | ); 71 | } 72 | 73 | Future endCall( 74 | BuildContext context, { 75 | required String callerId, 76 | required String receiverId, 77 | }) async { 78 | _callRepository.endCall( 79 | context, 80 | callerId: callerId, 81 | receiverId: receiverId, 82 | ); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /lib/screens/call/screens/call_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import '../../../models/call.dart'; 4 | import '../../../utils/common/widgets/loader.dart'; 5 | 6 | class CallScreen extends ConsumerStatefulWidget { 7 | const CallScreen({ 8 | required this.channelId, 9 | required this.call, 10 | required this.isGroupChat, 11 | Key? key, 12 | }) : super(key: key); 13 | final String channelId; 14 | final Call call; 15 | final bool isGroupChat; 16 | 17 | @override 18 | ConsumerState createState() => _CallScreenState(); 19 | } 20 | 21 | class _CallScreenState extends ConsumerState { 22 | // AgoraClient? client; 23 | 24 | @override 25 | void initState() { 26 | super.initState(); 27 | 28 | /* client = AgoraClient( 29 | agoraConnectionData: AgoraConnectionData( 30 | appId: AgoraConfig.appId, 31 | channelName: widget.channelId, 32 | tokenUrl: AgoraConfig.tokenBaseUrl, 33 | ), 34 | );*/ 35 | 36 | initAgora(); 37 | } 38 | 39 | @override 40 | Widget build(BuildContext context) { 41 | return const Scaffold( 42 | body: Loader(), 43 | /*body: client == null 44 | ? const Loader() 45 | : SafeArea( 46 | child: Stack( 47 | children: [ 48 | AgoraVideoViewer(client: client!), 49 | AgoraVideoButtons( 50 | client: client!, 51 | disconnectButtonChild: IconButton( 52 | color: AppColors.white, 53 | iconSize: 56.0, 54 | onPressed: () async { 55 | await client!.engine.leaveChannel(); 56 | if (!mounted) return; 57 | ref.read(callControllerProvider).endCall( 58 | context, 59 | callerId: widget.call.callerId, 60 | receiverId: widget.call.receiverId, 61 | ); 62 | Navigator.pop(context); 63 | }, 64 | icon: const Icon( 65 | Icons.call_end, 66 | color: AppColors.red, 67 | ), 68 | ), 69 | ), 70 | ], 71 | ), 72 | ),*/ 73 | ); 74 | } 75 | 76 | void initAgora() async { 77 | // await client!.initialize(); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /lib/screens/contact/repositories/select_receiver_contact_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_contacts/flutter_contacts.dart'; 4 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 5 | import '../../../models/user.dart' as app; 6 | import '../../../utils/common/widgets/helper_widgets.dart'; 7 | import '../../../utils/constants/routes_constants.dart'; 8 | import '../../../utils/constants/string_constants.dart'; 9 | 10 | final selectReceiverContactsRepositoryProvider = Provider( 11 | (ref) => SelectReceiverContactsRepository(FirebaseFirestore.instance), 12 | ); 13 | 14 | class SelectReceiverContactsRepository { 15 | SelectReceiverContactsRepository(FirebaseFirestore firestore) 16 | : _firestore = firestore; 17 | 18 | final FirebaseFirestore _firestore; 19 | 20 | /// invoke to Get all contacts (fully fetched) 21 | Future> getReceiverContacts(BuildContext context) async { 22 | List contactsList = []; 23 | try { 24 | if (await FlutterContacts.requestPermission()) { 25 | contactsList = await FlutterContacts.getContacts( 26 | withPhoto: true, 27 | withProperties: true, 28 | ); 29 | } 30 | } catch (e) { 31 | showSnackBar(context, content: e.toString()); 32 | } 33 | 34 | return contactsList; 35 | } 36 | 37 | /// invoke to select specific user if it exists 38 | Future selectReceiverContact( 39 | bool mounted, 40 | BuildContext context, { 41 | required String number, 42 | }) async { 43 | bool isFound = false; 44 | final userCollection = 45 | await _firestore.collection(StringsConsts.usersCollection).get(); 46 | 47 | for (var document in userCollection.docs) { 48 | app.User receiverUser = app.User.fromMap(document.data()); 49 | 50 | if (number == receiverUser.phoneNumber) { 51 | isFound = true; 52 | 53 | if (!mounted) return; 54 | Navigator.pushReplacementNamed( 55 | context, 56 | AppRoutes.chatScreen, 57 | arguments: { 58 | StringsConsts.username: receiverUser.name, 59 | StringsConsts.userId: receiverUser.uid, 60 | StringsConsts.profilePic: receiverUser.profilePic!, 61 | StringsConsts.isGroupChat: false, 62 | }, 63 | ); 64 | } 65 | } 66 | 67 | if (!isFound) { 68 | if (!mounted) return; 69 | showSnackBar(context, content: "User doesn't exist in this app"); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /lib/screens/landing/screens/landing_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../../../utils/common/widgets/round_button.dart'; 3 | import '../../../utils/constants/assets_constants.dart'; 4 | import '../../../utils/common/widgets/helper_widgets.dart'; 5 | import '../../../utils/constants/colors_constants.dart'; 6 | import '../../../utils/constants/routes_constants.dart'; 7 | 8 | class LandingScreen extends StatelessWidget { 9 | const LandingScreen({super.key}); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | Size size = MediaQuery.of(context).size; 14 | return Scaffold( 15 | body: SafeArea( 16 | child: SizedBox( 17 | width: size.width, 18 | child: Column( 19 | crossAxisAlignment: CrossAxisAlignment.center, 20 | children: [ 21 | addVerticalSpace(size.height * 0.05), 22 | _buildTitle(context, size), 23 | _buildSubTitle(context, size), 24 | const Expanded(child: SizedBox()), 25 | _buildHeroImage(size), 26 | const Expanded(child: SizedBox()), 27 | RoundButton( 28 | text: 'Get Started', 29 | onPressed: () { 30 | Navigator.pushNamed( 31 | context, 32 | AppRoutes.phoneLoginScreen, 33 | ); 34 | }, 35 | ) 36 | ], 37 | ), 38 | ), 39 | ), 40 | ); 41 | } 42 | 43 | Widget _buildHeroImage(Size size) { 44 | return Container( 45 | padding: EdgeInsets.symmetric(horizontal: size.width * 0.1), 46 | child: Image.asset( 47 | ImagesConsts.icLanding2, 48 | width: size.width * 0.9, 49 | height: size.width * 0.9, 50 | fit: BoxFit.cover, 51 | ), 52 | ); 53 | } 54 | 55 | Widget _buildTitle(BuildContext context, Size size) { 56 | return Text( 57 | 'Welcome To LetsChat', 58 | style: Theme.of(context).textTheme.headlineLarge?.copyWith( 59 | fontSize: size.width * 0.08, 60 | ), 61 | ); 62 | } 63 | 64 | Widget _buildSubTitle(BuildContext context, Size size) { 65 | return Padding( 66 | padding: const EdgeInsets.symmetric(horizontal: 8.0), 67 | child: Text( 68 | 'Easy and free you can get all features here.', 69 | style: Theme.of(context).textTheme.headlineSmall?.copyWith( 70 | fontSize: size.width * 0.04, 71 | color: AppColors.grey, 72 | fontWeight: FontWeight.normal, 73 | ), 74 | ), 75 | ); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /lib/screens/chat/widgets/chats_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:intl/intl.dart'; 4 | import '../../../models/chat.dart'; 5 | import '../controllers/chat_controller.dart'; 6 | import 'no_chat.dart'; 7 | import '../../../utils/common/widgets/loader.dart'; 8 | import '../../../utils/constants/routes_constants.dart'; 9 | import '../../../utils/constants/string_constants.dart'; 10 | 11 | class ChatsList extends ConsumerWidget { 12 | const ChatsList({super.key}); 13 | 14 | @override 15 | Widget build(BuildContext context, WidgetRef ref) { 16 | return StreamBuilder>( 17 | stream: ref.watch(chatControllerProvider).getChatsList(), 18 | builder: (context, snapshot) { 19 | if (!snapshot.hasData) { 20 | return const Loader(); 21 | } 22 | return snapshot.data!.isEmpty 23 | ? const NoChat() 24 | : ListView.builder( 25 | itemCount: snapshot.data!.length, 26 | itemBuilder: (context, index) { 27 | Chat chat = snapshot.data![index]; 28 | return _buildChatListItem(context, index, chat); 29 | }, 30 | ); 31 | }, 32 | ); 33 | } 34 | 35 | Widget _buildChatListItem(BuildContext context, int index, Chat chat) { 36 | Size size = MediaQuery.of(context).size; 37 | 38 | return ListTile( 39 | onTap: () => Navigator.pushNamed( 40 | context, 41 | AppRoutes.chatScreen, 42 | arguments: { 43 | StringsConsts.username: chat.name, 44 | StringsConsts.userId: chat.userId, 45 | StringsConsts.profilePic: chat.profilePic, 46 | StringsConsts.isGroupChat: false, 47 | }, 48 | ), 49 | title: Text( 50 | chat.name, 51 | style: Theme.of(context).textTheme.bodyLarge?.copyWith( 52 | fontSize: size.width * 0.045, 53 | ), 54 | ), 55 | subtitle: Text( 56 | chat.lastMessage, 57 | maxLines: 1, 58 | style: Theme.of(context).textTheme.bodyMedium?.copyWith( 59 | fontSize: size.width * 0.035, 60 | ), 61 | ), 62 | leading: CircleAvatar( 63 | radius: 30.0, 64 | backgroundImage: NetworkImage( 65 | chat.profilePic, 66 | ), 67 | ), 68 | trailing: Text( 69 | DateFormat.Hm().format(chat.time), 70 | style: Theme.of(context).textTheme.bodySmall?.copyWith( 71 | fontSize: size.width * 0.030, 72 | ), 73 | ), 74 | ); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /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 | // START: FlutterFire Configuration 26 | apply plugin: 'com.google.gms.google-services' 27 | // END: FlutterFire Configuration 28 | apply plugin: 'kotlin-android' 29 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 30 | 31 | android { 32 | compileSdkVersion 33 33 | ndkVersion flutter.ndkVersion 34 | 35 | compileOptions { 36 | sourceCompatibility JavaVersion.VERSION_1_8 37 | targetCompatibility JavaVersion.VERSION_1_8 38 | } 39 | 40 | kotlinOptions { 41 | jvmTarget = '1.8' 42 | } 43 | 44 | sourceSets { 45 | main.java.srcDirs += 'src/main/kotlin' 46 | } 47 | 48 | defaultConfig { 49 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 50 | applicationId "com.usamamuzaffar.i_chat_instant" 51 | // You can update the following values to match your application needs. 52 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. 53 | minSdkVersion 21 54 | targetSdkVersion flutter.targetSdkVersion 55 | versionCode flutterVersionCode.toInteger() 56 | versionName flutterVersionName 57 | } 58 | 59 | buildTypes { 60 | release { 61 | // TODO: Add your own signing config for the release build. 62 | // Signing with the debug keys for now, so `flutter run --release` works. 63 | signingConfig signingConfigs.debug 64 | } 65 | } 66 | } 67 | 68 | flutter { 69 | source '../..' 70 | } 71 | 72 | dependencies { 73 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 74 | // Import the BoM for the Firebase platform 75 | implementation platform('com.google.firebase:firebase-bom:31.1.1') 76 | 77 | // Add the dependency for the Firebase Authentication library 78 | // When using the BoM, you don't specify versions in Firebase library dependencies 79 | implementation 'com.google.firebase:firebase-auth' 80 | } 81 | -------------------------------------------------------------------------------- /lib/firebase_options.dart: -------------------------------------------------------------------------------- 1 | // File generated by FlutterFire CLI. 2 | // ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members 3 | import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; 4 | import 'package:flutter/foundation.dart' 5 | show defaultTargetPlatform, kIsWeb, TargetPlatform; 6 | 7 | /// Default [FirebaseOptions] for use with your Firebase apps. 8 | /// 9 | /// Example: 10 | /// ```dart 11 | /// import 'firebase_options.dart'; 12 | /// // ... 13 | /// await Firebase.initializeApp( 14 | /// options: DefaultFirebaseOptions.currentPlatform, 15 | /// ); 16 | /// ``` 17 | class DefaultFirebaseOptions { 18 | static FirebaseOptions get currentPlatform { 19 | if (kIsWeb) { 20 | throw UnsupportedError( 21 | 'DefaultFirebaseOptions have not been configured for web - ' 22 | 'you can reconfigure this by running the FlutterFire CLI again.', 23 | ); 24 | } 25 | switch (defaultTargetPlatform) { 26 | case TargetPlatform.android: 27 | return android; 28 | case TargetPlatform.iOS: 29 | return ios; 30 | case TargetPlatform.macOS: 31 | throw UnsupportedError( 32 | 'DefaultFirebaseOptions have not been configured for macos - ' 33 | 'you can reconfigure this by running the FlutterFire CLI again.', 34 | ); 35 | case TargetPlatform.windows: 36 | throw UnsupportedError( 37 | 'DefaultFirebaseOptions have not been configured for windows - ' 38 | 'you can reconfigure this by running the FlutterFire CLI again.', 39 | ); 40 | case TargetPlatform.linux: 41 | throw UnsupportedError( 42 | 'DefaultFirebaseOptions have not been configured for linux - ' 43 | 'you can reconfigure this by running the FlutterFire CLI again.', 44 | ); 45 | default: 46 | throw UnsupportedError( 47 | 'DefaultFirebaseOptions are not supported for this platform.', 48 | ); 49 | } 50 | } 51 | 52 | static const FirebaseOptions android = FirebaseOptions( 53 | apiKey: 'AIzaSyAdYzXavjDY5cvWsmwdIpleA6Xps0B6XnA', 54 | appId: '1:278875593512:android:45e1a5a2c65d16f18e8e1d', 55 | messagingSenderId: '278875593512', 56 | projectId: 'i-chat-instant', 57 | databaseURL: 'https://i-chat-instant-default-rtdb.firebaseio.com', 58 | storageBucket: 'i-chat-instant.appspot.com', 59 | ); 60 | 61 | static const FirebaseOptions ios = FirebaseOptions( 62 | apiKey: 'AIzaSyDuzWvQgS_Tlig1USupOKFDwhfWMR1FVP8', 63 | appId: '1:278875593512:ios:7cb48fdbc6e0ec228e8e1d', 64 | messagingSenderId: '278875593512', 65 | projectId: 'i-chat-instant', 66 | databaseURL: 'https://i-chat-instant-default-rtdb.firebaseio.com', 67 | storageBucket: 'i-chat-instant.appspot.com', 68 | iosClientId: '278875593512-lgd78flp7kjmof9e2kb0ur460d7d6n9o.apps.googleusercontent.com', 69 | iosBundleId: 'com.usamamuzaffar.iChatInstant', 70 | ); 71 | } 72 | -------------------------------------------------------------------------------- /lib/screens/home/widgets/home_fab.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:flutter/material.dart'; 3 | import '../../../utils/common/helper_methods/util_methods.dart'; 4 | import '../../../utils/common/widgets/helper_widgets.dart'; 5 | import '../../../utils/constants/colors_constants.dart'; 6 | import '../../../utils/constants/routes_constants.dart'; 7 | 8 | class HomeFAB extends StatefulWidget { 9 | const HomeFAB({ 10 | Key? key, 11 | required this.tabController, 12 | }) : super(key: key); 13 | 14 | final TabController tabController; 15 | 16 | @override 17 | State createState() => _HomeFABState(); 18 | } 19 | 20 | class _HomeFABState extends State { 21 | @override 22 | void initState() { 23 | super.initState(); 24 | widget.tabController.addListener( 25 | () { 26 | setState(() { 27 | widget.tabController.indexIsChanging; 28 | }); 29 | }, 30 | ); 31 | } 32 | 33 | @override 34 | Widget build(BuildContext context) { 35 | return Column( 36 | mainAxisSize: MainAxisSize.min, 37 | crossAxisAlignment: CrossAxisAlignment.center, 38 | children: [ 39 | widget.tabController.index == 0 40 | ? GestureDetector( 41 | onTap: () { 42 | Navigator.pushNamed(context, AppRoutes.groupChatsScreen); 43 | }, 44 | child: const CircleAvatar( 45 | radius: 24.0, 46 | backgroundColor: AppColors.primary, 47 | child: Icon( 48 | Icons.group, 49 | color: AppColors.white, 50 | ), 51 | ), 52 | ) 53 | : const SizedBox(), 54 | addVerticalSpace(16.0), 55 | FloatingActionButton( 56 | onPressed: () { 57 | switch (widget.tabController.index) { 58 | case 0: 59 | Navigator.pushNamed(context, AppRoutes.selectContactScreen); 60 | break; 61 | case 1: 62 | _selectAndConfirmImage(); 63 | break; 64 | case 2: 65 | break; 66 | default: 67 | Navigator.pushNamed(context, AppRoutes.errorScreen); 68 | } 69 | }, 70 | child: Icon( 71 | widget.tabController.index == 0 72 | ? Icons.chat_rounded 73 | : widget.tabController.index == 1 74 | ? Icons.image 75 | : Icons.call, 76 | ), 77 | ), 78 | ], 79 | ); 80 | } 81 | 82 | void _selectAndConfirmImage() async { 83 | File? imageFile = await pickImageFromGallery(context); 84 | if (imageFile != null) { 85 | if (!mounted) return; 86 | Navigator.pushNamed( 87 | context, 88 | AppRoutes.confirmStatusScreen, 89 | arguments: imageFile, 90 | ); 91 | } else { 92 | if (!mounted) return; 93 | showSnackBar(context, content: 'Image not selected'); 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /lib/screens/auth/repositories/auth_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | import 'package:firebase_auth/firebase_auth.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:i_chat_instant/utils/common/widgets/helper_widgets.dart'; 5 | import '../../../models/user.dart' as app; 6 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 7 | import '../../../utils/constants/routes_constants.dart'; 8 | import '../../../utils/constants/string_constants.dart'; 9 | 10 | /// provider to get AuthRepository. 11 | final authRepositoryProvider = Provider( 12 | (ref) => AuthRepository(FirebaseAuth.instance, FirebaseFirestore.instance), 13 | ); 14 | 15 | class AuthRepository { 16 | AuthRepository(FirebaseAuth auth, FirebaseFirestore firestore) 17 | : _auth = auth, 18 | _firestore = firestore; 19 | 20 | final FirebaseAuth _auth; 21 | final FirebaseFirestore _firestore; 22 | 23 | /// Invoke to signIn user with phone number. 24 | Future signInWithPhone( 25 | BuildContext context, { 26 | required String phoneNumber, 27 | }) async { 28 | try { 29 | await _auth.verifyPhoneNumber( 30 | phoneNumber: phoneNumber, 31 | verificationCompleted: (_) {}, 32 | verificationFailed: (FirebaseAuthException error) { 33 | throw Exception(error.message); 34 | }, 35 | codeSent: (String verificationId, int? forceResendingToken) { 36 | Navigator.pushNamed( 37 | context, 38 | AppRoutes.otpScreen, 39 | arguments: verificationId, 40 | ); 41 | }, 42 | codeAutoRetrievalTimeout: (_) {}, 43 | ); 44 | } on FirebaseAuthException catch (e) { 45 | showSnackBar(context, content: e.message!); 46 | } 47 | } 48 | 49 | /// Invoke to verify otp. 50 | Future verifyOTP( 51 | BuildContext context, 52 | bool mounted, { 53 | required String verificationId, 54 | required String smsCode, 55 | }) async { 56 | try { 57 | PhoneAuthCredential credential = PhoneAuthProvider.credential( 58 | verificationId: verificationId, 59 | smsCode: smsCode, 60 | ); 61 | 62 | UserCredential userCredential = 63 | await _auth.signInWithCredential(credential); 64 | 65 | if (userCredential.user != null) { 66 | if (!mounted) return; 67 | Navigator.pushNamedAndRemoveUntil( 68 | context, 69 | AppRoutes.userInformationScreen, 70 | (route) => false, 71 | ); 72 | } else { 73 | throw Exception('Something went wrong'); 74 | } 75 | } on FirebaseAuthException catch (e) { 76 | showSnackBar(context, content: e.message!); 77 | } 78 | } 79 | 80 | /// invoke to get user data form firestore. 81 | Stream getReceiverUserData(String receiverUserId) { 82 | return _firestore 83 | .collection(StringsConsts.usersCollection) 84 | .doc(receiverUserId) 85 | .snapshots() 86 | .map( 87 | (snapshot) => app.User.fromMap(snapshot.data()!), 88 | ); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.10) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | 12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 13 | # which isn't available in 3.10. 14 | function(list_prepend LIST_NAME PREFIX) 15 | set(NEW_LIST "") 16 | foreach(element ${${LIST_NAME}}) 17 | list(APPEND NEW_LIST "${PREFIX}${element}") 18 | endforeach(element) 19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 20 | endfunction() 21 | 22 | # === Flutter Library === 23 | # System-level dependencies. 24 | find_package(PkgConfig REQUIRED) 25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 28 | 29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 30 | 31 | # Published to parent scope for install step. 32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 36 | 37 | list(APPEND FLUTTER_LIBRARY_HEADERS 38 | "fl_basic_message_channel.h" 39 | "fl_binary_codec.h" 40 | "fl_binary_messenger.h" 41 | "fl_dart_project.h" 42 | "fl_engine.h" 43 | "fl_json_message_codec.h" 44 | "fl_json_method_codec.h" 45 | "fl_message_codec.h" 46 | "fl_method_call.h" 47 | "fl_method_channel.h" 48 | "fl_method_codec.h" 49 | "fl_method_response.h" 50 | "fl_plugin_registrar.h" 51 | "fl_plugin_registry.h" 52 | "fl_standard_message_codec.h" 53 | "fl_standard_method_codec.h" 54 | "fl_string_codec.h" 55 | "fl_value.h" 56 | "fl_view.h" 57 | "flutter_linux.h" 58 | ) 59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 60 | add_library(flutter INTERFACE) 61 | target_include_directories(flutter INTERFACE 62 | "${EPHEMERAL_DIR}" 63 | ) 64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 65 | target_link_libraries(flutter INTERFACE 66 | PkgConfig::GTK 67 | PkgConfig::GLIB 68 | PkgConfig::GIO 69 | ) 70 | add_dependencies(flutter flutter_assemble) 71 | 72 | # === Flutter tool backend === 73 | # _phony_ is a non-existent file to force this command to run every time, 74 | # since currently there's no way to get a full input/output list from the 75 | # flutter tool. 76 | add_custom_command( 77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 79 | COMMAND ${CMAKE_COMMAND} -E env 80 | ${FLUTTER_TOOL_ENVIRONMENT} 81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 83 | VERBATIM 84 | ) 85 | add_custom_target(flutter_assemble DEPENDS 86 | "${FLUTTER_LIBRARY}" 87 | ${FLUTTER_LIBRARY_HEADERS} 88 | ) 89 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/screens/group/repositories/group_repository.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:cloud_firestore/cloud_firestore.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:uuid/uuid.dart'; 5 | import '../../../models/group.dart'; 6 | import '../../../models/user.dart' as app; 7 | import 'package:flutter_contacts/contact.dart'; 8 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 9 | import '../../../utils/common/repositories/firebase_storage_repository.dart'; 10 | import '../../../utils/common/widgets/helper_widgets.dart'; 11 | import '../../../utils/constants/string_constants.dart'; 12 | 13 | final groupRepositoryProvider = Provider((ref) { 14 | return GroupRepository(FirebaseFirestore.instance, ref); 15 | }); 16 | 17 | class GroupRepository { 18 | GroupRepository(FirebaseFirestore firestore, ProviderRef ref) 19 | : _firestore = firestore, 20 | _ref = ref; 21 | final FirebaseFirestore _firestore; 22 | final ProviderRef _ref; 23 | 24 | Future createGroup( 25 | bool mounted, 26 | BuildContext context, { 27 | required String currentUserId, 28 | required String groupName, 29 | required File? groupProfilePic, 30 | required List selectedContacts, 31 | }) async { 32 | try { 33 | List uIds = []; 34 | String groupId = const Uuid().v1(); 35 | 36 | // getting list of users from firestore 37 | final querySnapshot = 38 | await _firestore.collection(StringsConsts.usersCollection).get(); 39 | // loop to got (doc) snapshots from querySnapshots 40 | for (var snapshot in querySnapshot.docs) { 41 | app.User user = app.User.fromMap(snapshot.data()); 42 | 43 | // loop to compare selectedContacts number with firebase users 44 | // to check if the selected users exists in our app 45 | for (var contact in selectedContacts) { 46 | String number; 47 | try { 48 | number = contact.phones[0].number.replaceAll(' ', ''); 49 | } catch (e) { 50 | number = '+12345667'; 51 | } 52 | 53 | if (user.phoneNumber == number) { 54 | uIds.add(user.uid); 55 | } 56 | } 57 | } 58 | 59 | // uploading our groupProfilePic to firebase storage and get url 60 | if (!mounted) return; 61 | String groupProfilePicUrl = await _ref 62 | .read(firebaseStorageRepositoryProvider) 63 | .storeFileToFirebaseStorage( 64 | context, 65 | file: groupProfilePic!, 66 | path: 'groups', 67 | fileName: groupId, 68 | ); 69 | 70 | // creating group instance 71 | final Group group = Group( 72 | groupName: groupName, 73 | groupId: groupId, 74 | groupProfilePic: groupProfilePicUrl, 75 | lastMessage: '', 76 | lastMessageUserSenderId: currentUserId, 77 | time: DateTime.now(), 78 | selectedMembersUIds: [currentUserId, ...uIds], 79 | ); 80 | 81 | await _firestore 82 | .collection(StringsConsts.groupsCollection) 83 | .doc(groupId) 84 | .set(group.toMap()); 85 | } catch (e) { 86 | showSnackBar(context, content: e.toString()); 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LetsChat 2 | 3 | ## Fully Featured Chat App Using Firebase, RiverPod and much more. 4 | 5 | LetsChat app has a beautiful responsive UI. The app includes many features like User Authentication using email and phone numbers, Online Messaging (Textual, Images, Audios), Status/Stories, Group Chats, Video Calling, and Group Calling. The app is somewhat similar to WhatsApp. LetsChat app built with Riverpod State Management, Firebase for authentication, messaging, and database, Agora streaming platform for video calling and group calling, and many amazing widgets. 6 | 7 | ✔️ Sound NullSafety 8 | 9 | ## Architechture 10 | ✔️ Clean Architechture
11 | 12 | ## State Management 13 | ✔️ Bloc
14 | 15 | ## Features 16 | 17 | ✔️ Phone Number Authentication
18 | ✔️ 1-1 Chatting with Contacts Only
19 | ✔️ Group Chatting
20 | ✔️ Text, Image, GIF, Audio(Recording), Video & Emoji Sharing
21 | ✔️ Video Calling
22 | ✔️ Online/Offline Status
23 | ✔️ Seen Message
24 | ✔️ Replying to Messages
25 | ✔️ Auto Scroll on New Messages
26 | 27 | # Tech Used 28 | ## Server: 29 | Firebase (Firebase Auth, Firebase Core, Firebase Firestore, Firebase Storage). 30 | ## State Management: 31 | Riverpod 32 | 33 | # Pictures: 34 | 35 |

36 | 40 |

41 | 42 |

43 | 47 |

48 | 49 | ## app-screenshots 50 | 51 |

52 | 56 |

57 | 58 | 59 |

60 | 64 |

65 | 66 | 67 |

68 | 72 |

73 | 74 | 75 |

76 | 80 |

81 | 82 | 83 |

84 | 88 |

89 | 90 |

91 | 95 |

96 | 97 |

98 | 102 |

103 | 104 | 105 | -------------------------------------------------------------------------------- /lib/screens/contact/state/contacts_list_state_notifier.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_contacts/contact.dart'; 4 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 5 | import '../controllers/select_receiver_contacts_controller.dart'; 6 | 7 | final contactsListStateProvider = StateNotifierProvider.family< 8 | ContactsListStateNotifier, ContactsListState, BuildContext>( 9 | (ref, context) { 10 | return ref.watch(selectReceiverContactsControllerProvider(context)).when( 11 | data: (data) { 12 | return ContactsListStateNotifier( 13 | contactList: data, 14 | state: GetAllReceiverContactsListState(data), 15 | ); 16 | }, 17 | error: (error, stackTrace) { 18 | return ContactsListStateNotifier( 19 | contactList: [], 20 | state: ErrorReceiverContactsListState(error.toString()), 21 | ); 22 | }, 23 | loading: () { 24 | return ContactsListStateNotifier( 25 | contactList: [], 26 | state: const LoadingReceiverContactsListState(), 27 | ); 28 | }, 29 | ); 30 | }, 31 | ); 32 | 33 | /// Base class for list states 34 | @immutable 35 | abstract class ContactsListState extends Equatable { 36 | const ContactsListState(); 37 | } 38 | 39 | class GetAllReceiverContactsListState extends ContactsListState { 40 | const GetAllReceiverContactsListState(this.contactList); 41 | 42 | final List contactList; 43 | 44 | @override 45 | List get props => [contactList]; 46 | 47 | @override 48 | bool? get stringify => true; 49 | } 50 | 51 | class SearchedReceiverContactsListState extends ContactsListState { 52 | const SearchedReceiverContactsListState(this.searchedQueryList); 53 | 54 | final List searchedQueryList; 55 | 56 | @override 57 | List get props => [searchedQueryList]; 58 | 59 | @override 60 | bool? get stringify => true; 61 | } 62 | 63 | class ErrorReceiverContactsListState extends ContactsListState { 64 | const ErrorReceiverContactsListState(this.errorMessage); 65 | 66 | final String errorMessage; 67 | 68 | @override 69 | List get props => [errorMessage]; 70 | 71 | @override 72 | bool? get stringify => true; 73 | } 74 | 75 | class LoadingReceiverContactsListState extends ContactsListState { 76 | const LoadingReceiverContactsListState(); 77 | 78 | @override 79 | List get props => []; 80 | 81 | @override 82 | bool? get stringify => true; 83 | } 84 | 85 | /// Contacts List State Notifier for notifying listeners. 86 | class ContactsListStateNotifier extends StateNotifier { 87 | ContactsListStateNotifier({ 88 | required this.contactList, 89 | required ContactsListState state, 90 | }) : super(state); 91 | 92 | final List contactList; 93 | 94 | void getSearchedContactsList(String query) async { 95 | List filteredList = contactList 96 | .where((contact) => 97 | contact.displayName.toLowerCase().contains(query.toLowerCase())) 98 | .toList(); 99 | state = SearchedReceiverContactsListState(filteredList); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /lib/screens/group/widgets/group_contacts_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_contacts/contact.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | import '../../../utils/common/widgets/loader.dart'; 5 | import '../../../utils/constants/colors_constants.dart'; 6 | import '../../contact/state/contacts_list_state_notifier.dart'; 7 | 8 | final selectedContactsGroupProvider = StateProvider>((ref) => []); 9 | 10 | class GroupContactsList extends ConsumerStatefulWidget { 11 | const GroupContactsList({ 12 | super.key, 13 | }); 14 | 15 | @override 16 | ConsumerState createState() => _ContactsListState(); 17 | } 18 | 19 | class _ContactsListState extends ConsumerState { 20 | List selectedContactsIndexList = []; 21 | 22 | void selectContact(int index, Contact contact) { 23 | if (selectedContactsIndexList.contains(index)) { 24 | selectedContactsIndexList.remove(index); 25 | ref.read(selectedContactsGroupProvider.state).update( 26 | (state) => [...state..remove(contact)], 27 | ); 28 | } else { 29 | selectedContactsIndexList.add(index); 30 | ref.read(selectedContactsGroupProvider.state).update( 31 | (state) => [...state, contact], 32 | ); 33 | } 34 | 35 | setState(() {}); 36 | } 37 | 38 | @override 39 | Widget build(BuildContext context) { 40 | return Expanded( 41 | child: Consumer( 42 | builder: (consumerContext, ref, child) { 43 | ContactsListState state = 44 | ref.watch(contactsListStateProvider(context)); 45 | if (state is LoadingReceiverContactsListState) { 46 | return const Loader(); 47 | } else if (state is GetAllReceiverContactsListState) { 48 | return ListView.builder( 49 | itemCount: state.contactList.length, 50 | itemBuilder: (context, index) => getListItem( 51 | state.contactList[index], 52 | index, 53 | ), 54 | ); 55 | } else if (state is ErrorReceiverContactsListState) { 56 | return Text(state.errorMessage); 57 | } else { 58 | return const Center( 59 | child: Text('Error'), 60 | ); 61 | } 62 | }, 63 | ), 64 | ); 65 | } 66 | 67 | Widget getListItem(Contact contact, int index) { 68 | String name = contact.displayName; 69 | return Column( 70 | mainAxisAlignment: MainAxisAlignment.start, 71 | mainAxisSize: MainAxisSize.min, 72 | crossAxisAlignment: CrossAxisAlignment.start, 73 | children: [ 74 | ListTile( 75 | onTap: () => selectContact(index, contact), 76 | title: Text(name), 77 | leading: contact.photo == null 78 | ? null 79 | : CircleAvatar( 80 | backgroundImage: MemoryImage(contact.photo!), 81 | ), 82 | trailing: selectedContactsIndexList.contains(index) 83 | ? const Icon( 84 | Icons.done, 85 | color: AppColors.black, 86 | ) 87 | : null, 88 | ), 89 | const Divider( 90 | indent: 50.0, 91 | endIndent: 50.0, 92 | height: 1.0, 93 | ), 94 | ], 95 | ); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /lib/screens/auth/screens/otp_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:i_chat_instant/utils/common/widgets/helper_widgets.dart'; 4 | import '../../../utils/constants/colors_constants.dart'; 5 | import '../controllers/auth_controller.dart'; 6 | 7 | class OTPScreen extends ConsumerStatefulWidget { 8 | const OTPScreen({super.key}); 9 | 10 | @override 11 | ConsumerState createState() => _OTPScreenState(); 12 | } 13 | 14 | class _OTPScreenState extends ConsumerState { 15 | late String? verificationId; 16 | late Size _size; 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | _size = MediaQuery.of(context).size; 21 | verificationId = ModalRoute.of(context)?.settings.arguments as String?; 22 | 23 | return Scaffold( 24 | appBar: _buildAppBar(), 25 | body: Center( 26 | child: Column( 27 | crossAxisAlignment: CrossAxisAlignment.center, 28 | mainAxisAlignment: MainAxisAlignment.start, 29 | children: [ 30 | addVerticalSpace(_size.width * 0.1), 31 | _buildInfoText(), 32 | addVerticalSpace(_size.width * 0.08), 33 | _buildNumberTF(), 34 | ], 35 | ), 36 | ), 37 | ); 38 | } 39 | 40 | AppBar _buildAppBar() { 41 | return AppBar( 42 | iconTheme: Theme.of(context).iconTheme.copyWith( 43 | color: AppColors.onPrimary, 44 | ), 45 | title: Text( 46 | 'Enter OTP', 47 | style: Theme.of(context).appBarTheme.titleTextStyle?.copyWith( 48 | color: AppColors.onPrimary, 49 | fontSize: 18.0, 50 | ), 51 | ), 52 | ); 53 | } 54 | 55 | Widget _buildInfoText() { 56 | return Text( 57 | 'We have sent an SMS with a code.', 58 | textAlign: TextAlign.center, 59 | style: Theme.of(context).textTheme.labelMedium?.copyWith( 60 | color: AppColors.black, 61 | fontSize: _size.width * 0.04, 62 | ), 63 | ); 64 | } 65 | 66 | Widget _buildNumberTF() { 67 | return SizedBox( 68 | width: _size.width * 0.5, 69 | child: TextField( 70 | maxLines: 1, 71 | minLines: 1, 72 | keyboardType: TextInputType.number, 73 | textAlign: TextAlign.center, 74 | onChanged: (String otp) { 75 | if (otp.length == 6) { 76 | FocusManager.instance.primaryFocus?.unfocus(); 77 | verifyOTP(otp); 78 | } 79 | }, 80 | maxLength: 6, 81 | decoration: InputDecoration( 82 | hintText: '- - - - - -', 83 | hintStyle: Theme.of(context).textTheme.displaySmall?.copyWith( 84 | color: AppColors.grey, 85 | fontSize: _size.width * 0.08, 86 | fontWeight: FontWeight.normal, 87 | ), 88 | ), 89 | style: Theme.of(context).textTheme.displaySmall?.copyWith( 90 | color: AppColors.black, 91 | fontSize: _size.width * 0.08, 92 | ), 93 | ), 94 | ); 95 | } 96 | 97 | void verifyOTP(String smsCode) async { 98 | await ref.watch(authControllerProvider).verifyOTP( 99 | context, 100 | mounted, 101 | verificationId: verificationId!, 102 | smsCode: smsCode, 103 | ); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /lib/screens/sender_info/repositories/sender_user_data_repository.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:cloud_firestore/cloud_firestore.dart'; 3 | import 'package:firebase_auth/firebase_auth.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 6 | import '../../../models/user.dart' as app; 7 | import '../../../utils/common/repositories/firebase_storage_repository.dart'; 8 | import '../../../utils/common/widgets/helper_widgets.dart'; 9 | import '../../../utils/constants/routes_constants.dart'; 10 | import '../../../utils/constants/string_constants.dart'; 11 | 12 | final senderUserDataRepositoryProvider = Provider( 13 | (ref) => SenderUserDataRepository( 14 | firestore: FirebaseFirestore.instance, 15 | auth: FirebaseAuth.instance, 16 | ref: ref, 17 | ), 18 | ); 19 | 20 | class SenderUserDataRepository { 21 | SenderUserDataRepository({ 22 | required FirebaseFirestore firestore, 23 | required FirebaseAuth auth, 24 | required ProviderRef ref, 25 | }) : _firestore = firestore, 26 | _ref = ref, 27 | _auth = auth; 28 | 29 | final FirebaseFirestore _firestore; 30 | final FirebaseAuth _auth; 31 | final ProviderRef _ref; 32 | 33 | /// Invoke method to get current user data 34 | Future getSenderUserData() async { 35 | final userData = await _firestore 36 | .collection(StringsConsts.usersCollection) 37 | .doc(_auth.currentUser?.uid) 38 | .get(); 39 | 40 | app.User? user; 41 | if (userData.data() != null) { 42 | user = app.User.fromMap(userData.data()!); 43 | } 44 | 45 | return user; 46 | } 47 | 48 | /// invoke to save user data to Firebase. 49 | Future saveSenderUserDataToFirebase( 50 | BuildContext context, 51 | bool mounted, { 52 | required String userName, 53 | File? imageFile, 54 | }) async { 55 | try { 56 | String uId = _auth.currentUser!.uid; 57 | String? photoUrl; 58 | 59 | if (imageFile != null) { 60 | // uploading image file to cloud storage and get its url. 61 | photoUrl = await _ref 62 | .read(firebaseStorageRepositoryProvider) 63 | .storeFileToFirebaseStorage( 64 | context, 65 | file: imageFile, 66 | path: 'profilePic', 67 | fileName: uId, 68 | ); 69 | } 70 | 71 | // creating user instance. 72 | app.User user = app.User( 73 | name: userName, 74 | uid: uId, 75 | isOnline: true, 76 | profilePic: photoUrl, 77 | groupId: [], 78 | phoneNumber: _auth.currentUser!.phoneNumber!, 79 | ); 80 | 81 | // saving user to firestore. 82 | await _firestore 83 | .collection(StringsConsts.usersCollection) 84 | .doc(uId) 85 | .set(user.toMap()); 86 | 87 | if (!mounted) return; 88 | // navigating to home screen if everything works well 89 | Navigator.pushNamed( 90 | context, 91 | AppRoutes.homeScreen, 92 | ); 93 | } catch (e) { 94 | showSnackBar(context, content: e.toString()); 95 | } 96 | } 97 | 98 | Future setSenderUserState(bool isOnline) async { 99 | await _firestore 100 | .collection(StringsConsts.usersCollection) 101 | .doc(_auth.currentUser!.uid) 102 | .update({ 103 | 'isOnline': isOnline, 104 | }); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /macos/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 | -------------------------------------------------------------------------------- /windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) 64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0,0 67 | #endif 68 | 69 | #if defined(FLUTTER_VERSION) 70 | #define VERSION_AS_STRING FLUTTER_VERSION 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "com.usamamuzaffar" "\0" 93 | VALUE "FileDescription", "i_chat_instant" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "i_chat_instant" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 com.usamamuzaffar. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "i_chat_instant.exe" "\0" 98 | VALUE "ProductName", "i_chat_instant" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates and shows a win32 window with |title| and position and size using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | -------------------------------------------------------------------------------- /windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # === Flutter Library === 14 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 15 | 16 | # Published to parent scope for install step. 17 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 18 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 19 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 20 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 21 | 22 | list(APPEND FLUTTER_LIBRARY_HEADERS 23 | "flutter_export.h" 24 | "flutter_windows.h" 25 | "flutter_messenger.h" 26 | "flutter_plugin_registrar.h" 27 | "flutter_texture_registrar.h" 28 | ) 29 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 30 | add_library(flutter INTERFACE) 31 | target_include_directories(flutter INTERFACE 32 | "${EPHEMERAL_DIR}" 33 | ) 34 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 35 | add_dependencies(flutter flutter_assemble) 36 | 37 | # === Wrapper === 38 | list(APPEND CPP_WRAPPER_SOURCES_CORE 39 | "core_implementations.cc" 40 | "standard_codec.cc" 41 | ) 42 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 43 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 44 | "plugin_registrar.cc" 45 | ) 46 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 47 | list(APPEND CPP_WRAPPER_SOURCES_APP 48 | "flutter_engine.cc" 49 | "flutter_view_controller.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 52 | 53 | # Wrapper sources needed for a plugin. 54 | add_library(flutter_wrapper_plugin STATIC 55 | ${CPP_WRAPPER_SOURCES_CORE} 56 | ${CPP_WRAPPER_SOURCES_PLUGIN} 57 | ) 58 | apply_standard_settings(flutter_wrapper_plugin) 59 | set_target_properties(flutter_wrapper_plugin PROPERTIES 60 | POSITION_INDEPENDENT_CODE ON) 61 | set_target_properties(flutter_wrapper_plugin PROPERTIES 62 | CXX_VISIBILITY_PRESET hidden) 63 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 64 | target_include_directories(flutter_wrapper_plugin PUBLIC 65 | "${WRAPPER_ROOT}/include" 66 | ) 67 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 68 | 69 | # Wrapper sources needed for the runner. 70 | add_library(flutter_wrapper_app STATIC 71 | ${CPP_WRAPPER_SOURCES_CORE} 72 | ${CPP_WRAPPER_SOURCES_APP} 73 | ) 74 | apply_standard_settings(flutter_wrapper_app) 75 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 76 | target_include_directories(flutter_wrapper_app PUBLIC 77 | "${WRAPPER_ROOT}/include" 78 | ) 79 | add_dependencies(flutter_wrapper_app flutter_assemble) 80 | 81 | # === Flutter tool backend === 82 | # _phony_ is a non-existent file to force this command to run every time, 83 | # since currently there's no way to get a full input/output list from the 84 | # flutter tool. 85 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 86 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 87 | add_custom_command( 88 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 89 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 90 | ${CPP_WRAPPER_SOURCES_APP} 91 | ${PHONY_OUTPUT} 92 | COMMAND ${CMAKE_COMMAND} -E env 93 | ${FLUTTER_TOOL_ENVIRONMENT} 94 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 95 | windows-x64 $ 96 | VERBATIM 97 | ) 98 | add_custom_target(flutter_assemble DEPENDS 99 | "${FLUTTER_LIBRARY}" 100 | ${FLUTTER_LIBRARY_HEADERS} 101 | ${CPP_WRAPPER_SOURCES_CORE} 102 | ${CPP_WRAPPER_SOURCES_PLUGIN} 103 | ${CPP_WRAPPER_SOURCES_APP} 104 | ) 105 | -------------------------------------------------------------------------------- /lib/screens/group/screens/group_chats_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:intl/intl.dart'; 4 | import '../../../models/group.dart'; 5 | import '../../../utils/common/widgets/loader.dart'; 6 | import '../../../utils/constants/colors_constants.dart'; 7 | import '../../../utils/constants/routes_constants.dart'; 8 | import '../../../utils/constants/string_constants.dart'; 9 | import '../../chat/controllers/chat_controller.dart'; 10 | import '../../chat/widgets/no_chat.dart'; 11 | 12 | class GroupChatScreen extends ConsumerStatefulWidget { 13 | const GroupChatScreen({Key? key}) : super(key: key); 14 | 15 | @override 16 | ConsumerState createState() => 17 | _GroupChatScreenState(); 18 | } 19 | 20 | class _GroupChatScreenState extends ConsumerState { 21 | @override 22 | Widget build(BuildContext context) { 23 | return Scaffold( 24 | appBar: _buildAppBar(), 25 | body: _buildBody(), 26 | ); 27 | } 28 | 29 | AppBar _buildAppBar() { 30 | return AppBar( 31 | iconTheme: Theme.of(context).iconTheme.copyWith( 32 | color: AppColors.onPrimary, 33 | ), 34 | title: Text( 35 | 'Groups', 36 | style: Theme.of(context).appBarTheme.titleTextStyle?.copyWith( 37 | color: AppColors.onPrimary, 38 | fontSize: 18.0, 39 | ), 40 | ), 41 | actions: [ 42 | PopupMenuButton( 43 | icon: const Icon(Icons.more_vert), 44 | itemBuilder: (context) => [ 45 | PopupMenuItem( 46 | child: const Text('Create Group'), 47 | onTap: () => Future( 48 | () => Navigator.pushNamed( 49 | context, 50 | AppRoutes.createGroupScreen, 51 | ), 52 | ), 53 | ), 54 | ], 55 | ), 56 | ], 57 | ); 58 | } 59 | 60 | Widget _buildBody() { 61 | return StreamBuilder>( 62 | stream: ref.watch(chatControllerProvider).getGroupChatsList(), 63 | builder: (context, snapshot) { 64 | if (!snapshot.hasData) { 65 | return const Loader(); 66 | } 67 | return snapshot.data!.isEmpty 68 | ? const NoChat() 69 | : ListView.builder( 70 | itemCount: snapshot.data!.length, 71 | itemBuilder: (context, index) { 72 | Group group = snapshot.data![index]; 73 | return _buildChatListItem(context, index, group); 74 | }, 75 | ); 76 | }, 77 | ); 78 | } 79 | 80 | Widget _buildChatListItem(BuildContext context, int index, Group group) { 81 | Size size = MediaQuery.of(context).size; 82 | 83 | return ListTile( 84 | onTap: () => Navigator.pushNamed( 85 | context, 86 | AppRoutes.chatScreen, 87 | arguments: { 88 | StringsConsts.username: group.groupName, 89 | StringsConsts.userId: group.groupId, 90 | StringsConsts.profilePic: group.groupProfilePic, 91 | StringsConsts.isGroupChat: true, 92 | }, 93 | ), 94 | title: Text( 95 | group.groupName, 96 | style: Theme.of(context).textTheme.bodyLarge?.copyWith( 97 | fontSize: size.width * 0.045, 98 | ), 99 | ), 100 | subtitle: Text( 101 | group.lastMessage, 102 | maxLines: 1, 103 | style: Theme.of(context).textTheme.bodyMedium?.copyWith( 104 | fontSize: size.width * 0.035, 105 | ), 106 | ), 107 | leading: CircleAvatar( 108 | radius: 30.0, 109 | backgroundImage: NetworkImage( 110 | group.groupProfilePic, 111 | ), 112 | ), 113 | trailing: Text( 114 | DateFormat.Hm().format(group.time), 115 | style: Theme.of(context).textTheme.bodySmall?.copyWith( 116 | fontSize: size.width * 0.030, 117 | ), 118 | ), 119 | ); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "i_chat_instant"); 44 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 46 | } else { 47 | gtk_window_set_title(window, "i_chat_instant"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GObject::dispose. 85 | static void my_application_dispose(GObject* object) { 86 | MyApplication* self = MY_APPLICATION(object); 87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 89 | } 90 | 91 | static void my_application_class_init(MyApplicationClass* klass) { 92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 95 | } 96 | 97 | static void my_application_init(MyApplication* self) {} 98 | 99 | MyApplication* my_application_new() { 100 | return MY_APPLICATION(g_object_new(my_application_get_type(), 101 | "application-id", APPLICATION_ID, 102 | "flags", G_APPLICATION_NON_UNIQUE, 103 | nullptr)); 104 | } 105 | -------------------------------------------------------------------------------- /lib/screens/call/screens/call_pickup_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | import '../../../models/call.dart'; 5 | import '../../../utils/constants/colors_constants.dart'; 6 | import '../controllers/call_controller.dart'; 7 | import 'call_screen.dart'; 8 | 9 | class CallPickupScreen extends ConsumerWidget { 10 | const CallPickupScreen({ 11 | required this.scaffold, 12 | Key? key, 13 | }) : super(key: key); 14 | 15 | final Widget scaffold; 16 | 17 | @override 18 | Widget build(BuildContext context, WidgetRef ref) { 19 | return StreamBuilder( 20 | stream: ref.watch(callControllerProvider).callDocsSnapshotsStream, 21 | builder: (context, snapshot) { 22 | if (snapshot.hasData && snapshot.data!.data() != null) { 23 | Call call = 24 | Call.fromMap(snapshot.data!.data() as Map); 25 | 26 | if (!call.hasDialled) { 27 | return Scaffold( 28 | body: Container( 29 | alignment: Alignment.center, 30 | padding: const EdgeInsets.all(16.0), 31 | child: Column( 32 | mainAxisAlignment: MainAxisAlignment.start, 33 | crossAxisAlignment: CrossAxisAlignment.center, 34 | children: [ 35 | const SizedBox(height: 48.0), 36 | Text( 37 | 'Incoming Call', 38 | style: Theme.of(context) 39 | .textTheme 40 | .headlineLarge 41 | ?.copyWith(fontSize: 36.0), 42 | ), 43 | const SizedBox(height: 48.0), 44 | CircleAvatar( 45 | radius: 64.0, 46 | backgroundImage: NetworkImage(call.callerPic), 47 | ), 48 | const SizedBox(height: 24.0), 49 | Text( 50 | call.callerName, 51 | style: Theme.of(context) 52 | .textTheme 53 | .headlineLarge 54 | ?.copyWith( 55 | fontSize: 28.0, 56 | fontWeight: FontWeight.w900, 57 | color: AppColors.black.withOpacity(0.7)), 58 | ), 59 | const SizedBox(height: 64.0), 60 | Row( 61 | mainAxisAlignment: MainAxisAlignment.center, 62 | children: [ 63 | IconButton( 64 | iconSize: 54.0, 65 | onPressed: () {}, 66 | icon: const Icon( 67 | Icons.call_end, 68 | color: AppColors.red, 69 | ), 70 | ), 71 | const SizedBox(width: 48.0), 72 | IconButton( 73 | iconSize: 54.0, 74 | onPressed: () { 75 | Navigator.push( 76 | context, 77 | MaterialPageRoute( 78 | builder: (_) => CallScreen( 79 | channelId: call.callId, 80 | call: call, 81 | isGroupChat: false, 82 | ), 83 | ), 84 | ); 85 | }, 86 | icon: const Icon( 87 | Icons.call, 88 | color: AppColors.green, 89 | ), 90 | ), 91 | ], 92 | ), 93 | ], 94 | ), 95 | ), 96 | ); 97 | } 98 | } 99 | return scaffold; 100 | }, 101 | ); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /lib/router/router.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:page_route_animator/page_route_animator.dart'; 3 | import '../models/status.dart'; 4 | import '../screens/auth/screens/otp_screen.dart'; 5 | import '../screens/auth/screens/phone_login_screen.dart'; 6 | import '../screens/chat/screens/chat_screen.dart'; 7 | import '../screens/contact/screens/select_receiver_contact_screen.dart'; 8 | import '../screens/group/screens/create_group_screen.dart'; 9 | import '../screens/group/screens/group_chats_screen.dart'; 10 | import '../utils/common/screens/error_screen.dart'; 11 | import '../screens/home/screens/home_screen.dart'; 12 | import '../screens/landing/screens/landing_screen.dart'; 13 | import '../screens/sender_info/screens/sender_user_information_screen.dart'; 14 | import '../screens/status/screens/confirm_status_screen.dart'; 15 | import '../screens/status/screens/status_screen.dart'; 16 | import '../screens/status/screens/watch_status_screen.dart'; 17 | import '../utils/constants/routes_constants.dart'; 18 | 19 | class AppRouter { 20 | static Route? onGenerateRoute(RouteSettings settings) { 21 | switch (settings.name) { 22 | case AppRoutes.homeScreen: 23 | return PageRouteAnimator( 24 | child: const HomeScreen(), 25 | routeAnimation: RouteAnimation.rightToLeft, 26 | settings: settings, 27 | ); 28 | case AppRoutes.landingScreen: 29 | return PageRouteAnimator( 30 | child: const LandingScreen(), 31 | routeAnimation: RouteAnimation.rightToLeft, 32 | settings: settings, 33 | ); 34 | case AppRoutes.phoneLoginScreen: 35 | return PageRouteAnimator( 36 | child: const PhoneLoginScreen(), 37 | routeAnimation: RouteAnimation.rightToLeft, 38 | settings: settings, 39 | ); 40 | case AppRoutes.otpScreen: 41 | return PageRouteAnimator( 42 | child: const OTPScreen(), 43 | routeAnimation: RouteAnimation.rightToLeft, 44 | settings: settings, 45 | ); 46 | case AppRoutes.userInformationScreen: 47 | return PageRouteAnimator( 48 | child: const SenderUserInformationScreen(), 49 | routeAnimation: RouteAnimation.rightToLeft, 50 | settings: settings, 51 | ); 52 | case AppRoutes.chatScreen: 53 | return PageRouteAnimator( 54 | child: const ChatScreen(), 55 | routeAnimation: RouteAnimation.rightToLeft, 56 | settings: settings, 57 | ); 58 | case AppRoutes.selectContactScreen: 59 | return PageRouteAnimator( 60 | child: const SelectReceiverContactScreen(), 61 | routeAnimation: RouteAnimation.rightToLeft, 62 | settings: settings, 63 | ); 64 | case AppRoutes.statusScreen: 65 | return PageRouteAnimator( 66 | child: const StatusScreen(), 67 | routeAnimation: RouteAnimation.rightToLeft, 68 | settings: settings, 69 | ); 70 | case AppRoutes.confirmStatusScreen: 71 | return PageRouteAnimator( 72 | child: const ConfirmStatusScreen(), 73 | fullscreenDialog: true, 74 | routeAnimation: RouteAnimation.rightToLeft, 75 | settings: settings, 76 | ); 77 | case AppRoutes.watchStatusScreen: 78 | return PageRouteAnimator( 79 | child: WatchStatusScreen(status: settings.arguments as Status), 80 | routeAnimation: RouteAnimation.rightToLeft, 81 | ); 82 | case AppRoutes.createGroupScreen: 83 | return PageRouteAnimator( 84 | child: const CreateGroupScreen(), 85 | routeAnimation: RouteAnimation.rightToLeft, 86 | settings: settings, 87 | ); 88 | case AppRoutes.groupChatsScreen: 89 | return PageRouteAnimator( 90 | child: const GroupChatScreen(), 91 | routeAnimation: RouteAnimation.rightToLeft, 92 | settings: settings, 93 | ); 94 | 95 | default: 96 | return PageRouteAnimator( 97 | child: ErrorScreen(error: settings.arguments as String), 98 | routeAnimation: RouteAnimation.rightToLeft, 99 | settings: settings, 100 | ); 101 | } 102 | } 103 | } 104 | --------------------------------------------------------------------------------