├── .github
├── ISSUE_TEMPLATE
│ └── bug_report.md
└── workflows
│ └── dart.yml
├── .gitignore
├── .metadata
├── README.md
├── android
├── .gitignore
├── app
│ ├── build.gradle
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── thealphamerc
│ │ │ │ └── flutter_chat_app
│ │ │ │ └── MainActivity.java
│ │ └── res
│ │ │ ├── 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
│ │ │ └── styles.xml
│ │ └── profile
│ │ └── AndroidManifest.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
└── settings.gradle
├── ios
├── .gitignore
├── Flutter
│ ├── AppFrameworkInfo.plist
│ ├── Debug.xcconfig
│ └── Release.xcconfig
├── Podfile
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ └── contents.xcworkspacedata
└── Runner
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── Icon-App-1024x1024@1x.png
│ │ ├── Icon-App-20x20@1x.png
│ │ ├── Icon-App-20x20@2x.png
│ │ ├── Icon-App-20x20@3x.png
│ │ ├── Icon-App-29x29@1x.png
│ │ ├── Icon-App-29x29@2x.png
│ │ ├── Icon-App-29x29@3x.png
│ │ ├── Icon-App-40x40@1x.png
│ │ ├── Icon-App-40x40@2x.png
│ │ ├── Icon-App-40x40@3x.png
│ │ ├── Icon-App-60x60@2x.png
│ │ ├── Icon-App-60x60@3x.png
│ │ ├── Icon-App-76x76@1x.png
│ │ ├── Icon-App-76x76@2x.png
│ │ └── Icon-App-83.5x83.5@2x.png
│ └── LaunchImage.imageset
│ │ ├── Contents.json
│ │ ├── LaunchImage.png
│ │ ├── LaunchImage@2x.png
│ │ ├── LaunchImage@3x.png
│ │ └── README.md
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ └── Runner-Bridging-Header.h
├── lib
├── helper
│ ├── enum.dart
│ ├── logger.dart
│ ├── routes.dart
│ └── utility.dart
├── locator.dart
├── main.dart
├── model
│ ├── chat_message.dart
│ └── user.dart
├── page
│ ├── chat_screen.dart
│ ├── home_page.dart
│ ├── login.dart
│ ├── profile_page.dart
│ ├── search_page.dart
│ ├── splash.dart
│ └── welcomPage.dart
├── service
│ ├── auth_service.dart
│ ├── firebase_service.dart
│ └── repository.dart
├── state
│ ├── app_state.dart
│ ├── auth_state.dart
│ └── chat_state.dart
├── theme
│ ├── dark_clolor.dart
│ ├── extentions.dart
│ ├── styles.dart
│ └── theme.dart
└── widgets
│ ├── bottomMenuBar.dart
│ ├── customRoute.dart
│ └── customWidgets.dart
├── pubspec.lock
├── pubspec.yaml
└── test
└── widget_test.dart
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Desktop (please complete the following information):**
27 | - OS: [e.g. iOS]
28 | - Browser [e.g. chrome, safari]
29 | - Version [e.g. 22]
30 |
31 | **Smartphone (please complete the following information):**
32 | - Device: [e.g. iPhone6]
33 | - OS: [e.g. iOS8.1]
34 | - Browser [e.g. stock browser, safari]
35 | - Version [e.g. 22]
36 |
37 | **Additional context**
38 | Add any other context about the problem here.
39 |
--------------------------------------------------------------------------------
/.github/workflows/dart.yml:
--------------------------------------------------------------------------------
1 | name: Dart CI
2 |
3 | on: [push]
4 |
5 | jobs:
6 | build-and-test:
7 | runs-on: ubuntu-latest
8 | steps:
9 | - uses: actions/checkout@v1
10 | - uses: actions/setup-java@v1
11 | with:
12 | java-version: '12.x'
13 | - uses: subosito/flutter-action@v1
14 | with:
15 | channel: 'stable'
16 | # Get flutter packages
17 | - run: flutter pub get
18 | # Build :D
19 | - run: flutter build aot
20 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | .dart_tool/
26 | .flutter-plugins
27 | .packages
28 | .pub-cache/
29 | .pub/
30 | /build/
31 |
32 | # Android related
33 | **/android/**/gradle-wrapper.jar
34 | **/android/.gradle
35 | **/android/captures/
36 | **/android/gradlew
37 | **/android/gradlew.bat
38 | **/android/local.properties
39 | **/android/**/GeneratedPluginRegistrant.java
40 | **/android/app/google-services.json
41 |
42 | # iOS/XCode related
43 | **/ios/**/*.mode1v3
44 | **/ios/**/*.mode2v3
45 | **/ios/**/*.moved-aside
46 | **/ios/**/*.pbxuser
47 | **/ios/**/*.perspectivev3
48 | **/ios/**/*sync/
49 | **/ios/**/.sconsign.dblite
50 | **/ios/**/.tags*
51 | **/ios/**/.vagrant/
52 | **/ios/**/DerivedData/
53 | **/ios/**/Icon?
54 | **/ios/**/Pods/
55 | **/ios/**/.symlinks/
56 | **/ios/**/profile
57 | **/ios/**/xcuserdata
58 | **/ios/.generated/
59 | **/ios/Flutter/App.framework
60 | **/ios/Flutter/Flutter.framework
61 | **/ios/Flutter/Generated.xcconfig
62 | **/ios/Flutter/app.flx
63 | **/ios/Flutter/app.zip
64 | **/ios/Flutter/flutter_assets/
65 | **/ios/Flutter/flutter_export_environment.sh
66 | **/ios/ServiceDefinitions.json
67 | **/ios/Runner/GeneratedPluginRegistrant.*
68 | **/ios/Runner/GoogleService-Info.plist
69 | /Users/ashwindas/Desktop/Workspace/Git Projects/flutter_twitter_clone/ios/Runner/GoogleService-Info.plist
70 | GoogleService-Info.plist
71 |
72 | # Exceptions to above rules.
73 | !**/ios/**/default.mode1v3
74 | !**/ios/**/default.mode2v3
75 | !**/ios/**/default.pbxuser
76 | !**/ios/**/default.perspectivev3
77 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
78 | .flutter-plugins-dependencies
79 | android/app/google-services.json
80 | google-services.json
--------------------------------------------------------------------------------
/.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 and should not be manually edited.
5 |
6 | version:
7 | revision: 0b8abb4724aa590dd0f429683339b1e045a1594d
8 | channel: stable
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## Flutter Messanger - Flutter Based Twitter Clone  [](https://github.com/login?return_to=%2FTheAlphamerc%flutter_wallet_app) 
3 |      [](https://github.com/Thealphamerc/flutter_chat_app)
4 |
5 | A messenger app built in flutter framework using Firebase auth,realtime database and storage.
6 |
7 | ## Contributing
8 |
9 | If you wish to contribute a change to any of the existing feature or add new in this repo
10 | send a [pull request](https://github.com/TheAlphamerc/flutter_chat_app/pulls). I welcome and encourage all pull requests. It usually will take me within 24-48 hours to respond to any issue or request.
11 |
12 | ## Created & Maintained By
13 |
14 | [Sonu Sharma](https://github.com/TheAlphamerc) ([Twitter](https://www.twitter.com/TheAlphamerc)) ([Youtube](https://www.youtube.com/user/sonusharma045sonu/)) ([Insta](https://www.instagram.com/_sonu_sharma__)) ([Dev.to](https://dev.to/thealphamerc))
15 | 
16 |
17 | > If you found this project helpful or you learned something from the source code and want to thank me, consider buying me a cup of :coffee:
18 | >
19 | > * [PayPal](paypal.me/shubhamsinghchahar/)
20 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | *.class
3 | .gradle
4 | /local.properties
5 | /.idea/workspace.xml
6 | /.idea/libraries
7 | .DS_Store
8 | /build
9 | /captures
10 | GeneratedPluginRegistrant.java
11 | /app/google-services.json
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
26 |
27 | android {
28 | compileSdkVersion 28
29 |
30 | lintOptions {
31 | disable 'InvalidPackage'
32 | }
33 |
34 | defaultConfig {
35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
36 | applicationId "com.thealphamerc.flutter_chat_app"
37 | minSdkVersion 16
38 | targetSdkVersion 28
39 | versionCode flutterVersionCode.toInteger()
40 | versionName flutterVersionName
41 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
42 | multiDexEnabled true
43 | }
44 |
45 | buildTypes {
46 | release {
47 | // TODO: Add your own signing config for the release build.
48 | // Signing with the debug keys for now, so `flutter run --release` works.
49 | signingConfig signingConfigs.debug
50 | }
51 | }
52 | }
53 |
54 | flutter {
55 | source '../..'
56 | }
57 |
58 | dependencies {
59 | testImplementation 'junit:junit:4.12'
60 | androidTestImplementation 'androidx.test:runner:1.1.1'
61 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
62 | implementation 'com.android.support:multidex:1.0.3'
63 | }
64 | apply plugin: 'com.google.gms.google-services'
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
8 |
12 |
19 |
20 |
21 |
22 |
23 |
24 |
26 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/thealphamerc/flutter_chat_app/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.thealphamerc.flutter_chat_app;
2 |
3 | import androidx.annotation.NonNull;
4 | import io.flutter.embedding.android.FlutterActivity;
5 | import io.flutter.embedding.engine.FlutterEngine;
6 | import io.flutter.plugins.GeneratedPluginRegistrant;
7 |
8 | public class MainActivity extends FlutterActivity {
9 | @Override
10 | public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
11 | GeneratedPluginRegistrant.registerWith(flutterEngine);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/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/TheAlphamerc/flutter_chat_app/91fcdcd6ae319a679a7d2a35a195c215dba0e388/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheAlphamerc/flutter_chat_app/91fcdcd6ae319a679a7d2a35a195c215dba0e388/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheAlphamerc/flutter_chat_app/91fcdcd6ae319a679a7d2a35a195c215dba0e388/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheAlphamerc/flutter_chat_app/91fcdcd6ae319a679a7d2a35a195c215dba0e388/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheAlphamerc/flutter_chat_app/91fcdcd6ae319a679a7d2a35a195c215dba0e388/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | google()
4 | jcenter()
5 | }
6 |
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:3.5.0'
9 | classpath 'com.google.gms:google-services:4.3.3'
10 | }
11 | }
12 |
13 | allprojects {
14 | repositories {
15 | google()
16 | jcenter()
17 | }
18 | }
19 |
20 | rootProject.buildDir = '../build'
21 | subprojects {
22 | project.buildDir = "${rootProject.buildDir}/${project.name}"
23 | }
24 | subprojects {
25 | project.evaluationDependsOn(':app')
26 | }
27 |
28 | task clean(type: Delete) {
29 | delete rootProject.buildDir
30 | }
31 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.enableR8=true
3 | android.useAndroidX=true
4 | android.enableJetifier=true
5 |
--------------------------------------------------------------------------------
/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-5.6.2-all.zip
7 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
4 |
5 | def plugins = new Properties()
6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7 | if (pluginsFile.exists()) {
8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
9 | }
10 |
11 | plugins.each { name, path ->
12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13 | include ":$name"
14 | project(":$name").projectDir = pluginDirectory
15 | }
16 |
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | *.mode1v3
2 | *.mode2v3
3 | *.moved-aside
4 | *.pbxuser
5 | *.perspectivev3
6 | **/*sync/
7 | .sconsign.dblite
8 | .tags*
9 | **/.vagrant/
10 | **/DerivedData/
11 | Icon?
12 | **/Pods/
13 | **/.symlinks/
14 | profile
15 | xcuserdata
16 | **/.generated/
17 | Flutter/App.framework
18 | Flutter/Flutter.framework
19 | Flutter/Flutter.podspec
20 | Flutter/Generated.xcconfig
21 | Flutter/app.flx
22 | Flutter/app.zip
23 | Flutter/flutter_assets/
24 | Flutter/flutter_export_environment.sh
25 | ServiceDefinitions.json
26 | Runner/GeneratedPluginRegistrant.*
27 |
28 | # Exceptions to above rules.
29 | !default.mode1v3
30 | !default.mode2v3
31 | !default.pbxuser
32 | !default.perspectivev3
33 |
--------------------------------------------------------------------------------
/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
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 | 8.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 |
--------------------------------------------------------------------------------
/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '9.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 parse_KV_file(file, separator='=')
14 | file_abs_path = File.expand_path(file)
15 | if !File.exists? file_abs_path
16 | return [];
17 | end
18 | generated_key_values = {}
19 | skip_line_start_symbols = ["#", "/"]
20 | File.foreach(file_abs_path) do |line|
21 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
22 | plugin = line.split(pattern=separator)
23 | if plugin.length == 2
24 | podname = plugin[0].strip()
25 | path = plugin[1].strip()
26 | podpath = File.expand_path("#{path}", file_abs_path)
27 | generated_key_values[podname] = podpath
28 | else
29 | puts "Invalid plugin specification: #{line}"
30 | end
31 | end
32 | generated_key_values
33 | end
34 |
35 | target 'Runner' do
36 | use_frameworks!
37 | use_modular_headers!
38 |
39 | # Flutter Pod
40 |
41 | copied_flutter_dir = File.join(__dir__, 'Flutter')
42 | copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
43 | copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
44 | unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
45 | # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
46 | # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
47 | # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
48 |
49 | generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
50 | unless File.exist?(generated_xcode_build_settings_path)
51 | raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
52 | end
53 | generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
54 | cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];
55 |
56 | unless File.exist?(copied_framework_path)
57 | FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
58 | end
59 | unless File.exist?(copied_podspec_path)
60 | FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
61 | end
62 | end
63 |
64 | # Keep pod path relative so it can be checked into Podfile.lock.
65 | pod 'Flutter', :path => 'Flutter'
66 |
67 | # Plugin Pods
68 |
69 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
70 | # referring to absolute paths on developers' machines.
71 | system('rm -rf .symlinks')
72 | system('mkdir -p .symlinks/plugins')
73 | plugin_pods = parse_KV_file('../.flutter-plugins')
74 | plugin_pods.each do |name, path|
75 | symlink = File.join('.symlinks', 'plugins', name)
76 | File.symlink(path, symlink)
77 | pod name, :path => File.join(symlink, 'ios')
78 | end
79 | end
80 |
81 | # Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
82 | install! 'cocoapods', :disable_input_output_paths => true
83 |
84 | post_install do |installer|
85 | installer.pods_project.targets.each do |target|
86 | target.build_configurations.each do |config|
87 | config.build_settings['ENABLE_BITCODE'] = 'NO'
88 | end
89 | end
90 | end
91 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
12 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
14 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
15 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
16 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
17 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
18 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
19 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
20 | /* End PBXBuildFile section */
21 |
22 | /* Begin PBXCopyFilesBuildPhase section */
23 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
24 | isa = PBXCopyFilesBuildPhase;
25 | buildActionMask = 2147483647;
26 | dstPath = "";
27 | dstSubfolderSpec = 10;
28 | files = (
29 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
30 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
31 | );
32 | name = "Embed Frameworks";
33 | runOnlyForDeploymentPostprocessing = 0;
34 | };
35 | /* End PBXCopyFilesBuildPhase section */
36 |
37 | /* Begin PBXFileReference section */
38 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
39 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
40 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
41 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; };
42 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
43 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
44 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
45 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
46 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
47 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; };
48 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
49 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
50 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
51 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
52 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
53 | /* End PBXFileReference section */
54 |
55 | /* Begin PBXFrameworksBuildPhase section */
56 | 97C146EB1CF9000F007C117D /* Frameworks */ = {
57 | isa = PBXFrameworksBuildPhase;
58 | buildActionMask = 2147483647;
59 | files = (
60 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
61 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
62 | );
63 | runOnlyForDeploymentPostprocessing = 0;
64 | };
65 | /* End PBXFrameworksBuildPhase section */
66 |
67 | /* Begin PBXGroup section */
68 | 9740EEB11CF90186004384FC /* Flutter */ = {
69 | isa = PBXGroup;
70 | children = (
71 | 3B80C3931E831B6300D905FE /* App.framework */,
72 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
73 | 9740EEBA1CF902C7004384FC /* Flutter.framework */,
74 | 9740EEB21CF90195004384FC /* Debug.xcconfig */,
75 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
76 | 9740EEB31CF90195004384FC /* Generated.xcconfig */,
77 | );
78 | name = Flutter;
79 | sourceTree = "";
80 | };
81 | 97C146E51CF9000F007C117D = {
82 | isa = PBXGroup;
83 | children = (
84 | 9740EEB11CF90186004384FC /* Flutter */,
85 | 97C146F01CF9000F007C117D /* Runner */,
86 | 97C146EF1CF9000F007C117D /* Products */,
87 | );
88 | sourceTree = "";
89 | };
90 | 97C146EF1CF9000F007C117D /* Products */ = {
91 | isa = PBXGroup;
92 | children = (
93 | 97C146EE1CF9000F007C117D /* Runner.app */,
94 | );
95 | name = Products;
96 | sourceTree = "";
97 | };
98 | 97C146F01CF9000F007C117D /* Runner */ = {
99 | isa = PBXGroup;
100 | children = (
101 | 97C146FA1CF9000F007C117D /* Main.storyboard */,
102 | 97C146FD1CF9000F007C117D /* Assets.xcassets */,
103 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
104 | 97C147021CF9000F007C117D /* Info.plist */,
105 | 97C146F11CF9000F007C117D /* Supporting Files */,
106 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
107 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
108 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
109 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
110 | );
111 | path = Runner;
112 | sourceTree = "";
113 | };
114 | 97C146F11CF9000F007C117D /* Supporting Files */ = {
115 | isa = PBXGroup;
116 | children = (
117 | );
118 | name = "Supporting Files";
119 | sourceTree = "";
120 | };
121 | /* End PBXGroup section */
122 |
123 | /* Begin PBXNativeTarget section */
124 | 97C146ED1CF9000F007C117D /* Runner */ = {
125 | isa = PBXNativeTarget;
126 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
127 | buildPhases = (
128 | 9740EEB61CF901F6004384FC /* Run Script */,
129 | 97C146EA1CF9000F007C117D /* Sources */,
130 | 97C146EB1CF9000F007C117D /* Frameworks */,
131 | 97C146EC1CF9000F007C117D /* Resources */,
132 | 9705A1C41CF9048500538489 /* Embed Frameworks */,
133 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
134 | );
135 | buildRules = (
136 | );
137 | dependencies = (
138 | );
139 | name = Runner;
140 | productName = Runner;
141 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
142 | productType = "com.apple.product-type.application";
143 | };
144 | /* End PBXNativeTarget section */
145 |
146 | /* Begin PBXProject section */
147 | 97C146E61CF9000F007C117D /* Project object */ = {
148 | isa = PBXProject;
149 | attributes = {
150 | LastUpgradeCheck = 1020;
151 | ORGANIZATIONNAME = "The Chromium Authors";
152 | TargetAttributes = {
153 | 97C146ED1CF9000F007C117D = {
154 | CreatedOnToolsVersion = 7.3.1;
155 | LastSwiftMigration = 1100;
156 | };
157 | };
158 | };
159 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
160 | compatibilityVersion = "Xcode 3.2";
161 | developmentRegion = en;
162 | hasScannedForEncodings = 0;
163 | knownRegions = (
164 | en,
165 | Base,
166 | );
167 | mainGroup = 97C146E51CF9000F007C117D;
168 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
169 | projectDirPath = "";
170 | projectRoot = "";
171 | targets = (
172 | 97C146ED1CF9000F007C117D /* Runner */,
173 | );
174 | };
175 | /* End PBXProject section */
176 |
177 | /* Begin PBXResourcesBuildPhase section */
178 | 97C146EC1CF9000F007C117D /* Resources */ = {
179 | isa = PBXResourcesBuildPhase;
180 | buildActionMask = 2147483647;
181 | files = (
182 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
183 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
184 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
185 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
186 | );
187 | runOnlyForDeploymentPostprocessing = 0;
188 | };
189 | /* End PBXResourcesBuildPhase section */
190 |
191 | /* Begin PBXShellScriptBuildPhase section */
192 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
193 | isa = PBXShellScriptBuildPhase;
194 | buildActionMask = 2147483647;
195 | files = (
196 | );
197 | inputPaths = (
198 | );
199 | name = "Thin Binary";
200 | outputPaths = (
201 | );
202 | runOnlyForDeploymentPostprocessing = 0;
203 | shellPath = /bin/sh;
204 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
205 | };
206 | 9740EEB61CF901F6004384FC /* Run Script */ = {
207 | isa = PBXShellScriptBuildPhase;
208 | buildActionMask = 2147483647;
209 | files = (
210 | );
211 | inputPaths = (
212 | );
213 | name = "Run Script";
214 | outputPaths = (
215 | );
216 | runOnlyForDeploymentPostprocessing = 0;
217 | shellPath = /bin/sh;
218 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
219 | };
220 | /* End PBXShellScriptBuildPhase section */
221 |
222 | /* Begin PBXSourcesBuildPhase section */
223 | 97C146EA1CF9000F007C117D /* Sources */ = {
224 | isa = PBXSourcesBuildPhase;
225 | buildActionMask = 2147483647;
226 | files = (
227 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
228 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
229 | );
230 | runOnlyForDeploymentPostprocessing = 0;
231 | };
232 | /* End PBXSourcesBuildPhase section */
233 |
234 | /* Begin PBXVariantGroup section */
235 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
236 | isa = PBXVariantGroup;
237 | children = (
238 | 97C146FB1CF9000F007C117D /* Base */,
239 | );
240 | name = Main.storyboard;
241 | sourceTree = "";
242 | };
243 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
244 | isa = PBXVariantGroup;
245 | children = (
246 | 97C147001CF9000F007C117D /* Base */,
247 | );
248 | name = LaunchScreen.storyboard;
249 | sourceTree = "";
250 | };
251 | /* End PBXVariantGroup section */
252 |
253 | /* Begin XCBuildConfiguration section */
254 | 249021D3217E4FDB00AE95B9 /* Profile */ = {
255 | isa = XCBuildConfiguration;
256 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
257 | buildSettings = {
258 | ALWAYS_SEARCH_USER_PATHS = NO;
259 | CLANG_ANALYZER_NONNULL = YES;
260 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
261 | CLANG_CXX_LIBRARY = "libc++";
262 | CLANG_ENABLE_MODULES = YES;
263 | CLANG_ENABLE_OBJC_ARC = YES;
264 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
265 | CLANG_WARN_BOOL_CONVERSION = YES;
266 | CLANG_WARN_COMMA = YES;
267 | CLANG_WARN_CONSTANT_CONVERSION = YES;
268 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
269 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
270 | CLANG_WARN_EMPTY_BODY = YES;
271 | CLANG_WARN_ENUM_CONVERSION = YES;
272 | CLANG_WARN_INFINITE_RECURSION = YES;
273 | CLANG_WARN_INT_CONVERSION = YES;
274 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
275 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
276 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
277 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
278 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
279 | CLANG_WARN_STRICT_PROTOTYPES = YES;
280 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
281 | CLANG_WARN_UNREACHABLE_CODE = YES;
282 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
283 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
284 | COPY_PHASE_STRIP = NO;
285 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
286 | ENABLE_NS_ASSERTIONS = NO;
287 | ENABLE_STRICT_OBJC_MSGSEND = YES;
288 | GCC_C_LANGUAGE_STANDARD = gnu99;
289 | GCC_NO_COMMON_BLOCKS = YES;
290 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
291 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
292 | GCC_WARN_UNDECLARED_SELECTOR = YES;
293 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
294 | GCC_WARN_UNUSED_FUNCTION = YES;
295 | GCC_WARN_UNUSED_VARIABLE = YES;
296 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
297 | MTL_ENABLE_DEBUG_INFO = NO;
298 | SDKROOT = iphoneos;
299 | SUPPORTED_PLATFORMS = iphoneos;
300 | TARGETED_DEVICE_FAMILY = "1,2";
301 | VALIDATE_PRODUCT = YES;
302 | };
303 | name = Profile;
304 | };
305 | 249021D4217E4FDB00AE95B9 /* Profile */ = {
306 | isa = XCBuildConfiguration;
307 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
308 | buildSettings = {
309 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
310 | CLANG_ENABLE_MODULES = YES;
311 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
312 | ENABLE_BITCODE = NO;
313 | FRAMEWORK_SEARCH_PATHS = (
314 | "$(inherited)",
315 | "$(PROJECT_DIR)/Flutter",
316 | );
317 | INFOPLIST_FILE = Runner/Info.plist;
318 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
319 | LIBRARY_SEARCH_PATHS = (
320 | "$(inherited)",
321 | "$(PROJECT_DIR)/Flutter",
322 | );
323 | PRODUCT_BUNDLE_IDENTIFIER = com.thealphamerc.flutterChatApp;
324 | PRODUCT_NAME = "$(TARGET_NAME)";
325 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
326 | SWIFT_VERSION = 5.0;
327 | VERSIONING_SYSTEM = "apple-generic";
328 | };
329 | name = Profile;
330 | };
331 | 97C147031CF9000F007C117D /* Debug */ = {
332 | isa = XCBuildConfiguration;
333 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
334 | buildSettings = {
335 | ALWAYS_SEARCH_USER_PATHS = NO;
336 | CLANG_ANALYZER_NONNULL = YES;
337 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
338 | CLANG_CXX_LIBRARY = "libc++";
339 | CLANG_ENABLE_MODULES = YES;
340 | CLANG_ENABLE_OBJC_ARC = YES;
341 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
342 | CLANG_WARN_BOOL_CONVERSION = YES;
343 | CLANG_WARN_COMMA = YES;
344 | CLANG_WARN_CONSTANT_CONVERSION = YES;
345 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
346 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
347 | CLANG_WARN_EMPTY_BODY = YES;
348 | CLANG_WARN_ENUM_CONVERSION = YES;
349 | CLANG_WARN_INFINITE_RECURSION = YES;
350 | CLANG_WARN_INT_CONVERSION = YES;
351 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
352 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
353 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
354 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
355 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
356 | CLANG_WARN_STRICT_PROTOTYPES = YES;
357 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
358 | CLANG_WARN_UNREACHABLE_CODE = YES;
359 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
360 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
361 | COPY_PHASE_STRIP = NO;
362 | DEBUG_INFORMATION_FORMAT = dwarf;
363 | ENABLE_STRICT_OBJC_MSGSEND = YES;
364 | ENABLE_TESTABILITY = YES;
365 | GCC_C_LANGUAGE_STANDARD = gnu99;
366 | GCC_DYNAMIC_NO_PIC = NO;
367 | GCC_NO_COMMON_BLOCKS = YES;
368 | GCC_OPTIMIZATION_LEVEL = 0;
369 | GCC_PREPROCESSOR_DEFINITIONS = (
370 | "DEBUG=1",
371 | "$(inherited)",
372 | );
373 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
374 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
375 | GCC_WARN_UNDECLARED_SELECTOR = YES;
376 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
377 | GCC_WARN_UNUSED_FUNCTION = YES;
378 | GCC_WARN_UNUSED_VARIABLE = YES;
379 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
380 | MTL_ENABLE_DEBUG_INFO = YES;
381 | ONLY_ACTIVE_ARCH = YES;
382 | SDKROOT = iphoneos;
383 | TARGETED_DEVICE_FAMILY = "1,2";
384 | };
385 | name = Debug;
386 | };
387 | 97C147041CF9000F007C117D /* Release */ = {
388 | isa = XCBuildConfiguration;
389 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
390 | buildSettings = {
391 | ALWAYS_SEARCH_USER_PATHS = NO;
392 | CLANG_ANALYZER_NONNULL = YES;
393 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
394 | CLANG_CXX_LIBRARY = "libc++";
395 | CLANG_ENABLE_MODULES = YES;
396 | CLANG_ENABLE_OBJC_ARC = YES;
397 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
398 | CLANG_WARN_BOOL_CONVERSION = YES;
399 | CLANG_WARN_COMMA = YES;
400 | CLANG_WARN_CONSTANT_CONVERSION = YES;
401 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
402 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
403 | CLANG_WARN_EMPTY_BODY = YES;
404 | CLANG_WARN_ENUM_CONVERSION = YES;
405 | CLANG_WARN_INFINITE_RECURSION = YES;
406 | CLANG_WARN_INT_CONVERSION = YES;
407 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
408 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
409 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
410 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
411 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
412 | CLANG_WARN_STRICT_PROTOTYPES = YES;
413 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
414 | CLANG_WARN_UNREACHABLE_CODE = YES;
415 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
416 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
417 | COPY_PHASE_STRIP = NO;
418 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
419 | ENABLE_NS_ASSERTIONS = NO;
420 | ENABLE_STRICT_OBJC_MSGSEND = YES;
421 | GCC_C_LANGUAGE_STANDARD = gnu99;
422 | GCC_NO_COMMON_BLOCKS = YES;
423 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
424 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
425 | GCC_WARN_UNDECLARED_SELECTOR = YES;
426 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
427 | GCC_WARN_UNUSED_FUNCTION = YES;
428 | GCC_WARN_UNUSED_VARIABLE = YES;
429 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
430 | MTL_ENABLE_DEBUG_INFO = NO;
431 | SDKROOT = iphoneos;
432 | SUPPORTED_PLATFORMS = iphoneos;
433 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
434 | TARGETED_DEVICE_FAMILY = "1,2";
435 | VALIDATE_PRODUCT = YES;
436 | };
437 | name = Release;
438 | };
439 | 97C147061CF9000F007C117D /* Debug */ = {
440 | isa = XCBuildConfiguration;
441 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
442 | buildSettings = {
443 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
444 | CLANG_ENABLE_MODULES = YES;
445 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
446 | ENABLE_BITCODE = NO;
447 | FRAMEWORK_SEARCH_PATHS = (
448 | "$(inherited)",
449 | "$(PROJECT_DIR)/Flutter",
450 | );
451 | INFOPLIST_FILE = Runner/Info.plist;
452 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
453 | LIBRARY_SEARCH_PATHS = (
454 | "$(inherited)",
455 | "$(PROJECT_DIR)/Flutter",
456 | );
457 | PRODUCT_BUNDLE_IDENTIFIER = com.thealphamerc.flutterChatApp;
458 | PRODUCT_NAME = "$(TARGET_NAME)";
459 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
460 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
461 | SWIFT_VERSION = 5.0;
462 | VERSIONING_SYSTEM = "apple-generic";
463 | };
464 | name = Debug;
465 | };
466 | 97C147071CF9000F007C117D /* Release */ = {
467 | isa = XCBuildConfiguration;
468 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
469 | buildSettings = {
470 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
471 | CLANG_ENABLE_MODULES = YES;
472 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
473 | ENABLE_BITCODE = NO;
474 | FRAMEWORK_SEARCH_PATHS = (
475 | "$(inherited)",
476 | "$(PROJECT_DIR)/Flutter",
477 | );
478 | INFOPLIST_FILE = Runner/Info.plist;
479 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
480 | LIBRARY_SEARCH_PATHS = (
481 | "$(inherited)",
482 | "$(PROJECT_DIR)/Flutter",
483 | );
484 | PRODUCT_BUNDLE_IDENTIFIER = com.thealphamerc.flutterChatApp;
485 | PRODUCT_NAME = "$(TARGET_NAME)";
486 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
487 | SWIFT_VERSION = 5.0;
488 | VERSIONING_SYSTEM = "apple-generic";
489 | };
490 | name = Release;
491 | };
492 | /* End XCBuildConfiguration section */
493 |
494 | /* Begin XCConfigurationList section */
495 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
496 | isa = XCConfigurationList;
497 | buildConfigurations = (
498 | 97C147031CF9000F007C117D /* Debug */,
499 | 97C147041CF9000F007C117D /* Release */,
500 | 249021D3217E4FDB00AE95B9 /* Profile */,
501 | );
502 | defaultConfigurationIsVisible = 0;
503 | defaultConfigurationName = Release;
504 | };
505 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
506 | isa = XCConfigurationList;
507 | buildConfigurations = (
508 | 97C147061CF9000F007C117D /* Debug */,
509 | 97C147071CF9000F007C117D /* Release */,
510 | 249021D4217E4FDB00AE95B9 /* Profile */,
511 | );
512 | defaultConfigurationIsVisible = 0;
513 | defaultConfigurationName = Release;
514 | };
515 | /* End XCConfigurationList section */
516 | };
517 | rootObject = 97C146E61CF9000F007C117D /* Project object */;
518 | }
519 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheAlphamerc/flutter_chat_app/91fcdcd6ae319a679a7d2a35a195c215dba0e388/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/TheAlphamerc/flutter_chat_app/91fcdcd6ae319a679a7d2a35a195c215dba0e388/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/TheAlphamerc/flutter_chat_app/91fcdcd6ae319a679a7d2a35a195c215dba0e388/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/TheAlphamerc/flutter_chat_app/91fcdcd6ae319a679a7d2a35a195c215dba0e388/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/TheAlphamerc/flutter_chat_app/91fcdcd6ae319a679a7d2a35a195c215dba0e388/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/TheAlphamerc/flutter_chat_app/91fcdcd6ae319a679a7d2a35a195c215dba0e388/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/TheAlphamerc/flutter_chat_app/91fcdcd6ae319a679a7d2a35a195c215dba0e388/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/TheAlphamerc/flutter_chat_app/91fcdcd6ae319a679a7d2a35a195c215dba0e388/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/TheAlphamerc/flutter_chat_app/91fcdcd6ae319a679a7d2a35a195c215dba0e388/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/TheAlphamerc/flutter_chat_app/91fcdcd6ae319a679a7d2a35a195c215dba0e388/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/TheAlphamerc/flutter_chat_app/91fcdcd6ae319a679a7d2a35a195c215dba0e388/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/TheAlphamerc/flutter_chat_app/91fcdcd6ae319a679a7d2a35a195c215dba0e388/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/TheAlphamerc/flutter_chat_app/91fcdcd6ae319a679a7d2a35a195c215dba0e388/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/TheAlphamerc/flutter_chat_app/91fcdcd6ae319a679a7d2a35a195c215dba0e388/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/TheAlphamerc/flutter_chat_app/91fcdcd6ae319a679a7d2a35a195c215dba0e388/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/TheAlphamerc/flutter_chat_app/91fcdcd6ae319a679a7d2a35a195c215dba0e388/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheAlphamerc/flutter_chat_app/91fcdcd6ae319a679a7d2a35a195c215dba0e388/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheAlphamerc/flutter_chat_app/91fcdcd6ae319a679a7d2a35a195c215dba0e388/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | flutter_chat_app
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
--------------------------------------------------------------------------------
/lib/helper/enum.dart:
--------------------------------------------------------------------------------
1 | enum AuthStatus {
2 | NOT_DETERMINED,
3 | NOT_LOGGED_IN,
4 | LOGGED_IN,
5 | }
--------------------------------------------------------------------------------
/lib/helper/logger.dart:
--------------------------------------------------------------------------------
1 | import 'package:logger/logger.dart';
2 |
3 | Logger getLogger(String className) {
4 | return Logger(printer: SimpleLogPrinter(className));
5 | }
6 |
7 | class SimpleLogPrinter extends PrettyPrinter {
8 | final String className;
9 | SimpleLogPrinter(this.className);
10 |
11 | @override
12 | List log(LogEvent event) {
13 | var color = PrettyPrinter.levelColors[event.level];
14 | var emoji = PrettyPrinter.levelEmojis[event.level];
15 |
16 | return [color('$emoji $className - ${event.message}')];
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/lib/helper/routes.dart:
--------------------------------------------------------------------------------
1 |
2 | import 'package:flutter/material.dart';
3 | import 'package:flutter_chat_app/page/chat_screen.dart';
4 | import 'package:flutter_chat_app/page/login.dart';
5 | import 'package:flutter_chat_app/page/profile_page.dart';
6 | import 'package:flutter_chat_app/page/splash.dart';
7 | import 'package:flutter_chat_app/page/welcomPage.dart';
8 | import 'package:flutter_chat_app/widgets/customRoute.dart';
9 | import '../widgets/customWidgets.dart';
10 |
11 | class Routes{
12 | static dynamic route(){
13 | return {
14 | '/': (BuildContext context) => SplashPage(),
15 | };
16 | }
17 |
18 |
19 | static Route onGenerateRoute(RouteSettings settings) {
20 | final List pathElements = settings.name.split('/');
21 | if (pathElements[0] != '' || pathElements.length == 1) {
22 | return null;
23 | }
24 | switch (pathElements[1]) {
25 | case "ChatScreenPage":
26 |
27 | return CustomRoute(builder:(BuildContext context)=> ChatScreenPage());
28 |
29 | case "WelcomePage":return CustomRoute(builder:(BuildContext context)=> WelcomePage());
30 | case "LoginPage":return CustomRoute(builder:(BuildContext context)=> LoginPage());
31 | case "ProfilePage":return CustomRoute(builder:(BuildContext context)=> ProfilePage());
32 |
33 | default:return onUnknownRoute(RouteSettings(name: '/Feature'));
34 | }
35 | }
36 |
37 | static Route onUnknownRoute(RouteSettings settings){
38 | return MaterialPageRoute(
39 | builder: (_) => Scaffold(
40 | appBar: AppBar(title: customTitleText(settings.name.split('/')[1]),centerTitle: true,),
41 | body: Center(
42 | child: Text('${settings.name.split('/')[1]} Comming soon..'),
43 | ),
44 | ),
45 | );
46 | }
47 | }
--------------------------------------------------------------------------------
/lib/helper/utility.dart:
--------------------------------------------------------------------------------
1 | import 'package:cloud_firestore/cloud_firestore.dart';
2 | import 'package:firebase_database/firebase_database.dart';
3 | import 'package:flutter/foundation.dart';
4 | import 'package:flutter/material.dart';
5 | import 'package:flutter_chat_app/helper/logger.dart';
6 | import 'package:flutter_chat_app/widgets/customWidgets.dart';
7 | import 'package:intl/intl.dart';
8 | import 'package:share/share.dart';
9 | import 'package:logger/logger.dart';
10 | import 'package:url_launcher/url_launcher.dart';
11 |
12 | final DatabaseReference kDatabase = FirebaseDatabase.instance.reference();
13 | final log = getLogger("General");
14 |
15 | String getPostTime2(String date) {
16 | if (date == null || date.isEmpty) {
17 | return '';
18 | }
19 | var dt = DateTime.parse(date).toLocal();
20 | var dat =
21 | DateFormat.jm().format(dt) + ' - ' + DateFormat("dd MMM yy").format(dt);
22 | return dat;
23 | }
24 |
25 | String getdob(String date) {
26 | if (date == null || date.isEmpty) {
27 | return '';
28 | }
29 | var dt = DateTime.parse(date).toLocal();
30 | var dat = DateFormat.yMMMd().format(dt);
31 | return dat;
32 | }
33 |
34 | String getJoiningDate(String date) {
35 | if (date == null || date.isEmpty) {
36 | return '';
37 | }
38 | var dt = DateTime.parse(date).toLocal();
39 | var dat = DateFormat("MMMM yyyy").format(dt);
40 | return 'Joined $dat';
41 | }
42 |
43 | String getChatTime(String date) {
44 | if (date == null || date.isEmpty) {
45 | return '';
46 | }
47 | String msg = '';
48 | var dt = DateTime.parse(date).toLocal();
49 |
50 | if (DateTime.now().toLocal().isBefore(dt)) {
51 | return DateFormat.jm().format(DateTime.parse(date).toLocal()).toString();
52 | }
53 |
54 | var dur = DateTime.now().toLocal().difference(dt);
55 | if (dur.inDays > 0) {
56 | msg = '${dur.inDays} d';
57 | return dur.inDays == 1 ? '1d' : DateFormat("dd MMM").format(dt);
58 | } else if (dur.inHours > 0) {
59 | msg = '${dur.inHours} h';
60 | } else if (dur.inMinutes > 0) {
61 | msg = '${dur.inMinutes} m';
62 | } else if (dur.inSeconds > 0) {
63 | msg = '${dur.inSeconds} s';
64 | } else {
65 | msg = 'now';
66 | }
67 | return msg;
68 | }
69 |
70 | String getPollTime(String date) {
71 | int hr, mm;
72 | String msg = 'Poll ended';
73 | var enddate = DateTime.parse(date);
74 | if (DateTime.now().isAfter(enddate)) {
75 | return msg;
76 | }
77 | msg = 'Poll ended in';
78 | var dur = enddate.difference(DateTime.now());
79 | hr = dur.inHours - dur.inDays * 24;
80 | mm = dur.inMinutes - (dur.inHours * 60);
81 | if (dur.inDays > 0) {
82 | msg = ' ' + dur.inDays.toString() + (dur.inDays > 1 ? ' Days ' : ' Day');
83 | }
84 | if (hr > 0) {
85 | msg += ' ' + hr.toString() + ' hour';
86 | }
87 | if (mm > 0) {
88 | msg += ' ' + mm.toString() + ' min';
89 | }
90 | return (dur.inDays).toString() +
91 | ' Days ' +
92 | ' ' +
93 | hr.toString() +
94 | ' Hours ' +
95 | mm.toString() +
96 | ' min';
97 | }
98 |
99 | String getSocialLinks(String url) {
100 | if (url != null && url.isNotEmpty) {
101 | url = url.contains("https://www") || url.contains("http://www")
102 | ? url
103 | : url.contains("www") &&
104 | (!url.contains('https') && !url.contains('http'))
105 | ? 'https://' + url
106 | : 'https://www.' + url;
107 | } else {
108 | return null;
109 | }
110 | cprint('Launching URL : $url');
111 | return url;
112 | }
113 |
114 | launchURL(String url) async {
115 | if (await canLaunch(url)) {
116 | await launch(url);
117 | } else {
118 | cprint('Could not launch $url');
119 | }
120 | }
121 |
122 | void cprint(dynamic data, {String errorIn, String event}) {
123 |
124 | if (errorIn != null) {
125 | final log = getLogger("errorIn");
126 | log.d(
127 | '****************************** error ******************************');
128 | log.e('[Error] $errorIn $data');
129 | log.d(
130 | '****************************** error ******************************');
131 | } else if (data != null) {
132 | log.i(data);
133 | }
134 | if (event != null) {
135 | logEvent(event);
136 | }
137 | }
138 |
139 | void logEvent(String event, {Map parameter}) {
140 | // kReleaseMode
141 | // ? kAnalytics.logEvent(name: event, parameters: parameter)
142 | // : print("[EVENT]: $event");
143 | }
144 |
145 | void debugLog(String log, {dynamic param = ""}) {
146 | final String time = DateFormat("mm:ss:mmm").format(DateTime.now());
147 | print("[$time][Log]: $log, $param");
148 | }
149 |
150 | void share(String message, {String subject}) {
151 | Share.share(message, subject: subject);
152 | }
153 |
154 | List getHashTags(String text) {
155 | RegExp reg = RegExp(
156 | r"([#])\w+|(https?|ftp|file|#)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]*");
157 | Iterable _matches = reg.allMatches(text);
158 | List resultMatches = List();
159 | for (Match match in _matches) {
160 | if (match.group(0).isNotEmpty) {
161 | var tag = match.group(0);
162 | resultMatches.add(tag);
163 | }
164 | }
165 | return resultMatches;
166 | }
167 |
168 | String getUserName({String name, String id}) {
169 | String userName = '';
170 | name = name.split(' ')[0];
171 | id = id.substring(0, 4).toLowerCase();
172 | userName = '@$name$id';
173 | return userName;
174 | }
175 |
176 | bool validateCredentials(
177 | GlobalKey _scaffoldKey, String email, String password) {
178 | if (email == null || email.isEmpty) {
179 | customSnackBar(_scaffoldKey, 'Please enter email id');
180 | return false;
181 | } else if (password == null || password.isEmpty) {
182 | customSnackBar(_scaffoldKey, 'Please enter password');
183 | return false;
184 | } else if (password.length < 8) {
185 | customSnackBar(_scaffoldKey, 'Password must me 8 character long');
186 | return false;
187 | }
188 |
189 | var status = validateEmal(email);
190 | if (!status) {
191 | customSnackBar(_scaffoldKey, 'Please enter valid email id');
192 | return false;
193 | }
194 | return true;
195 | }
196 |
197 | bool validateEmal(String email) {
198 | String p =
199 | r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$';
200 |
201 | RegExp regExp = new RegExp(p);
202 |
203 | var status = regExp.hasMatch(email);
204 | return status;
205 | }
206 |
207 | String getChannelName(String user1, String user2) {
208 | user1 = user1.substring(0, 5);
209 | user2 = user2.substring(0, 5);
210 | List list = [user1, user2];
211 | list.sort();
212 | final channelName = '${list[0]}-${list[1]}';
213 | // cprint(_channelName); //2RhfE-5kyFB
214 | return channelName;
215 | }
216 |
217 | // DateTime time = castTimestampToDateTime(snapshot.data['purchaseDate']);
218 | ///Timestamp to DateTime in a separately method
219 | castTimestampToDateTime(Timestamp data) {
220 | return data.toDate();
221 | }
222 |
--------------------------------------------------------------------------------
/lib/locator.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_chat_app/service/auth_service.dart';
2 | import 'package:flutter_chat_app/service/firebase_service.dart';
3 | import 'package:flutter_chat_app/service/repository.dart';
4 | import 'package:get_it/get_it.dart';
5 | GetIt getIt = GetIt.instance;
6 |
7 | setupLocator() {
8 | getIt.registerSingleton(AuthService());
9 | getIt.registerSingleton(FirebaseService());
10 | getIt.registerSingleton(Repository());
11 | }
12 |
--------------------------------------------------------------------------------
/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_chat_app/locator.dart';
3 | import 'package:flutter_chat_app/state/app_state.dart';
4 | import 'package:flutter_chat_app/state/auth_state.dart';
5 | import 'package:flutter_chat_app/state/chat_state.dart';
6 | import 'package:flutter_chat_app/theme/theme.dart';
7 | import 'package:provider/provider.dart';
8 |
9 | import 'helper/routes.dart';
10 |
11 | void main() {
12 | WidgetsFlutterBinding.ensureInitialized();
13 | setupLocator();
14 | runApp(MyApp());
15 | }
16 |
17 | class MyApp extends StatelessWidget {
18 | // This widget is the root of your application.
19 | @override
20 | Widget build(BuildContext context) {
21 | return MultiProvider(
22 | providers: [
23 | ChangeNotifierProvider(create: (_) => AuthState()),
24 | ChangeNotifierProvider(create: (_) => AppState()),
25 | ChangeNotifierProvider(create: (_) => ChatState()),
26 | ],
27 | child: MaterialApp(
28 | title: 'Flutter Demo',
29 | theme: AppTheme.darkTheme,
30 | themeMode: ThemeMode.light,
31 | routes: Routes.route(),
32 | onGenerateRoute: (settings) => Routes.onGenerateRoute(settings),
33 | onUnknownRoute: (settings) => Routes.onUnknownRoute(settings),
34 | ),
35 | );
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/lib/model/chat_message.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | class ChatMessage {
4 | String key;
5 | String senderId;
6 | String message;
7 | bool seen;
8 | String createdAt;
9 | String senderName;
10 | String receiverId;
11 |
12 | ChatMessage({
13 | this.key,
14 | this.senderId,
15 | this.message,
16 | this.seen,
17 | this.createdAt,
18 | this.receiverId,
19 | this.senderName,
20 | });
21 |
22 | factory ChatMessage.fromJson(Map json) => ChatMessage(
23 | senderName: json["senderName"] == null ? null : json["senderName"],
24 | receiverId: json["receiverId"] == null ? null : json["receiverId"],
25 | createdAt: json["created_at"] == null ? null : json["created_at"],
26 | message: json["message"] == null ? null : json["message"],
27 | key: json["key"],
28 | seen: json["seen"] == null ? null : json["seen"],
29 | senderId: json["sender_id"] == null ? null : json["sender_id"],
30 | );
31 |
32 | Map toJson() => {
33 | "senderName": senderName == null ? null : senderName,
34 | "receiverId": receiverId == null ? null : receiverId,
35 | "created_at": createdAt == null ? null : createdAt,
36 | "message": message == null ? null : message,
37 | "key": key,
38 | "seen": seen == null ? false : seen,
39 | "sender_id": senderId == null ? null : senderId,
40 | };
41 | }
42 |
43 | class ChatResponse {
44 | List data;
45 |
46 | ChatResponse({
47 | this.data,
48 | });
49 |
50 | factory ChatResponse.fromRawJson(String str) => ChatResponse.fromJson(json.decode(str));
51 |
52 | String toRawJson() => json.encode(toJson());
53 |
54 | factory ChatResponse.fromJson(Map json) => ChatResponse(
55 | data: json["data"] == null ? null : List.from(json["data"].map((x) => ChatMessage.fromJson(x))),
56 | );
57 |
58 | Map toJson() => {
59 | "data": data == null ? null : List.from(data.map((x) => x.toJson())),
60 | };
61 | }
--------------------------------------------------------------------------------
/lib/model/user.dart:
--------------------------------------------------------------------------------
1 | class User {
2 | String key;
3 | String email;
4 | String userId;
5 | String displayName;
6 | String userName;
7 | String webSite;
8 | String profilePic;
9 | String contact;
10 | String bio;
11 | String location;
12 | String dob;
13 | String createdAt;
14 | bool isVerified;
15 | int followers;
16 | int following;
17 | List followersList;
18 | List followingList;
19 |
20 | User(
21 | {this.email,
22 | this.userId,
23 | this.displayName,
24 | this.profilePic,
25 | this.key,
26 | this.contact,
27 | this.bio,
28 | this.dob,
29 | this.location,
30 | this.createdAt,
31 | this.userName,
32 | this.followers,
33 | this.following,
34 | this.webSite,
35 | this.isVerified,
36 | this.followersList,
37 | });
38 |
39 | User.fromJson(Map map) {
40 | if (map == null) {
41 | return;
42 | }
43 | if(followersList == null){
44 | followersList = [];
45 | }
46 | email = map['email'];
47 | userId = map['userId'];
48 | displayName = map['displayName'];
49 | profilePic = map['profilePic'];
50 | key = map['key'];
51 | dob = map['dob'];
52 | bio = map['bio'];
53 | location = map['location'];
54 | contact = map['contact'];
55 | createdAt = map['createdAt'];
56 | followers = map['followers'];
57 | following = map['following'];
58 | userName = map['userName'];
59 | webSite = map['webSite'];
60 | isVerified = map['isVerified'] ?? false;
61 | if(map['followerList'] != null){
62 | followersList = List();
63 | map['followerList'].forEach((value){
64 | followersList.add(value);
65 | });
66 | }
67 | followers = followersList != null ? followersList.length : null;
68 | if(map['followingList'] != null){
69 | followingList = List();
70 | map['followingList'].forEach((value){
71 | followingList.add(value);
72 | });
73 | }
74 | following = followingList != null ? followingList.length : null;
75 | }
76 | toJson() {
77 | return {
78 | 'key': key,
79 | "userId": userId,
80 | "email": email,
81 | 'displayName': displayName,
82 | 'userId': userId,
83 | 'profilePic': profilePic,
84 | 'contact': contact,
85 | 'dob': dob,
86 | 'bio': bio,
87 | 'location': location,
88 | 'createdAt': createdAt,
89 | 'followers': followersList != null ? followersList.length : null,
90 | 'following': followersList!= null ? followersList.length : null,
91 | 'userName': userName,
92 | 'webSite': webSite,
93 | 'isVerified': isVerified ?? false,
94 | 'followerList' : followersList,
95 | 'followingList':followingList
96 | };
97 | }
98 |
99 | User copyWith(
100 | {String email,
101 | String userId,
102 | String displayName,
103 | String profilePic,
104 | String key,
105 | String contact,
106 | bio,
107 | String dob,
108 | String location,
109 | String createdAt,
110 | String userName,
111 | int followers,
112 | int following,
113 | String webSite,
114 | bool isVerified,
115 | List followingList,
116 | }) {
117 | return User(
118 | email: email ?? this.email,
119 | bio: bio ?? this.bio,
120 | contact: contact ?? this.contact,
121 | createdAt: createdAt ?? this.createdAt,
122 | displayName: displayName ?? this.displayName,
123 | dob: dob ?? this.dob,
124 | followers: followersList != null ? followersList.length : null,
125 | following: following ?? this.following,
126 | isVerified: isVerified ?? this.isVerified,
127 | key: key ?? this.key,
128 | location: location ?? this.location,
129 | profilePic: profilePic ?? this.profilePic,
130 | userId: userId ?? this.userId,
131 | userName: userName ?? this.userName,
132 | webSite: webSite ?? this.webSite,
133 | followersList: followersList ?? this.followersList,
134 | );
135 | }
136 |
137 | String getFollower() {
138 | return '${this.followers ?? 0}';
139 | }
140 |
141 | String getFollowing() {
142 | return '${this.following ?? 0}';
143 | }
144 | }
145 |
--------------------------------------------------------------------------------
/lib/page/chat_screen.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 | import 'package:flutter/material.dart';
3 | import 'package:flutter/services.dart';
4 | import 'package:flutter_chat_app/helper/utility.dart';
5 | import 'package:flutter_chat_app/locator.dart';
6 | import 'package:flutter_chat_app/model/chat_message.dart';
7 | import 'package:flutter_chat_app/model/user.dart';
8 | import 'package:flutter_chat_app/service/repository.dart';
9 | import 'package:flutter_chat_app/state/auth_state.dart';
10 | import 'package:flutter_chat_app/state/chat_state.dart';
11 | import 'package:flutter_chat_app/theme/styles.dart';
12 | import 'package:flutter_chat_app/widgets/customWidgets.dart';
13 | import 'package:flutter_chat_app/theme/extentions.dart';
14 | import 'package:provider/provider.dart';
15 | import 'package:flutter_chat_app/theme/extentions.dart';
16 |
17 | class ChatScreenPage extends StatelessWidget {
18 | ChatScreenPage({Key key}) : super(key: key);
19 | Widget _appBar(BuildContext context) {
20 | var state = Provider.of(context, listen: false);
21 | return StreamBuilder(
22 | stream: state.chatUser,
23 | builder: (context, AsyncSnapshot snapshot) {
24 | if (snapshot.hasData) {
25 | return Row(
26 | children: [
27 | userAvatar(snapshot.data, radius: 20),
28 | Column(
29 | crossAxisAlignment: CrossAxisAlignment.start,
30 | children: [
31 | Text(snapshot.data.displayName,
32 | style: TextStyles.titleMedium.white),
33 | Text('online', style: TextStyles.bodySm.dimWhite),
34 | ],
35 | ).hP16,
36 | Spacer(),
37 | ],
38 | );
39 | } else {
40 | return LinearProgressIndicator();
41 | }
42 | });
43 | }
44 |
45 | final messageController = new TextEditingController();
46 | String senderId = "abcd";
47 | String userImage;
48 | String message;
49 | ScrollController _controller;
50 |
51 | Widget _messageList(BuildContext context) {
52 | final state = Provider.of(context);
53 | return StreamBuilder(
54 | stream: state.getMessageList,
55 | builder: (context, AsyncSnapshot snapshot) {
56 | if (snapshot.hasData) {
57 | return ListView.builder(
58 | controller: _controller,
59 | shrinkWrap: true,
60 | reverse: true,
61 | physics: BouncingScrollPhysics(),
62 | itemCount: snapshot.data?.data?.length ?? 0,
63 | itemBuilder: (context, index) => chatMessage(
64 | context, snapshot.data.data[index],
65 | isLastMessage: index == 0, index: index),
66 | );
67 | }
68 | if (snapshot.connectionState == ConnectionState.done ||
69 | snapshot.connectionState == ConnectionState.active) {
70 | return Center(
71 | child: Text("No message available"),
72 | );
73 | }
74 | return loader();
75 | },
76 | );
77 | }
78 |
79 | Widget chatMessage(BuildContext context, ChatMessage message,
80 | {bool isLastMessage, int index}) {
81 | if (senderId == null) {
82 | return Container();
83 | }
84 | if (message.senderId == senderId)
85 | return _message(context, message, true, isLastMessage: isLastMessage);
86 | else
87 | return _message(
88 | context,
89 | message,
90 | false,
91 | isLastMessage: isLastMessage,
92 | );
93 | }
94 |
95 | Widget _message(
96 | BuildContext context,
97 | ChatMessage chat,
98 | bool myMessage, {
99 | bool isLastMessage,
100 | }) {
101 | return Column(
102 | crossAxisAlignment:
103 | myMessage ? CrossAxisAlignment.end : CrossAxisAlignment.start,
104 | mainAxisAlignment:
105 | myMessage ? MainAxisAlignment.end : MainAxisAlignment.start,
106 | children: [
107 | Row(
108 | crossAxisAlignment: CrossAxisAlignment.end,
109 | children: [
110 | SizedBox(width: 15),
111 | Expanded(
112 | child: Container(
113 | alignment:
114 | myMessage ? Alignment.centerRight : Alignment.centerLeft,
115 | margin: EdgeInsets.only(
116 | right: myMessage ? 10 : (fullWidth(context) / 4),
117 | top: 20,
118 | left: myMessage ? (fullWidth(context) / 4) : 0,
119 | ),
120 | child: Container(
121 | padding: EdgeInsets.all(10),
122 | decoration: BoxDecoration(
123 | borderRadius: getBorder(myMessage),
124 | color: myMessage
125 | ? Theme.of(context).primaryColor
126 | : Theme.of(context).secondaryHeaderColor,
127 | ),
128 | child: Text(
129 | chat.message,
130 | style: TextStyle(
131 | fontSize: 16,
132 | ).white,
133 | ),
134 | ).ripple(
135 | () {
136 | var text = ClipboardData(text: chat.message);
137 | Clipboard.setData(text);
138 | Scaffold.of(context).hideCurrentSnackBar();
139 | Scaffold.of(context).showSnackBar(
140 | SnackBar(
141 | backgroundColor: Theme.of(context).selectedRowColor,
142 | content: Text(
143 | 'Message copied',
144 | style: TextStyle(color: Colors.black),
145 | ),
146 | ),
147 | );
148 | },
149 | borderRadius: getBorder(myMessage),
150 | ),
151 | ),
152 | ),
153 | ],
154 | ),
155 | Text(
156 | getChatTime(chat.createdAt),
157 | style:
158 | Theme.of(context).textTheme.caption.copyWith(fontSize: 12).white,
159 | ).hP16,
160 | SizedBox(height: isLastMessage ? 70 : 0)
161 | ],
162 | );
163 | }
164 |
165 | BorderRadius getBorder(bool myMessage) {
166 | return BorderRadius.only(
167 | topLeft: myMessage ? Radius.circular(10) : Radius.circular(0),
168 | topRight: Radius.circular(10),
169 | bottomRight: myMessage ? Radius.circular(0) : Radius.circular(10),
170 | bottomLeft: Radius.circular(10),
171 | );
172 | }
173 |
174 | Widget _bottomEntryField(BuildContext context) {
175 | return Align(
176 | alignment: Alignment.bottomLeft,
177 | child: Column(
178 | mainAxisAlignment: MainAxisAlignment.end,
179 | children: [
180 | TextField(
181 | onSubmitted: (val) async {
182 | submitMessage(context, val);
183 | },
184 | onChanged: (val) {
185 | message = val;
186 | },
187 | style: TextStyles.titleMedium.white,
188 | controller: messageController,
189 | decoration: InputDecoration(
190 | contentPadding: EdgeInsets.only(left: 16, right: 0, top: 10),
191 | alignLabelWithHint: true,
192 | hintText: 'Write something',
193 | suffixIcon: Container(
194 | width: 50,
195 | height: 50,
196 | alignment: Alignment.centerRight,
197 | child: CircleAvatar(
198 | maxRadius: 50,
199 | backgroundColor: Theme.of(context).secondaryHeaderColor,
200 | child: Transform.rotate(
201 | angle: 1.9 * pi * 2,
202 | child: IconButton(
203 | color: Theme.of(context).primaryColor,
204 | padding: EdgeInsets.all(0),
205 | icon: Icon(
206 | Icons.send,
207 | size: 20,
208 | ),
209 | onPressed: () {
210 | submitMessage(context, message);
211 | },
212 | ),
213 | )).p(8),
214 | ),
215 | hintStyle: TextStyles.title.dimWhite,
216 | border: InputBorder.none,
217 | fillColor: Colors.black54,
218 | filled: true),
219 | ).circular,
220 | ],
221 | ),
222 | ).p(16);
223 | }
224 |
225 | Future _onWillPop() async {
226 | // final chatState = Provider.of(context);
227 | // chatState.setIsChatScreenOpen = false;
228 | // chatState.dispose();
229 | return true;
230 | }
231 |
232 | void submitMessage(BuildContext context, String text) {
233 | if (text == null || text.isEmpty) {
234 | return;
235 | }
236 | final state = Provider.of(context, listen: false);
237 | final authState = Provider.of(context, listen: false);
238 | final messageModel = ChatMessage(
239 | createdAt: DateTime.now().toUtc().toString(),
240 | message: text,
241 | receiverId: state.chatUser.value.userId,
242 | senderId: authState.user.uid,
243 | senderName: authState.user.displayName,
244 | seen: false,
245 | );
246 |
247 | state.sendMessage(messageModel, authState.userModel);
248 | message = "";
249 | WidgetsBinding.instance
250 | .addPostFrameCallback((_) => messageController.clear());
251 | }
252 |
253 | @override
254 | Widget build(BuildContext context) {
255 | final authState = Provider.of(context, listen: false);
256 | senderId = authState.user.uid;
257 | return WillPopScope(
258 | onWillPop: _onWillPop,
259 | child: Scaffold(
260 | backgroundColor: Theme.of(context).backgroundColor,
261 | appBar: AppBar(
262 | leading: IconButton(
263 | icon: Icon(Icons.keyboard_arrow_left,
264 | size: 40, color: Theme.of(context).iconTheme.color),
265 | onPressed: () {
266 | Navigator.of(context).pop();
267 | },
268 | ),
269 | title: _appBar(context),
270 | actions: [
271 | IconButton(
272 | icon: Icon(
273 | Icons.more_vert,
274 | color: Theme.of(context).iconTheme.color,
275 | ),
276 | onPressed: () {})
277 | ],
278 | ),
279 | body: SafeArea(
280 | child: Stack(
281 | children: [
282 | Align(
283 | alignment: Alignment.topRight,
284 | child: _messageList(context),
285 | ),
286 | _bottomEntryField(context)
287 | ],
288 | ),
289 | ),
290 | ),
291 | );
292 | }
293 | }
294 |
--------------------------------------------------------------------------------
/lib/page/home_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_chat_app/locator.dart';
3 | import 'package:flutter_chat_app/model/user.dart';
4 | import 'package:flutter_chat_app/service/repository.dart';
5 | import 'package:flutter_chat_app/state/app_state.dart';
6 | import 'package:flutter_chat_app/state/auth_state.dart';
7 | import 'package:flutter_chat_app/state/chat_state.dart';
8 | import 'package:flutter_chat_app/theme/styles.dart';
9 | import 'package:flutter_chat_app/widgets/bottomMenuBar.dart';
10 | import 'package:flutter_chat_app/widgets/customWidgets.dart';
11 | import 'package:provider/provider.dart';
12 | import 'package:flutter_chat_app/theme/extentions.dart';
13 |
14 | class HomePage extends StatelessWidget {
15 | Widget _appBar(BuildContext context) {
16 | return Container(
17 | color: Theme.of(context).secondaryHeaderColor,
18 | padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
19 | child: Row(
20 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
21 | children: [
22 | Text('Chats'),
23 | ],
24 | ),
25 | );
26 | }
27 |
28 | Widget _favouriteList(BuildContext context) {
29 | return Column(
30 | crossAxisAlignment: CrossAxisAlignment.start,
31 | children: [
32 | Padding(
33 | padding: EdgeInsets.all(16),
34 | child: Text(
35 | 'Favourites',
36 | style: TextStyles.bodySm.bold,
37 | ),
38 | ),
39 | SizedBox(
40 | height: 60,
41 | child: ListView.builder(
42 | scrollDirection: Axis.horizontal,
43 | itemBuilder: (context, index) {
44 | return userAvatar(null).p(8);
45 | },
46 | itemCount: 25,
47 | ),
48 | ),
49 | SizedBox(
50 | height: 16,
51 | ),
52 | Divider(
53 | height: 0,
54 | color: Theme.of(context).dividerColor,
55 | )
56 | ],
57 | );
58 | }
59 |
60 | Widget _userList(BuildContext context) {
61 | var myId = Provider.of(context).userModel.userId;
62 | return StreamBuilder(
63 | stream: Provider.of(context).getChatUsersList(myId),
64 | builder: (context, AsyncSnapshot> snapshot) {
65 | if (snapshot.hasData) {
66 | return ListView.builder(
67 | itemBuilder: (context, index) {
68 | return _userTile(context, snapshot.data[index]);
69 | },
70 | itemCount: snapshot.data.length,
71 | );
72 | }
73 | if (snapshot.connectionState == ConnectionState.done) {
74 | return Text("No Users Available");
75 | } else {
76 | return loader();
77 | }
78 | },
79 | );
80 | }
81 |
82 | Widget _userTile(BuildContext context, User model) {
83 | return ListTile(
84 | leading: userAvatar(model),
85 | title: Row(
86 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
87 | children: [
88 | Text(
89 | model.displayName,
90 | style: TextStyles.titleMedium.white,
91 | ),
92 | Text(
93 | '1:04am',
94 | style: TextStyles.bodySm.lighGrey,
95 | )
96 | ],
97 | ),
98 | subtitle: Text(
99 | description(
100 | "Is it possible to create an “extension methods” for the Widgets? Is it possible to create an “extension methods” for the Widgets?"),
101 | style: TextStyles.bodySm.dimWhite),
102 | ).vP4.ripple(() {
103 | var state = Provider.of(context, listen: false);
104 | Provider.of(context, listen: false)
105 | .selectUserToChat(model, state.userModel.userId);
106 | Navigator.of(context).pushNamed('/ChatScreenPage');
107 | });
108 | }
109 |
110 | String description(String msg) {
111 | if (msg.isNotEmpty && msg.length > 50) {
112 | return msg.substring(0, 38) + "...";
113 | } else if (msg.isNotEmpty) {
114 | return msg;
115 | } else {
116 | return msg;
117 | }
118 | }
119 |
120 | @override
121 | Widget build(BuildContext context) {
122 | return Scaffold(
123 | backgroundColor: Theme.of(context).backgroundColor,
124 | appBar: AppBar(
125 | backgroundColor: Theme.of(context).secondaryHeaderColor,
126 | title: _appBar(context),
127 | actions: [
128 | IconButton(icon: Icon(Icons.search), onPressed: () {}),
129 | ],
130 | ),
131 | floatingActionButton: FloatingActionButton(
132 | onPressed: () {},
133 | child: Icon(Icons.add),
134 | ),
135 | body: SafeArea(
136 | child: Column(
137 | children: [
138 | _favouriteList(context),
139 | _userList(context).extended,
140 | ],
141 | ),
142 | ),
143 | );
144 | }
145 | }
146 |
--------------------------------------------------------------------------------
/lib/page/login.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_chat_app/state/auth_state.dart';
3 | import 'package:flutter_chat_app/theme/styles.dart';
4 | import 'package:flutter_chat_app/widgets/customWidgets.dart';
5 | import 'package:flutter_chat_app/theme/extentions.dart';
6 | import 'package:provider/provider.dart';
7 |
8 | class LoginPage extends StatelessWidget {
9 | const LoginPage({Key key}) : super(key: key);
10 |
11 | @override
12 | Widget build(BuildContext context) {
13 | return SafeArea(
14 | top: false,
15 | child: Container(
16 | height: fullHeight(context),
17 | width: fullHeight(context),
18 | alignment: Alignment.center,
19 | color: Theme.of(context).backgroundColor,
20 | child: MaterialButton(
21 | color: Theme.of(context).primaryColor,
22 | onPressed: () {
23 | Provider.of(context,listen: false).loginViaGoogle();
24 | },
25 | child: Text("Google Login",style: TextStyles.title.white,),
26 | ),
27 | ),
28 | );
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/lib/page/profile_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_chat_app/state/auth_state.dart';
3 | import 'package:flutter_chat_app/theme/styles.dart';
4 | import 'package:flutter_chat_app/widgets/customWidgets.dart';
5 | import 'package:flutter_chat_app/theme/extentions.dart';
6 | import 'package:provider/provider.dart';
7 |
8 | class ProfilePage extends StatelessWidget {
9 | const ProfilePage({Key key}) : super(key: key);
10 |
11 | @override
12 | Widget build(BuildContext context) {
13 | final state = Provider.of(context, listen: false);
14 | final user = state.userModel;
15 | return SafeArea(
16 | top: false,
17 | child: Container(
18 | padding: MediaQuery.of(context).viewPadding,
19 | height: fullHeight(context),
20 | width: fullHeight(context),
21 | alignment: Alignment.center,
22 | color: Theme.of(context).backgroundColor,
23 | child: Column(
24 | mainAxisAlignment: MainAxisAlignment.center,
25 | children: [
26 | userAvatar(state.userModel).p16,
27 | Text(
28 | user.displayName,
29 | style: TextStyles.title,
30 | ),
31 | Text(
32 | user.userName ?? "",
33 | style: TextStyles.title,
34 | ),
35 | MaterialButton(
36 | color: Theme.of(context).primaryColor,
37 | onPressed: () {
38 | Provider.of(context, listen: false).logout();
39 | },
40 | child: Text(
41 | "Log out",
42 | style: TextStyles.title.white,
43 | ),
44 | ).p(16),
45 | ],
46 | ),
47 | ),
48 | );
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/lib/page/search_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_chat_app/model/user.dart';
3 | import 'package:flutter_chat_app/state/app_state.dart';
4 | import 'package:flutter_chat_app/state/auth_state.dart';
5 | import 'package:flutter_chat_app/state/chat_state.dart';
6 | import 'package:flutter_chat_app/theme/styles.dart';
7 | import 'package:flutter_chat_app/widgets/customWidgets.dart';
8 | import 'package:provider/provider.dart';
9 | import 'package:flutter_chat_app/theme/extentions.dart';
10 |
11 | class SearchPage extends StatelessWidget {
12 | Widget _appBar(BuildContext context) {
13 | return Container(
14 | color: Theme.of(context).secondaryHeaderColor,
15 | padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
16 | child: Row(
17 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
18 | children: [
19 | Text('Search'),
20 | ],
21 | ),
22 | );
23 | }
24 |
25 |
26 | Widget _userList(BuildContext context) {
27 | var myId = Provider.of(context).userModel.userId;
28 | return StreamBuilder(
29 | stream: Provider.of(context).getAllUSerList(myId),
30 | builder: (context, AsyncSnapshot> snapshot) {
31 | if (snapshot.hasData) {
32 | return ListView.builder(
33 | itemBuilder: (context, index) {
34 | return _userTile(context, snapshot.data[index]);
35 | },
36 | itemCount: snapshot.data.length,
37 | );
38 | }
39 | if (snapshot.connectionState == ConnectionState.done) {
40 | return Text("No Users Available");
41 | } else {
42 | return loader();
43 | }
44 | },
45 | );
46 | }
47 |
48 | Widget _userTile(BuildContext context, User model) {
49 | return ListTile(
50 | leading: userAvatar(model),
51 | title: Row(
52 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
53 | children: [
54 | Text(
55 | model.displayName,
56 | style: TextStyles.titleMedium.white,
57 | ),
58 | Text(
59 | '1:04am',
60 | style: TextStyles.bodySm.lighGrey,
61 | )
62 | ],
63 | ),
64 | subtitle: Text(
65 | description(model.bio),
66 |
67 | style: TextStyles.bodySm.dimWhite),
68 | ).vP4.ripple(() {
69 | var state = Provider.of(context, listen: false);
70 | Provider.of(context, listen: false)
71 | .selectUserToChat(model, state.userModel.userId);
72 | Navigator.of(context).pushNamed('/ChatScreenPage');
73 | });
74 | }
75 |
76 | String description(String msg) {
77 | if (msg.isNotEmpty && msg.length > 50) {
78 | return msg.substring(0, 38) + "...";
79 | } else if (msg.isNotEmpty) {
80 | return msg;
81 | } else {
82 | return msg;
83 | }
84 | }
85 |
86 | @override
87 | Widget build(BuildContext context) {
88 | return Scaffold(
89 | backgroundColor: Theme.of(context).backgroundColor,
90 | appBar: AppBar(
91 | backgroundColor: Theme.of(context).secondaryHeaderColor,
92 | title: _appBar(context),
93 | actions: [
94 | IconButton(icon: Icon(Icons.search), onPressed: () {}),
95 | ],
96 | ),
97 | body: SafeArea(
98 | child: Container(
99 | height: fullHeight(context),
100 | child:_userList(context)
101 | )
102 | ),
103 | );
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/lib/page/splash.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_chat_app/helper/enum.dart';
3 | import 'package:flutter_chat_app/page/login.dart';
4 | import 'package:flutter_chat_app/page/welcomPage.dart';
5 | import 'package:flutter_chat_app/state/auth_state.dart';
6 | import 'package:provider/provider.dart';
7 |
8 | class SplashPage extends StatelessWidget {
9 | const SplashPage({Key key}) : super(key: key);
10 |
11 | @override
12 | Widget build(BuildContext context) {
13 | return Scaffold(
14 | body: StreamBuilder(
15 | stream: Provider.of(context,listen: false).loginStatus,
16 | builder: (context, AsyncSnapshot snapshot) {
17 | if(snapshot.data == AuthStatus.NOT_LOGGED_IN || snapshot.data == AuthStatus.NOT_DETERMINED){
18 | return LoginPage();
19 | }
20 | return WelcomePage();
21 | },
22 | ),
23 | );
24 | }
25 | }
--------------------------------------------------------------------------------
/lib/page/welcomPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_chat_app/page/home_page.dart';
3 | import 'package:flutter_chat_app/page/profile_page.dart';
4 | import 'package:flutter_chat_app/page/search_page.dart';
5 | import 'package:flutter_chat_app/state/app_state.dart';
6 | import 'package:flutter_chat_app/state/auth_state.dart';
7 | import 'package:flutter_chat_app/widgets/bottomMenuBar.dart';
8 | import 'package:provider/provider.dart';
9 |
10 | class WelcomePage extends StatelessWidget {
11 | const WelcomePage({Key key}) : super(key: key);
12 |
13 | @override
14 | Widget build(BuildContext context) {
15 | return Scaffold(
16 | bottomNavigationBar: BottomMenubar(),
17 | body: StreamBuilder(
18 | stream: Provider.of(context).pageIndex,
19 | builder: (context, AsyncSnapshot snapshot) {
20 | return snapshot.data == 0 ? HomePage() : snapshot.data == 1 ? SearchPage() : snapshot.data == 2 ? ProfilePage() : HomePage();
21 | // return IndexedStack(
22 | // index: snapshot.data,
23 | // children: [
24 | // HomePage(),
25 | // SearchPage(),
26 | // ProfilePage(),
27 | // ProfilePage()
28 | // ],
29 | // );
30 | },
31 | ),
32 | );
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/lib/service/auth_service.dart:
--------------------------------------------------------------------------------
1 | import 'package:cloud_firestore/cloud_firestore.dart';
2 | import 'package:firebase_auth/firebase_auth.dart';
3 | import 'package:firebase_database/firebase_database.dart';
4 | import 'package:flutter_chat_app/helper/enum.dart';
5 | import 'package:flutter_chat_app/helper/logger.dart';
6 | import 'package:flutter_chat_app/helper/utility.dart';
7 | import 'package:flutter_chat_app/model/user.dart';
8 | import 'package:google_sign_in/google_sign_in.dart';
9 | import 'package:logger/logger.dart';
10 |
11 | class AuthService {
12 | final GoogleSignIn _googleSignIn = GoogleSignIn();
13 | final FirebaseAuth _firebaseAuth = FirebaseAuth.instance;
14 | final _fireStoreInstance = Firestore.instance;
15 | final DatabaseReference kDatabase = FirebaseDatabase.instance.reference();
16 | final log = getLogger("AuthService");
17 | Future handleGoogleSignIn() async {
18 | try {
19 | final GoogleSignInAccount googleUser = await _googleSignIn.signIn();
20 |
21 | if (googleUser == null) {
22 | throw Exception('Google login cancelled by user');
23 | }
24 | final GoogleSignInAuthentication googleAuth =
25 | await googleUser.authentication;
26 |
27 | final AuthCredential credential = GoogleAuthProvider.getCredential(
28 | accessToken: googleAuth.accessToken,
29 | idToken: googleAuth.idToken,
30 | );
31 | var user = (await _firebaseAuth.signInWithCredential(credential)).user;
32 | log.log(Level.info, "Google login success");
33 | return user;
34 | } catch (error) {
35 | log.e(error);
36 | return null;
37 | }
38 | }
39 |
40 | /// Create user profile from google login
41 | User createUserFromGoogleSignIn(FirebaseUser user) {
42 | var diff = DateTime.now().difference(user.metadata.creationTime);
43 | User model = User(
44 | bio: 'Edit profile to update bio',
45 | dob: DateTime(1950, DateTime.now().month, DateTime.now().day + 3)
46 | .toString(),
47 | location: 'Somewhere in universe',
48 | profilePic: user.photoUrl,
49 | displayName: user.displayName,
50 | email: user.email,
51 | key: user.uid,
52 | userId: user.uid,
53 | contact: user.phoneNumber,
54 | isVerified: user.isEmailVerified,
55 | );
56 | // Check if user is new or old
57 | // If user is new then add new user to firebase realtime kDatabase
58 | if (diff < Duration(seconds: 25)) {
59 | createUser(model, newUser: true);
60 | log.w("User created");
61 | }
62 | return model;
63 | }
64 |
65 | /// `Create` and `Update` user
66 | /// IF `newUser` is true new user is created
67 | /// Else existing user will update with new values
68 | createUser(User user, {bool newUser = false}) {
69 | if (newUser) {
70 | // Create username by the combination of name and id
71 | user.userName = getUserName(id: user.userId, name: user.displayName);
72 |
73 | // Time at which user is created
74 | user.createdAt = DateTime.now().toUtc().toString();
75 | }
76 | kDatabase.child('profile').child(user.userId).set(user.toJson());
77 | _fireStoreInstance
78 | .collection("users")
79 | .document(user.userId)
80 | .setData(user.toJson());
81 |
82 | log.log(Level.info, "User created");
83 | }
84 |
85 | void logout() {
86 | _firebaseAuth.signOut();
87 | _googleSignIn.signOut();
88 | log.wtf("Logout Sucess");
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/lib/service/firebase_service.dart:
--------------------------------------------------------------------------------
1 | import 'package:cloud_firestore/cloud_firestore.dart';
2 | import 'package:firebase_auth/firebase_auth.dart';
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter_chat_app/helper/logger.dart';
5 | import 'package:flutter_chat_app/helper/utility.dart';
6 | import 'package:flutter_chat_app/model/chat_message.dart';
7 | import 'package:flutter_chat_app/model/user.dart';
8 |
9 | enum AuthProblems { UserNotFound, PasswordNotValid, NetworkError }
10 |
11 | class FirebaseService {
12 | var _fireStoreInstance = Firestore.instance;
13 | final logger = getLogger("FirebaseService");
14 |
15 | Stream> getAllUsers() async* {
16 | await for (QuerySnapshot data
17 | in _fireStoreInstance.collection("users").snapshots()) {
18 | final list = data.documents.map((d) => User.fromJson(d.data)).toList();
19 | logger.i("Fetch user list: ${list.length}");
20 | yield list;
21 | }
22 | }
23 |
24 | Stream> getchatUsers(String myId) async* {
25 | print(myId);
26 | var data = await _fireStoreInstance
27 | .collection("Messenger")
28 | .document("chatUsers")
29 | .collection(myId)
30 | .getDocuments();
31 | final list = data.documents.map((d) {
32 | var user = User.fromJson(d.data);
33 | return user;
34 | }).toList();
35 | logger.i("Fetch chat user list: ${list.length}");
36 | yield list;
37 | }
38 |
39 | Future getUserProfile(FirebaseUser user) async {
40 | final doc =
41 | await _fireStoreInstance.collection("users").document(user.uid).get();
42 | return User.fromJson(doc.data);
43 | }
44 |
45 | sendMessage(ChatMessage message,
46 | {@required User myUser,
47 | @required User chatUser,
48 | @required bool isNewChat}) {
49 | final chanelName = getChannelName(myUser.userId, chatUser.userId);
50 | if (isNewChat) {
51 | _fireStoreInstance
52 | .collection("Messenger")
53 | .document("chatUsers")
54 | .collection(myUser.userId)
55 | .document(chatUser.userId)
56 | .setData(chatUser.toJson());
57 | _fireStoreInstance
58 | .collection("Messenger")
59 | .document("chatUsers")
60 | .collection(chatUser.userId)
61 | .document(myUser.userId)
62 | .setData(myUser.toJson());
63 | }
64 | _fireStoreInstance
65 | .collection("Messenger")
66 | .document("chats")
67 | .collection(chanelName)
68 | .document()
69 | .setData(message.toJson());
70 | }
71 |
72 | Stream getChatMessage(String channelName) async* {
73 | await for (QuerySnapshot data in _fireStoreInstance
74 | .collection("Messenger")
75 | .document("chats")
76 | .collection(channelName)
77 | .orderBy("created_at")
78 | .snapshots()) {
79 | final list = data.documents.map((d) {
80 | var dd = ChatMessage.fromJson(d.data);
81 | return dd;
82 | }).toList();
83 | logger.i("Fetch chat message list: ${list.length}");
84 | yield list != null && list.length > 0
85 | ? ChatResponse(data: list.reversed.toList())
86 | : null;
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/lib/service/repository.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_chat_app/helper/logger.dart';
2 | import 'package:flutter_chat_app/locator.dart';
3 | import 'package:flutter_chat_app/model/chat_message.dart';
4 | import 'package:flutter_chat_app/model/user.dart';
5 | import 'package:flutter_chat_app/service/firebase_service.dart';
6 | import 'package:rxdart/subjects.dart';
7 |
8 | class Repository {
9 | final logger = getLogger("UserRepository");
10 | final getit = getIt();
11 |
12 | Stream getMessageList(String channelName) => getit.getChatMessage(channelName);
13 | Stream> getAllUsersList() => getit.getAllUsers();
14 | Stream> getChatUsersList(String myId) => getit.getchatUsers(myId);
15 | sendMessage(ChatMessage message,{ User myUser, User chatUser, bool isNewChat}){
16 | getit.sendMessage(message, myUser: myUser, chatUser: chatUser, isNewChat: true);
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/lib/state/app_state.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_chat_app/locator.dart';
3 | import 'package:flutter_chat_app/model/chat_message.dart';
4 | import 'package:flutter_chat_app/model/user.dart';
5 | import 'package:flutter_chat_app/service/repository.dart';
6 | import 'package:rxdart/rxdart.dart';
7 |
8 | class AppState extends ChangeNotifier {
9 | bool _isBusy;
10 | bool get isbusy => _isBusy;
11 |
12 | BehaviorSubject pageIndex = BehaviorSubject()..add(0);
13 | set setpageIndex(int index) {
14 | pageIndex.value = index;
15 | }
16 |
17 | final repo = getIt();
18 | Stream> getAllUSerList(String myId) => repo.getAllUsersList();
19 | Stream> getChatUsersList(String myId) => repo.getChatUsersList(myId);
20 |
21 | @override
22 | void dispose() {
23 | pageIndex.close();
24 | super.dispose();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/lib/state/auth_state.dart:
--------------------------------------------------------------------------------
1 | import 'package:firebase_auth/firebase_auth.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:flutter_chat_app/helper/enum.dart';
4 | import 'package:flutter_chat_app/helper/logger.dart';
5 | import 'package:flutter_chat_app/helper/utility.dart';
6 | import 'package:flutter_chat_app/locator.dart';
7 | import 'package:flutter_chat_app/model/user.dart';
8 | import 'package:flutter_chat_app/service/auth_service.dart';
9 | import 'package:rxdart/rxdart.dart';
10 |
11 | class AuthState extends ChangeNotifier {
12 | AuthStatus authStatus = AuthStatus.NOT_DETERMINED;
13 | BehaviorSubject loginStatus = BehaviorSubject()
14 | ..add(AuthStatus.NOT_DETERMINED);
15 | bool isSignInWithGoogle = false;
16 | FirebaseUser user;
17 |
18 | String userId;
19 | User _userModel;
20 |
21 | final getit = getIt();
22 | User get userModel => _userModel;
23 |
24 | /// Asynchronously signs in to Firebase with the google email
25 | /// If successful, it also signs the user in into the app and updates the [onAuthStateChanged] stream.
26 | /// If the user doesn't have an account already, one will be created automatically.
27 | loginViaGoogle() {
28 | getit.handleGoogleSignIn().then((user) {
29 | this.user = user;
30 | loginStatus.add(AuthStatus.LOGGED_IN);
31 | return user;
32 | }).then((user) {
33 | _userModel = getit.createUserFromGoogleSignIn(user);
34 | }).catchError((error) {
35 | cprint(error, errorIn: "loginViaGoogle");
36 | loginStatus.add(AuthStatus.NOT_LOGGED_IN);
37 | });
38 | }
39 |
40 | /// Asynchronously logout from firebase
41 | logout() {
42 | getit.logout();
43 | loginStatus.add(AuthStatus.NOT_LOGGED_IN);
44 | }
45 |
46 | @override
47 | void dispose() {
48 | loginStatus.close();
49 | super.dispose();
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/lib/state/chat_state.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_chat_app/helper/utility.dart';
3 | import 'package:flutter_chat_app/locator.dart';
4 | import 'package:flutter_chat_app/model/chat_message.dart';
5 | import 'package:flutter_chat_app/model/user.dart';
6 | import 'package:flutter_chat_app/service/firebase_service.dart';
7 | import 'package:flutter_chat_app/service/repository.dart';
8 | import 'package:rxdart/rxdart.dart';
9 |
10 | class ChatState extends ChangeNotifier {
11 | BehaviorSubject chatUser = BehaviorSubject();
12 | // BehaviorSubject chat = BehaviorSubject();
13 | // BehaviorSubject chatMessageList = BehaviorSubject();
14 | // final getit = getIt();
15 | final repo = getIt();
16 | List messageList = [];
17 |
18 | void selectUserToChat(User model, String myId) {
19 | chatUser.add(model);
20 | channelName = getChannelName(model.userId, myId);
21 | }
22 |
23 | static String channelName;
24 | Stream get getMessageList => repo.getMessageList(channelName);
25 | sendMessage(ChatMessage message, User myUser) {
26 | repo.sendMessage(message,
27 | myUser: myUser, chatUser: chatUser.value, isNewChat: true);
28 | }
29 | }
--------------------------------------------------------------------------------
/lib/theme/dark_clolor.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class DarkColor{
4 | static final Color primary = Color(0xff00B2FF);
5 | static final Color secondary = Color(0xff282434);
6 | static final Color darkGrey = Color(0xff343640);
7 | static final Color lightGrey = Color(0xffAAB8C2);
8 | static final Color extraLightGrey = Color(0xffE1E8ED);
9 | static final Color extraExtraLightGrey = Color(0xfff5F8FA);
10 | static final Color white = Color(0xFFffffff);
11 | static final Color dimWhite = Color(0xff9d9ea2);
12 | }
--------------------------------------------------------------------------------
/lib/theme/extentions.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_chat_app/theme/dark_clolor.dart';
3 |
4 | extension TextStyleHelpers on TextStyle {
5 | TextStyle get bold => copyWith(fontWeight: FontWeight.bold);
6 | TextStyle get italic => copyWith(fontStyle: FontStyle.italic);
7 | TextStyle get white => copyWith(color: Colors.white);
8 | TextStyle get lighGrey => copyWith(color: DarkColor.lightGrey);
9 | TextStyle get dimWhite => copyWith(color: DarkColor.dimWhite);
10 | TextStyle letterSpace(double value) => copyWith(letterSpacing: value);
11 | }
12 |
13 | extension PaddingHelper on Widget {
14 | Padding get p16 => Padding(padding: EdgeInsets.all(16), child: this);
15 |
16 | /// Set padding according to `value`
17 | Padding p(double value) =>
18 | Padding(padding: EdgeInsets.all(value), child: this);
19 |
20 | /// Horizontal Padding 16
21 | Padding get hP16 =>
22 | Padding(padding: EdgeInsets.symmetric(horizontal: 16), child: this);
23 |
24 | /// Vertical Padding 16
25 | Padding get vP16 =>
26 | Padding(padding: EdgeInsets.symmetric(vertical: 16), child: this);
27 | Padding get vP8 =>
28 | Padding(padding: EdgeInsets.symmetric(vertical: 8), child: this);
29 | Padding get vP4 =>
30 | Padding(padding: EdgeInsets.symmetric(vertical: 8), child: this);
31 | }
32 |
33 | extension Extented on Widget {
34 | Expanded get extended => Expanded(
35 | child: this,
36 | );
37 | }
38 | extension CornerRadius on Widget {
39 | ClipRRect get circular=> ClipRRect(
40 | borderRadius: BorderRadius.all(Radius.circular(1000)),
41 | child: this,
42 | );
43 | }
44 | extension OnPressed on Widget {
45 | Widget ripple(Function onPressed, {BorderRadiusGeometry borderRadius =const BorderRadius.all(Radius.circular(5))}) => Stack(
46 | children: [
47 | this,
48 | Positioned(
49 | left: 0,
50 | right: 0,
51 | top: 0,
52 | bottom: 0,
53 | child: FlatButton(
54 | shape: RoundedRectangleBorder(
55 | borderRadius: borderRadius
56 | ),
57 | onPressed: () {
58 | if (onPressed != null) {
59 | onPressed();
60 | }
61 | },
62 | child: Container()),
63 | )
64 | ],
65 | );
66 | }
--------------------------------------------------------------------------------
/lib/theme/styles.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class FontSizes {
4 | static double scale = 1.2;
5 | static double get body => 14 * scale;
6 | static double get bodySm => 12 * scale;
7 | static double get title => 16 * scale;
8 | static double get titleM => 14 * scale;
9 | }
10 |
11 | class TextStyles {
12 |
13 | static TextStyle get title =>TextStyle(fontSize: FontSizes.title);
14 | static TextStyle get titleM =>TextStyle(fontSize: FontSizes.titleM);
15 | static TextStyle get titleLight => title.copyWith(fontWeight: FontWeight.w300);
16 | static TextStyle get titleMedium => titleM.copyWith(fontWeight: FontWeight.w300);
17 |
18 | static TextStyle get body => TextStyle(fontSize: FontSizes.body, fontWeight: FontWeight.w300);
19 | static TextStyle get bodySm => body.copyWith(fontSize: FontSizes.bodySm);
20 | }
--------------------------------------------------------------------------------
/lib/theme/theme.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_chat_app/theme/dark_clolor.dart';
3 | import 'package:flutter_chat_app/theme/styles.dart';
4 | import 'package:google_fonts/google_fonts.dart';
5 | export 'extentions.dart';
6 |
7 | class AppTheme {
8 | static ThemeData darkTheme = ThemeData(
9 | primarySwatch: Colors.blue,
10 | backgroundColor: DarkColor.secondary,
11 | secondaryHeaderColor: DarkColor.darkGrey,
12 | primaryColor: DarkColor.primary,
13 | textTheme: GoogleFonts.muliTextTheme(
14 | TextTheme(
15 | body1: TextStyle(color: Colors.white),
16 | body2: TextStyle(color: DarkColor.extraExtraLightGrey),
17 | title: TextStyle(color: Colors.white),
18 | subtitle: TextStyle(color: DarkColor.extraExtraLightGrey),
19 | ),
20 | ),
21 | dividerColor: DarkColor.lightGrey,
22 | bottomAppBarColor: DarkColor.darkGrey,
23 | iconTheme: IconThemeData(color: DarkColor.lightGrey),
24 | appBarTheme: AppBarTheme(
25 | textTheme: TextTheme(
26 | title: TextStyles.title,
27 | ),
28 | color:DarkColor.darkGrey,
29 | iconTheme: IconThemeData(color: DarkColor.lightGrey)
30 | ),
31 | );
32 | }
33 |
--------------------------------------------------------------------------------
/lib/widgets/bottomMenuBar.dart:
--------------------------------------------------------------------------------
1 | // import 'package:fancy_bottom_navigation/internal/tab_item.dart';
2 | import 'package:flutter/cupertino.dart';
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter_chat_app/state/app_state.dart';
5 | import 'package:flutter_chat_app/widgets/customWidgets.dart';
6 | import 'package:provider/provider.dart';
7 | // import 'customBottomNavigationBar.dart';
8 |
9 | class BottomMenubar extends StatefulWidget {
10 | _BottomMenubarState createState() => _BottomMenubarState();
11 | }
12 |
13 | class _BottomMenubarState extends State {
14 | @override
15 | void initState() {
16 | super.initState();
17 | }
18 |
19 | Widget _iconRow() {
20 | return Container(
21 | height: 50,
22 | decoration: BoxDecoration(
23 | color: Theme.of(context).bottomAppBarColor,
24 | boxShadow: [
25 | BoxShadow(
26 | color: Colors.black12, offset: Offset(0, -.1), blurRadius: 0)
27 | ],
28 | ),
29 | child: Row(
30 | mainAxisSize: MainAxisSize.max,
31 | crossAxisAlignment: CrossAxisAlignment.center,
32 | children: [
33 | _icon(Icons.home, 0),
34 | _icon(Icons.search, 1),
35 | _icon(Icons.person, 2),
36 | _icon(Icons.settings, 3),
37 | ],
38 | ),
39 | );
40 | }
41 |
42 | Widget _icon(IconData iconData, int index) {
43 | var state = Provider.of(context,listen:false);
44 |
45 | return Expanded(
46 | child: Container(
47 | height: double.infinity,
48 | width: double.infinity,
49 | child: AnimatedAlign(
50 | duration: Duration(milliseconds: 300),
51 | curve: Curves.easeIn,
52 | alignment: Alignment(0, 0),
53 | child: AnimatedOpacity(
54 | duration: Duration(milliseconds: 300),
55 | opacity: 1,
56 | child: IconButton(
57 | highlightColor: Colors.transparent,
58 | splashColor: Colors.transparent,
59 | padding: EdgeInsets.all(0),
60 | alignment: Alignment(0, 0),
61 | icon: StreamBuilder(
62 | stream: state.pageIndex,
63 | builder: (context, AsyncSnapshot snapshot) {
64 | return Icon(iconData,
65 | color: index == snapshot.data
66 | ? Theme.of(context).primaryColor
67 | : Theme.of(context).bottomAppBarTheme.color);
68 | },
69 | ),
70 | onPressed: () {
71 | state.setpageIndex = index;
72 | },
73 | ),
74 | ),
75 | ),
76 | ),
77 | );
78 | }
79 |
80 | @override
81 | Widget build(BuildContext context) {
82 | return _iconRow();
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/lib/widgets/customRoute.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class CustomRoute extends MaterialPageRoute {
4 | CustomRoute({WidgetBuilder builder, RouteSettings settings})
5 | : super(builder: builder, settings: settings);
6 |
7 | @override
8 | Widget buildTransitions(BuildContext context, Animation animation,
9 | Animation secondaryAnimation, Widget child) {
10 |
11 | if (settings.isInitialRoute) {
12 | return child;
13 | }
14 | return FadeTransition(
15 | opacity: CurvedAnimation(parent: animation, curve: Curves.fastOutSlowIn),
16 | child: child,
17 | );
18 | }
19 | }
20 |
21 | class SlideLeftRoute extends MaterialPageRoute {
22 | SlideLeftRoute({WidgetBuilder builder, RouteSettings settings})
23 | : super(builder: builder, settings: settings);
24 | @override
25 | Widget buildTransitions(BuildContext context, Animation animation,
26 | Animation secondaryAnimation, Widget child) {
27 |
28 | if (settings.isInitialRoute) {
29 | return child;
30 | }
31 | return SlideTransition(
32 | position: new Tween(
33 | begin: const Offset(1.0, 0.0),
34 | end: Offset.zero,
35 | ).animate(
36 | CurvedAnimation(parent: animation, curve: Curves.fastOutSlowIn)),
37 | child: child,
38 | );
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/lib/widgets/customWidgets.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:flutter/cupertino.dart';
4 | import 'package:flutter/material.dart';
5 | import 'package:flutter/widgets.dart';
6 | import 'package:flutter_chat_app/model/user.dart';
7 | import 'package:flutter_chat_app/theme/theme.dart';
8 | import 'package:image_picker/image_picker.dart';
9 |
10 | Widget customTitleText(String title, {BuildContext context}) {
11 | return Text(
12 | title ?? '',
13 | style: TextStyle(
14 | color: Colors.black87,
15 | fontFamily: 'HelveticaNeue',
16 | fontWeight: FontWeight.w900,
17 | fontSize: 20),
18 | );
19 | }
20 |
21 | Widget customText(String msg,
22 | {Key key,
23 | TextStyle style,
24 | TextAlign textAlign = TextAlign.justify,
25 | TextOverflow overflow = TextOverflow.visible,
26 | BuildContext context,
27 | bool softwrap = true}) {
28 | if (msg == null) {
29 | return SizedBox(
30 | height: 0,
31 | width: 0,
32 | );
33 | } else {
34 | if (context != null && style != null) {
35 | var fontSize =
36 | style.fontSize ?? Theme.of(context).textTheme.body1.fontSize;
37 | style = style.copyWith(
38 | fontSize: fontSize - (fullWidth(context) <= 375 ? 2 : 0));
39 | }
40 | return Text(
41 | msg,
42 | style: style,
43 | textAlign: textAlign,
44 | overflow: overflow,
45 | softWrap: softwrap,
46 | key: key,
47 | );
48 | }
49 | }
50 |
51 | Widget userAvatar(User user, {double radius = 25}) {
52 | if (user == null) {
53 | user = User(
54 | profilePic:
55 | 'http://www.azembelani.co.za/wp-content/uploads/2016/07/20161014_58006bf6e7079-3.png');
56 | }
57 | if(user.profilePic == null){
58 | print(user.displayName);
59 | return Container();
60 | }
61 | return CircleAvatar(radius: radius, backgroundImage: NetworkImage(user.profilePic));
62 | }
63 |
64 | double fullWidth(BuildContext context) {
65 | // cprint(MediaQuery.of(context).size.width.toString());
66 | return MediaQuery.of(context).size.width;
67 | }
68 |
69 | double fullHeight(BuildContext context) {
70 | return MediaQuery.of(context).size.height;
71 | }
72 |
73 | Widget customInkWell(
74 | {Widget child,
75 | BuildContext context,
76 | Function(bool, int) function1,
77 | Function onPressed,
78 | bool isEnable = false,
79 | int no = 0,
80 | Color color = Colors.transparent,
81 | Color splashColor,
82 | BorderRadius radius}) {
83 | if (splashColor == null) {
84 | splashColor = Theme.of(context).primaryColorLight;
85 | }
86 | if (radius == null) {
87 | radius = BorderRadius.circular(0);
88 | }
89 | return Material(
90 | color: color,
91 | child: InkWell(
92 | borderRadius: radius,
93 | onTap: () {
94 | if (function1 != null) {
95 | function1(isEnable, no);
96 | } else if (onPressed != null) {
97 | onPressed();
98 | }
99 | },
100 | splashColor: splashColor,
101 | child: child,
102 | ),
103 | );
104 | }
105 |
106 | SizedBox sizedBox({double height = 5, String title}) {
107 | return SizedBox(
108 | height: title == null || title.isEmpty ? 0 : height,
109 | );
110 | }
111 |
112 | void showAlert(BuildContext context,
113 | {@required Function onPressedOk,
114 | @required String title,
115 | String okText = 'OK',
116 | String cancelText = 'Cancel'}) async {
117 | showDialog(
118 | context: context,
119 | builder: (context) {
120 | return customAlert(context,
121 | onPressedOk: onPressedOk,
122 | title: title,
123 | okText: okText,
124 | cancelText: cancelText);
125 | });
126 | }
127 |
128 | Widget customAlert(BuildContext context,
129 | {@required Function onPressedOk,
130 | @required String title,
131 | String okText = 'OK',
132 | String cancelText = 'Cancel'}) {
133 | return AlertDialog(
134 | title: Text('Alert',
135 | style: TextStyle(
136 | fontSize: getDimention(context, 25), color: Colors.black54)),
137 | content: customText(title, style: TextStyle(color: Colors.black45)),
138 | actions: [
139 | FlatButton(
140 | textColor: Colors.grey,
141 | onPressed: () {
142 | Navigator.pop(context);
143 | },
144 | child: Text(cancelText),
145 | ),
146 | FlatButton(
147 | textColor: Theme.of(context).primaryColor,
148 | onPressed: () {
149 | Navigator.pop(context);
150 | onPressedOk();
151 | },
152 | child: Text(okText),
153 | )
154 | ],
155 | );
156 | }
157 |
158 | void customSnackBar(GlobalKey _scaffoldKey, String msg,
159 | {double height = 30, Color backgroundColor = Colors.black}) {
160 | if (_scaffoldKey == null || _scaffoldKey.currentState == null) {
161 | return;
162 | }
163 | _scaffoldKey.currentState.hideCurrentSnackBar();
164 | final snackBar = SnackBar(
165 | backgroundColor: backgroundColor,
166 | content: Text(
167 | msg,
168 | style: TextStyle(
169 | color: Colors.white,
170 | ),
171 | ));
172 | _scaffoldKey.currentState.showSnackBar(snackBar);
173 | }
174 |
175 | Widget emptyListWidget(BuildContext context, String title,
176 | {String subTitle, String image = 'emptyImage.png'}) {
177 | return Container(
178 | color: Color(0xfffafafa),
179 | child: Center(
180 | child: Stack(
181 | alignment: Alignment.center,
182 | children: [
183 | Container(
184 | width: fullWidth(context) * .95,
185 | height: fullWidth(context) * .95,
186 | decoration: BoxDecoration(
187 | // color: Color(0xfff1f3f6),
188 | boxShadow: [
189 | // BoxShadow(blurRadius: 50,offset: Offset(0, 0),color: Color(0xffe2e5ed),spreadRadius:20),
190 | BoxShadow(
191 | offset: Offset(0, 0),
192 | color: Color(0xffe2e5ed),
193 | ),
194 | BoxShadow(
195 | blurRadius: 50,
196 | offset: Offset(10, 0),
197 | color: Color(0xffffffff),
198 | spreadRadius: -5),
199 | ], shape: BoxShape.circle),
200 | ),
201 | Column(
202 | mainAxisAlignment: MainAxisAlignment.center,
203 | children: [
204 | Image.asset('assets/images/$image', height: 170),
205 | SizedBox(
206 | height: 20,
207 | ),
208 | customText(title,
209 | style: Theme.of(context)
210 | .typography
211 | .dense
212 | .display1
213 | .copyWith(color: Color(0xff9da9c7))),
214 | customText(subTitle,
215 | style: Theme.of(context)
216 | .typography
217 | .dense
218 | .body2
219 | .copyWith(color: Color(0xffabb8d6))),
220 | ],
221 | )
222 | ],
223 | )));
224 | }
225 |
226 | Widget loader() {
227 | if (Platform.isIOS) {
228 | return Center(
229 | child: CupertinoActivityIndicator(),
230 | );
231 | } else {
232 | return Center(
233 | child: CircularProgressIndicator(
234 | valueColor: AlwaysStoppedAnimation(Colors.blue),
235 | ),
236 | );
237 | }
238 | }
239 |
240 | Widget customSwitcherWidget(
241 | {@required child, Duration duraton = const Duration(milliseconds: 500)}) {
242 | return AnimatedSwitcher(
243 | duration: duraton,
244 | transitionBuilder: (Widget child, Animation animation) {
245 | return ScaleTransition(child: child, scale: animation);
246 | },
247 | child: child,
248 | );
249 | }
250 |
251 | Widget customExtendedText(String text, bool isExpanded,
252 | {BuildContext context,
253 | TextStyle style,
254 | @required Function onPressed,
255 | @required TickerProvider provider,
256 | AlignmentGeometry alignment = Alignment.topRight,
257 | @required EdgeInsetsGeometry padding,
258 | int wordLimit = 100,
259 | bool isAnimated = true}) {
260 | return Column(
261 | crossAxisAlignment: CrossAxisAlignment.start,
262 | children: [
263 | AnimatedSize(
264 | vsync: provider,
265 | duration: Duration(milliseconds: (isAnimated ? 500 : 0)),
266 | child: ConstrainedBox(
267 | constraints: isExpanded
268 | ? BoxConstraints()
269 | : BoxConstraints(
270 | maxHeight: wordLimit == 100 ? 100.0 : 260.0),
271 | child: customText(text,
272 | softwrap: true,
273 | overflow: TextOverflow.fade,
274 | style: style,
275 | context: context,
276 | textAlign: TextAlign.start))),
277 | text != null && text.length > wordLimit
278 | ? Container(
279 | alignment: alignment,
280 | child: InkWell(
281 | onTap: onPressed,
282 | child: Padding(
283 | padding: padding,
284 | child: Text(
285 | !isExpanded ? 'more...' : 'Less...',
286 | style: TextStyle(color: Colors.blue, fontSize: 14),
287 | ),
288 | )),
289 | )
290 | : Container()
291 | ]);
292 | }
293 |
294 | double getDimention(context, double unit) {
295 | if (fullWidth(context) <= 360.0) {
296 | return unit / 1.3;
297 | } else {
298 | return unit;
299 | }
300 | }
301 |
302 | Widget customListTile(BuildContext context,
303 | {Widget title,
304 | Widget subtitle,
305 | Widget leading,
306 | Widget trailing,
307 | Function onTap}) {
308 | return customInkWell(
309 | context: context,
310 | onPressed: () {
311 | if (onTap != null) {
312 | onTap();
313 | }
314 | },
315 | child: Padding(
316 | padding: EdgeInsets.symmetric(vertical: 0),
317 | child: Row(
318 | crossAxisAlignment: CrossAxisAlignment.start,
319 | children: [
320 | SizedBox(
321 | width: 10,
322 | ),
323 | Container(
324 | width: 40,
325 | height: 40,
326 | child: leading,
327 | ),
328 | SizedBox(
329 | width: 20,
330 | ),
331 | Container(
332 | width: fullWidth(context) - 80,
333 | child: Column(
334 | crossAxisAlignment: CrossAxisAlignment.start,
335 | children: [
336 | Row(
337 | children: [
338 | Expanded(child: title ?? Container()),
339 | trailing ?? Container(),
340 | ],
341 | ),
342 | subtitle
343 | ],
344 | ),
345 | ),
346 | SizedBox(
347 | width: 10,
348 | ),
349 | ],
350 | )));
351 | }
352 |
353 | openImagePicker(BuildContext context, Function onImageSelected) {
354 | showModalBottomSheet(
355 | context: context,
356 | builder: (BuildContext context) {
357 | return Container(
358 | height: 100,
359 | padding: EdgeInsets.all(10),
360 | child: Column(
361 | children: [
362 | Text(
363 | 'Pick an image',
364 | style: TextStyle(fontWeight: FontWeight.bold),
365 | ),
366 | SizedBox(height: 10),
367 | Row(
368 | children: [
369 | Expanded(
370 | child: FlatButton(
371 | color: Theme.of(context).primaryColor,
372 | child: Text(
373 | 'Use Camera',
374 | style:
375 | TextStyle(color: Theme.of(context).backgroundColor),
376 | ),
377 | onPressed: () {
378 | getImage(context, ImageSource.camera, onImageSelected);
379 | },
380 | ),
381 | ),
382 | SizedBox(
383 | width: 10,
384 | ),
385 | Expanded(
386 | child: FlatButton(
387 | color: Theme.of(context).primaryColor,
388 | child: Text(
389 | 'Use Gallery',
390 | style:
391 | TextStyle(color: Theme.of(context).backgroundColor),
392 | ),
393 | onPressed: () {
394 | getImage(context, ImageSource.gallery, onImageSelected);
395 | },
396 | ),
397 | )
398 | ],
399 | )
400 | ],
401 | ),
402 | );
403 | });
404 | }
405 |
406 | getImage(BuildContext context, ImageSource source, Function onImageSelected) {
407 | ImagePicker.pickImage(source: source, imageQuality: 50).then((File file) {
408 | onImageSelected(file);
409 | Navigator.pop(context);
410 | });
411 | }
412 |
--------------------------------------------------------------------------------
/pubspec.lock:
--------------------------------------------------------------------------------
1 | # Generated by pub
2 | # See https://dart.dev/tools/pub/glossary#lockfile
3 | packages:
4 | archive:
5 | dependency: transitive
6 | description:
7 | name: archive
8 | url: "https://pub.dartlang.org"
9 | source: hosted
10 | version: "2.0.11"
11 | args:
12 | dependency: transitive
13 | description:
14 | name: args
15 | url: "https://pub.dartlang.org"
16 | source: hosted
17 | version: "1.5.2"
18 | async:
19 | dependency: "direct main"
20 | description:
21 | name: async
22 | url: "https://pub.dartlang.org"
23 | source: hosted
24 | version: "2.4.0"
25 | boolean_selector:
26 | dependency: transitive
27 | description:
28 | name: boolean_selector
29 | url: "https://pub.dartlang.org"
30 | source: hosted
31 | version: "1.0.5"
32 | charcode:
33 | dependency: transitive
34 | description:
35 | name: charcode
36 | url: "https://pub.dartlang.org"
37 | source: hosted
38 | version: "1.1.2"
39 | cloud_firestore:
40 | dependency: "direct main"
41 | description:
42 | name: cloud_firestore
43 | url: "https://pub.dartlang.org"
44 | source: hosted
45 | version: "0.13.4+2"
46 | cloud_firestore_platform_interface:
47 | dependency: transitive
48 | description:
49 | name: cloud_firestore_platform_interface
50 | url: "https://pub.dartlang.org"
51 | source: hosted
52 | version: "1.1.0"
53 | cloud_firestore_web:
54 | dependency: transitive
55 | description:
56 | name: cloud_firestore_web
57 | url: "https://pub.dartlang.org"
58 | source: hosted
59 | version: "0.1.1+2"
60 | collection:
61 | dependency: transitive
62 | description:
63 | name: collection
64 | url: "https://pub.dartlang.org"
65 | source: hosted
66 | version: "1.14.11"
67 | convert:
68 | dependency: transitive
69 | description:
70 | name: convert
71 | url: "https://pub.dartlang.org"
72 | source: hosted
73 | version: "2.1.1"
74 | crypto:
75 | dependency: transitive
76 | description:
77 | name: crypto
78 | url: "https://pub.dartlang.org"
79 | source: hosted
80 | version: "2.1.3"
81 | cupertino_icons:
82 | dependency: "direct main"
83 | description:
84 | name: cupertino_icons
85 | url: "https://pub.dartlang.org"
86 | source: hosted
87 | version: "0.1.3"
88 | firebase:
89 | dependency: transitive
90 | description:
91 | name: firebase
92 | url: "https://pub.dartlang.org"
93 | source: hosted
94 | version: "7.3.0"
95 | firebase_auth:
96 | dependency: "direct main"
97 | description:
98 | name: firebase_auth
99 | url: "https://pub.dartlang.org"
100 | source: hosted
101 | version: "0.15.5+3"
102 | firebase_auth_platform_interface:
103 | dependency: transitive
104 | description:
105 | name: firebase_auth_platform_interface
106 | url: "https://pub.dartlang.org"
107 | source: hosted
108 | version: "1.1.7"
109 | firebase_auth_web:
110 | dependency: transitive
111 | description:
112 | name: firebase_auth_web
113 | url: "https://pub.dartlang.org"
114 | source: hosted
115 | version: "0.1.2"
116 | firebase_core:
117 | dependency: transitive
118 | description:
119 | name: firebase_core
120 | url: "https://pub.dartlang.org"
121 | source: hosted
122 | version: "0.4.4+3"
123 | firebase_core_platform_interface:
124 | dependency: transitive
125 | description:
126 | name: firebase_core_platform_interface
127 | url: "https://pub.dartlang.org"
128 | source: hosted
129 | version: "1.0.4"
130 | firebase_core_web:
131 | dependency: transitive
132 | description:
133 | name: firebase_core_web
134 | url: "https://pub.dartlang.org"
135 | source: hosted
136 | version: "0.1.1+2"
137 | firebase_database:
138 | dependency: "direct main"
139 | description:
140 | name: firebase_database
141 | url: "https://pub.dartlang.org"
142 | source: hosted
143 | version: "3.1.3"
144 | flutter:
145 | dependency: "direct main"
146 | description: flutter
147 | source: sdk
148 | version: "0.0.0"
149 | flutter_plugin_android_lifecycle:
150 | dependency: transitive
151 | description:
152 | name: flutter_plugin_android_lifecycle
153 | url: "https://pub.dartlang.org"
154 | source: hosted
155 | version: "1.0.6"
156 | flutter_test:
157 | dependency: "direct dev"
158 | description: flutter
159 | source: sdk
160 | version: "0.0.0"
161 | flutter_web_plugins:
162 | dependency: transitive
163 | description: flutter
164 | source: sdk
165 | version: "0.0.0"
166 | get_it:
167 | dependency: "direct main"
168 | description:
169 | name: get_it
170 | url: "https://pub.dartlang.org"
171 | source: hosted
172 | version: "4.0.1"
173 | google_fonts:
174 | dependency: "direct main"
175 | description:
176 | name: google_fonts
177 | url: "https://pub.dartlang.org"
178 | source: hosted
179 | version: "0.3.10"
180 | google_sign_in:
181 | dependency: "direct main"
182 | description:
183 | name: google_sign_in
184 | url: "https://pub.dartlang.org"
185 | source: hosted
186 | version: "4.4.0"
187 | google_sign_in_platform_interface:
188 | dependency: transitive
189 | description:
190 | name: google_sign_in_platform_interface
191 | url: "https://pub.dartlang.org"
192 | source: hosted
193 | version: "1.1.0"
194 | google_sign_in_web:
195 | dependency: transitive
196 | description:
197 | name: google_sign_in_web
198 | url: "https://pub.dartlang.org"
199 | source: hosted
200 | version: "0.8.4"
201 | http:
202 | dependency: transitive
203 | description:
204 | name: http
205 | url: "https://pub.dartlang.org"
206 | source: hosted
207 | version: "0.12.0+4"
208 | http_parser:
209 | dependency: transitive
210 | description:
211 | name: http_parser
212 | url: "https://pub.dartlang.org"
213 | source: hosted
214 | version: "3.1.4"
215 | image:
216 | dependency: transitive
217 | description:
218 | name: image
219 | url: "https://pub.dartlang.org"
220 | source: hosted
221 | version: "2.1.4"
222 | image_picker:
223 | dependency: "direct main"
224 | description:
225 | name: image_picker
226 | url: "https://pub.dartlang.org"
227 | source: hosted
228 | version: "0.6.4"
229 | intl:
230 | dependency: "direct main"
231 | description:
232 | name: intl
233 | url: "https://pub.dartlang.org"
234 | source: hosted
235 | version: "0.15.8"
236 | io:
237 | dependency: transitive
238 | description:
239 | name: io
240 | url: "https://pub.dartlang.org"
241 | source: hosted
242 | version: "0.3.4"
243 | js:
244 | dependency: transitive
245 | description:
246 | name: js
247 | url: "https://pub.dartlang.org"
248 | source: hosted
249 | version: "0.6.1+1"
250 | logger:
251 | dependency: "direct main"
252 | description:
253 | name: logger
254 | url: "https://pub.dartlang.org"
255 | source: hosted
256 | version: "0.8.3"
257 | matcher:
258 | dependency: transitive
259 | description:
260 | name: matcher
261 | url: "https://pub.dartlang.org"
262 | source: hosted
263 | version: "0.12.6"
264 | meta:
265 | dependency: transitive
266 | description:
267 | name: meta
268 | url: "https://pub.dartlang.org"
269 | source: hosted
270 | version: "1.1.8"
271 | nested:
272 | dependency: transitive
273 | description:
274 | name: nested
275 | url: "https://pub.dartlang.org"
276 | source: hosted
277 | version: "0.0.4"
278 | path:
279 | dependency: transitive
280 | description:
281 | name: path
282 | url: "https://pub.dartlang.org"
283 | source: hosted
284 | version: "1.6.4"
285 | path_provider:
286 | dependency: transitive
287 | description:
288 | name: path_provider
289 | url: "https://pub.dartlang.org"
290 | source: hosted
291 | version: "1.6.5"
292 | path_provider_macos:
293 | dependency: transitive
294 | description:
295 | name: path_provider_macos
296 | url: "https://pub.dartlang.org"
297 | source: hosted
298 | version: "0.0.4"
299 | path_provider_platform_interface:
300 | dependency: transitive
301 | description:
302 | name: path_provider_platform_interface
303 | url: "https://pub.dartlang.org"
304 | source: hosted
305 | version: "1.0.1"
306 | pedantic:
307 | dependency: transitive
308 | description:
309 | name: pedantic
310 | url: "https://pub.dartlang.org"
311 | source: hosted
312 | version: "1.8.0+1"
313 | petitparser:
314 | dependency: transitive
315 | description:
316 | name: petitparser
317 | url: "https://pub.dartlang.org"
318 | source: hosted
319 | version: "2.4.0"
320 | platform:
321 | dependency: transitive
322 | description:
323 | name: platform
324 | url: "https://pub.dartlang.org"
325 | source: hosted
326 | version: "2.2.1"
327 | plugin_platform_interface:
328 | dependency: transitive
329 | description:
330 | name: plugin_platform_interface
331 | url: "https://pub.dartlang.org"
332 | source: hosted
333 | version: "1.0.2"
334 | provider:
335 | dependency: "direct main"
336 | description:
337 | name: provider
338 | url: "https://pub.dartlang.org"
339 | source: hosted
340 | version: "4.0.4"
341 | quiver:
342 | dependency: transitive
343 | description:
344 | name: quiver
345 | url: "https://pub.dartlang.org"
346 | source: hosted
347 | version: "2.0.5"
348 | rxdart:
349 | dependency: "direct main"
350 | description:
351 | name: rxdart
352 | url: "https://pub.dartlang.org"
353 | source: hosted
354 | version: "0.23.1"
355 | share:
356 | dependency: "direct main"
357 | description:
358 | name: share
359 | url: "https://pub.dartlang.org"
360 | source: hosted
361 | version: "0.6.3+6"
362 | sky_engine:
363 | dependency: transitive
364 | description: flutter
365 | source: sdk
366 | version: "0.0.99"
367 | source_span:
368 | dependency: transitive
369 | description:
370 | name: source_span
371 | url: "https://pub.dartlang.org"
372 | source: hosted
373 | version: "1.5.5"
374 | stack_trace:
375 | dependency: transitive
376 | description:
377 | name: stack_trace
378 | url: "https://pub.dartlang.org"
379 | source: hosted
380 | version: "1.9.3"
381 | stream_channel:
382 | dependency: transitive
383 | description:
384 | name: stream_channel
385 | url: "https://pub.dartlang.org"
386 | source: hosted
387 | version: "2.0.0"
388 | string_scanner:
389 | dependency: transitive
390 | description:
391 | name: string_scanner
392 | url: "https://pub.dartlang.org"
393 | source: hosted
394 | version: "1.0.5"
395 | term_glyph:
396 | dependency: transitive
397 | description:
398 | name: term_glyph
399 | url: "https://pub.dartlang.org"
400 | source: hosted
401 | version: "1.1.0"
402 | test_api:
403 | dependency: transitive
404 | description:
405 | name: test_api
406 | url: "https://pub.dartlang.org"
407 | source: hosted
408 | version: "0.2.11"
409 | typed_data:
410 | dependency: transitive
411 | description:
412 | name: typed_data
413 | url: "https://pub.dartlang.org"
414 | source: hosted
415 | version: "1.1.6"
416 | url_launcher:
417 | dependency: "direct main"
418 | description:
419 | name: url_launcher
420 | url: "https://pub.dartlang.org"
421 | source: hosted
422 | version: "5.4.2"
423 | url_launcher_macos:
424 | dependency: transitive
425 | description:
426 | name: url_launcher_macos
427 | url: "https://pub.dartlang.org"
428 | source: hosted
429 | version: "0.0.1+4"
430 | url_launcher_platform_interface:
431 | dependency: transitive
432 | description:
433 | name: url_launcher_platform_interface
434 | url: "https://pub.dartlang.org"
435 | source: hosted
436 | version: "1.0.6"
437 | url_launcher_web:
438 | dependency: transitive
439 | description:
440 | name: url_launcher_web
441 | url: "https://pub.dartlang.org"
442 | source: hosted
443 | version: "0.1.1+1"
444 | vector_math:
445 | dependency: transitive
446 | description:
447 | name: vector_math
448 | url: "https://pub.dartlang.org"
449 | source: hosted
450 | version: "2.0.8"
451 | xml:
452 | dependency: transitive
453 | description:
454 | name: xml
455 | url: "https://pub.dartlang.org"
456 | source: hosted
457 | version: "3.5.0"
458 | sdks:
459 | dart: ">=2.7.0 <3.0.0"
460 | flutter: ">=1.12.13+hotfix.4 <2.0.0"
461 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: flutter_chat_app
2 | description: A new Flutter project.
3 |
4 | # The following defines the version and build number for your application.
5 | # A version number is three numbers separated by dots, like 1.2.43
6 | # followed by an optional build number separated by a +.
7 | # Both the version and the builder number may be overridden in flutter
8 | # build by specifying --build-name and --build-number, respectively.
9 | # In Android, build-name is used as versionName while build-number used as versionCode.
10 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
11 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
12 | # Read more about iOS versioning at
13 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
14 | version: 1.0.0+1
15 |
16 | environment:
17 | sdk: ">=2.1.0 <3.0.0"
18 |
19 | dependencies:
20 | flutter:
21 | sdk: flutter
22 |
23 | # The following adds the Cupertino Icons font to your application.
24 | # Use with the CupertinoIcons class for iOS style icons.
25 | cupertino_icons: ^0.1.2
26 | firebase_auth:
27 | firebase_database:
28 | get_it: ^4.0.1
29 | provider:
30 | async:
31 | image_picker: ^0.6.2
32 | google_sign_in:
33 | intl: ^0.15.8
34 | url_launcher:
35 | share: ^0.6.3
36 | google_fonts: ^0.3.9
37 | logger:
38 | rxdart:
39 | cloud_firestore:
40 |
41 | dev_dependencies:
42 | flutter_test:
43 | sdk: flutter
44 |
45 |
46 | # For information on the generic Dart part of this file, see the
47 | # following page: https://dart.dev/tools/pub/pubspec
48 |
49 | # The following section is specific to Flutter.
50 | flutter:
51 |
52 | # The following line ensures that the Material Icons font is
53 | # included with your application, so that you can use the icons in
54 | # the material Icons class.
55 | uses-material-design: true
56 |
57 | # To add assets to your application, add an assets section, like this:
58 | # assets:
59 | # - images/a_dot_burr.jpeg
60 | # - images/a_dot_ham.jpeg
61 |
62 | # An image asset can refer to one or more resolution-specific "variants", see
63 | # https://flutter.dev/assets-and-images/#resolution-aware.
64 |
65 | # For details regarding adding assets from package dependencies, see
66 | # https://flutter.dev/assets-and-images/#from-packages
67 |
68 | # To add custom fonts to your application, add a fonts section here,
69 | # in this "flutter" section. Each entry in this list should have a
70 | # "family" key with the font family name, and a "fonts" key with a
71 | # list giving the asset and other descriptors for the font. For
72 | # example:
73 | # fonts:
74 | # - family: Schyler
75 | # fonts:
76 | # - asset: fonts/Schyler-Regular.ttf
77 | # - asset: fonts/Schyler-Italic.ttf
78 | # style: italic
79 | # - family: Trajan Pro
80 | # fonts:
81 | # - asset: fonts/TrajanPro.ttf
82 | # - asset: fonts/TrajanPro_Bold.ttf
83 | # weight: 700
84 | #
85 | # For details regarding fonts from package dependencies,
86 | # see https://flutter.dev/custom-fonts/#from-packages
87 |
--------------------------------------------------------------------------------
/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 that Flutter provides. 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:flutter_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(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 |
--------------------------------------------------------------------------------