├── .gitignore
├── .metadata
├── README.md
├── Screenshots
├── Chat-app.gif
├── cameraoptions.png
├── chatpage.png
├── homepage.png
├── login.png
├── loginphone.png
├── profilepage.png
├── signout.png
├── signup.png
└── userstochat.png
├── analysis_options.yaml
├── android
├── .gitignore
├── app
│ ├── build.gradle
│ ├── google-services.json
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── kotlin
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── chat_app
│ │ │ │ └── MainActivity.kt
│ │ └── res
│ │ │ ├── drawable-v21
│ │ │ └── launch_background.xml
│ │ │ ├── drawable
│ │ │ └── launch_background.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── values-night
│ │ │ └── styles.xml
│ │ │ └── values
│ │ │ └── styles.xml
│ │ └── profile
│ │ └── AndroidManifest.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
└── settings.gradle
├── assets
├── alex.png
├── camera.png
├── google.png
├── jim.png
├── logo.png
├── mic.png
├── more.png
├── ping.png
├── precious.png
├── profile.png
├── right.png
├── search.png
├── send-message.png
├── send.png
├── send1.png
├── smile.png
├── splash-logo.png
├── tom.png
└── video.png
├── ios
├── .gitignore
├── Flutter
│ ├── AppFrameworkInfo.plist
│ ├── Debug.xcconfig
│ └── Release.xcconfig
├── Podfile
├── Podfile.lock
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ ├── IDEWorkspaceChecks.plist
│ │ └── WorkspaceSettings.xcsettings
├── Runner
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ ├── Icon-App-20x20@1x.png
│ │ │ ├── Icon-App-20x20@2x.png
│ │ │ ├── Icon-App-20x20@3x.png
│ │ │ ├── Icon-App-29x29@1x.png
│ │ │ ├── Icon-App-29x29@2x.png
│ │ │ ├── Icon-App-29x29@3x.png
│ │ │ ├── Icon-App-40x40@1x.png
│ │ │ ├── Icon-App-40x40@2x.png
│ │ │ ├── Icon-App-40x40@3x.png
│ │ │ ├── Icon-App-60x60@2x.png
│ │ │ ├── Icon-App-60x60@3x.png
│ │ │ ├── Icon-App-76x76@1x.png
│ │ │ ├── Icon-App-76x76@2x.png
│ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ └── LaunchImage.imageset
│ │ │ ├── Contents.json
│ │ │ ├── LaunchImage.png
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ └── README.md
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── GoogleService-Info.plist
│ ├── Info.plist
│ └── Runner-Bridging-Header.h
└── firebase_app_id_file.json
├── lib
├── firebase_options.dart
├── main.dart
├── models
│ ├── chatgroupmodel.dart
│ ├── chatgroupmodel.g.dart
│ ├── chatroommodel.dart
│ ├── chatroommodel.g.dart
│ ├── messagemodel.dart
│ ├── messagemodel.g.dart
│ ├── usersmodel.dart
│ └── usersmodel.g.dart
├── screens
│ ├── camera_page.dart
│ ├── chat_page.dart
│ ├── complete_profile_page.dart
│ ├── complete_profile_phonelogin_page.dart
│ ├── home_page.dart
│ ├── login_page.dart
│ ├── phone_login_page.dart
│ ├── selectusertochat_page.dart
│ ├── signup_page.dart
│ ├── splashhome_page.dart
│ ├── splashlogin_page.dart
│ └── userinfo_page.dart
├── service
│ └── firebase_service.dart
└── widgets
│ ├── about_userdata.dart
│ ├── chats_homepage.dart
│ ├── email_userdata.dart
│ ├── listusers_addbutton.dart
│ ├── login_button.dart
│ ├── logintohome.dart
│ ├── name_userdata.dart
│ ├── phone_userdata.dart
│ ├── previewimage_chatpage.dart
│ ├── profile_image_homepage.dart
│ ├── showmessage.dart
│ ├── userinfo_popup.dart
│ ├── viewmessagepicture.dart
│ └── viewuserprofilepic.dart
├── linux
├── .gitignore
├── CMakeLists.txt
├── flutter
│ ├── CMakeLists.txt
│ ├── generated_plugin_registrant.cc
│ ├── generated_plugin_registrant.h
│ └── generated_plugins.cmake
├── main.cc
├── my_application.cc
└── my_application.h
├── macos
├── .gitignore
├── Flutter
│ ├── Flutter-Debug.xcconfig
│ ├── Flutter-Release.xcconfig
│ └── GeneratedPluginRegistrant.swift
├── Podfile
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
├── Runner
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── app_icon_1024.png
│ │ │ ├── app_icon_128.png
│ │ │ ├── app_icon_16.png
│ │ │ ├── app_icon_256.png
│ │ │ ├── app_icon_32.png
│ │ │ ├── app_icon_512.png
│ │ │ └── app_icon_64.png
│ ├── Base.lproj
│ │ └── MainMenu.xib
│ ├── Configs
│ │ ├── AppInfo.xcconfig
│ │ ├── Debug.xcconfig
│ │ ├── Release.xcconfig
│ │ └── Warnings.xcconfig
│ ├── DebugProfile.entitlements
│ ├── GoogleService-Info.plist
│ ├── Info.plist
│ ├── MainFlutterWindow.swift
│ └── Release.entitlements
└── firebase_app_id_file.json
├── pubspec.lock
├── pubspec.yaml
├── test
└── widget_test.dart
├── web
├── favicon.png
├── icons
│ ├── Icon-192.png
│ ├── Icon-512.png
│ ├── Icon-maskable-192.png
│ └── Icon-maskable-512.png
├── index.html
└── manifest.json
└── windows
├── .gitignore
├── CMakeLists.txt
├── flutter
├── CMakeLists.txt
├── generated_plugin_registrant.cc
├── generated_plugin_registrant.h
└── generated_plugins.cmake
└── runner
├── CMakeLists.txt
├── Runner.rc
├── flutter_window.cpp
├── flutter_window.h
├── main.cpp
├── resource.h
├── resources
└── app_icon.ico
├── runner.exe.manifest
├── utils.cpp
├── utils.h
├── win32_window.cpp
└── win32_window.h
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | **/doc/api/
26 | **/ios/Flutter/.last_build_id
27 | .dart_tool/
28 | .flutter-plugins
29 | .flutter-plugins-dependencies
30 | .packages
31 | .pub-cache/
32 | .pub/
33 | /build/
34 |
35 | # Web related
36 | lib/generated_plugin_registrant.dart
37 |
38 | # Symbolication related
39 | app.*.symbols
40 |
41 | # Obfuscation related
42 | app.*.map.json
43 |
44 | # Android Studio will place build artifacts here
45 | /android/app/debug
46 | /android/app/profile
47 | /android/app/release
48 |
--------------------------------------------------------------------------------
/.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: 6f1cee910457c7efb9467ebe81122c691b313fae
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: 6f1cee910457c7efb9467ebe81122c691b313fae
17 | base_revision: 6f1cee910457c7efb9467ebe81122c691b313fae
18 | - platform: android
19 | create_revision: 6f1cee910457c7efb9467ebe81122c691b313fae
20 | base_revision: 6f1cee910457c7efb9467ebe81122c691b313fae
21 | - platform: ios
22 | create_revision: 6f1cee910457c7efb9467ebe81122c691b313fae
23 | base_revision: 6f1cee910457c7efb9467ebe81122c691b313fae
24 | - platform: linux
25 | create_revision: 6f1cee910457c7efb9467ebe81122c691b313fae
26 | base_revision: 6f1cee910457c7efb9467ebe81122c691b313fae
27 | - platform: macos
28 | create_revision: 6f1cee910457c7efb9467ebe81122c691b313fae
29 | base_revision: 6f1cee910457c7efb9467ebe81122c691b313fae
30 | - platform: web
31 | create_revision: 6f1cee910457c7efb9467ebe81122c691b313fae
32 | base_revision: 6f1cee910457c7efb9467ebe81122c691b313fae
33 | - platform: windows
34 | create_revision: 6f1cee910457c7efb9467ebe81122c691b313fae
35 | base_revision: 6f1cee910457c7efb9467ebe81122c691b313fae
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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Chat App with Firebase
2 |
3 | The UI of this chat app is developed in flutter and designed in figma. The app includes main page where chat rooms are present of user also there is profile page, login page etc.
4 |
5 |
6 |
7 |
8 |
9 | The app design was taken from this figma design file.
10 |
11 | https://www.figma.com/file/10G6zbwg91v7VEyn3jHIHY/Ping-Chat-App-(Community)?node-id=11%3A167&t=Cxirxsdvq7OSWpVT-0
12 |
13 |
14 |
15 |
16 | 
17 |
18 |
19 |
20 |
21 | # Video
22 |
23 |
24 | 
25 |
26 |
27 |
28 | # Screenshots
29 |
30 |
.
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | # App Overview
40 |
41 | Ping is a chat application developed in flutter for both android and ios users. The app contains major login methods like login with email, phone and google also users can signup and complete their user profile. After loging in they reach home screen where they see already open chatroom with other users if any. There is a profile page to see current info and also edit it. The main chat page is also functional and has features like sending texts,emojis and image files from gallery and camera as well. The chats work in realtime as firebase is used for backend and storage of our app. Users can also signout and select who they want to chat.
42 |
43 |
44 | # Future Work
45 |
46 | In future we have plans to add video and audio calls feature. File sending like pdfs, word to also be added. Searching to be implemented and blocking and deleting options as well are planned in future.
47 |
--------------------------------------------------------------------------------
/Screenshots/Chat-app.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/Screenshots/Chat-app.gif
--------------------------------------------------------------------------------
/Screenshots/cameraoptions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/Screenshots/cameraoptions.png
--------------------------------------------------------------------------------
/Screenshots/chatpage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/Screenshots/chatpage.png
--------------------------------------------------------------------------------
/Screenshots/homepage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/Screenshots/homepage.png
--------------------------------------------------------------------------------
/Screenshots/login.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/Screenshots/login.png
--------------------------------------------------------------------------------
/Screenshots/loginphone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/Screenshots/loginphone.png
--------------------------------------------------------------------------------
/Screenshots/profilepage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/Screenshots/profilepage.png
--------------------------------------------------------------------------------
/Screenshots/signout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/Screenshots/signout.png
--------------------------------------------------------------------------------
/Screenshots/signup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/Screenshots/signup.png
--------------------------------------------------------------------------------
/Screenshots/userstochat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/Screenshots/userstochat.png
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | // 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 flutter.compileSdkVersion
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.example.chat_app"
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 platform('com.google.firebase:firebase-bom:30.1.0')
74 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
75 | }
76 |
--------------------------------------------------------------------------------
/android/app/google-services.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_info": {
3 | "project_number": "653162562389",
4 | "firebase_url": "https://chat-app-9ce0c-default-rtdb.firebaseio.com",
5 | "project_id": "chat-app-9ce0c",
6 | "storage_bucket": "chat-app-9ce0c.appspot.com"
7 | },
8 | "client": [
9 | {
10 | "client_info": {
11 | "mobilesdk_app_id": "1:653162562389:android:c53333eb305845ad3765dc",
12 | "android_client_info": {
13 | "package_name": "com.example.chat_app"
14 | }
15 | },
16 | "oauth_client": [
17 | {
18 | "client_id": "653162562389-ibei0vt09nisvvt0pq00pa11b2372qrk.apps.googleusercontent.com",
19 | "client_type": 1,
20 | "android_info": {
21 | "package_name": "com.example.chat_app",
22 | "certificate_hash": "182cafdc9422f1fba6ad77ce52a57104a9e5ea6d"
23 | }
24 | },
25 | {
26 | "client_id": "653162562389-pq4jp16ncvb3i6r0b8rg1oaiebiheja6.apps.googleusercontent.com",
27 | "client_type": 3
28 | }
29 | ],
30 | "api_key": [
31 | {
32 | "current_key": "AIzaSyBsdLnl-bnspibK1_7lkSABTv7e8Kiyd5k"
33 | }
34 | ],
35 | "services": {
36 | "appinvite_service": {
37 | "other_platform_oauth_client": [
38 | {
39 | "client_id": "653162562389-pq4jp16ncvb3i6r0b8rg1oaiebiheja6.apps.googleusercontent.com",
40 | "client_type": 3
41 | },
42 | {
43 | "client_id": "653162562389-7ctthls8387kfh2nd6hchdhh3e2dirjm.apps.googleusercontent.com",
44 | "client_type": 2,
45 | "ios_info": {
46 | "bundle_id": "com.example.chatApp"
47 | }
48 | }
49 | ]
50 | }
51 | }
52 | }
53 | ],
54 | "configuration_version": "1"
55 | }
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
15 |
19 |
23 |
24 |
25 |
26 |
27 |
28 |
32 |
34 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/chat_app/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.chat_app
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.6.10'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.1.2'
10 | // 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 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
7 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/assets/alex.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/assets/alex.png
--------------------------------------------------------------------------------
/assets/camera.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/assets/camera.png
--------------------------------------------------------------------------------
/assets/google.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/assets/google.png
--------------------------------------------------------------------------------
/assets/jim.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/assets/jim.png
--------------------------------------------------------------------------------
/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/assets/logo.png
--------------------------------------------------------------------------------
/assets/mic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/assets/mic.png
--------------------------------------------------------------------------------
/assets/more.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/assets/more.png
--------------------------------------------------------------------------------
/assets/ping.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/assets/ping.png
--------------------------------------------------------------------------------
/assets/precious.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/assets/precious.png
--------------------------------------------------------------------------------
/assets/profile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/assets/profile.png
--------------------------------------------------------------------------------
/assets/right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/assets/right.png
--------------------------------------------------------------------------------
/assets/search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/assets/search.png
--------------------------------------------------------------------------------
/assets/send-message.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/assets/send-message.png
--------------------------------------------------------------------------------
/assets/send.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/assets/send.png
--------------------------------------------------------------------------------
/assets/send1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/assets/send1.png
--------------------------------------------------------------------------------
/assets/smile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/assets/smile.png
--------------------------------------------------------------------------------
/assets/splash-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/assets/splash-logo.png
--------------------------------------------------------------------------------
/assets/tom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/assets/tom.png
--------------------------------------------------------------------------------
/assets/video.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/assets/video.png
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | **/dgph
2 | *.mode1v3
3 | *.mode2v3
4 | *.moved-aside
5 | *.pbxuser
6 | *.perspectivev3
7 | **/*sync/
8 | .sconsign.dblite
9 | .tags*
10 | **/.vagrant/
11 | **/DerivedData/
12 | Icon?
13 | **/Pods/
14 | **/.symlinks/
15 | profile
16 | xcuserdata
17 | **/.generated/
18 | Flutter/App.framework
19 | Flutter/Flutter.framework
20 | Flutter/Flutter.podspec
21 | Flutter/Generated.xcconfig
22 | Flutter/ephemeral/
23 | Flutter/app.flx
24 | Flutter/app.zip
25 | Flutter/flutter_assets/
26 | Flutter/flutter_export_environment.sh
27 | ServiceDefinitions.json
28 | Runner/GeneratedPluginRegistrant.*
29 |
30 | # Exceptions to above rules.
31 | !default.mode1v3
32 | !default.mode2v3
33 | !default.pbxuser
34 | !default.perspectivev3
35 |
--------------------------------------------------------------------------------
/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 11.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"
--------------------------------------------------------------------------------
/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | platform :ios, '13.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def flutter_root
14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15 | unless File.exist?(generated_xcode_build_settings_path)
16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17 | end
18 |
19 | File.foreach(generated_xcode_build_settings_path) do |line|
20 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
21 | return matches[1].strip if matches
22 | end
23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24 | end
25 |
26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27 |
28 | flutter_ios_podfile_setup
29 |
30 | target 'Runner' do
31 | use_frameworks!
32 | use_modular_headers!
33 | pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '10.2.0'
34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35 | end
36 |
37 | post_install do |installer|
38 | installer.pods_project.targets.each do |target|
39 | flutter_additional_ios_build_settings(target)
40 | end
41 | end
42 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
41 |
42 |
52 |
54 |
60 |
61 |
62 |
63 |
69 |
71 |
77 |
78 |
79 |
80 |
82 |
83 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 | import FirebaseCore
4 |
5 | @UIApplicationMain
6 | @objc class AppDelegate: FlutterAppDelegate {
7 | override func application(
8 | _ application: UIApplication,
9 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
10 | ) -> Bool {
11 | FirebaseApp.configure()
12 | GeneratedPluginRegistrant.register(with: self)
13 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/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/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/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/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/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/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/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/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/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/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/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/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/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/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/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/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/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/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/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/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/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/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/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/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Runner/GoogleService-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CLIENT_ID
6 | 653162562389-7ctthls8387kfh2nd6hchdhh3e2dirjm.apps.googleusercontent.com
7 | REVERSED_CLIENT_ID
8 | com.googleusercontent.apps.653162562389-7ctthls8387kfh2nd6hchdhh3e2dirjm
9 | ANDROID_CLIENT_ID
10 | 653162562389-ibei0vt09nisvvt0pq00pa11b2372qrk.apps.googleusercontent.com
11 | API_KEY
12 | AIzaSyCrTd4H8xllknYDODJo1j-2EkhR8TlvOA4
13 | GCM_SENDER_ID
14 | 653162562389
15 | PLIST_VERSION
16 | 1
17 | BUNDLE_ID
18 | com.example.chatApp
19 | PROJECT_ID
20 | chat-app-9ce0c
21 | STORAGE_BUCKET
22 | chat-app-9ce0c.appspot.com
23 | IS_ADS_ENABLED
24 |
25 | IS_ANALYTICS_ENABLED
26 |
27 | IS_APPINVITE_ENABLED
28 |
29 | IS_GCM_ENABLED
30 |
31 | IS_SIGNIN_ENABLED
32 |
33 | GOOGLE_APP_ID
34 | 1:653162562389:ios:58eb4c477596f1763765dc
35 | DATABASE_URL
36 | https://chat-app-9ce0c-default-rtdb.firebaseio.com
37 |
38 |
--------------------------------------------------------------------------------
/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 |
7 | $(DEVELOPMENT_LANGUAGE)
8 | CFBundleDisplayName
9 | Chat App
10 | CFBundleExecutable
11 | $(EXECUTABLE_NAME)
12 | CFBundleIdentifier
13 | $(PRODUCT_BUNDLE_IDENTIFIER)
14 | CFBundleInfoDictionaryVersion
15 | 6.0
16 | CFBundleName
17 | chat_app
18 | CFBundlePackageType
19 | APPL
20 | CFBundleShortVersionString
21 | $(FLUTTER_BUILD_NAME)
22 | CFBundleSignature
23 | ????
24 | CFBundleVersion
25 | $(FLUTTER_BUILD_NUMBER)
26 | LSRequiresIPhoneOS
27 |
28 | UILaunchStoryboardName
29 | LaunchScreen
30 | UIMainStoryboardFile
31 | Main
32 | UISupportedInterfaceOrientations
33 |
34 | UIInterfaceOrientationPortrait
35 | UIInterfaceOrientationLandscapeLeft
36 | UIInterfaceOrientationLandscapeRight
37 |
38 | UISupportedInterfaceOrientations~ipad
39 |
40 | UIInterfaceOrientationPortrait
41 | UIInterfaceOrientationPortraitUpsideDown
42 | UIInterfaceOrientationLandscapeLeft
43 | UIInterfaceOrientationLandscapeRight
44 |
45 | UIViewControllerBasedStatusBarAppearance
46 |
47 | CADisableMinimumFrameDurationOnPhone
48 |
49 | CFBundleURLTypes
50 |
51 |
52 | CFBundleTypeRole
53 | Editor
54 | CFBundleURLSchemes
55 |
56 |
57 |
58 | com.googleusercontent.apps.653162562389-7ctthls8387kfh2nd6hchdhh3e2dirjm
59 |
60 |
61 |
62 | NSPhotoLibraryUsageDescription
63 | Acess Gallery
64 | NSCameraUsageDescription
65 | Acess Camera
66 | NSMicrophoneUsageDescription
67 | Acess Microphone
68 |
69 |
70 |
--------------------------------------------------------------------------------
/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/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:653162562389:ios:58eb4c477596f1763765dc",
5 | "FIREBASE_PROJECT_ID": "chat-app-9ce0c",
6 | "GCM_SENDER_ID": "653162562389"
7 | }
--------------------------------------------------------------------------------
/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 | return web;
21 | }
22 | switch (defaultTargetPlatform) {
23 | case TargetPlatform.android:
24 | return android;
25 | case TargetPlatform.iOS:
26 | return ios;
27 | case TargetPlatform.macOS:
28 | return macos;
29 | case TargetPlatform.windows:
30 | throw UnsupportedError(
31 | 'DefaultFirebaseOptions have not been configured for windows - '
32 | 'you can reconfigure this by running the FlutterFire CLI again.',
33 | );
34 | case TargetPlatform.linux:
35 | throw UnsupportedError(
36 | 'DefaultFirebaseOptions have not been configured for linux - '
37 | 'you can reconfigure this by running the FlutterFire CLI again.',
38 | );
39 | default:
40 | throw UnsupportedError(
41 | 'DefaultFirebaseOptions are not supported for this platform.',
42 | );
43 | }
44 | }
45 |
46 | static const FirebaseOptions web = FirebaseOptions(
47 | apiKey: 'AIzaSyDi55mTIYpxS2HWvSYiuYv-xOc_lmFuwJY',
48 | appId: '1:653162562389:web:f756c8b82aa704113765dc',
49 | messagingSenderId: '653162562389',
50 | projectId: 'chat-app-9ce0c',
51 | authDomain: 'chat-app-9ce0c.firebaseapp.com',
52 | storageBucket: 'chat-app-9ce0c.appspot.com',
53 | measurementId: 'G-7YWMBZHXJ5',
54 | );
55 |
56 | static const FirebaseOptions android = FirebaseOptions(
57 | apiKey: 'AIzaSyBsdLnl-bnspibK1_7lkSABTv7e8Kiyd5k',
58 | appId: '1:653162562389:android:c53333eb305845ad3765dc',
59 | messagingSenderId: '653162562389',
60 | projectId: 'chat-app-9ce0c',
61 | storageBucket: 'chat-app-9ce0c.appspot.com',
62 | );
63 |
64 | static const FirebaseOptions ios = FirebaseOptions(
65 | apiKey: 'AIzaSyCrTd4H8xllknYDODJo1j-2EkhR8TlvOA4',
66 | appId: '1:653162562389:ios:58eb4c477596f1763765dc',
67 | messagingSenderId: '653162562389',
68 | projectId: 'chat-app-9ce0c',
69 | storageBucket: 'chat-app-9ce0c.appspot.com',
70 | iosClientId: '653162562389-7ctthls8387kfh2nd6hchdhh3e2dirjm.apps.googleusercontent.com',
71 | iosBundleId: 'com.example.chatApp',
72 | );
73 |
74 | static const FirebaseOptions macos = FirebaseOptions(
75 | apiKey: 'AIzaSyCrTd4H8xllknYDODJo1j-2EkhR8TlvOA4',
76 | appId: '1:653162562389:ios:58eb4c477596f1763765dc',
77 | messagingSenderId: '653162562389',
78 | projectId: 'chat-app-9ce0c',
79 | storageBucket: 'chat-app-9ce0c.appspot.com',
80 | iosClientId: '653162562389-7ctthls8387kfh2nd6hchdhh3e2dirjm.apps.googleusercontent.com',
81 | iosBundleId: 'com.example.chatApp',
82 | );
83 | }
84 |
--------------------------------------------------------------------------------
/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:chat_app/screens/complete_profile_page.dart';
2 | import 'package:chat_app/screens/home_page.dart';
3 | import 'package:chat_app/screens/login_page.dart';
4 | import 'package:chat_app/screens/splashhome_page.dart';
5 | import 'package:chat_app/screens/splashlogin_page.dart';
6 | import 'package:firebase_core/firebase_core.dart';
7 | import 'package:firebase_auth/firebase_auth.dart';
8 | import 'package:flutter/material.dart';
9 | import 'package:flutter_easyloading/flutter_easyloading.dart';
10 | import 'package:uuid/uuid.dart';
11 | import 'firebase_options.dart';
12 |
13 | var uuid = Uuid();
14 |
15 | Future main() async {
16 | WidgetsFlutterBinding.ensureInitialized();
17 | await Firebase.initializeApp(
18 | options: DefaultFirebaseOptions.currentPlatform,
19 | );
20 | runApp(const MyApp());
21 | }
22 |
23 | class MyApp extends StatelessWidget {
24 | const MyApp({Key? key}) : super(key: key);
25 |
26 | @override
27 | Widget build(BuildContext context) {
28 | return MaterialApp(
29 | title: 'Flutter Demo',
30 | debugShowCheckedModeBanner: false,
31 | theme: ThemeData(),
32 | home: AuthStateChanges(),
33 | builder: EasyLoading.init(),
34 | );
35 | }
36 | }
37 |
38 | AuthStateChanges() {
39 | return StreamBuilder(
40 | stream: FirebaseAuth.instance.authStateChanges(),
41 | builder: (BuildContext context, snapshot) {
42 | if (snapshot.hasData) {
43 | return SplashPageHome();
44 | } else {
45 | return SplashLoginPage();
46 | }
47 | });
48 | }
49 |
--------------------------------------------------------------------------------
/lib/models/chatgroupmodel.dart:
--------------------------------------------------------------------------------
1 | import 'package:json_annotation/json_annotation.dart';
2 |
3 | part 'chatgroupmodel.g.dart';
4 |
5 | @JsonSerializable()
6 | class ChatGroupModel {
7 | String? groupid;
8 |
9 | Map? participants;
10 |
11 | String? lastmessage;
12 |
13 | ChatGroupModel({this.groupid, this.participants, this.lastmessage});
14 |
15 | factory ChatGroupModel.fromJson(Map json) =>
16 | _$ChatGroupModelFromJson(json);
17 | Map toJson() => _$ChatGroupModelToJson(this);
18 | }
19 |
--------------------------------------------------------------------------------
/lib/models/chatgroupmodel.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'chatgroupmodel.dart';
4 |
5 | // **************************************************************************
6 | // JsonSerializableGenerator
7 | // **************************************************************************
8 |
9 | ChatGroupModel _$ChatGroupModelFromJson(Map json) =>
10 | ChatGroupModel(
11 | groupid: json['groupid'] as String?,
12 | participants: json['participants'] as Map?,
13 | lastmessage: json['lastmessage'] as String?,
14 | );
15 |
16 | Map _$ChatGroupModelToJson(ChatGroupModel instance) =>
17 | {
18 | 'groupid': instance.groupid,
19 | 'participants': instance.participants,
20 | 'lastmessage': instance.lastmessage,
21 | };
22 |
--------------------------------------------------------------------------------
/lib/models/chatroommodel.dart:
--------------------------------------------------------------------------------
1 | // ignore_for_file: public_member_api_docs, sort_constructors_first
2 | import 'package:json_annotation/json_annotation.dart';
3 |
4 | part 'chatroommodel.g.dart';
5 |
6 | @JsonSerializable()
7 | class ChatRoomModel {
8 | String? chatroomid;
9 |
10 | Map? participants;
11 |
12 | String? lastmessage;
13 |
14 | DateTime? time;
15 |
16 | DateTime? lastmsgtime;
17 |
18 | ChatRoomModel({
19 | this.chatroomid,
20 | this.participants,
21 | this.lastmessage,
22 | this.time,
23 | this.lastmsgtime,
24 | });
25 |
26 | factory ChatRoomModel.fromJson(Map json) =>
27 | _$ChatRoomModelFromJson(json);
28 | Map toJson() => _$ChatRoomModelToJson(this);
29 | }
30 |
--------------------------------------------------------------------------------
/lib/models/chatroommodel.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'chatroommodel.dart';
4 |
5 | // **************************************************************************
6 | // JsonSerializableGenerator
7 | // **************************************************************************
8 |
9 | ChatRoomModel _$ChatRoomModelFromJson(Map json) =>
10 | ChatRoomModel(
11 | chatroomid: json['chatroomid'] as String?,
12 | participants: json['participants'] as Map?,
13 | lastmessage: json['lastmessage'] as String?,
14 | time:
15 | json['time'] == null ? null : DateTime.parse(json['time'] as String),
16 | lastmsgtime: json['lastmsgtime'] == null
17 | ? null
18 | : DateTime.parse(json['lastmsgtime'] as String),
19 | );
20 |
21 | Map _$ChatRoomModelToJson(ChatRoomModel instance) =>
22 | {
23 | 'chatroomid': instance.chatroomid,
24 | 'participants': instance.participants,
25 | 'lastmessage': instance.lastmessage,
26 | 'time': instance.time?.toIso8601String(),
27 | 'lastmsgtime': instance.lastmsgtime?.toIso8601String(),
28 | };
29 |
--------------------------------------------------------------------------------
/lib/models/messagemodel.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:camera/camera.dart';
4 | import 'package:flutter/material.dart';
5 | import 'package:json_annotation/json_annotation.dart';
6 |
7 | part 'messagemodel.g.dart';
8 |
9 | @JsonSerializable()
10 | class MessageModel {
11 | String? messageid;
12 |
13 | String? sender;
14 |
15 | String? messagetext;
16 |
17 | bool? seen;
18 |
19 | DateTime? timecreated;
20 |
21 | String? msgimg;
22 |
23 | MessageModel({
24 | this.messagetext,
25 | this.seen,
26 | this.sender,
27 | this.timecreated,
28 | this.messageid,
29 | this.msgimg,
30 | });
31 |
32 | factory MessageModel.fromJson(Map json) =>
33 | _$MessageModelFromJson(json);
34 | Map toJson() => _$MessageModelToJson(this);
35 | }
36 |
37 | // class XFileConverter extends JsonConverter {
38 | // const XFileConverter();
39 |
40 | // @override
41 | // XFile fromJson(String json) => XFile(json);
42 |
43 | // @override
44 | // String toJson(XFile? object) => object.path;
45 | // }
46 |
--------------------------------------------------------------------------------
/lib/models/messagemodel.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'messagemodel.dart';
4 |
5 | // **************************************************************************
6 | // JsonSerializableGenerator
7 | // **************************************************************************
8 |
9 | MessageModel _$MessageModelFromJson(Map json) => MessageModel(
10 | messagetext: json['messagetext'] as String?,
11 | seen: json['seen'] as bool?,
12 | sender: json['sender'] as String?,
13 | timecreated: json['timecreated'] == null
14 | ? null
15 | : DateTime.parse(json['timecreated'] as String),
16 | messageid: json['messageid'] as String?,
17 | msgimg: json['msgimg'] as String?,
18 | );
19 |
20 | Map _$MessageModelToJson(MessageModel instance) =>
21 | {
22 | 'messageid': instance.messageid,
23 | 'sender': instance.sender,
24 | 'messagetext': instance.messagetext,
25 | 'seen': instance.seen,
26 | 'timecreated': instance.timecreated?.toIso8601String(),
27 | 'msgimg': instance.msgimg,
28 | };
29 |
--------------------------------------------------------------------------------
/lib/models/usersmodel.dart:
--------------------------------------------------------------------------------
1 | import 'package:json_annotation/json_annotation.dart';
2 |
3 | part 'usersmodel.g.dart';
4 |
5 | @JsonSerializable()
6 | class ChatUser {
7 |
8 | String? username;
9 |
10 |
11 | String? uid;
12 |
13 |
14 | String? email;
15 |
16 |
17 | String? phone;
18 |
19 |
20 | String? profilepic;
21 |
22 | String? about;
23 |
24 | ChatUser({
25 | this.email,
26 | this.uid,
27 | this.profilepic,
28 | this.username,
29 | this.phone,
30 | this.about,
31 | });
32 |
33 | factory ChatUser.fromJson(Map json) =>
34 | _$ChatUserFromJson(json);
35 | Map toJson() => _$ChatUserToJson(this);
36 | }
37 |
--------------------------------------------------------------------------------
/lib/models/usersmodel.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'usersmodel.dart';
4 |
5 | // **************************************************************************
6 | // JsonSerializableGenerator
7 | // **************************************************************************
8 |
9 | ChatUser _$ChatUserFromJson(Map json) => ChatUser(
10 | email: json['email'] as String?,
11 | uid: json['uid'] as String?,
12 | profilepic: json['profilepic'] as String?,
13 | username: json['username'] as String?,
14 | phone: json['phone'] as String?,
15 | about: json['about'] as String?,
16 | );
17 |
18 | Map _$ChatUserToJson(ChatUser instance) => {
19 | 'username': instance.username,
20 | 'uid': instance.uid,
21 | 'email': instance.email,
22 | 'phone': instance.phone,
23 | 'profilepic': instance.profilepic,
24 | 'about': instance.about,
25 | };
26 |
--------------------------------------------------------------------------------
/lib/screens/camera_page.dart:
--------------------------------------------------------------------------------
1 | // ignore_for_file: public_member_api_docs, sort_constructors_first
2 | import 'package:camera/camera.dart';
3 | import 'package:firebase_auth/firebase_auth.dart';
4 | import 'package:flutter/cupertino.dart';
5 | import 'package:flutter/material.dart';
6 | import 'package:image_cropper/image_cropper.dart';
7 |
8 | import 'package:chat_app/widgets/previewimage_chatpage.dart';
9 |
10 | import '../models/chatroommodel.dart';
11 | import '../models/usersmodel.dart';
12 |
13 | class CameraPage extends StatefulWidget {
14 | final List? cameras;
15 | final ChatRoomModel chatroom;
16 | final User currentuser;
17 | final ChatUser targetuser;
18 | const CameraPage({
19 | Key? key,
20 | required this.cameras,
21 | required this.chatroom,
22 | required this.currentuser,
23 | required this.targetuser,
24 | }) : super(key: key);
25 |
26 | @override
27 | State createState() => _CameraPageState();
28 | }
29 |
30 | class _CameraPageState extends State {
31 | late CameraController _cameraController;
32 |
33 | bool _isRearCameraSelected = true;
34 |
35 | @override
36 | void dispose() {
37 | _cameraController.dispose();
38 | super.dispose();
39 | }
40 |
41 | @override
42 | void initState() {
43 | super.initState();
44 | initCamera(widget.cameras![1]);
45 | }
46 |
47 | XFile? imagefile;
48 |
49 | void cropImage(XFile file) async {
50 | CroppedFile? cropedImage = (await ImageCropper().cropImage(
51 | sourcePath: file.path,
52 | compressQuality: 20,
53 | ));
54 |
55 | if (cropedImage != null) {
56 | setState(() {
57 | imagefile = XFile(cropedImage.path);
58 | });
59 | Navigator.push(
60 | context,
61 | MaterialPageRoute(
62 | builder: (context) => PreviewImage(
63 | picture: imagefile,
64 | chatroom: widget.chatroom,
65 | currentuser: widget.currentuser,
66 | targetuser: widget.targetuser,
67 | )));
68 | }
69 | }
70 |
71 | Future takePicture() async {
72 | if (!_cameraController.value.isInitialized) {
73 | return null;
74 | }
75 | if (_cameraController.value.isTakingPicture) {
76 | return null;
77 | }
78 | try {
79 | await _cameraController.setFlashMode(FlashMode.off);
80 | XFile picture = await _cameraController.takePicture();
81 | cropImage(picture);
82 | } on CameraException catch (e) {
83 | debugPrint('Error occured while taking picture: $e');
84 | return null;
85 | }
86 | }
87 |
88 | Future initCamera(CameraDescription cameraDescription) async {
89 | _cameraController =
90 | CameraController(cameraDescription, ResolutionPreset.ultraHigh);
91 | try {
92 | await _cameraController.initialize().then((_) {
93 | if (!mounted) return;
94 | setState(() {});
95 | });
96 | } on CameraException catch (e) {
97 | debugPrint("camera error $e");
98 | }
99 | }
100 |
101 | @override
102 | Widget build(BuildContext context) {
103 | return Scaffold(
104 | backgroundColor: Colors.white,
105 | body: Stack(children: [
106 | (_cameraController.value.isInitialized)
107 | ? SizedBox(
108 | width: MediaQuery.of(context).size.width,
109 | height: MediaQuery.of(context).size.height * 1,
110 | child: CameraPreview(
111 | _cameraController,
112 | ),
113 | )
114 | : Container(
115 | color: Colors.black,
116 | child: const Center(
117 | child: CircularProgressIndicator(),
118 | ),
119 | ),
120 | Align(
121 | alignment: Alignment.bottomCenter,
122 | child: Container(
123 | height: MediaQuery.of(context).size.height * 0.20,
124 | decoration: const BoxDecoration(
125 | borderRadius: BorderRadius.vertical(
126 | top: Radius.circular(24),
127 | ),
128 | color: Colors.transparent,
129 | ),
130 | child: Row(
131 | crossAxisAlignment: CrossAxisAlignment.center,
132 | children: [
133 | Expanded(
134 | child: Container(
135 | decoration: BoxDecoration(
136 | color: Colors.black,
137 | shape: BoxShape.circle,
138 | ),
139 | child: IconButton(
140 | padding: EdgeInsets.zero,
141 | iconSize: 30,
142 | icon: Icon(
143 | _isRearCameraSelected
144 | ? CupertinoIcons.switch_camera
145 | : CupertinoIcons.switch_camera_solid,
146 | color: Colors.white),
147 | onPressed: () {
148 | setState(() =>
149 | _isRearCameraSelected = !_isRearCameraSelected);
150 | initCamera(
151 | widget.cameras![_isRearCameraSelected ? 0 : 1]);
152 | },
153 | ),
154 | ),
155 | ),
156 | Expanded(
157 | child: Container(
158 | decoration: BoxDecoration(
159 | color: Colors.grey.shade800,
160 | shape: BoxShape.circle,
161 | ),
162 | child: IconButton(
163 | splashColor: Colors.grey,
164 | highlightColor: Colors.black,
165 | onPressed: takePicture,
166 | iconSize: 50,
167 | padding: EdgeInsets.zero,
168 | // constraints: const BoxConstraints(),
169 | icon: const Icon(
170 | Icons.circle,
171 | color: Colors.white,
172 | ),
173 | ),
174 | ),
175 | ),
176 | const Spacer(),
177 | ],
178 | ),
179 | ),
180 | ),
181 | ]));
182 | }
183 | }
184 |
--------------------------------------------------------------------------------
/lib/screens/complete_profile_page.dart:
--------------------------------------------------------------------------------
1 | // ignore_for_file: public_member_api_docs, sort_constructors_first
2 | import 'dart:developer';
3 | import 'dart:io';
4 | import 'package:chat_app/screens/home_page.dart';
5 | import 'package:cloud_firestore/cloud_firestore.dart';
6 | import 'package:firebase_auth/firebase_auth.dart';
7 | import 'package:firebase_storage/firebase_storage.dart';
8 | import 'package:flutter/material.dart';
9 | import 'package:fluttertoast/fluttertoast.dart';
10 | import 'package:google_fonts/google_fonts.dart';
11 | import 'package:image_cropper/image_cropper.dart';
12 | import 'package:image_picker/image_picker.dart';
13 | import 'package:chat_app/models/usersmodel.dart';
14 | import 'package:chat_app/widgets/login_button.dart';
15 |
16 | class CompleteProfile extends StatefulWidget {
17 | final ChatUser chatUser;
18 | final User firestoreuser;
19 |
20 | const CompleteProfile({
21 | Key? key,
22 | required this.chatUser,
23 | required this.firestoreuser,
24 | }) : super(key: key);
25 |
26 | @override
27 | State createState() => _CompleteProfileState();
28 | }
29 |
30 | class _CompleteProfileState extends State {
31 | void showPhotoOptions() {
32 | showDialog(
33 | context: context,
34 | builder: (context) {
35 | return AlertDialog(
36 | title: const Text("Upload Profile Picture"),
37 | content: Column(
38 | mainAxisSize: MainAxisSize.min,
39 | children: [
40 | ListTile(
41 | onTap: () {
42 | Navigator.pop(context);
43 | imageSelect(ImageSource.gallery);
44 | },
45 | leading: Icon(Icons.photo_album),
46 | title: Text("Select from gallery"),
47 | ),
48 | const SizedBox(
49 | height: 15,
50 | ),
51 | ListTile(
52 | onTap: () {
53 | Navigator.pop(context);
54 | imageSelect(ImageSource.camera);
55 | },
56 | leading: Icon(Icons.camera_alt),
57 | title: Text("Select from camera"),
58 | ),
59 | ],
60 | ),
61 | );
62 | });
63 | }
64 |
65 | File? imagefile;
66 | TextEditingController fullnamecontroller = TextEditingController();
67 | TextEditingController aboutcontroller = TextEditingController();
68 |
69 | void checkValues() {
70 | String fullname = fullnamecontroller.text.trim();
71 | String about = aboutcontroller.text.trim();
72 |
73 | if (imagefile != null || fullname != "" || about != "") {
74 | uploadData(fullname, about);
75 | } else {
76 | print("Please Fill all Values");
77 | }
78 | }
79 |
80 | void uploadData(
81 | String fullname,
82 | String about,
83 | ) async {
84 | UploadTask uploadTask = FirebaseStorage.instance
85 | .ref("profilepics")
86 | .child(widget.chatUser.uid.toString())
87 | .putFile(imagefile!);
88 |
89 | TaskSnapshot snapshot = await uploadTask;
90 |
91 | String? imgUrl = await snapshot.ref.getDownloadURL();
92 |
93 | widget.chatUser.profilepic = imgUrl;
94 | widget.chatUser.username = fullname;
95 | widget.chatUser.about = about;
96 |
97 | await FirebaseFirestore.instance
98 | .collection("Users")
99 | .doc(widget.chatUser.uid.toString())
100 | .set(widget.chatUser.toJson())
101 | .then(
102 | (value) {
103 | Fluttertoast.showToast(
104 | msg: "Loggin In",
105 | backgroundColor: Colors.black,
106 | textColor: Colors.white,
107 | );
108 | Navigator.push(context, MaterialPageRoute(builder: ((context) {
109 | return HomePage(
110 | chatUser: widget.chatUser,
111 | firestoreuser: widget.firestoreuser,
112 | );
113 | })));
114 | },
115 | );
116 | }
117 |
118 | void imageSelect(ImageSource source) async {
119 | XFile? pickedimage = await ImagePicker().pickImage(source: source);
120 | if (pickedimage != null) {
121 | cropImage(pickedimage);
122 | }
123 | }
124 |
125 | void cropImage(XFile file) async {
126 | CroppedFile? cropedImage = (await ImageCropper().cropImage(
127 | sourcePath: file.path,
128 | compressQuality: 20,
129 | aspectRatio: CropAspectRatio(ratioX: 1, ratioY: 1),
130 | ));
131 |
132 | if (cropedImage != null) {
133 | setState(() {
134 | imagefile = File(cropedImage.path);
135 | });
136 | }
137 | }
138 |
139 | @override
140 | Widget build(BuildContext context) {
141 | return Scaffold(
142 | appBar: AppBar(
143 | title: const Text("Complete Your Profile Info"),
144 | backgroundColor: Color(0xff2865DC),
145 | ),
146 | body: SafeArea(
147 | child: Padding(
148 | padding: const EdgeInsets.only(
149 | top: 20,
150 | left: 35,
151 | right: 35,
152 | ),
153 | child: Column(
154 | children: [
155 | InkWell(
156 | onTap: () {
157 | showPhotoOptions();
158 | },
159 | child: CircleAvatar(
160 | backgroundImage:
161 | (imagefile != null) ? FileImage(imagefile!) : null,
162 | radius: 60,
163 | child: (imagefile == null) ? const Icon(Icons.person) : null,
164 | ),
165 | ),
166 | const SizedBox(
167 | height: 25,
168 | ),
169 | TextField(
170 | controller: fullnamecontroller,
171 | decoration: const InputDecoration(
172 | labelText: "Full Name",
173 | ),
174 | ),
175 | const SizedBox(
176 | height: 25,
177 | ),
178 | TextField(
179 | controller: aboutcontroller,
180 | decoration: const InputDecoration(
181 | labelText: "About Yourself",
182 | ),
183 | ),
184 | const SizedBox(
185 | height: 35,
186 | ),
187 | LoginButton(
188 | height: 50,
189 | width: 200,
190 | buttoncolor: Color(0xff2865DC),
191 | radius: 30,
192 | onPressed: () {
193 | checkValues();
194 | },
195 | child: Text(
196 | "Submit",
197 | style: GoogleFonts.inter(
198 | fontSize: 16,
199 | color: Colors.white,
200 | ),
201 | ),
202 | ),
203 | ],
204 | ),
205 | ),
206 | ),
207 | );
208 | }
209 | }
210 |
--------------------------------------------------------------------------------
/lib/screens/complete_profile_phonelogin_page.dart:
--------------------------------------------------------------------------------
1 | // ignore_for_file: public_member_api_docs, sort_constructors_first
2 | import 'dart:io';
3 |
4 | import 'package:camera/camera.dart';
5 | import 'package:cloud_firestore/cloud_firestore.dart';
6 | import 'package:firebase_storage/firebase_storage.dart';
7 | import 'package:flutter/material.dart';
8 | import 'package:flutter/src/widgets/container.dart';
9 | import 'package:flutter/src/widgets/framework.dart';
10 | import 'package:fluttertoast/fluttertoast.dart';
11 | import 'package:google_fonts/google_fonts.dart';
12 | import 'package:image_cropper/image_cropper.dart';
13 | import 'package:image_picker/image_picker.dart';
14 | import 'package:firebase_auth/firebase_auth.dart';
15 | import '../models/usersmodel.dart';
16 | import '../widgets/login_button.dart';
17 | import 'home_page.dart';
18 |
19 | class CompleteProfilePhone extends StatefulWidget {
20 | final ChatUser chatUser;
21 | final User firestoreuser;
22 | const CompleteProfilePhone({
23 | Key? key,
24 | required this.chatUser,
25 | required this.firestoreuser,
26 | }) : super(key: key);
27 |
28 | @override
29 | State createState() => _CompleteProfilePhoneState();
30 | }
31 |
32 | class _CompleteProfilePhoneState extends State {
33 | void showPhotoOptions() {
34 | showDialog(
35 | context: context,
36 | builder: (context) {
37 | return AlertDialog(
38 | title: const Text("Upload Profile Picture"),
39 | content: Column(
40 | mainAxisSize: MainAxisSize.min,
41 | children: [
42 | ListTile(
43 | onTap: () {
44 | Navigator.pop(context);
45 | imageSelect(ImageSource.gallery);
46 | },
47 | leading: Icon(Icons.photo_album),
48 | title: Text("Select from gallery"),
49 | ),
50 | const SizedBox(
51 | height: 15,
52 | ),
53 | ListTile(
54 | onTap: () {
55 | Navigator.pop(context);
56 | imageSelect(ImageSource.camera);
57 | },
58 | leading: Icon(Icons.camera_alt),
59 | title: Text("Select from camera"),
60 | ),
61 | ],
62 | ),
63 | );
64 | });
65 | }
66 |
67 | File? imagefile;
68 | TextEditingController fullnamecontroller = TextEditingController();
69 | TextEditingController aboutcontroller = TextEditingController();
70 | TextEditingController emailcontroller = TextEditingController();
71 |
72 | void checkValues() {
73 | String fullname = fullnamecontroller.text.trim();
74 | String about = aboutcontroller.text.trim();
75 | String email = emailcontroller.text.trim();
76 |
77 | if (imagefile != null || fullname != "" || about != "" || email != "") {
78 | uploadData(fullname, about, email);
79 | } else {
80 | Fluttertoast.showToast(msg: "Please Fill all Fields");
81 | }
82 | }
83 |
84 | void uploadData(
85 | String fullname,
86 | String about,
87 | String email,
88 | ) async {
89 | UploadTask uploadTask = FirebaseStorage.instance
90 | .ref("profilepics")
91 | .child(widget.chatUser.uid.toString())
92 | .putFile(imagefile!);
93 |
94 | TaskSnapshot snapshot = await uploadTask;
95 |
96 | String? imgUrl = await snapshot.ref.getDownloadURL();
97 |
98 | widget.chatUser.email = email;
99 | widget.chatUser.profilepic = imgUrl;
100 | widget.chatUser.username = fullname;
101 | widget.chatUser.about = about;
102 |
103 | await FirebaseFirestore.instance
104 | .collection("Users")
105 | .doc(widget.chatUser.uid.toString())
106 | .set(widget.chatUser.toJson())
107 | .then(
108 | (value) {
109 | Fluttertoast.showToast(
110 | msg: "Loggin In",
111 | backgroundColor: Colors.black,
112 | textColor: Colors.white,
113 | );
114 | Navigator.push(context, MaterialPageRoute(builder: ((context) {
115 | return HomePage(
116 | chatUser: widget.chatUser,
117 | firestoreuser: widget.firestoreuser,
118 | );
119 | })));
120 | },
121 | );
122 | }
123 |
124 | void imageSelect(ImageSource source) async {
125 | XFile? pickedimage = await ImagePicker().pickImage(source: source);
126 | if (pickedimage != null) {
127 | cropImage(pickedimage);
128 | }
129 | }
130 |
131 | void cropImage(XFile file) async {
132 | CroppedFile? cropedImage = (await ImageCropper().cropImage(
133 | sourcePath: file.path,
134 | compressQuality: 20,
135 | aspectRatio: CropAspectRatio(ratioX: 1, ratioY: 1),
136 | ));
137 |
138 | if (cropedImage != null) {
139 | setState(() {
140 | imagefile = File(cropedImage.path);
141 | });
142 | }
143 | }
144 |
145 | @override
146 | Widget build(BuildContext context) {
147 | return Scaffold(
148 | appBar: AppBar(
149 | title: const Text("Complete Your Profile Info"),
150 | backgroundColor: Color(0xff2865DC),
151 | ),
152 | body: SafeArea(
153 | child: Padding(
154 | padding: const EdgeInsets.only(
155 | top: 20,
156 | left: 35,
157 | right: 35,
158 | ),
159 | child: SingleChildScrollView(
160 | child: Column(
161 | children: [
162 | InkWell(
163 | onTap: () {
164 | showPhotoOptions();
165 | },
166 | child: CircleAvatar(
167 | backgroundImage:
168 | (imagefile != null) ? FileImage(imagefile!) : null,
169 | radius: 60,
170 | child:
171 | (imagefile == null) ? const Icon(Icons.person) : null,
172 | ),
173 | ),
174 | const SizedBox(
175 | height: 25,
176 | ),
177 | TextField(
178 | controller: emailcontroller,
179 | decoration: const InputDecoration(
180 | labelText: "Email Address",
181 | ),
182 | ),
183 | const SizedBox(
184 | height: 25,
185 | ),
186 | TextField(
187 | controller: fullnamecontroller,
188 | decoration: const InputDecoration(
189 | labelText: "Full Name",
190 | ),
191 | ),
192 | const SizedBox(
193 | height: 25,
194 | ),
195 | TextField(
196 | controller: aboutcontroller,
197 | decoration: const InputDecoration(
198 | labelText: "About Yourself",
199 | ),
200 | ),
201 | const SizedBox(
202 | height: 35,
203 | ),
204 | LoginButton(
205 | height: 50,
206 | width: 200,
207 | buttoncolor: Color(0xff2865DC),
208 | radius: 30,
209 | onPressed: () {
210 | checkValues();
211 | },
212 | child: Text(
213 | "Submit",
214 | style: GoogleFonts.inter(
215 | fontSize: 16,
216 | color: Colors.white,
217 | ),
218 | ),
219 | ),
220 | ],
221 | ),
222 | ),
223 | ),
224 | ),
225 | );
226 | }
227 | }
228 |
--------------------------------------------------------------------------------
/lib/screens/selectusertochat_page.dart:
--------------------------------------------------------------------------------
1 | // ignore_for_file: public_member_api_docs, sort_constructors_first
2 | import 'package:flutter/material.dart';
3 | import 'package:firebase_auth/firebase_auth.dart';
4 | import 'package:chat_app/models/usersmodel.dart';
5 | import 'package:chat_app/widgets/listusers_addbutton.dart';
6 |
7 | class SelectUserToChat extends StatefulWidget {
8 | final User? chatUser;
9 |
10 | const SelectUserToChat({
11 | Key? key,
12 | required this.chatUser,
13 | }) : super(key: key);
14 |
15 | @override
16 | State createState() => _SelectUserToChatState();
17 | }
18 |
19 | class _SelectUserToChatState extends State {
20 | @override
21 | Widget build(BuildContext context) {
22 | return Scaffold(
23 | appBar: AppBar(
24 | backgroundColor: Color(0xff2865DC),
25 | toolbarHeight: 130,
26 | title: Text("Select any User to Chat"),
27 | ),
28 | body: Container(child: ChatList(chatUser: widget.chatUser!)),
29 | );
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/lib/screens/splashhome_page.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:animated_splash_screen/animated_splash_screen.dart';
4 | import 'package:chat_app/screens/home_page.dart';
5 | import 'package:flutter/material.dart';
6 |
7 | class SplashPageHome extends StatefulWidget {
8 | const SplashPageHome({super.key});
9 |
10 | @override
11 | State createState() => _SplashPageHomeState();
12 | }
13 |
14 | class _SplashPageHomeState extends State {
15 | @override
16 | Widget build(BuildContext context) {
17 | return AnimatedSplashScreen(
18 | splash: Image.asset("assets/splash-logo.png"),
19 | nextScreen: HomePage(),
20 | duration: 5,
21 | splashIconSize: 70,
22 | splashTransition: SplashTransition.fadeTransition,
23 | );
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/lib/screens/splashlogin_page.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:animated_splash_screen/animated_splash_screen.dart';
4 | import 'package:chat_app/screens/login_page.dart';
5 | import 'package:flutter/material.dart';
6 |
7 | class SplashLoginPage extends StatefulWidget {
8 | const SplashLoginPage({super.key});
9 |
10 | @override
11 | State createState() => _SplashLoginPageState();
12 | }
13 |
14 | class _SplashLoginPageState extends State {
15 | @override
16 | Widget build(BuildContext context) {
17 | return AnimatedSplashScreen(
18 | splash: Image.asset("assets/splash-logo.png"),
19 | nextScreen: LoginPage(),
20 | duration: 4,
21 | splashIconSize: 70,
22 | splashTransition: SplashTransition.fadeTransition,
23 | );
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/lib/service/firebase_service.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'dart:developer';
3 |
4 | import 'package:cloud_firestore/cloud_firestore.dart';
5 | import 'package:firebase_auth/firebase_auth.dart';
6 | import 'package:firebase_core/firebase_core.dart';
7 |
8 | import 'package:flutter/services.dart';
9 | import 'package:flutter_easyloading/flutter_easyloading.dart';
10 | import 'package:google_sign_in/google_sign_in.dart';
11 |
12 | import '../models/usersmodel.dart';
13 |
14 | class FirebaseService {
15 | final FirebaseAuth _auth = FirebaseAuth.instance;
16 | final FirebaseFirestore _db = FirebaseFirestore.instance;
17 | final GoogleSignIn _googleSignIn = GoogleSignIn();
18 |
19 | Future signInWithGoogle() async {
20 | try {
21 | final GoogleSignInAccount? googleSignInAccount =
22 | await _googleSignIn.signIn();
23 | final GoogleSignInAuthentication googleSignInAuthentication =
24 | await googleSignInAccount!.authentication;
25 | final AuthCredential credential = GoogleAuthProvider.credential(
26 | accessToken: googleSignInAuthentication.accessToken,
27 | idToken: googleSignInAuthentication.idToken,
28 | );
29 | final UserCredential authResult =
30 | await _auth.signInWithCredential(credential);
31 | final User user = authResult.user!;
32 | EasyLoading.showInfo(
33 | "Logging In",
34 | dismissOnTap: true,
35 | duration: const Duration(seconds: 1),
36 | );
37 | ChatUser chatUser;
38 | final checkUser = await checkSignInDetailsToDb(user);
39 | chatUser = checkUser;
40 | if (checkUser.uid == null) {
41 | chatUser = await addSignInDetailsToDb(user);
42 | }
43 |
44 | return chatUser;
45 | } on PlatformException catch (err) {
46 | if (err.code == 'sign_in_canceled') {
47 | log(err.code);
48 | rethrow;
49 | } else {
50 | rethrow;
51 | }
52 | } on FirebaseAuthException catch (e) {
53 | log(e.code);
54 | rethrow;
55 | }
56 | }
57 |
58 | Future addSignInDetailsToDb(User? user) async {
59 | ChatUser chatuser = ChatUser();
60 |
61 | if (user == null) {
62 | } else {
63 | String uid = user.uid;
64 | ChatUser chatUser = ChatUser(
65 | uid: uid,
66 | username: user.displayName,
67 | email: user.email,
68 | phone: user.phoneNumber,
69 | profilepic: user.photoURL,
70 | );
71 | await _db.collection("Users").doc(uid).set(chatUser.toJson());
72 | chatuser = chatUser;
73 | }
74 | return chatuser;
75 | }
76 |
77 | Future checkSignInDetailsToDb(User? user) async {
78 | ChatUser chatuser = ChatUser();
79 |
80 | if (user == null) {
81 | } else {
82 | String uid = user.uid;
83 | final userDetails = await _db.collection("Users").doc(uid).get();
84 | if (userDetails.exists) {
85 | final userData = userDetails.data();
86 | ChatUser chatUser = ChatUser(
87 | uid: userData!['uid'],
88 | username: userData['username'],
89 | email: userData['email'],
90 | phone: userData['phone'],
91 | profilepic: userData['profilepic'],
92 | );
93 | chatuser = chatUser;
94 | }
95 | }
96 | return chatuser;
97 | }
98 |
99 | Future signOutFromGoogle() async {
100 | await _googleSignIn.signOut();
101 | await _auth.signOut();
102 | }
103 |
104 | static Future getUserModelbyId(String uid) async {
105 | ChatUser? chatUser;
106 |
107 | DocumentSnapshot docsnapshot =
108 | await FirebaseFirestore.instance.collection("Users").doc(uid).get();
109 |
110 | if (docsnapshot.data() != null) {
111 | chatUser = ChatUser.fromJson(docsnapshot.data() as Map);
112 | }
113 | return chatUser;
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/lib/widgets/about_userdata.dart:
--------------------------------------------------------------------------------
1 | import 'package:cloud_firestore/cloud_firestore.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:firebase_auth/firebase_auth.dart';
4 |
5 | class UserAbout extends StatefulWidget {
6 | const UserAbout({super.key});
7 |
8 | @override
9 | State createState() => _UserAboutState();
10 | }
11 |
12 | class _UserAboutState extends State {
13 | Stream _aboutStream() {
14 | return FirebaseFirestore.instance
15 | .collection("Users")
16 | .doc(FirebaseAuth.instance.currentUser!.uid)
17 | .snapshots();
18 | }
19 |
20 | @override
21 | Widget build(BuildContext context) {
22 | return StreamBuilder(
23 | stream: _aboutStream(),
24 | builder: (context, AsyncSnapshot snapshot) {
25 | if (snapshot.connectionState == ConnectionState.none) {
26 | return Text("No Internet Connection");
27 | } else if (snapshot.connectionState == ConnectionState.waiting) {
28 | return CircularProgressIndicator();
29 | }
30 | if (!snapshot.hasData) {
31 | return Icon(Icons.person);
32 | }
33 | dynamic data = snapshot.data;
34 | return Text(
35 | (data['about'] == null) ? "" : data['about'],
36 | );
37 | },
38 | );
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/lib/widgets/email_userdata.dart:
--------------------------------------------------------------------------------
1 | import 'package:cloud_firestore/cloud_firestore.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:firebase_auth/firebase_auth.dart';
4 |
5 | class UserEmail extends StatefulWidget {
6 | const UserEmail({super.key});
7 |
8 | @override
9 | State createState() => _UserEmailState();
10 | }
11 |
12 | class _UserEmailState extends State {
13 | Stream _emailStream() {
14 | return FirebaseFirestore.instance
15 | .collection("Users")
16 | .doc(FirebaseAuth.instance.currentUser!.uid)
17 | .snapshots();
18 | }
19 |
20 | @override
21 | Widget build(BuildContext context) {
22 | return StreamBuilder(
23 | stream: _emailStream(),
24 | builder: (context, AsyncSnapshot snapshot) {
25 | if (snapshot.connectionState == ConnectionState.none) {
26 | return Text("No Internet Connection");
27 | } else if (snapshot.connectionState == ConnectionState.waiting) {
28 | return CircularProgressIndicator();
29 | }
30 | if (!snapshot.hasData) {
31 | return Icon(Icons.person);
32 | }
33 | dynamic data = snapshot.data;
34 | return Text(
35 | (data['email'] == null) ? "" : data['email'],
36 | );
37 | },
38 | );
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/lib/widgets/listusers_addbutton.dart:
--------------------------------------------------------------------------------
1 | // ignore_for_file: public_member_api_docs, sort_constructors_first, use_build_context_synchronously
2 | import 'dart:developer';
3 |
4 | import 'package:chat_app/main.dart';
5 | import 'package:chat_app/models/chatgroupmodel.dart';
6 | import 'package:chat_app/models/chatroommodel.dart';
7 | import 'package:cloud_firestore/cloud_firestore.dart';
8 | import 'package:firebase_auth/firebase_auth.dart';
9 | import 'package:firebase_core/firebase_core.dart';
10 | import 'package:firebase_storage/firebase_storage.dart';
11 | import 'package:flutter/material.dart';
12 | import 'package:flutter/src/foundation/key.dart';
13 | import 'package:flutter/src/widgets/framework.dart';
14 |
15 | import 'package:chat_app/models/usersmodel.dart';
16 | import 'package:chat_app/screens/chat_page.dart';
17 | import 'package:uuid/uuid.dart';
18 |
19 | class ChatList extends StatefulWidget {
20 | final User chatUser;
21 |
22 | const ChatList({
23 | Key? key,
24 | required this.chatUser,
25 | }) : super(key: key);
26 |
27 | @override
28 | State createState() => _ChatListState();
29 | }
30 |
31 | class _ChatListState extends State {
32 | final ChatUser chatuser = ChatUser();
33 | FirebaseFirestore database = FirebaseFirestore.instance;
34 | final FirebaseAuth _auth = FirebaseAuth.instance;
35 |
36 | late Stream>> stream;
37 |
38 | Future getChatroomModel(ChatUser targetuser) async {
39 | ChatRoomModel chatRoom;
40 |
41 | QuerySnapshot chatroomsnapshot = await database
42 | .collection("Chatrooms")
43 | .where("participants.${widget.chatUser.uid}", isEqualTo: true)
44 | .where("participants.${targetuser.uid}", isEqualTo: true)
45 | .get();
46 |
47 | if (chatroomsnapshot.docs.length > 0) {
48 | log("Chatroom already exists");
49 | var docdata = chatroomsnapshot.docs[0].data();
50 | ChatRoomModel existingchatroom =
51 | ChatRoomModel.fromJson(docdata as Map);
52 |
53 | chatRoom = existingchatroom;
54 | } else {
55 | ChatRoomModel newchatroom = ChatRoomModel(
56 | chatroomid: uuid.v1(),
57 | lastmessage: "",
58 | participants: {
59 | widget.chatUser.uid.toString(): true,
60 | targetuser.uid.toString(): true,
61 | },
62 | time: DateTime.now(),
63 | );
64 |
65 | await FirebaseFirestore.instance
66 | .collection("Chatrooms")
67 | .doc(newchatroom.chatroomid)
68 | .set(newchatroom.toJson());
69 | log("New Chatroom created");
70 |
71 | chatRoom = newchatroom;
72 | }
73 | return chatRoom;
74 | }
75 |
76 | @override
77 | void initState() {
78 | final user = _auth.currentUser;
79 | stream = FirebaseFirestore.instance
80 | .collection('Users')
81 | .where("uid", isNotEqualTo: user!.uid)
82 | .snapshots();
83 | super.initState();
84 | }
85 |
86 | @override
87 | Widget build(BuildContext context) {
88 | final user = _auth.currentUser;
89 | return StreamBuilder(
90 | stream: stream,
91 | builder: (BuildContext context, AsyncSnapshot snapshot) {
92 | // snapshot.data.docs[index];
93 | if (!snapshot.hasData) {
94 | return Center(
95 | child: CircularProgressIndicator(),
96 | );
97 | }
98 | QuerySnapshot datasnapshot = snapshot.data as QuerySnapshot;
99 | if (datasnapshot.docs.length > 0) {
100 | return ListView.builder(
101 | itemCount: datasnapshot.docs.length,
102 | padding: EdgeInsets.symmetric(horizontal: 23, vertical: 40),
103 | itemBuilder: (context, index) {
104 | var document = datasnapshot.docs[index];
105 | Map chatuser =
106 | datasnapshot.docs[index].data() as Map;
107 |
108 | ChatUser addtochatUser = ChatUser.fromJson(chatuser);
109 | return Padding(
110 | padding: const EdgeInsets.only(
111 | bottom: 10,
112 | ),
113 | child: ListTile(
114 | leading: CircleAvatar(
115 | radius: 30,
116 | backgroundImage: NetworkImage(document['profilepic']),
117 | ),
118 | title: Text(document['username']),
119 | tileColor: Colors.white,
120 | subtitle: Text((document['about'] == null)
121 | ? ""
122 | : document['about'].toString()),
123 | trailing: Icon(Icons.arrow_right),
124 | onTap: () async {
125 | ChatRoomModel? chatroommodel =
126 | await getChatroomModel(addtochatUser);
127 | if (chatroommodel != null) {
128 | Navigator.push(
129 | context,
130 | MaterialPageRoute(
131 | builder: (context) => ChatPage(
132 | targetuser: addtochatUser,
133 | firebaseuser: user!,
134 | chatroom: chatroommodel,
135 | currentuser: user,
136 | ),
137 | ),
138 | );
139 | }
140 | },
141 | ),
142 | );
143 | },
144 | );
145 | } else {
146 | return Text("No Users found");
147 | }
148 | });
149 | }
150 | }
151 |
--------------------------------------------------------------------------------
/lib/widgets/login_button.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class LoginButton extends StatelessWidget {
4 | double height;
5 | double width;
6 | Widget child;
7 | Color buttoncolor;
8 | double radius;
9 | VoidCallback? onPressed;
10 | LoginButton({
11 | Key? key,
12 | required this.height,
13 | required this.width,
14 | required this.child,
15 | required this.buttoncolor,
16 | required this.radius,
17 | this.onPressed,
18 | }) : super(key: key);
19 |
20 | @override
21 | Widget build(BuildContext context) {
22 | return TextButton(
23 | onPressed: onPressed,
24 | child: Container(
25 | height: height,
26 | width: width,
27 | decoration: BoxDecoration(
28 | color: buttoncolor, borderRadius: BorderRadius.circular(radius)),
29 | child: Center(child: child),
30 | ),
31 | );
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/lib/widgets/logintohome.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class LoginToHome extends StatefulWidget {
4 | const LoginToHome({super.key});
5 |
6 | @override
7 | State createState() => _LoginToHomeState();
8 | }
9 |
10 | class _LoginToHomeState extends State {
11 | @override
12 | Widget build(BuildContext context) {
13 | return Navigator();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/lib/widgets/name_userdata.dart:
--------------------------------------------------------------------------------
1 | import 'package:cloud_firestore/cloud_firestore.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:firebase_auth/firebase_auth.dart';
4 |
5 | class UserName extends StatefulWidget {
6 | const UserName({super.key});
7 |
8 | @override
9 | State createState() => _UserNameState();
10 | }
11 |
12 | class _UserNameState extends State {
13 | Stream _nameStream() {
14 | return FirebaseFirestore.instance
15 | .collection("Users")
16 | .doc(FirebaseAuth.instance.currentUser!.uid)
17 | .snapshots();
18 | }
19 |
20 | @override
21 | Widget build(BuildContext context) {
22 | return StreamBuilder(
23 | stream: _nameStream(),
24 | builder: (context, AsyncSnapshot snapshot) {
25 | if (snapshot.connectionState == ConnectionState.none) {
26 | return Text("No Internet Connection");
27 | } else if (snapshot.connectionState == ConnectionState.waiting) {
28 | return CircularProgressIndicator();
29 | }
30 | if (!snapshot.hasData) {
31 | return Icon(Icons.person);
32 | }
33 | dynamic data = snapshot.data;
34 | return Text(
35 | (data['username'] == null) ? "" : data['username'],
36 | );
37 | },
38 | );
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/lib/widgets/phone_userdata.dart:
--------------------------------------------------------------------------------
1 | import 'package:cloud_firestore/cloud_firestore.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:firebase_auth/firebase_auth.dart';
4 |
5 | class UserPhone extends StatefulWidget {
6 | const UserPhone({super.key});
7 |
8 | @override
9 | State createState() => _UserPhoneState();
10 | }
11 |
12 | class _UserPhoneState extends State {
13 | Stream _phoneStream() {
14 | return FirebaseFirestore.instance
15 | .collection("Users")
16 | .doc(FirebaseAuth.instance.currentUser!.uid)
17 | .snapshots();
18 | }
19 |
20 | @override
21 | Widget build(BuildContext context) {
22 | return StreamBuilder(
23 | stream: _phoneStream(),
24 | builder: (context, AsyncSnapshot snapshot) {
25 | if (snapshot.connectionState == ConnectionState.none) {
26 | return Text("No Internet Connection");
27 | } else if (snapshot.connectionState == ConnectionState.waiting) {
28 | return CircularProgressIndicator();
29 | }
30 | if (!snapshot.hasData) {
31 | return Icon(Icons.person);
32 | }
33 | dynamic data = snapshot.data;
34 | return Text(
35 | (data['phone'] == null) ? "" : data['phone'],
36 | );
37 | },
38 | );
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/lib/widgets/previewimage_chatpage.dart:
--------------------------------------------------------------------------------
1 | // ignore_for_file: public_member_api_docs, sort_constructors_first
2 | import 'dart:io';
3 |
4 | import 'package:camera/camera.dart';
5 | import 'package:cloud_firestore/cloud_firestore.dart';
6 | import 'package:firebase_auth/firebase_auth.dart';
7 | import 'package:firebase_storage/firebase_storage.dart';
8 | import 'package:flutter/material.dart';
9 |
10 | import 'package:chat_app/main.dart';
11 | import 'package:chat_app/models/messagemodel.dart';
12 | import 'package:chat_app/screens/chat_page.dart';
13 |
14 | import '../models/chatroommodel.dart';
15 | import '../models/usersmodel.dart';
16 |
17 | class PreviewImage extends StatefulWidget {
18 | final XFile? picture;
19 | final ChatRoomModel chatroom;
20 | final User currentuser;
21 | final ChatUser targetuser;
22 | const PreviewImage({
23 | Key? key,
24 | required this.picture,
25 | required this.chatroom,
26 | required this.currentuser,
27 | required this.targetuser,
28 | }) : super(key: key);
29 |
30 | @override
31 | State createState() => _PreviewImageState();
32 | }
33 |
34 | class _PreviewImageState extends State {
35 | void sendMessage() async {
36 | final File msgfile = File(widget.picture!.path);
37 |
38 | UploadTask uploadTask = FirebaseStorage.instance
39 | .ref("messagepics")
40 | .child(widget.chatroom.chatroomid.toString())
41 | .child(uuid.v1())
42 | .putFile(msgfile);
43 |
44 | TaskSnapshot snapshot = await uploadTask;
45 |
46 | String? imgUrl = await snapshot.ref.getDownloadURL();
47 |
48 | MessageModel newMessage = MessageModel(
49 | messageid: uuid.v1(),
50 | msgimg: imgUrl,
51 | sender: widget.currentuser.uid,
52 | seen: false,
53 | timecreated: DateTime.now(),
54 | );
55 | await FirebaseFirestore.instance
56 | .collection("Chatrooms")
57 | .doc(widget.chatroom.chatroomid)
58 | .collection("Messages")
59 | .doc(newMessage.messageid)
60 | .set(newMessage.toJson());
61 |
62 | widget.chatroom.lastmsgtime = DateTime.now();
63 | widget.chatroom.lastmessage = imgUrl;
64 |
65 | await FirebaseFirestore.instance
66 | .collection("Chatrooms")
67 | .doc(widget.chatroom.chatroomid)
68 | .set(widget.chatroom.toJson());
69 | }
70 |
71 | @override
72 | Widget build(BuildContext context) {
73 | return Scaffold(
74 | floatingActionButton: FloatingActionButton(
75 | onPressed: () {
76 | sendMessage();
77 | Navigator.pop(context, MaterialPageRoute(builder: ((context) {
78 | return ChatPage(
79 | targetuser: widget.targetuser,
80 | chatroom: widget.chatroom,
81 | currentuser: widget.currentuser,
82 | firebaseuser: widget.currentuser);
83 | })));
84 | },
85 | backgroundColor: Color(0xff2865DC),
86 | child: Center(
87 | child: Image.asset(
88 | "assets/send1.png",
89 | width: 38,
90 | color: Colors.white,
91 | //height: 70,
92 | ),
93 | ),
94 | ),
95 | backgroundColor: Colors.black,
96 | appBar: AppBar(
97 | title: const Text(
98 | 'Send Image',
99 | ),
100 | backgroundColor: Colors.black,
101 | ),
102 | body: Center(
103 | child: Column(
104 | mainAxisSize: MainAxisSize.min,
105 | children: [
106 | Image.file(
107 | File(widget.picture!.path),
108 | fit: BoxFit.contain,
109 | width: MediaQuery.of(context).size.width,
110 | height: MediaQuery.of(context).size.height * 0.8,
111 | ),
112 | const SizedBox(height: 24),
113 | Text(widget.picture!.name)
114 | ],
115 | ),
116 | ),
117 | );
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/lib/widgets/profile_image_homepage.dart:
--------------------------------------------------------------------------------
1 | import 'package:cloud_firestore/cloud_firestore.dart';
2 | import 'package:firebase_auth/firebase_auth.dart';
3 | import 'package:flutter/material.dart';
4 |
5 | class LogedInUserPic extends StatefulWidget {
6 | const LogedInUserPic({Key? key}) : super(key: key);
7 |
8 | @override
9 | State createState() => _LogedInUserPicState();
10 | }
11 |
12 | class _LogedInUserPicState extends State {
13 | Stream _imageStream() {
14 | return FirebaseFirestore.instance
15 | .collection("Users")
16 | .doc(FirebaseAuth.instance.currentUser!.uid)
17 | .snapshots();
18 | }
19 |
20 | @override
21 | Widget build(BuildContext context) {
22 | return StreamBuilder(
23 | stream: _imageStream(),
24 | builder: (context, AsyncSnapshot snapshot) {
25 | if (snapshot.connectionState == ConnectionState.none) {
26 | return Text("No Internet Connection");
27 | } else if (snapshot.connectionState == ConnectionState.waiting) {
28 | return CircularProgressIndicator();
29 | }
30 | if (!snapshot.hasData) {
31 | return Icon(Icons.person);
32 | }
33 | dynamic data = snapshot.data;
34 | return CircleAvatar(
35 | maxRadius: 80,
36 | backgroundImage: NetworkImage(data['profilepic']),
37 | );
38 | },
39 | );
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/lib/widgets/showmessage.dart:
--------------------------------------------------------------------------------
1 | // ignore_for_file: public_member_api_docs, sort_constructors_first
2 | import 'dart:io';
3 |
4 | import 'package:chat_app/models/messagemodel.dart';
5 | import 'package:chat_app/widgets/viewmessagepicture.dart';
6 | import 'package:cloud_firestore/cloud_firestore.dart';
7 | import 'package:flutter/material.dart';
8 | import 'package:firebase_auth/firebase_auth.dart';
9 | import 'package:chat_app/models/chatroommodel.dart';
10 | import 'package:chat_app/models/usersmodel.dart';
11 | import 'package:google_fonts/google_fonts.dart';
12 | import 'package:intl/intl.dart';
13 |
14 | class ShowMessages extends StatefulWidget {
15 | final ChatRoomModel chatroom;
16 | final User chatuser;
17 | final ChatUser targetuser;
18 |
19 | const ShowMessages({
20 | Key? key,
21 | required this.chatroom,
22 | required this.chatuser,
23 | required this.targetuser,
24 | }) : super(key: key);
25 |
26 | @override
27 | State createState() => _ShowMessagesState();
28 | }
29 |
30 | class _ShowMessagesState extends State {
31 | late Stream>> stream;
32 | @override
33 | void initState() {
34 | stream = FirebaseFirestore.instance
35 | .collection("Chatrooms")
36 | .doc(widget.chatroom.chatroomid)
37 | .collection("Messages")
38 | .orderBy("timecreated", descending: true)
39 | .snapshots();
40 | super.initState();
41 | }
42 |
43 | @override
44 | Widget build(BuildContext context) {
45 | return StreamBuilder(
46 | stream: stream,
47 | builder: ((context, snapshot) {
48 | if (snapshot.connectionState == ConnectionState.active) {
49 | if (snapshot.hasData) {
50 | QuerySnapshot datasnapshot = snapshot.data as QuerySnapshot;
51 | return ListView.builder(
52 | reverse: true,
53 | itemCount: datasnapshot.docs.length,
54 | itemBuilder: (context, index) {
55 | MessageModel newmessage = MessageModel.fromJson(
56 | datasnapshot.docs[index].data()
57 | as Map);
58 | return Row(
59 | mainAxisAlignment:
60 | (newmessage.sender == widget.chatuser.uid)
61 | ? MainAxisAlignment.end
62 | : MainAxisAlignment.start,
63 | children: [
64 | Container(
65 | margin: EdgeInsets.symmetric(
66 | vertical: 10,
67 | horizontal: 10,
68 | ),
69 | padding: EdgeInsets.symmetric(
70 | horizontal: 10,
71 | vertical: 10,
72 | ),
73 | decoration: BoxDecoration(
74 | color: (newmessage.sender == widget.chatuser.uid)
75 | ? Color(0xff2865DC)
76 | : Color(0xffFFFFFF),
77 | borderRadius: BorderRadius.circular(10),
78 | shape: BoxShape.rectangle,
79 | boxShadow: [
80 | BoxShadow(
81 | color:
82 | (newmessage.sender == widget.chatuser.uid)
83 | ? Color(0xffE4E9F6)
84 | : Color(0xffE1E1E1),
85 | blurRadius: 10,
86 | blurStyle: BlurStyle.normal,
87 | offset: Offset(0, 4),
88 | ),
89 | ]),
90 | child: Column(
91 | crossAxisAlignment: CrossAxisAlignment.start,
92 | mainAxisAlignment: MainAxisAlignment.start,
93 | children: [
94 | (newmessage.msgimg == null &&
95 | newmessage.messagetext
96 | .toString()
97 | .isNotEmpty)
98 | ? Text(
99 | newmessage.messagetext.toString(),
100 | style: GoogleFonts.inter(
101 | fontSize: 16,
102 | color: (newmessage.sender ==
103 | widget.chatuser.uid)
104 | ? Colors.white
105 | : Colors.black,
106 | ),
107 | )
108 | : GestureDetector(
109 | onTap: () {
110 | Navigator.push(context,
111 | MaterialPageRoute(
112 | builder: (context) {
113 | return ViewMessagePic(
114 | image: newmessage.msgimg.toString(),
115 | );
116 | }));
117 | },
118 | child: Image.network(
119 | newmessage.msgimg.toString(),
120 | width: 250,
121 | height: 330,
122 | ),
123 | ),
124 | SizedBox(
125 | height: 5,
126 | ),
127 | Row(
128 | mainAxisAlignment:
129 | MainAxisAlignment.spaceBetween,
130 | //crossAxisAlignment: CrossAxisAlignment.end,
131 | children: [
132 | Text(
133 | DateFormat.jm()
134 | .format(newmessage.timecreated!),
135 | style: GoogleFonts.inter(
136 | fontSize: 11,
137 | fontWeight: FontWeight.w300,
138 | color: (newmessage.sender ==
139 | widget.chatuser.uid)
140 | ? Colors.white
141 | : Colors.black,
142 | ),
143 | ),
144 | (newmessage.sender == widget.chatuser.uid)
145 | ? Icon(
146 | Icons.check,
147 | size: 16,
148 | color: (newmessage.sender ==
149 | widget.chatuser.uid)
150 | ? Colors.white
151 | : Colors.black,
152 | )
153 | : Text(""),
154 | ],
155 | )
156 | ],
157 | ),
158 | ),
159 | ],
160 | );
161 | });
162 | } else if (snapshot.hasError) {
163 | return Text("Internet Connection Error");
164 | } else {
165 | return Text("Say Hi");
166 | }
167 | } else {
168 | return Center(
169 | child: CircularProgressIndicator(),
170 | );
171 | }
172 | }));
173 | }
174 | }
175 |
--------------------------------------------------------------------------------
/lib/widgets/userinfo_popup.dart:
--------------------------------------------------------------------------------
1 | // ignore_for_file: public_member_api_docs, sort_constructors_first
2 | import 'package:flutter/material.dart';
3 | import 'package:google_fonts/google_fonts.dart';
4 |
5 | class UserInfoPop {
6 | BuildContext context;
7 | TextEditingController textcontroller;
8 | Widget title;
9 | int maxlength;
10 | void Function(String)? onSubmitingcomplete;
11 | String hinttext;
12 | TextInputType keyboardtype;
13 | VoidCallback updatedata;
14 |
15 | UserInfoPop({
16 | required this.context,
17 | required this.textcontroller,
18 | required this.title,
19 | required this.maxlength,
20 | required this.onSubmitingcomplete,
21 | required this.hinttext,
22 | required this.keyboardtype,
23 | required this.updatedata,
24 | });
25 |
26 | Future popup() {
27 | return showDialog(
28 | context: context,
29 | builder: ((context) {
30 | return AlertDialog(
31 | title: title,
32 | content: TextField(
33 | autofocus: true,
34 | controller: textcontroller,
35 | maxLength: maxlength,
36 | keyboardType: keyboardtype,
37 | textInputAction: TextInputAction.done,
38 | onSubmitted: onSubmitingcomplete,
39 | decoration: InputDecoration(
40 | hintText: hinttext,
41 | ),
42 | ),
43 | actions: [
44 | // TextButton(
45 | // onPressed: () {
46 | // updatedata;
47 | // Navigator.of(context).pop(textcontroller.text.trim());
48 | // textcontroller.clear();
49 | // },
50 | // child: Text(
51 | // "Save",
52 | // style: GoogleFonts.acme(color: Colors.cyan),
53 | // ),
54 | // )
55 | ],
56 | );
57 | }),
58 | );
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/lib/widgets/viewmessagepicture.dart:
--------------------------------------------------------------------------------
1 | // ignore_for_file: public_member_api_docs, sort_constructors_first
2 | import 'package:flutter/material.dart';
3 | import 'package:photo_view/photo_view.dart';
4 |
5 | class ViewMessagePic extends StatefulWidget {
6 | final String image;
7 |
8 | const ViewMessagePic({
9 | Key? key,
10 | required this.image,
11 | }) : super(key: key);
12 |
13 | @override
14 | State createState() => _ViewMessagePicState();
15 | }
16 |
17 | class _ViewMessagePicState extends State {
18 | @override
19 | Widget build(BuildContext context) {
20 | return Scaffold(
21 | appBar: AppBar(
22 | backgroundColor: Colors.transparent,
23 | ),
24 | backgroundColor: Colors.black,
25 | body: Container(
26 | margin: EdgeInsets.symmetric(horizontal: 20, vertical: 30),
27 | child: Center(
28 | child: PhotoView(
29 | imageProvider: NetworkImage(widget.image),
30 | minScale: PhotoViewComputedScale.contained * 0.8,
31 | maxScale: PhotoViewComputedScale.covered * 2,
32 | initialScale: PhotoViewComputedScale.contained * 1.1,
33 | )
34 | // child: Image.network(
35 | // widget.image,
36 | // ),
37 | ),
38 | ),
39 | );
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/lib/widgets/viewuserprofilepic.dart:
--------------------------------------------------------------------------------
1 | // ignore_for_file: public_member_api_docs, sort_constructors_first
2 | import 'package:chat_app/widgets/profile_image_homepage.dart';
3 | import 'package:cloud_firestore/cloud_firestore.dart';
4 | import 'package:flutter/material.dart';
5 | import 'package:photo_view/photo_view.dart';
6 | import 'package:chat_app/models/usersmodel.dart';
7 | import 'package:firebase_auth/firebase_auth.dart';
8 |
9 | class ViewUserProfilePic extends StatefulWidget {
10 | const ViewUserProfilePic({
11 | Key? key,
12 | }) : super(key: key);
13 |
14 | @override
15 | State createState() => _ViewUserProfilePicState();
16 | }
17 |
18 | class _ViewUserProfilePicState extends State {
19 | @override
20 | Widget build(BuildContext context) {
21 | return Scaffold(
22 | backgroundColor: Colors.black,
23 | appBar: AppBar(
24 | toolbarHeight: 60,
25 | backgroundColor: Colors.black,
26 | ),
27 | body: Center(
28 | child: UserProfilePic(),
29 | ),
30 | );
31 | }
32 | }
33 |
34 | class UserProfilePic extends StatefulWidget {
35 | const UserProfilePic({super.key});
36 |
37 | @override
38 | State createState() => _UserProfilePicState();
39 | }
40 |
41 | class _UserProfilePicState extends State {
42 | Stream _imageStream() {
43 | return FirebaseFirestore.instance
44 | .collection("Users")
45 | .doc(FirebaseAuth.instance.currentUser!.uid)
46 | .snapshots();
47 | }
48 |
49 | @override
50 | Widget build(BuildContext context) {
51 | return StreamBuilder(
52 | stream: _imageStream(),
53 | builder: (context, AsyncSnapshot snapshot) {
54 | if (snapshot.connectionState == ConnectionState.none) {
55 | return Text("No Internet Connection");
56 | } else if (snapshot.connectionState == ConnectionState.waiting) {
57 | return CircularProgressIndicator();
58 | }
59 | if (!snapshot.hasData) {
60 | return Icon(Icons.person);
61 | }
62 | dynamic data = snapshot.data;
63 | return Image.network(
64 | data['profilepic'],
65 | );
66 | },
67 | );
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/linux/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral
2 |
--------------------------------------------------------------------------------
/linux/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Project-level configuration.
2 | cmake_minimum_required(VERSION 3.10)
3 | project(runner LANGUAGES CXX)
4 |
5 | # The name of the executable created for the application. Change this to change
6 | # the on-disk name of your application.
7 | set(BINARY_NAME "chat_app")
8 | # The unique GTK application identifier for this application. See:
9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID
10 | set(APPLICATION_ID "com.example.chat_app")
11 |
12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
13 | # versions of CMake.
14 | cmake_policy(SET CMP0063 NEW)
15 |
16 | # Load bundled libraries from the lib/ directory relative to the binary.
17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
18 |
19 | # Root filesystem for cross-building.
20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT)
21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT})
22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})
23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
27 | endif()
28 |
29 | # Define build configuration options.
30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
31 | set(CMAKE_BUILD_TYPE "Debug" CACHE
32 | STRING "Flutter build mode" FORCE)
33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
34 | "Debug" "Profile" "Release")
35 | endif()
36 |
37 | # Compilation settings that should be applied to most targets.
38 | #
39 | # Be cautious about adding new options here, as plugins use this function by
40 | # default. In most cases, you should add new options to specific targets instead
41 | # of modifying this function.
42 | function(APPLY_STANDARD_SETTINGS TARGET)
43 | target_compile_features(${TARGET} PUBLIC cxx_std_14)
44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror)
45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>")
46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>")
47 | endfunction()
48 |
49 | # Flutter library and tool build rules.
50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
51 | add_subdirectory(${FLUTTER_MANAGED_DIR})
52 |
53 | # System-level dependencies.
54 | find_package(PkgConfig REQUIRED)
55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
56 |
57 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
58 |
59 | # Define the application target. To change its name, change BINARY_NAME above,
60 | # not the value here, or `flutter run` will no longer work.
61 | #
62 | # Any new source files that you add to the application should be added here.
63 | add_executable(${BINARY_NAME}
64 | "main.cc"
65 | "my_application.cc"
66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
67 | )
68 |
69 | # Apply the standard set of build settings. This can be removed for applications
70 | # that need different build settings.
71 | apply_standard_settings(${BINARY_NAME})
72 |
73 | # Add dependency libraries. Add any application-specific dependencies here.
74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter)
75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
76 |
77 | # Run the Flutter tool portions of the build. This must not be removed.
78 | add_dependencies(${BINARY_NAME} flutter_assemble)
79 |
80 | # Only the install-generated bundle's copy of the executable will launch
81 | # correctly, since the resources must in the right relative locations. To avoid
82 | # people trying to run the unbundled copy, put it in a subdirectory instead of
83 | # the default top-level location.
84 | set_target_properties(${BINARY_NAME}
85 | PROPERTIES
86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
87 | )
88 |
89 | # Generated plugin build rules, which manage building the plugins and adding
90 | # them to the application.
91 | include(flutter/generated_plugins.cmake)
92 |
93 |
94 | # === Installation ===
95 | # By default, "installing" just makes a relocatable bundle in the build
96 | # directory.
97 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
98 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
99 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
100 | endif()
101 |
102 | # Start with a clean build bundle directory every time.
103 | install(CODE "
104 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")
105 | " COMPONENT Runtime)
106 |
107 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
108 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
109 |
110 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
111 | COMPONENT Runtime)
112 |
113 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
114 | COMPONENT Runtime)
115 |
116 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
117 | COMPONENT Runtime)
118 |
119 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
120 | install(FILES "${bundled_library}"
121 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
122 | COMPONENT Runtime)
123 | endforeach(bundled_library)
124 |
125 | # Fully re-copy the assets directory on each build to avoid having stale files
126 | # from a previous install.
127 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
128 | install(CODE "
129 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
130 | " COMPONENT Runtime)
131 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
132 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
133 |
134 | # Install the AOT library on non-Debug builds only.
135 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
136 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
137 | COMPONENT Runtime)
138 | endif()
139 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
11 | void fl_register_plugins(FlPluginRegistry* registry) {
12 | g_autoptr(FlPluginRegistrar) emoji_picker_flutter_registrar =
13 | fl_plugin_registry_get_registrar_for_plugin(registry, "EmojiPickerFlutterPlugin");
14 | emoji_picker_flutter_plugin_register_with_registrar(emoji_picker_flutter_registrar);
15 | }
16 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/linux/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | emoji_picker_flutter
7 | )
8 |
9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
10 | )
11 |
12 | set(PLUGIN_BUNDLED_LIBRARIES)
13 |
14 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
19 | endforeach(plugin)
20 |
21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
24 | endforeach(ffi_plugin)
25 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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, "chat_app");
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, "chat_app");
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 |
--------------------------------------------------------------------------------
/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/.gitignore:
--------------------------------------------------------------------------------
1 | # Flutter-related
2 | **/Flutter/ephemeral/
3 | **/Pods/
4 |
5 | # Xcode-related
6 | **/dgph
7 | **/xcuserdata/
8 |
--------------------------------------------------------------------------------
/macos/Flutter/Flutter-Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "ephemeral/Flutter-Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/macos/Flutter/Flutter-Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "ephemeral/Flutter-Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/macos/Flutter/GeneratedPluginRegistrant.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | import FlutterMacOS
6 | import Foundation
7 |
8 | import cloud_firestore
9 | import emoji_picker_flutter
10 | import firebase_auth
11 | import firebase_core
12 | import firebase_database
13 | import firebase_storage
14 | import path_provider_macos
15 | import shared_preferences_macos
16 |
17 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
18 | FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin"))
19 | EmojiPickerFlutterPlugin.register(with: registry.registrar(forPlugin: "EmojiPickerFlutterPlugin"))
20 | FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin"))
21 | FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
22 | FLTFirebaseDatabasePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseDatabasePlugin"))
23 | FLTFirebaseStoragePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseStoragePlugin"))
24 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
25 | SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
26 | }
27 |
--------------------------------------------------------------------------------
/macos/Podfile:
--------------------------------------------------------------------------------
1 | platform :osx, '10.12'
2 |
3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
5 |
6 | project 'Runner', {
7 | 'Debug' => :debug,
8 | 'Profile' => :release,
9 | 'Release' => :release,
10 | }
11 |
12 | def flutter_root
13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
14 | unless File.exist?(generated_xcode_build_settings_path)
15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
16 | end
17 |
18 | File.foreach(generated_xcode_build_settings_path) do |line|
19 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
20 | return matches[1].strip if matches
21 | end
22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
23 | end
24 |
25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
26 |
27 | flutter_macos_podfile_setup
28 |
29 | target 'Runner' do
30 | use_frameworks!
31 | use_modular_headers!
32 |
33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
34 | end
35 |
36 | post_install do |installer|
37 | installer.pods_project.targets.each do |target|
38 | flutter_additional_macos_build_settings(target)
39 | end
40 | end
41 |
--------------------------------------------------------------------------------
/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/macos/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png
--------------------------------------------------------------------------------
/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 = chat_app
9 |
10 | // The application's bundle identifier
11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.chatApp
12 |
13 | // The copyright displayed in application information
14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved.
15 |
--------------------------------------------------------------------------------
/macos/Runner/Configs/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Debug.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/macos/Runner/Configs/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Release.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/macos/Runner/GoogleService-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CLIENT_ID
6 | 653162562389-7ctthls8387kfh2nd6hchdhh3e2dirjm.apps.googleusercontent.com
7 | REVERSED_CLIENT_ID
8 | com.googleusercontent.apps.653162562389-7ctthls8387kfh2nd6hchdhh3e2dirjm
9 | API_KEY
10 | AIzaSyCrTd4H8xllknYDODJo1j-2EkhR8TlvOA4
11 | GCM_SENDER_ID
12 | 653162562389
13 | PLIST_VERSION
14 | 1
15 | BUNDLE_ID
16 | com.example.chatApp
17 | PROJECT_ID
18 | chat-app-9ce0c
19 | STORAGE_BUCKET
20 | chat-app-9ce0c.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:653162562389:ios:58eb4c477596f1763765dc
33 |
34 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/macos/Runner/Release.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/macos/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:653162562389:ios:58eb4c477596f1763765dc",
5 | "FIREBASE_PROJECT_ID": "chat-app-9ce0c",
6 | "GCM_SENDER_ID": "653162562389"
7 | }
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: chat_app
2 | description: A new Flutter project.
3 |
4 | # The following line prevents the package from being accidentally published to
5 | # pub.dev using `flutter pub publish`. This is preferred for private packages.
6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev
7 |
8 | # The following defines the version and build number for your application.
9 | # A version number is three numbers separated by dots, like 1.2.43
10 | # followed by an optional build number separated by a +.
11 | # Both the version and the builder number may be overridden in flutter
12 | # build by specifying --build-name and --build-number, respectively.
13 | # In Android, build-name is used as versionName while build-number used as versionCode.
14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
16 | # Read more about iOS versioning at
17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
18 | version: 1.0.0+1
19 |
20 | environment:
21 | sdk: ">=2.17.1 <3.0.0"
22 |
23 | # Dependencies specify other packages that your package needs in order to work.
24 | # To automatically upgrade your package dependencies to the latest versions
25 | # consider running `flutter pub upgrade --major-versions`. Alternatively,
26 | # dependencies can be manually updated by changing the version numbers below to
27 | # the latest version available on pub.dev. To see which dependencies have newer
28 | # versions available, run `flutter pub outdated`.
29 | dependencies:
30 | flutter:
31 | sdk: flutter
32 | json_annotation: ^4.7.0
33 |
34 | # The following adds the Cupertino Icons font to your application.
35 | # Use with the CupertinoIcons class for iOS style icons.
36 | cupertino_icons: ^1.0.2
37 | google_fonts: ^3.0.1
38 |
39 |
40 | firebase_storage: ^11.0.6
41 | cloud_firestore: ^4.1.0
42 | fluttertoast: ^8.1.1
43 |
44 | image_picker: ^0.8.6
45 |
46 | intl: ^0.17.0
47 | photo_view: ^0.14.0
48 | provider: ^6.0.4
49 |
50 |
51 | firebase_database: ^10.0.6
52 | image_cropper: ^3.0.1
53 | email_validator: ^2.1.17
54 | uuid: ^3.0.7
55 | flutter_easyloading: ^3.0.5
56 | camera: ^0.10.0+4
57 | emoji_picker_flutter: ^1.5.1
58 | animated_splash_screen: ^1.3.0
59 |
60 |
61 | dev_dependencies:
62 | flutter_test:
63 | sdk: flutter
64 | build_runner: ^2.3.2
65 | json_serializable: ^6.5.4
66 |
67 | # The "flutter_lints" package below contains a set of recommended lints to
68 | # encourage good coding practices. The lint set provided by the package is
69 | # activated in the `analysis_options.yaml` file located at the root of your
70 | # package. See that file for information about deactivating specific lint
71 | # rules and activating additional ones.
72 | flutter_lints: ^2.0.0
73 | firebase_core: ^2.3.0
74 | firebase_auth: ^4.1.4
75 | google_sign_in: ^5.4.2
76 |
77 | # For information on the generic Dart part of this file, see the
78 | # following page: https://dart.dev/tools/pub/pubspec
79 |
80 | # The following section is specific to Flutter packages.
81 | flutter:
82 |
83 | # The following line ensures that the Material Icons font is
84 | # included with your application, so that you can use the icons in
85 | # the material Icons class.
86 | uses-material-design: true
87 | assets:
88 | - assets/
89 | # To add assets to your application, add an assets section, like this:
90 | # assets:
91 | # - images/a_dot_burr.jpeg
92 | # - images/a_dot_ham.jpeg
93 |
94 | # An image asset can refer to one or more resolution-specific "variants", see
95 | # https://flutter.dev/assets-and-images/#resolution-aware
96 |
97 | # For details regarding adding assets from package dependencies, see
98 | # https://flutter.dev/assets-and-images/#from-packages
99 |
100 | # To add custom fonts to your application, add a fonts section here,
101 | # in this "flutter" section. Each entry in this list should have a
102 | # "family" key with the font family name, and a "fonts" key with a
103 | # list giving the asset and other descriptors for the font. For
104 | # example:
105 | # fonts:
106 | # - family: Schyler
107 | # fonts:
108 | # - asset: fonts/Schyler-Regular.ttf
109 | # - asset: fonts/Schyler-Italic.ttf
110 | # style: italic
111 | # - family: Trajan Pro
112 | # fonts:
113 | # - asset: fonts/TrajanPro.ttf
114 | # - asset: fonts/TrajanPro_Bold.ttf
115 | # weight: 700
116 | #
117 | # For details regarding fonts from package dependencies,
118 | # see https://flutter.dev/custom-fonts/#from-packages
119 |
--------------------------------------------------------------------------------
/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:chat_app/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 |
--------------------------------------------------------------------------------
/web/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/web/favicon.png
--------------------------------------------------------------------------------
/web/icons/Icon-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/web/icons/Icon-192.png
--------------------------------------------------------------------------------
/web/icons/Icon-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/web/icons/Icon-512.png
--------------------------------------------------------------------------------
/web/icons/Icon-maskable-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/web/icons/Icon-maskable-192.png
--------------------------------------------------------------------------------
/web/icons/Icon-maskable-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/web/icons/Icon-maskable-512.png
--------------------------------------------------------------------------------
/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | chat_app
33 |
34 |
35 |
39 |
40 |
41 |
42 |
43 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/web/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "chat_app",
3 | "short_name": "chat_app",
4 | "start_url": ".",
5 | "display": "standalone",
6 | "background_color": "#0175C2",
7 | "theme_color": "#0175C2",
8 | "description": "A new Flutter 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/.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 |
--------------------------------------------------------------------------------
/windows/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Project-level configuration.
2 | cmake_minimum_required(VERSION 3.14)
3 | project(chat_app LANGUAGES CXX)
4 |
5 | # The name of the executable created for the application. Change this to change
6 | # the on-disk name of your application.
7 | set(BINARY_NAME "chat_app")
8 |
9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
10 | # versions of CMake.
11 | cmake_policy(SET CMP0063 NEW)
12 |
13 | # Define build configuration option.
14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
15 | if(IS_MULTICONFIG)
16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
17 | CACHE STRING "" FORCE)
18 | else()
19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
20 | set(CMAKE_BUILD_TYPE "Debug" CACHE
21 | STRING "Flutter build mode" FORCE)
22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
23 | "Debug" "Profile" "Release")
24 | endif()
25 | endif()
26 | # Define settings for the Profile build mode.
27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
31 |
32 | # Use Unicode for all projects.
33 | add_definitions(-DUNICODE -D_UNICODE)
34 |
35 | # Compilation settings that should be applied to most targets.
36 | #
37 | # Be cautious about adding new options here, as plugins use this function by
38 | # default. In most cases, you should add new options to specific targets instead
39 | # of modifying this function.
40 | function(APPLY_STANDARD_SETTINGS TARGET)
41 | target_compile_features(${TARGET} PUBLIC cxx_std_17)
42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
43 | target_compile_options(${TARGET} PRIVATE /EHsc)
44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>")
46 | endfunction()
47 |
48 | # Flutter library and tool build rules.
49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
50 | add_subdirectory(${FLUTTER_MANAGED_DIR})
51 |
52 | # Application build; see runner/CMakeLists.txt.
53 | add_subdirectory("runner")
54 |
55 | # Generated plugin build rules, which manage building the plugins and adding
56 | # them to the application.
57 | include(flutter/generated_plugins.cmake)
58 |
59 |
60 | # === Installation ===
61 | # Support files are copied into place next to the executable, so that it can
62 | # run in place. This is done instead of making a separate bundle (as on Linux)
63 | # so that building and running from within Visual Studio will work.
64 | set(BUILD_BUNDLE_DIR "$")
65 | # Make the "install" step default, as it's required to run.
66 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
67 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
68 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
69 | endif()
70 |
71 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
72 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
73 |
74 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
75 | COMPONENT Runtime)
76 |
77 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
78 | COMPONENT Runtime)
79 |
80 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
81 | COMPONENT Runtime)
82 |
83 | if(PLUGIN_BUNDLED_LIBRARIES)
84 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
85 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
86 | COMPONENT Runtime)
87 | endif()
88 |
89 | # Fully re-copy the assets directory on each build to avoid having stale files
90 | # from a previous install.
91 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
92 | install(CODE "
93 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
94 | " COMPONENT Runtime)
95 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
96 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
97 |
98 | # Install the AOT library on non-Debug builds only.
99 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
100 | CONFIGURATIONS Profile;Release
101 | COMPONENT Runtime)
102 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
11 | void RegisterPlugins(flutter::PluginRegistry* registry) {
12 | EmojiPickerFlutterPluginCApiRegisterWithRegistrar(
13 | registry->GetRegistrarForPlugin("EmojiPickerFlutterPluginCApi"));
14 | }
15 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/windows/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | emoji_picker_flutter
7 | )
8 |
9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
10 | )
11 |
12 | set(PLUGIN_BUNDLED_LIBRARIES)
13 |
14 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
19 | endforeach(plugin)
20 |
21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
24 | endforeach(ffi_plugin)
25 |
--------------------------------------------------------------------------------
/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 | # Disable Windows macros that collide with C++ standard library functions.
24 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
25 |
26 | # Add dependency libraries and include directories. Add any application-specific
27 | # dependencies here.
28 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
29 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
30 |
31 | # Run the Flutter tool portions of the build. This must not be removed.
32 | add_dependencies(${BINARY_NAME} flutter_assemble)
33 |
--------------------------------------------------------------------------------
/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 | #ifdef FLUTTER_BUILD_NUMBER
64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
65 | #else
66 | #define VERSION_AS_NUMBER 1,0,0
67 | #endif
68 |
69 | #ifdef FLUTTER_BUILD_NAME
70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME
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.example" "\0"
93 | VALUE "FileDescription", "chat_app" "\0"
94 | VALUE "FileVersion", VERSION_AS_STRING "\0"
95 | VALUE "InternalName", "chat_app" "\0"
96 | VALUE "LegalCopyright", "Copyright (C) 2022 com.example. All rights reserved." "\0"
97 | VALUE "OriginalFilename", "chat_app.exe" "\0"
98 | VALUE "ProductName", "chat_app" "\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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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"chat_app", 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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/windows/runner/resources/app_icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/appstree-io/flutter_chating_demo_app/cc53d584d2ee31c534e9dec83714e5e4086f4ed7/windows/runner/resources/app_icon.ico
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/windows/runner/win32_window.cpp:
--------------------------------------------------------------------------------
1 | #include "win32_window.h"
2 |
3 | #include
4 |
5 | #include "resource.h"
6 |
7 | namespace {
8 |
9 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW";
10 |
11 | // The number of Win32Window objects that currently exist.
12 | static int g_active_window_count = 0;
13 |
14 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd);
15 |
16 | // Scale helper to convert logical scaler values to physical using passed in
17 | // scale factor
18 | int Scale(int source, double scale_factor) {
19 | return static_cast(source * scale_factor);
20 | }
21 |
22 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module.
23 | // This API is only needed for PerMonitor V1 awareness mode.
24 | void EnableFullDpiSupportIfAvailable(HWND hwnd) {
25 | HMODULE user32_module = LoadLibraryA("User32.dll");
26 | if (!user32_module) {
27 | return;
28 | }
29 | auto enable_non_client_dpi_scaling =
30 | reinterpret_cast(
31 | GetProcAddress(user32_module, "EnableNonClientDpiScaling"));
32 | if (enable_non_client_dpi_scaling != nullptr) {
33 | enable_non_client_dpi_scaling(hwnd);
34 | FreeLibrary(user32_module);
35 | }
36 | }
37 |
38 | } // namespace
39 |
40 | // Manages the Win32Window's window class registration.
41 | class WindowClassRegistrar {
42 | public:
43 | ~WindowClassRegistrar() = default;
44 |
45 | // Returns the singleton registar instance.
46 | static WindowClassRegistrar* GetInstance() {
47 | if (!instance_) {
48 | instance_ = new WindowClassRegistrar();
49 | }
50 | return instance_;
51 | }
52 |
53 | // Returns the name of the window class, registering the class if it hasn't
54 | // previously been registered.
55 | const wchar_t* GetWindowClass();
56 |
57 | // Unregisters the window class. Should only be called if there are no
58 | // instances of the window.
59 | void UnregisterWindowClass();
60 |
61 | private:
62 | WindowClassRegistrar() = default;
63 |
64 | static WindowClassRegistrar* instance_;
65 |
66 | bool class_registered_ = false;
67 | };
68 |
69 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr;
70 |
71 | const wchar_t* WindowClassRegistrar::GetWindowClass() {
72 | if (!class_registered_) {
73 | WNDCLASS window_class{};
74 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW);
75 | window_class.lpszClassName = kWindowClassName;
76 | window_class.style = CS_HREDRAW | CS_VREDRAW;
77 | window_class.cbClsExtra = 0;
78 | window_class.cbWndExtra = 0;
79 | window_class.hInstance = GetModuleHandle(nullptr);
80 | window_class.hIcon =
81 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON));
82 | window_class.hbrBackground = 0;
83 | window_class.lpszMenuName = nullptr;
84 | window_class.lpfnWndProc = Win32Window::WndProc;
85 | RegisterClass(&window_class);
86 | class_registered_ = true;
87 | }
88 | return kWindowClassName;
89 | }
90 |
91 | void WindowClassRegistrar::UnregisterWindowClass() {
92 | UnregisterClass(kWindowClassName, nullptr);
93 | class_registered_ = false;
94 | }
95 |
96 | Win32Window::Win32Window() {
97 | ++g_active_window_count;
98 | }
99 |
100 | Win32Window::~Win32Window() {
101 | --g_active_window_count;
102 | Destroy();
103 | }
104 |
105 | bool Win32Window::CreateAndShow(const std::wstring& title,
106 | const Point& origin,
107 | const Size& size) {
108 | Destroy();
109 |
110 | const wchar_t* window_class =
111 | WindowClassRegistrar::GetInstance()->GetWindowClass();
112 |
113 | const POINT target_point = {static_cast(origin.x),
114 | static_cast(origin.y)};
115 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST);
116 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor);
117 | double scale_factor = dpi / 96.0;
118 |
119 | HWND window = CreateWindow(
120 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE,
121 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor),
122 | Scale(size.width, scale_factor), Scale(size.height, scale_factor),
123 | nullptr, nullptr, GetModuleHandle(nullptr), this);
124 |
125 | if (!window) {
126 | return false;
127 | }
128 |
129 | return OnCreate();
130 | }
131 |
132 | // static
133 | LRESULT CALLBACK Win32Window::WndProc(HWND const window,
134 | UINT const message,
135 | WPARAM const wparam,
136 | LPARAM const lparam) noexcept {
137 | if (message == WM_NCCREATE) {
138 | auto window_struct = reinterpret_cast(lparam);
139 | SetWindowLongPtr(window, GWLP_USERDATA,
140 | reinterpret_cast(window_struct->lpCreateParams));
141 |
142 | auto that = static_cast(window_struct->lpCreateParams);
143 | EnableFullDpiSupportIfAvailable(window);
144 | that->window_handle_ = window;
145 | } else if (Win32Window* that = GetThisFromHandle(window)) {
146 | return that->MessageHandler(window, message, wparam, lparam);
147 | }
148 |
149 | return DefWindowProc(window, message, wparam, lparam);
150 | }
151 |
152 | LRESULT
153 | Win32Window::MessageHandler(HWND hwnd,
154 | UINT const message,
155 | WPARAM const wparam,
156 | LPARAM const lparam) noexcept {
157 | switch (message) {
158 | case WM_DESTROY:
159 | window_handle_ = nullptr;
160 | Destroy();
161 | if (quit_on_close_) {
162 | PostQuitMessage(0);
163 | }
164 | return 0;
165 |
166 | case WM_DPICHANGED: {
167 | auto newRectSize = reinterpret_cast(lparam);
168 | LONG newWidth = newRectSize->right - newRectSize->left;
169 | LONG newHeight = newRectSize->bottom - newRectSize->top;
170 |
171 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth,
172 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE);
173 |
174 | return 0;
175 | }
176 | case WM_SIZE: {
177 | RECT rect = GetClientArea();
178 | if (child_content_ != nullptr) {
179 | // Size and position the child window.
180 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left,
181 | rect.bottom - rect.top, TRUE);
182 | }
183 | return 0;
184 | }
185 |
186 | case WM_ACTIVATE:
187 | if (child_content_ != nullptr) {
188 | SetFocus(child_content_);
189 | }
190 | return 0;
191 | }
192 |
193 | return DefWindowProc(window_handle_, message, wparam, lparam);
194 | }
195 |
196 | void Win32Window::Destroy() {
197 | OnDestroy();
198 |
199 | if (window_handle_) {
200 | DestroyWindow(window_handle_);
201 | window_handle_ = nullptr;
202 | }
203 | if (g_active_window_count == 0) {
204 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass();
205 | }
206 | }
207 |
208 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept {
209 | return reinterpret_cast(
210 | GetWindowLongPtr(window, GWLP_USERDATA));
211 | }
212 |
213 | void Win32Window::SetChildContent(HWND content) {
214 | child_content_ = content;
215 | SetParent(content, window_handle_);
216 | RECT frame = GetClientArea();
217 |
218 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left,
219 | frame.bottom - frame.top, true);
220 |
221 | SetFocus(child_content_);
222 | }
223 |
224 | RECT Win32Window::GetClientArea() {
225 | RECT frame;
226 | GetClientRect(window_handle_, &frame);
227 | return frame;
228 | }
229 |
230 | HWND Win32Window::GetHandle() {
231 | return window_handle_;
232 | }
233 |
234 | void Win32Window::SetQuitOnClose(bool quit_on_close) {
235 | quit_on_close_ = quit_on_close;
236 | }
237 |
238 | bool Win32Window::OnCreate() {
239 | // No-op; provided for subclasses.
240 | return true;
241 | }
242 |
243 | void Win32Window::OnDestroy() {
244 | // No-op; provided for subclasses.
245 | }
246 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------