├── .gitattributes
├── .gitignore
├── .metadata
├── README.md
├── android
├── app
│ ├── build.gradle
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── fintasys
│ │ │ │ └── flutter_demo_chat
│ │ │ │ └── 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
├── flutter_bloc_firebase_chat_android.iml
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
└── settings.gradle
├── assets
└── stickers
│ └── angry_cat
│ ├── cat_1.png
│ ├── cat_2.png
│ ├── cat_3.png
│ ├── cat_4.png
│ ├── cat_5.png
│ └── cat_6.png
├── flutter_bloc_firebase_chat.iml
├── ios
├── Flutter
│ ├── AppFrameworkInfo.plist
│ ├── Debug.xcconfig
│ └── Release.xcconfig
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ └── contents.xcworkspacedata
└── Runner
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── 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
│ └── main.m
├── lib
├── main.dart
└── src
│ ├── app.dart
│ ├── bloc
│ ├── base_bloc.dart
│ ├── chat_bloc.dart
│ ├── chat_list_bloc.dart
│ ├── sign_in_bloc.dart
│ └── user_settings_bloc.dart
│ ├── model
│ ├── chat_info.dart
│ ├── sticker.dart
│ └── user.dart
│ ├── resources
│ ├── fireauth_provider.dart
│ ├── firestorage_provider.dart
│ └── firestore_provider.dart
│ ├── routing
│ ├── arguments
│ │ └── chatArgs.dart
│ └── router.dart
│ ├── services
│ ├── auth_service.dart
│ ├── auth_service_impl.dart
│ ├── repository_service.dart
│ └── repository_service_impl.dart
│ ├── utils
│ ├── color_const.dart
│ ├── string_const.dart
│ └── util_nav.dart
│ └── widgets
│ ├── helper
│ ├── NavBarMenuItem.dart
│ └── UiAction.dart
│ ├── screen_chat.dart
│ ├── screen_chat_list.dart
│ ├── screen_sign_in.dart
│ └── screen_user_settings.dart
├── pubspec.lock
├── pubspec.yaml
└── screenshots
├── Screenshot_chat.png
├── Screenshot_chat_list.png
├── Screenshot_sign_in.png
└── Screenshot_user_settings.png
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by https://www.gitignore.io/api/flutter
2 | # Edit at https://www.gitignore.io/?templates=flutter
3 |
4 | ### Flutter ###
5 | # Flutter/Dart/Pub related
6 | **/doc/api/
7 | .dart_tool/
8 | .flutter-plugins
9 | .packages
10 | .pub-cache/
11 | .pub/
12 | .idea/
13 | build/
14 |
15 | # Android related
16 | **/android/**/gradle-wrapper.jar
17 | **/android/.gradle
18 | **/android/captures/
19 | **/android/gradlew
20 | **/android/gradlew.bat
21 | **/android/local.properties
22 | **/android/**/GeneratedPluginRegistrant.java
23 | **/android/app/google-services.json
24 |
25 | # iOS/XCode related
26 | **/ios/**/*.mode1v3
27 | **/ios/**/*.mode2v3
28 | **/ios/**/*.moved-aside
29 | **/ios/**/*.pbxuser
30 | **/ios/**/*.perspectivev3
31 | **/ios/**/*sync/
32 | **/ios/**/.sconsign.dblite
33 | **/ios/**/.tags*
34 | **/ios/**/.vagrant/
35 | **/ios/**/DerivedData/
36 | **/ios/**/Icon?
37 | **/ios/**/Pods/
38 | **/ios/**/.symlinks/
39 | **/ios/**/profile
40 | **/ios/**/xcuserdata
41 | **/ios/.generated/
42 | **/ios/Flutter/App.framework
43 | **/ios/Flutter/Flutter.framework
44 | **/ios/Flutter/Generated.xcconfig
45 | **/ios/Flutter/app.flx
46 | **/ios/Flutter/app.zip
47 | **/ios/Flutter/flutter_assets/
48 | **/ios/ServiceDefinitions.json
49 | **/ios/Runner/GeneratedPluginRegistrant.*
50 |
51 | # Exceptions to above rules.
52 | !**/ios/**/default.mode1v3
53 | !**/ios/**/default.mode2v3
54 | !**/ios/**/default.pbxuser
55 | !**/ios/**/default.perspectivev3
56 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
57 |
58 | # End of https://www.gitignore.io/api/flutter
59 |
--------------------------------------------------------------------------------
/.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: 8661d8aecd626f7f57ccbcb735553edc05a2e713
8 | channel: stable
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Flutter-Bloc-Firebase-Chat Example
2 | This project is based on the following two articles below. Afterwards I almost completely refactored it by adding bloc pattern, GetIt Library and other code optimizations. I did this project to learn Flutter and for better understanding of its state management architectures.
3 |
4 | https://medium.com/flutter-community/building-a-chat-app-with-flutter-and-firebase-from-scratch-9eaa7f41782e
5 | https://medium.com/flutterpub/when-firebase-meets-bloc-pattern-fb5c405597e0
6 |
7 | # Screenshots
8 |
9 |
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply plugin: 'com.google.gms.google-services'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 |
28 | android {
29 | compileSdkVersion 28
30 |
31 | lintOptions {
32 | disable 'InvalidPackage'
33 | }
34 |
35 | defaultConfig {
36 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
37 | applicationId "com.fintasys.flutter_demo_chat"
38 | minSdkVersion 16
39 | targetSdkVersion 28
40 | versionCode flutterVersionCode.toInteger()
41 | versionName flutterVersionName
42 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
43 | multiDexEnabled true
44 | }
45 |
46 | buildTypes {
47 | release {
48 | // TODO: Add your own signing config for the release build.
49 | // Signing with the debug keys for now, so `flutter run --release` works.
50 | signingConfig signingConfigs.debug
51 | }
52 | }
53 | }
54 |
55 | flutter {
56 | source '../..'
57 | }
58 |
59 | dependencies {
60 | testImplementation 'junit:junit:4.12'
61 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
62 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
63 |
64 | implementation 'com.google.firebase:firebase-core:16.0.1'
65 |
66 | implementation 'com.android.support:multidex:1.0.3'
67 | }
68 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
9 |
13 |
20 |
24 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/fintasys/flutter_demo_chat/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.fintasys.flutter_demo_chat;
2 |
3 | import android.os.Bundle;
4 | import io.flutter.app.FlutterActivity;
5 | import io.flutter.plugins.GeneratedPluginRegistrant;
6 |
7 | public class MainActivity extends FlutterActivity {
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | GeneratedPluginRegistrant.registerWith(this);
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/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/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.2.1'
9 | classpath 'com.google.gms:google-services:4.2.0'
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/flutter_bloc_firebase_chat_android.iml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 |
--------------------------------------------------------------------------------
/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-4.10.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 |
--------------------------------------------------------------------------------
/assets/stickers/angry_cat/cat_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/assets/stickers/angry_cat/cat_1.png
--------------------------------------------------------------------------------
/assets/stickers/angry_cat/cat_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/assets/stickers/angry_cat/cat_2.png
--------------------------------------------------------------------------------
/assets/stickers/angry_cat/cat_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/assets/stickers/angry_cat/cat_3.png
--------------------------------------------------------------------------------
/assets/stickers/angry_cat/cat_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/assets/stickers/angry_cat/cat_4.png
--------------------------------------------------------------------------------
/assets/stickers/angry_cat/cat_5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/assets/stickers/angry_cat/cat_5.png
--------------------------------------------------------------------------------
/assets/stickers/angry_cat/cat_6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/assets/stickers/angry_cat/cat_6.png
--------------------------------------------------------------------------------
/flutter_bloc_firebase_chat.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 8.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.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 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
15 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
16 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
17 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
18 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
19 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
20 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
21 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
22 | /* End PBXBuildFile section */
23 |
24 | /* Begin PBXCopyFilesBuildPhase section */
25 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
26 | isa = PBXCopyFilesBuildPhase;
27 | buildActionMask = 2147483647;
28 | dstPath = "";
29 | dstSubfolderSpec = 10;
30 | files = (
31 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
32 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
33 | );
34 | name = "Embed Frameworks";
35 | runOnlyForDeploymentPostprocessing = 0;
36 | };
37 | /* End PBXCopyFilesBuildPhase section */
38 |
39 | /* Begin PBXFileReference section */
40 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
41 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
42 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
43 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; };
44 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
45 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
46 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
47 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
48 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
49 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; };
50 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
51 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
52 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
53 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
54 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
55 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
56 | /* End PBXFileReference section */
57 |
58 | /* Begin PBXFrameworksBuildPhase section */
59 | 97C146EB1CF9000F007C117D /* Frameworks */ = {
60 | isa = PBXFrameworksBuildPhase;
61 | buildActionMask = 2147483647;
62 | files = (
63 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
64 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
65 | );
66 | runOnlyForDeploymentPostprocessing = 0;
67 | };
68 | /* End PBXFrameworksBuildPhase section */
69 |
70 | /* Begin PBXGroup section */
71 | 9740EEB11CF90186004384FC /* Flutter */ = {
72 | isa = PBXGroup;
73 | children = (
74 | 3B80C3931E831B6300D905FE /* App.framework */,
75 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
76 | 9740EEBA1CF902C7004384FC /* Flutter.framework */,
77 | 9740EEB21CF90195004384FC /* Debug.xcconfig */,
78 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
79 | 9740EEB31CF90195004384FC /* Generated.xcconfig */,
80 | );
81 | name = Flutter;
82 | sourceTree = "";
83 | };
84 | 97C146E51CF9000F007C117D = {
85 | isa = PBXGroup;
86 | children = (
87 | 9740EEB11CF90186004384FC /* Flutter */,
88 | 97C146F01CF9000F007C117D /* Runner */,
89 | 97C146EF1CF9000F007C117D /* Products */,
90 | CF3B75C9A7D2FA2A4C99F110 /* Frameworks */,
91 | );
92 | sourceTree = "";
93 | };
94 | 97C146EF1CF9000F007C117D /* Products */ = {
95 | isa = PBXGroup;
96 | children = (
97 | 97C146EE1CF9000F007C117D /* Runner.app */,
98 | );
99 | name = Products;
100 | sourceTree = "";
101 | };
102 | 97C146F01CF9000F007C117D /* Runner */ = {
103 | isa = PBXGroup;
104 | children = (
105 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
106 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
107 | 97C146FA1CF9000F007C117D /* Main.storyboard */,
108 | 97C146FD1CF9000F007C117D /* Assets.xcassets */,
109 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
110 | 97C147021CF9000F007C117D /* Info.plist */,
111 | 97C146F11CF9000F007C117D /* Supporting Files */,
112 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
113 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
114 | );
115 | path = Runner;
116 | sourceTree = "";
117 | };
118 | 97C146F11CF9000F007C117D /* Supporting Files */ = {
119 | isa = PBXGroup;
120 | children = (
121 | 97C146F21CF9000F007C117D /* main.m */,
122 | );
123 | name = "Supporting Files";
124 | sourceTree = "";
125 | };
126 | /* End PBXGroup section */
127 |
128 | /* Begin PBXNativeTarget section */
129 | 97C146ED1CF9000F007C117D /* Runner */ = {
130 | isa = PBXNativeTarget;
131 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
132 | buildPhases = (
133 | 9740EEB61CF901F6004384FC /* Run Script */,
134 | 97C146EA1CF9000F007C117D /* Sources */,
135 | 97C146EB1CF9000F007C117D /* Frameworks */,
136 | 97C146EC1CF9000F007C117D /* Resources */,
137 | 9705A1C41CF9048500538489 /* Embed Frameworks */,
138 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
139 | );
140 | buildRules = (
141 | );
142 | dependencies = (
143 | );
144 | name = Runner;
145 | productName = Runner;
146 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
147 | productType = "com.apple.product-type.application";
148 | };
149 | /* End PBXNativeTarget section */
150 |
151 | /* Begin PBXProject section */
152 | 97C146E61CF9000F007C117D /* Project object */ = {
153 | isa = PBXProject;
154 | attributes = {
155 | LastUpgradeCheck = 0910;
156 | ORGANIZATIONNAME = "The Chromium Authors";
157 | TargetAttributes = {
158 | 97C146ED1CF9000F007C117D = {
159 | CreatedOnToolsVersion = 7.3.1;
160 | };
161 | };
162 | };
163 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
164 | compatibilityVersion = "Xcode 3.2";
165 | developmentRegion = English;
166 | hasScannedForEncodings = 0;
167 | knownRegions = (
168 | en,
169 | Base,
170 | );
171 | mainGroup = 97C146E51CF9000F007C117D;
172 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
173 | projectDirPath = "";
174 | projectRoot = "";
175 | targets = (
176 | 97C146ED1CF9000F007C117D /* Runner */,
177 | );
178 | };
179 | /* End PBXProject section */
180 |
181 | /* Begin PBXResourcesBuildPhase section */
182 | 97C146EC1CF9000F007C117D /* Resources */ = {
183 | isa = PBXResourcesBuildPhase;
184 | buildActionMask = 2147483647;
185 | files = (
186 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
187 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
188 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
189 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
190 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
191 | );
192 | runOnlyForDeploymentPostprocessing = 0;
193 | };
194 | /* End PBXResourcesBuildPhase section */
195 |
196 | /* Begin PBXShellScriptBuildPhase section */
197 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
198 | isa = PBXShellScriptBuildPhase;
199 | buildActionMask = 2147483647;
200 | files = (
201 | );
202 | inputPaths = (
203 | );
204 | name = "Thin Binary";
205 | outputPaths = (
206 | );
207 | runOnlyForDeploymentPostprocessing = 0;
208 | shellPath = /bin/sh;
209 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
210 | };
211 | 9740EEB61CF901F6004384FC /* Run Script */ = {
212 | isa = PBXShellScriptBuildPhase;
213 | buildActionMask = 2147483647;
214 | files = (
215 | );
216 | inputPaths = (
217 | );
218 | name = "Run Script";
219 | outputPaths = (
220 | );
221 | runOnlyForDeploymentPostprocessing = 0;
222 | shellPath = /bin/sh;
223 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
224 | };
225 | /* End PBXShellScriptBuildPhase section */
226 |
227 | /* Begin PBXSourcesBuildPhase section */
228 | 97C146EA1CF9000F007C117D /* Sources */ = {
229 | isa = PBXSourcesBuildPhase;
230 | buildActionMask = 2147483647;
231 | files = (
232 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */,
233 | 97C146F31CF9000F007C117D /* main.m in Sources */,
234 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
235 | );
236 | runOnlyForDeploymentPostprocessing = 0;
237 | };
238 | /* End PBXSourcesBuildPhase section */
239 |
240 | /* Begin PBXVariantGroup section */
241 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
242 | isa = PBXVariantGroup;
243 | children = (
244 | 97C146FB1CF9000F007C117D /* Base */,
245 | );
246 | name = Main.storyboard;
247 | sourceTree = "";
248 | };
249 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
250 | isa = PBXVariantGroup;
251 | children = (
252 | 97C147001CF9000F007C117D /* Base */,
253 | );
254 | name = LaunchScreen.storyboard;
255 | sourceTree = "";
256 | };
257 | /* End PBXVariantGroup section */
258 |
259 | /* Begin XCBuildConfiguration section */
260 | 249021D3217E4FDB00AE95B9 /* Profile */ = {
261 | isa = XCBuildConfiguration;
262 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
263 | buildSettings = {
264 | ALWAYS_SEARCH_USER_PATHS = NO;
265 | CLANG_ANALYZER_NONNULL = YES;
266 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
267 | CLANG_CXX_LIBRARY = "libc++";
268 | CLANG_ENABLE_MODULES = YES;
269 | CLANG_ENABLE_OBJC_ARC = YES;
270 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
271 | CLANG_WARN_BOOL_CONVERSION = YES;
272 | CLANG_WARN_COMMA = YES;
273 | CLANG_WARN_CONSTANT_CONVERSION = YES;
274 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
275 | CLANG_WARN_EMPTY_BODY = YES;
276 | CLANG_WARN_ENUM_CONVERSION = YES;
277 | CLANG_WARN_INFINITE_RECURSION = YES;
278 | CLANG_WARN_INT_CONVERSION = YES;
279 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
280 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
281 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
282 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
283 | CLANG_WARN_STRICT_PROTOTYPES = YES;
284 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
285 | CLANG_WARN_UNREACHABLE_CODE = YES;
286 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
287 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
288 | COPY_PHASE_STRIP = NO;
289 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
290 | ENABLE_NS_ASSERTIONS = NO;
291 | ENABLE_STRICT_OBJC_MSGSEND = YES;
292 | GCC_C_LANGUAGE_STANDARD = gnu99;
293 | GCC_NO_COMMON_BLOCKS = YES;
294 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
295 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
296 | GCC_WARN_UNDECLARED_SELECTOR = YES;
297 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
298 | GCC_WARN_UNUSED_FUNCTION = YES;
299 | GCC_WARN_UNUSED_VARIABLE = YES;
300 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
301 | MTL_ENABLE_DEBUG_INFO = NO;
302 | SDKROOT = iphoneos;
303 | TARGETED_DEVICE_FAMILY = "1,2";
304 | VALIDATE_PRODUCT = YES;
305 | };
306 | name = Profile;
307 | };
308 | 249021D4217E4FDB00AE95B9 /* Profile */ = {
309 | isa = XCBuildConfiguration;
310 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
311 | buildSettings = {
312 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
313 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
314 | DEVELOPMENT_TEAM = S8QB4VV633;
315 | ENABLE_BITCODE = NO;
316 | FRAMEWORK_SEARCH_PATHS = (
317 | "$(inherited)",
318 | "$(PROJECT_DIR)/Flutter",
319 | );
320 | INFOPLIST_FILE = Runner/Info.plist;
321 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
322 | LIBRARY_SEARCH_PATHS = (
323 | "$(inherited)",
324 | "$(PROJECT_DIR)/Flutter",
325 | );
326 | PRODUCT_BUNDLE_IDENTIFIER = com.fintasys.flutterDemoChat;
327 | PRODUCT_NAME = "$(TARGET_NAME)";
328 | VERSIONING_SYSTEM = "apple-generic";
329 | };
330 | name = Profile;
331 | };
332 | 97C147031CF9000F007C117D /* Debug */ = {
333 | isa = XCBuildConfiguration;
334 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
335 | buildSettings = {
336 | ALWAYS_SEARCH_USER_PATHS = NO;
337 | CLANG_ANALYZER_NONNULL = YES;
338 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
339 | CLANG_CXX_LIBRARY = "libc++";
340 | CLANG_ENABLE_MODULES = YES;
341 | CLANG_ENABLE_OBJC_ARC = YES;
342 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
343 | CLANG_WARN_BOOL_CONVERSION = YES;
344 | CLANG_WARN_COMMA = YES;
345 | CLANG_WARN_CONSTANT_CONVERSION = 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_LITERAL_CONVERSION = YES;
353 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
354 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
355 | CLANG_WARN_STRICT_PROTOTYPES = YES;
356 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
357 | CLANG_WARN_UNREACHABLE_CODE = YES;
358 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
359 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
360 | COPY_PHASE_STRIP = NO;
361 | DEBUG_INFORMATION_FORMAT = dwarf;
362 | ENABLE_STRICT_OBJC_MSGSEND = YES;
363 | ENABLE_TESTABILITY = YES;
364 | GCC_C_LANGUAGE_STANDARD = gnu99;
365 | GCC_DYNAMIC_NO_PIC = NO;
366 | GCC_NO_COMMON_BLOCKS = YES;
367 | GCC_OPTIMIZATION_LEVEL = 0;
368 | GCC_PREPROCESSOR_DEFINITIONS = (
369 | "DEBUG=1",
370 | "$(inherited)",
371 | );
372 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
373 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
374 | GCC_WARN_UNDECLARED_SELECTOR = YES;
375 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
376 | GCC_WARN_UNUSED_FUNCTION = YES;
377 | GCC_WARN_UNUSED_VARIABLE = YES;
378 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
379 | MTL_ENABLE_DEBUG_INFO = YES;
380 | ONLY_ACTIVE_ARCH = YES;
381 | SDKROOT = iphoneos;
382 | TARGETED_DEVICE_FAMILY = "1,2";
383 | };
384 | name = Debug;
385 | };
386 | 97C147041CF9000F007C117D /* Release */ = {
387 | isa = XCBuildConfiguration;
388 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
389 | buildSettings = {
390 | ALWAYS_SEARCH_USER_PATHS = NO;
391 | CLANG_ANALYZER_NONNULL = YES;
392 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
393 | CLANG_CXX_LIBRARY = "libc++";
394 | CLANG_ENABLE_MODULES = YES;
395 | CLANG_ENABLE_OBJC_ARC = YES;
396 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
397 | CLANG_WARN_BOOL_CONVERSION = YES;
398 | CLANG_WARN_COMMA = YES;
399 | CLANG_WARN_CONSTANT_CONVERSION = YES;
400 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
401 | CLANG_WARN_EMPTY_BODY = YES;
402 | CLANG_WARN_ENUM_CONVERSION = YES;
403 | CLANG_WARN_INFINITE_RECURSION = YES;
404 | CLANG_WARN_INT_CONVERSION = YES;
405 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
406 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
407 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
408 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
409 | CLANG_WARN_STRICT_PROTOTYPES = YES;
410 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
411 | CLANG_WARN_UNREACHABLE_CODE = YES;
412 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
413 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
414 | COPY_PHASE_STRIP = NO;
415 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
416 | ENABLE_NS_ASSERTIONS = NO;
417 | ENABLE_STRICT_OBJC_MSGSEND = YES;
418 | GCC_C_LANGUAGE_STANDARD = gnu99;
419 | GCC_NO_COMMON_BLOCKS = YES;
420 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
421 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
422 | GCC_WARN_UNDECLARED_SELECTOR = YES;
423 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
424 | GCC_WARN_UNUSED_FUNCTION = YES;
425 | GCC_WARN_UNUSED_VARIABLE = YES;
426 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
427 | MTL_ENABLE_DEBUG_INFO = NO;
428 | SDKROOT = iphoneos;
429 | TARGETED_DEVICE_FAMILY = "1,2";
430 | VALIDATE_PRODUCT = YES;
431 | };
432 | name = Release;
433 | };
434 | 97C147061CF9000F007C117D /* Debug */ = {
435 | isa = XCBuildConfiguration;
436 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
437 | buildSettings = {
438 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
439 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
440 | ENABLE_BITCODE = NO;
441 | FRAMEWORK_SEARCH_PATHS = (
442 | "$(inherited)",
443 | "$(PROJECT_DIR)/Flutter",
444 | );
445 | INFOPLIST_FILE = Runner/Info.plist;
446 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
447 | LIBRARY_SEARCH_PATHS = (
448 | "$(inherited)",
449 | "$(PROJECT_DIR)/Flutter",
450 | );
451 | PRODUCT_BUNDLE_IDENTIFIER = com.fintasys.flutterDemoChat;
452 | PRODUCT_NAME = "$(TARGET_NAME)";
453 | VERSIONING_SYSTEM = "apple-generic";
454 | };
455 | name = Debug;
456 | };
457 | 97C147071CF9000F007C117D /* Release */ = {
458 | isa = XCBuildConfiguration;
459 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
460 | buildSettings = {
461 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
462 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
463 | ENABLE_BITCODE = NO;
464 | FRAMEWORK_SEARCH_PATHS = (
465 | "$(inherited)",
466 | "$(PROJECT_DIR)/Flutter",
467 | );
468 | INFOPLIST_FILE = Runner/Info.plist;
469 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
470 | LIBRARY_SEARCH_PATHS = (
471 | "$(inherited)",
472 | "$(PROJECT_DIR)/Flutter",
473 | );
474 | PRODUCT_BUNDLE_IDENTIFIER = com.fintasys.flutterDemoChat;
475 | PRODUCT_NAME = "$(TARGET_NAME)";
476 | VERSIONING_SYSTEM = "apple-generic";
477 | };
478 | name = Release;
479 | };
480 | /* End XCBuildConfiguration section */
481 |
482 | /* Begin XCConfigurationList section */
483 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
484 | isa = XCConfigurationList;
485 | buildConfigurations = (
486 | 97C147031CF9000F007C117D /* Debug */,
487 | 97C147041CF9000F007C117D /* Release */,
488 | 249021D3217E4FDB00AE95B9 /* Profile */,
489 | );
490 | defaultConfigurationIsVisible = 0;
491 | defaultConfigurationName = Release;
492 | };
493 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
494 | isa = XCConfigurationList;
495 | buildConfigurations = (
496 | 97C147061CF9000F007C117D /* Debug */,
497 | 97C147071CF9000F007C117D /* Release */,
498 | 249021D4217E4FDB00AE95B9 /* Profile */,
499 | );
500 | defaultConfigurationIsVisible = 0;
501 | defaultConfigurationName = Release;
502 | };
503 | /* End XCConfigurationList section */
504 | };
505 | rootObject = 97C146E61CF9000F007C117D /* Project object */;
506 | }
507 |
--------------------------------------------------------------------------------
/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 |
31 |
32 |
33 |
34 |
40 |
41 |
42 |
43 |
44 |
45 |
56 |
58 |
64 |
65 |
66 |
67 |
68 |
69 |
75 |
77 |
83 |
84 |
85 |
86 |
88 |
89 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import
4 |
5 | @interface AppDelegate : FlutterAppDelegate
6 |
7 | @end
8 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.m:
--------------------------------------------------------------------------------
1 | #include "AppDelegate.h"
2 | #include "GeneratedPluginRegistrant.h"
3 |
4 | @implementation AppDelegate
5 |
6 | - (BOOL)application:(UIApplication *)application
7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
8 | [GeneratedPluginRegistrant registerWithRegistry:self];
9 | // Override point for customization after application launch.
10 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
11 | }
12 |
13 | @end
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/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/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/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/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/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/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/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/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/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/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/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/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/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/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/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/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/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/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/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/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/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/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/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/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/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/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/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/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/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/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/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/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 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | flutter_demo_chat
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/main.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import "AppDelegate.h"
4 |
5 | int main(int argc, char* argv[]) {
6 | @autoreleasepool {
7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_bloc_firebase_chat/src/app.dart';
3 | import 'package:flutter_bloc_firebase_chat/src/services/auth_service.dart';
4 | import 'package:flutter_bloc_firebase_chat/src/services/auth_service_impl.dart';
5 | import 'package:flutter_bloc_firebase_chat/src/services/repository_service.dart';
6 | import 'package:flutter_bloc_firebase_chat/src/services/repository_service_impl.dart';
7 | import 'package:get_it/get_it.dart';
8 |
9 | GetIt locator = new GetIt();
10 |
11 | void main() {
12 | locator.registerSingleton(new RepositoryServiceImpl());
13 | locator.registerSingleton(new AuthServiceImpl());
14 | runApp(MyApp());
15 | }
16 |
--------------------------------------------------------------------------------
/lib/src/app.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_bloc_firebase_chat/src/routing/router.dart';
3 | import 'package:flutter_bloc_firebase_chat/src/services/auth_service.dart';
4 | import 'package:flutter_bloc_firebase_chat/src/utils/color_const.dart';
5 | import 'package:flutter_bloc_firebase_chat/src/utils/string_const.dart';
6 |
7 | import '../main.dart';
8 |
9 | class MyApp extends StatefulWidget {
10 | @override
11 | _MyAppState createState() => _MyAppState();
12 | }
13 |
14 | class _MyAppState extends State {
15 | @override
16 | Widget build(BuildContext context) {
17 | return MaterialApp(
18 | theme: ThemeData(
19 | primarySwatch: primarySwatch,
20 | primaryColor: primaryColor,
21 | accentColor: accentColor,
22 | canvasColor: canvasColor,
23 | ),
24 | initialRoute: StringConstant.route_sign_in,
25 | onGenerateRoute: Router.generateRoute);
26 | }
27 |
28 | @override
29 | void dispose() {
30 | locator().dispose();
31 | super.dispose();
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/lib/src/bloc/base_bloc.dart:
--------------------------------------------------------------------------------
1 |
2 |
3 | import 'package:rxdart/rxdart.dart';
4 |
5 | class BaseBloc {
6 | final _loading = BehaviorSubject();
7 |
8 | Observable get loadingObservable => _loading.stream;
9 |
10 | void setLoading(bool loading) {
11 | _loading.sink.add(loading);
12 | }
13 |
14 | void dispose() async {
15 | await _loading.drain();
16 | _loading.close();
17 | }
18 | }
--------------------------------------------------------------------------------
/lib/src/bloc/chat_bloc.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:cloud_firestore/cloud_firestore.dart';
4 | import 'package:firebase_storage/firebase_storage.dart';
5 | import 'package:flutter_bloc_firebase_chat/src/bloc/base_bloc.dart';
6 | import 'package:flutter_bloc_firebase_chat/src/model/chat_info.dart';
7 | import 'package:flutter_bloc_firebase_chat/src/services/repository_service.dart';
8 | import 'package:flutter_bloc_firebase_chat/src/utils/string_const.dart';
9 | import 'package:flutter_bloc_firebase_chat/src/widgets/helper/UiAction.dart';
10 | import 'package:rxdart/rxdart.dart';
11 | import 'package:shared_preferences/shared_preferences.dart';
12 |
13 | import '../../main.dart';
14 |
15 | enum ACTIONS {
16 | clearTextEditingController,
17 | error,
18 | showToast,
19 | animateListScrollController
20 | }
21 |
22 | class ChatBloc extends BaseBloc {
23 | var _repository;
24 | final _showSticker = BehaviorSubject.seeded(false);
25 | final _uiActions = BehaviorSubject();
26 | final _chatHistory = BehaviorSubject();
27 | ChatInfo chatInfo;
28 | String currentUserId;
29 |
30 | ChatBloc([RepositoryService repoService]) {
31 | _repository = repoService ?? locator();
32 | }
33 |
34 | Observable get actions => _uiActions.stream;
35 |
36 | Observable get chatHistory => _chatHistory.stream;
37 |
38 | Observable get showSticker => _showSticker;
39 |
40 | void setShowSticker(bool show) => _showSticker.sink.add(show);
41 |
42 | bool getShowSticker() => _showSticker.value;
43 |
44 | ChatInfo getChatInfo() => chatInfo;
45 |
46 | void getChatHistory() =>
47 | _chatHistory.addStream(_repository.getChatHistory(chatInfo));
48 |
49 | Future setChatInfo(ChatInfo chatInfo) async {
50 | this.chatInfo = chatInfo;
51 | }
52 |
53 | Future getGroupChatId(String peerId) async {
54 | // read Local
55 | var groupChatId;
56 | var prefs = await SharedPreferences.getInstance();
57 | var id = prefs.getString('id') ?? '';
58 | if (id.hashCode <= peerId.hashCode) {
59 | groupChatId = '$id-$peerId';
60 | } else {
61 | groupChatId = '$peerId-$id';
62 | }
63 | return groupChatId;
64 | }
65 |
66 | Future uploadFile(File imageFile) async {
67 | setLoading(true);
68 | String fileName = DateTime.now().millisecondsSinceEpoch.toString();
69 | StorageReference reference = FirebaseStorage.instance.ref().child(fileName);
70 | StorageUploadTask uploadTask = reference.putFile(imageFile);
71 | StorageTaskSnapshot storageTaskSnapshot = await uploadTask.onComplete;
72 | storageTaskSnapshot.ref.getDownloadURL().then((downloadUrl) {
73 | String imageUrl = downloadUrl;
74 | onSendMessage(imageUrl, 1);
75 | setLoading(false);
76 | }, onError: (err) {
77 | setLoading(false);
78 | _uiActions.sink.add(new UiAction(
79 | action: ACTIONS.showToast.index,
80 | message: StringConstant.chat_image_upload_wrong_type));
81 | });
82 | }
83 |
84 | void onSendMessage(String content, int type) {
85 | // type: 0 = text, 1 = image, 2 = sticker
86 | if (content.trim() != '') {
87 | _uiActions.sink
88 | .add(new UiAction(action: ACTIONS.clearTextEditingController.index));
89 |
90 | _repository.sendChatMsg(chatInfo, content, type);
91 |
92 | _uiActions.sink
93 | .add(new UiAction(action: ACTIONS.animateListScrollController.index));
94 | } else {
95 | _uiActions.sink.add(new UiAction(
96 | action: ACTIONS.showToast.index,
97 | message: StringConstant.chat_text_empty));
98 | }
99 | }
100 |
101 | void dispose() async {
102 | super.dispose();
103 | await _showSticker.drain();
104 | _showSticker.close();
105 | await _uiActions.drain();
106 | _uiActions.close();
107 | await _chatHistory.drain();
108 | _chatHistory.close();
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/lib/src/bloc/chat_list_bloc.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:cloud_firestore/cloud_firestore.dart';
4 | import 'package:flutter_bloc_firebase_chat/src/bloc/base_bloc.dart';
5 | import 'package:flutter_bloc_firebase_chat/src/model/user.dart';
6 | import 'package:flutter_bloc_firebase_chat/src/services/auth_service.dart';
7 | import 'package:flutter_bloc_firebase_chat/src/services/repository_service.dart';
8 | import 'package:rxdart/rxdart.dart';
9 |
10 | import '../../main.dart';
11 |
12 | class ChatListBloc extends BaseBloc {
13 | var _repository;
14 | final _authService = locator();
15 | final _signedOut = BehaviorSubject();
16 |
17 | ChatListBloc([RepositoryService repoService]) {
18 | _repository = repoService ?? locator();
19 | }
20 |
21 | Observable get signedOut => _signedOut.stream;
22 |
23 | Stream> chatList() =>
24 | _repository.getChatList().transform(documentToUserTransformer);
25 |
26 | static void convertDocumentToUser(
27 | QuerySnapshot snapShot, EventSink> sink) {
28 | List result = new List();
29 | snapShot.documents.forEach((doc) => result.add(User(
30 | id: doc['id'],
31 | name: doc['name'],
32 | avatar: doc['avatar'],
33 | aboutMe: doc['aboutMe'])));
34 | sink.add(result);
35 | }
36 |
37 | StreamTransformer documentToUserTransformer =
38 | new StreamTransformer>.fromHandlers(
39 | handleData: convertDocumentToUser);
40 |
41 | void handleSignOut() async {
42 | setLoading(true);
43 | await _authService.handleUserSignOut();
44 | _signedOut.sink.add(true);
45 | setLoading(false);
46 | }
47 |
48 | void dispose() async {
49 | super.dispose();
50 | await _signedOut.drain();
51 | _signedOut.close();
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/lib/src/bloc/sign_in_bloc.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_bloc_firebase_chat/main.dart';
2 | import 'package:flutter_bloc_firebase_chat/src/bloc/base_bloc.dart';
3 | import 'package:flutter_bloc_firebase_chat/src/services/auth_service.dart';
4 | import 'package:rxdart/rxdart.dart';
5 |
6 | enum Status { signedOut, signedIn, error }
7 |
8 | class SignInBloc extends BaseBloc {
9 | final _statusSubject = BehaviorSubject.seeded(Status.signedOut);
10 | final _authService = locator();
11 |
12 | Observable get status => _statusSubject.stream;
13 |
14 | void isUserSignedIn() async {
15 | setLoading(true);
16 |
17 | var isSignedIn = await _authService.isUserSignedIn();
18 | var user = await _authService.getCurrentLocalUser();
19 |
20 | if (isSignedIn && user != null) {
21 | _authService.setCurrentUser(user);
22 | _statusSubject.sink.add(Status.signedIn);
23 | } else {
24 | _statusSubject.sink.add(Status.signedOut);
25 | setLoading(false);
26 | }
27 | }
28 |
29 | void handleUserSignIn() async {
30 | setLoading(true);
31 |
32 | var result = await _authService.handleUserSignIn();
33 | if (result) {
34 | // Successful signed in
35 | _statusSubject.sink.add(Status.signedIn);
36 | } else {
37 | // Sign in failed
38 | _statusSubject.sink.add(Status.error);
39 | setLoading(false);
40 | }
41 | }
42 |
43 | void dispose() async {
44 | super.dispose();
45 | await _statusSubject.drain();
46 | _statusSubject.close();
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/lib/src/bloc/user_settings_bloc.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:flutter_bloc_firebase_chat/src/bloc/base_bloc.dart';
4 | import 'package:flutter_bloc_firebase_chat/src/model/user.dart';
5 | import 'package:flutter_bloc_firebase_chat/src/services/auth_service.dart';
6 | import 'package:flutter_bloc_firebase_chat/src/services/repository_service.dart';
7 | import 'package:flutter_bloc_firebase_chat/src/utils/string_const.dart';
8 | import 'package:flutter_bloc_firebase_chat/src/widgets/helper/UiAction.dart';
9 | import 'package:rxdart/rxdart.dart';
10 |
11 | import '../../main.dart';
12 |
13 | enum ACTIONS {
14 | showToast,
15 | error,
16 | }
17 |
18 | class UserSettingsBloc extends BaseBloc {
19 | var _repository;
20 | final _uiActions = BehaviorSubject();
21 | final _authService = locator();
22 | User localUser;
23 |
24 | UserSettingsBloc([RepositoryService repoService]) {
25 | _repository = repoService ?? locator();
26 | }
27 |
28 | Observable get actions => _uiActions.stream;
29 |
30 | void initUser() {
31 | localUser = _authService.getCurrentUser();
32 | }
33 |
34 | void setUserAvatar(File image) async {
35 | setLoading(true);
36 | await uploadFile(image);
37 | setLoading(false);
38 | }
39 |
40 | Future uploadFile(File image) async {
41 | var doc = await _repository.uploadUserAvatar(
42 | _authService.getCurrentUser().id, image);
43 |
44 | if (doc.error == null) {
45 | await doc.ref.getDownloadURL().then((downloadUrl) async {
46 | localUser.avatar = downloadUrl;
47 | await _repository.updateUser(localUser).then((user) async {
48 | _authService.setCurrentUser(user);
49 | _uiActions.sink.add(new UiAction(
50 | action: ACTIONS.showToast.index, message: 'Upload success'));
51 | }).catchError((err) {
52 | _uiActions.sink.add(new UiAction(
53 | action: ACTIONS.showToast.index, message: err.toString()));
54 | });
55 | }, onError: (err) {
56 | _uiActions.sink.add(new UiAction(
57 | action: ACTIONS.showToast.index,
58 | message: StringConstant.error_upload_type_image));
59 | });
60 | } else {
61 | _uiActions.sink.add(new UiAction(
62 | action: ACTIONS.showToast.index,
63 | message: StringConstant.error_upload_type_image));
64 | }
65 | }
66 |
67 | void updateUserInfo() async {
68 | setLoading(true);
69 | _repository.updateUser(localUser).then((user) {
70 | _authService.setCurrentUser(user);
71 | setLoading(false);
72 | _uiActions.sink.add(new UiAction(
73 | action: ACTIONS.showToast.index, message: 'Update success'));
74 | }).catchError((err) {
75 | setLoading(false);
76 | _uiActions.sink.add(new UiAction(
77 | action: ACTIONS.showToast.index, message: err.toString()));
78 | });
79 | }
80 |
81 | void dispose() async {
82 | super.dispose();
83 | await _uiActions.drain();
84 | _uiActions.close();
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/lib/src/model/chat_info.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_bloc_firebase_chat/src/model/user.dart';
2 |
3 | class ChatInfo {
4 | const ChatInfo(this.fromUser, this.toUser);
5 | final User fromUser;
6 | final User toUser;
7 |
8 | String getGroupChatId() {
9 | if (fromUser.id.hashCode <= toUser.id.hashCode) {
10 | return '${fromUser.id}-${toUser.id}';
11 | }
12 | return '${toUser.id}-${fromUser.id}';
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/lib/src/model/sticker.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class Sticker {
4 | Sticker({@required this.id, this.collection, this.files, this.fileType});
5 | String id;
6 | String collection;
7 | List files;
8 | String fileType;
9 | }
--------------------------------------------------------------------------------
/lib/src/model/user.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class User {
4 | User({@required this.id, this.name, this.avatar, this.aboutMe});
5 | String id;
6 | String name;
7 | String avatar;
8 | String aboutMe;
9 | }
--------------------------------------------------------------------------------
/lib/src/resources/fireauth_provider.dart:
--------------------------------------------------------------------------------
1 | import 'package:firebase_auth/firebase_auth.dart';
2 |
3 | class FireAuthProvider {
4 | FirebaseAuth _fireAuth = FirebaseAuth.instance;
5 |
6 | Future signInWithCredential(AuthCredential credential) async {
7 | return _fireAuth.signInWithCredential(credential);
8 | }
9 |
10 | Future signOut() async {
11 | return _fireAuth.signOut();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/lib/src/resources/firestorage_provider.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:firebase_storage/firebase_storage.dart';
4 |
5 | class FireStorageProvider {
6 | FirebaseStorage _fireStorage = FirebaseStorage.instance;
7 |
8 | Future uploadUserAvatar(String userId, File image) {
9 | StorageReference reference = _fireStorage.ref().child(userId);
10 | StorageUploadTask uploadTask = reference.putFile(image);
11 | return uploadTask.onComplete;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/lib/src/resources/firestore_provider.dart:
--------------------------------------------------------------------------------
1 | import 'package:cloud_firestore/cloud_firestore.dart';
2 | import 'package:flutter_bloc_firebase_chat/src/model/chat_info.dart';
3 | import 'package:flutter_bloc_firebase_chat/src/model/user.dart';
4 |
5 | class FireStoreProvider {
6 | Firestore _firestore = Firestore.instance;
7 |
8 | Future authenticateUser() async {
9 | final QuerySnapshot result =
10 | await _firestore.collection("users").getDocuments();
11 | final List docs = result.documents;
12 | if (docs.length == 0) {
13 | return 0;
14 | } else {
15 | return 1;
16 | }
17 | }
18 |
19 | Future registerUser(User user) async {
20 | _firestore
21 | .collection('users')
22 | .document(user.id)
23 | .setData({'id': user.id, 'name': user.name, 'avatar': user.avatar});
24 | }
25 |
26 | Future updateUser(User user) async {
27 | return _firestore.collection("users").document(user.id).updateData({
28 | 'name': user.name,
29 | 'avatar': user.avatar,
30 | 'aboutMe': user.aboutMe
31 | }).then((_) {
32 | return getUser(user.id);
33 | });
34 | }
35 |
36 | Future getUser(String userId) async {
37 | var result = await _firestore
38 | .collection('users')
39 | .where('id', isEqualTo: userId)
40 | .getDocuments();
41 | List documents = result.documents;
42 | if (documents.length == 1) {
43 | return User(
44 | id: documents[0]['id'],
45 | name: documents[0]['name'],
46 | avatar: documents[0]['avatar'],
47 | aboutMe: documents[0]['aboutMe']);
48 | }
49 | return null;
50 | }
51 |
52 | Stream getChatList() {
53 | return _firestore.collection('users').snapshots();
54 | }
55 |
56 | Stream getChatHistory(ChatInfo chatInfo) {
57 | return _firestore
58 | .collection('messages')
59 | .document(chatInfo?.getGroupChatId())
60 | .collection(chatInfo?.getGroupChatId())
61 | .orderBy('timestamp', descending: true)
62 | .limit(20)
63 | .snapshots();
64 | }
65 |
66 | Future sendChatMsg(ChatInfo chatInfo, String content, int type) async {
67 | var chatReference = Firestore.instance
68 | .collection('messages')
69 | .document(chatInfo.getGroupChatId())
70 | .collection(chatInfo.getGroupChatId())
71 | .document(DateTime.now().millisecondsSinceEpoch.toString());
72 |
73 | return _firestore.runTransaction((transaction) async {
74 | await transaction.set(
75 | chatReference,
76 | {
77 | 'idFrom': chatInfo.fromUser.id,
78 | 'idTo': chatInfo.toUser.id,
79 | 'timestamp': DateTime.now().millisecondsSinceEpoch.toString(),
80 | 'content': content,
81 | 'type': type
82 | },
83 | );
84 | });
85 | }
86 |
87 | Future setChatLastMsg(ChatInfo chatInfo, String lastContent) async {
88 | var chatReference = Firestore.instance
89 | .collection('messages')
90 | .document(chatInfo.getGroupChatId());
91 |
92 | return _firestore.runTransaction((transaction) async {
93 | await transaction.set(
94 | chatReference,
95 | {
96 | 'lastMessage': lastContent,
97 | },
98 | );
99 | });
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/lib/src/routing/arguments/chatArgs.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_bloc_firebase_chat/src/model/chat_info.dart';
2 |
3 | class ChatArgs {
4 | const ChatArgs(this.chatInfo);
5 | final ChatInfo chatInfo;
6 | }
7 |
--------------------------------------------------------------------------------
/lib/src/routing/router.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_bloc_firebase_chat/src/routing/arguments/chatArgs.dart';
3 | import 'package:flutter_bloc_firebase_chat/src/utils/string_const.dart';
4 | import 'package:flutter_bloc_firebase_chat/src/widgets/screen_chat.dart';
5 | import 'package:flutter_bloc_firebase_chat/src/widgets/screen_chat_list.dart';
6 | import 'package:flutter_bloc_firebase_chat/src/widgets/screen_sign_in.dart';
7 | import 'package:flutter_bloc_firebase_chat/src/widgets/screen_user_settings.dart';
8 |
9 | class Router {
10 | static Route generateRoute(RouteSettings settings) {
11 | switch (settings.name) {
12 | case StringConstant.route_sign_in:
13 | return MaterialPageRoute(builder: (context) => SignIn());
14 | case StringConstant.route_chat_list:
15 | return MaterialPageRoute(builder: (context) => ChatList());
16 | case StringConstant.route_chat:
17 | return MaterialPageRoute(
18 | builder: (context) =>
19 | Chat(chatInfo: (settings.arguments as ChatArgs).chatInfo));
20 | case StringConstant.route_user_settings:
21 | return MaterialPageRoute(builder: (context) => UserSettings());
22 | default:
23 | return MaterialPageRoute(
24 | builder: (context) =>
25 | Scaffold(body: Center(child: Text(StringConstant.error_widget_not_found))));
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/lib/src/services/auth_service.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_bloc_firebase_chat/src/model/user.dart';
2 | import 'package:rxdart/rxdart.dart';
3 |
4 | abstract class AuthService {
5 | User getCurrentUser();
6 |
7 | Future handleUserSignIn();
8 |
9 | Future handleUserSignOut();
10 |
11 | Future isUserSignedIn();
12 |
13 | Future getCurrentLocalUser();
14 |
15 | Observable get currentUser;
16 |
17 | void setCurrentUser(User user);
18 |
19 | void dispose();
20 | }
21 |
--------------------------------------------------------------------------------
/lib/src/services/auth_service_impl.dart:
--------------------------------------------------------------------------------
1 | import 'package:firebase_auth/firebase_auth.dart';
2 | import 'package:flutter_bloc_firebase_chat/src/model/user.dart';
3 | import 'package:flutter_bloc_firebase_chat/src/services/repository_service.dart';
4 | import 'package:google_sign_in/google_sign_in.dart';
5 | import 'package:rxdart/rxdart.dart';
6 | import 'package:shared_preferences/shared_preferences.dart';
7 |
8 | import '../../main.dart';
9 | import 'auth_service.dart';
10 |
11 | class AuthServiceImpl implements AuthService {
12 | final _repository = locator();
13 | final _currentUser = BehaviorSubject();
14 |
15 | Observable get currentUser => _currentUser.stream;
16 |
17 | void setCurrentUser(User user) {
18 | _currentUser.sink.add(user);
19 | }
20 |
21 | User getCurrentUser() {
22 | return _currentUser.value;
23 | }
24 |
25 | Future isUserSignedIn() async {
26 | return GoogleSignIn().isSignedIn();
27 | }
28 |
29 | Future getCurrentLocalUser() async {
30 | var prefs = await SharedPreferences.getInstance();
31 | User user;
32 | var id = prefs.getString('id');
33 | var name = prefs.getString('name');
34 | var avatar = prefs.getString('avatar');
35 | var aboutMe = prefs.getString('aboutMe');
36 | if (id != null) {
37 | user = User(id: id, name: name, avatar: avatar, aboutMe: aboutMe);
38 | }
39 | return user;
40 | }
41 |
42 | void saveUserLocally(User user) async {
43 | final _prefs = await SharedPreferences.getInstance();
44 | _prefs.setString('id', user.id);
45 | if (user.name != null) {
46 | _prefs.setString('name', user.name);
47 | }
48 | if (user.avatar != null) {
49 | _prefs.setString('avatar', user.avatar);
50 | }
51 | if (user.aboutMe != null) {
52 | _prefs.setString('aboutMe', user.aboutMe);
53 | }
54 | }
55 |
56 | Future handleUserSignIn() async {
57 | FirebaseUser firebaseUser;
58 | GoogleSignInAccount googleUser = await GoogleSignIn().signIn(); // new instance to avoid platform exception
59 | if (googleUser != null) {
60 | GoogleSignInAuthentication googleAuth =
61 | await googleUser.authentication.catchError((error) => null);
62 |
63 | final AuthCredential credential = GoogleAuthProvider.getCredential(
64 | accessToken: googleAuth.accessToken,
65 | idToken: googleAuth.idToken,
66 | );
67 |
68 | firebaseUser = await _repository.signInWithCredential(credential);
69 | }
70 |
71 | if (firebaseUser != null) {
72 | // Check is already sign up
73 | var user = await _repository.getUser(firebaseUser.uid);
74 |
75 | if (user == null) {
76 | // Update data to server if new user
77 | user = User(
78 | id: firebaseUser.uid,
79 | name: firebaseUser.displayName,
80 | avatar: firebaseUser.photoUrl);
81 |
82 | await _repository.registerUser(user);
83 | }
84 | // Write data to local
85 | setCurrentUser(user);
86 | saveUserLocally(user);
87 | return true;
88 | } else {
89 | return false;
90 | }
91 | }
92 |
93 | Future handleUserSignOut() async {
94 | final prefs = await SharedPreferences.getInstance();
95 | await _repository.signOut();
96 | var googleSignIn = GoogleSignIn();
97 | await googleSignIn.disconnect().catchError((_) => null);
98 | await googleSignIn.signOut().catchError((_) => null);
99 | await prefs.clear();
100 | }
101 |
102 | @override
103 | void dispose() async {
104 | await _currentUser.drain();
105 | _currentUser.close();
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/lib/src/services/repository_service.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:cloud_firestore/cloud_firestore.dart';
4 | import 'package:firebase_auth/firebase_auth.dart';
5 | import 'package:firebase_storage/firebase_storage.dart';
6 | import 'package:flutter_bloc_firebase_chat/src/model/chat_info.dart';
7 | import 'package:flutter_bloc_firebase_chat/src/model/user.dart';
8 |
9 | abstract class RepositoryService {
10 | Future signInWithCredential(AuthCredential credential);
11 |
12 | Future signOut();
13 |
14 | Future registerUser(User user);
15 |
16 | Future getUser(String userId);
17 |
18 | Future updateUser(User user);
19 |
20 | Future uploadUserAvatar(String userId, File image);
21 |
22 | Stream getChatList();
23 |
24 | Stream getChatHistory(ChatInfo chatInfo);
25 |
26 | Future sendChatMsg(ChatInfo chatInfo, String content, int type);
27 | }
28 |
--------------------------------------------------------------------------------
/lib/src/services/repository_service_impl.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'dart:io';
3 |
4 | import 'package:cloud_firestore/cloud_firestore.dart';
5 | import 'package:firebase_auth/firebase_auth.dart';
6 | import 'package:firebase_storage/firebase_storage.dart';
7 | import 'package:flutter_bloc_firebase_chat/src/model/chat_info.dart';
8 | import 'package:flutter_bloc_firebase_chat/src/model/user.dart';
9 | import 'package:flutter_bloc_firebase_chat/src/resources/fireauth_provider.dart';
10 | import 'package:flutter_bloc_firebase_chat/src/resources/firestorage_provider.dart';
11 | import 'package:flutter_bloc_firebase_chat/src/resources/firestore_provider.dart';
12 | import 'package:flutter_bloc_firebase_chat/src/services/repository_service.dart';
13 |
14 | class RepositoryServiceImpl implements RepositoryService {
15 | final _fireAuthProvider = FireAuthProvider();
16 | final _fireStoreProvider = FireStoreProvider();
17 | final _fireStorageProvider = FireStorageProvider();
18 |
19 | Future signInWithCredential(AuthCredential credential) =>
20 | _fireAuthProvider.signInWithCredential(credential);
21 |
22 | Future signOut() => _fireAuthProvider.signOut();
23 |
24 | Future registerUser(User user) => _fireStoreProvider.registerUser(user);
25 |
26 | Stream getChatList() => _fireStoreProvider.getChatList();
27 |
28 | Stream getChatHistory(ChatInfo chatInfo) =>
29 | _fireStoreProvider.getChatHistory(chatInfo);
30 |
31 | Future sendChatMsg(ChatInfo chatInfo, String content, int type) {
32 | var lastContent = content;
33 | if (type == 1) {
34 | lastContent = "Image was sent";
35 | } else if (type == 2) {
36 | lastContent = "Sticker was sent";
37 | }
38 |
39 | return _fireStoreProvider.sendChatMsg(chatInfo, content, type).then((_) {
40 | _fireStoreProvider.setChatLastMsg(chatInfo, lastContent);
41 | });
42 | }
43 |
44 | Future getUser(String userId) {
45 | return _fireStoreProvider.getUser(userId);
46 | }
47 |
48 | Future updateUser(User user) {
49 | return _fireStoreProvider.updateUser(user);
50 | }
51 |
52 | Future uploadUserAvatar(String userId, File image) {
53 | return _fireStorageProvider.uploadUserAvatar(userId, image);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/lib/src/utils/color_const.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ui';
2 |
3 | import 'package:flutter/material.dart';
4 |
5 | final primarySwatch = Colors.blue;
6 | final primaryColor = Colors.blue;
7 | final accentColor = Colors.blue;
8 | final canvasColor = Colors.white;
9 | final screenTitleColor = Colors.white;
10 | final textBlackColor = Colors.black;
11 | final textDarkGrayColor = Colors.black38;
12 | final greyColor = Color(0xffaeaeae);
13 | final bgGreyColor = Color(0xffE8E8E8);
--------------------------------------------------------------------------------
/lib/src/utils/string_const.dart:
--------------------------------------------------------------------------------
1 | class StringConstant{
2 |
3 | // General UI
4 | static const String cancel = "Cancel";
5 | static const String yes = "Yes";
6 |
7 | // Routes
8 | static const String route_sign_in = "/";
9 | static const String route_chat_list = "/chat_list";
10 | static const String route_chat = "/chat";
11 | static const String route_user_settings = "/user_settings";
12 |
13 | // Assets
14 | static const String asset_sticker = "assets/stickers";
15 |
16 | // Login
17 | static const String title_login = "SignIn";
18 | static const String login_logo_desc = "Bloc-based Chat with Firebase";
19 | static const String btn_login_google = "SIGN IN WITH GOOGLE";
20 |
21 | // Chat List
22 | static const String title_chat_list = "Chats";
23 | static const String menu_user_settings = "Settings";
24 | static const String menu_sign_out = "Log out";
25 | static const String dialog_title_exit_app = "Exit App";
26 | static const String dialog_title_exit_app_desc = "Are you sure to exit app?";
27 | static const String list_item_name_label = "Name";
28 | static const String list_item_about_me_label = "About Me";
29 | static const String list_item_about_me_not_available = "Not available";
30 |
31 | // Chat
32 | static const String chat_text_input_hint = "Type your message...";
33 | static const String chat_text_empty = 'Nothing to send';
34 | static const String chat_image_upload_wrong_type = 'This file is not an image';
35 |
36 | // User Settings
37 | static const String title_user_settings = "Settings";
38 |
39 | // Resources
40 | static const String collection_user = "users";
41 |
42 | // Error
43 | static const String error_widget_not_found = "Widget not found";
44 | static const String error_login_sns = "Login failed. Please try it later again";
45 | static const String error_upload_type_image = "This file is not an image";
46 |
47 | }
--------------------------------------------------------------------------------
/lib/src/utils/util_nav.dart:
--------------------------------------------------------------------------------
1 |
2 | import 'package:flutter/material.dart';
3 |
4 | void navigateTo(BuildContext context, String routeName, dynamic arguments) {
5 | Navigator.pushNamed(context, routeName, arguments: arguments);
6 | }
7 |
8 | void navigateToAndRemoveUntil(BuildContext context, String routeName, dynamic arguments) {
9 | Navigator.pushNamedAndRemoveUntil(context, routeName, (Route route) => false, arguments: arguments);
10 | }
11 |
--------------------------------------------------------------------------------
/lib/src/widgets/helper/NavBarMenuItem.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class NavBarMenuItem {
4 | const NavBarMenuItem({this.key, this.title, this.icon});
5 | final String title;
6 | final int key;
7 | final IconData icon;
8 | }
--------------------------------------------------------------------------------
/lib/src/widgets/helper/UiAction.dart:
--------------------------------------------------------------------------------
1 | class UiAction {
2 | const UiAction({this.action, this.message});
3 | final int action;
4 | final String message;
5 | }
6 |
--------------------------------------------------------------------------------
/lib/src/widgets/screen_chat.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'dart:io';
3 |
4 | import 'package:cached_network_image/cached_network_image.dart';
5 | import 'package:cloud_firestore/cloud_firestore.dart';
6 | import 'package:flutter/material.dart';
7 | import 'package:flutter_bloc_firebase_chat/src/bloc/chat_bloc.dart';
8 | import 'package:flutter_bloc_firebase_chat/src/model/chat_info.dart';
9 | import 'package:flutter_bloc_firebase_chat/src/model/sticker.dart';
10 | import 'package:flutter_bloc_firebase_chat/src/utils/color_const.dart';
11 | import 'package:flutter_bloc_firebase_chat/src/utils/string_const.dart';
12 | import 'package:fluttertoast/fluttertoast.dart';
13 | import 'package:image_picker/image_picker.dart';
14 | import 'package:intl/intl.dart';
15 | import 'package:provider/provider.dart';
16 |
17 | import 'helper/UiAction.dart';
18 |
19 | class Chat extends StatelessWidget {
20 | final ChatInfo chatInfo;
21 |
22 | Chat({Key key, @required this.chatInfo}) : super(key: key);
23 |
24 | @override
25 | Widget build(BuildContext context) {
26 | return Provider(
27 | builder: (context) => ChatBloc(),
28 | dispose: (context, bloc) => bloc.dispose(),
29 | child: new Scaffold(
30 | appBar: new AppBar(
31 | title: new Text(
32 | chatInfo.toUser.name,
33 | style: TextStyle(
34 | color: screenTitleColor, fontWeight: FontWeight.bold),
35 | ),
36 | centerTitle: true,
37 | ),
38 | body: new ChatScreen(chatInfo: chatInfo),
39 | ));
40 | }
41 | }
42 |
43 | class ChatScreen extends StatefulWidget {
44 | final ChatInfo chatInfo;
45 |
46 | ChatScreen({Key key, @required this.chatInfo}) : super(key: key);
47 |
48 | @override
49 | State createState() => new ChatScreenState(chatInfo: chatInfo);
50 | }
51 |
52 | class ChatScreenState extends State {
53 | final ChatInfo chatInfo;
54 | ChatBloc _bloc;
55 |
56 | ChatScreenState({Key key, @required this.chatInfo});
57 |
58 | var listMessage;
59 |
60 | final TextEditingController textEditingController =
61 | new TextEditingController();
62 | final ScrollController listScrollController = new ScrollController();
63 | final FocusNode focusNode = new FocusNode();
64 |
65 | @override
66 | void didChangeDependencies() {
67 | super.didChangeDependencies();
68 | if (_bloc == null) {
69 | _bloc = Provider.of(context);
70 | _blocListener(context, _bloc);
71 | _bloc.setChatInfo(chatInfo).then((_) => _bloc.getChatHistory());
72 | }
73 | }
74 |
75 | @override
76 | void initState() {
77 | super.initState();
78 | focusNode.addListener(onFocusChange);
79 | }
80 |
81 | void onFocusChange() {
82 | if (focusNode.hasFocus) {
83 | // Hide sticker when keyboard appear
84 | _bloc.setShowSticker(false);
85 | }
86 | }
87 |
88 | void _blocListener(BuildContext context, ChatBloc chatBloc) {
89 | final actionListener = (UiAction action) {
90 | if (action.action == ACTIONS.clearTextEditingController.index) {
91 | textEditingController.clear();
92 | } else if (action.action == ACTIONS.animateListScrollController.index) {
93 | listScrollController.animateTo(0.0,
94 | duration: Duration(milliseconds: 300), curve: Curves.easeOut);
95 | } else if (action.action == ACTIONS.showToast.index) {
96 | Fluttertoast.showToast(msg: action.message);
97 | } else if (action.action == ACTIONS.error.index) {}
98 | };
99 | chatBloc.actions.listen(actionListener);
100 | }
101 |
102 | Future getImage() async {
103 | File imageFile = await ImagePicker.pickImage(source: ImageSource.gallery);
104 |
105 | if (imageFile != null) {
106 | _bloc.uploadFile(imageFile);
107 | }
108 | }
109 |
110 | void getSticker() {
111 | // Hide keyboard when sticker appear
112 | focusNode.unfocus();
113 | _bloc.setShowSticker(!_bloc.getShowSticker());
114 | }
115 |
116 | Widget buildItem(int index, DocumentSnapshot document) {
117 | if (document['idFrom'] == _bloc.chatInfo.fromUser.id) {
118 | // Right (my message)
119 | return Row(
120 | children: [
121 | document['type'] == 0
122 | // Text
123 | ? Container(
124 | child: Text(
125 | document['content'],
126 | style: TextStyle(color: textBlackColor),
127 | ),
128 | padding: EdgeInsets.fromLTRB(15.0, 10.0, 15.0, 10.0),
129 | width: 200.0,
130 | decoration: BoxDecoration(
131 | color: bgGreyColor,
132 | borderRadius: BorderRadius.circular(8.0)),
133 | margin: EdgeInsets.only(
134 | bottom: isLastMessageRight(index) ? 20.0 : 10.0,
135 | right: 10.0),
136 | )
137 | : document['type'] == 1
138 | // Image
139 | ? Container(
140 | child: Material(
141 | child: CachedNetworkImage(
142 | placeholder: (context, url) => Container(
143 | child: CircularProgressIndicator(
144 | valueColor: AlwaysStoppedAnimation(
145 | primaryColor),
146 | ),
147 | width: 200.0,
148 | height: 200.0,
149 | padding: EdgeInsets.all(70.0),
150 | decoration: BoxDecoration(
151 | color: bgGreyColor,
152 | borderRadius: BorderRadius.all(
153 | Radius.circular(8.0),
154 | ),
155 | ),
156 | ),
157 | errorWidget: (context, url, error) => Material(
158 | child: Container(
159 | width: 200,
160 | height: 200,
161 | color: bgGreyColor,
162 | child: Center(
163 | child: Icon(
164 | Icons.error,
165 | color: Colors.red,
166 | size: 64,
167 | )),
168 | ),
169 | borderRadius: BorderRadius.all(
170 | Radius.circular(8.0),
171 | ),
172 | clipBehavior: Clip.hardEdge,
173 | ),
174 | imageUrl: document['content'],
175 | width: 200.0,
176 | height: 200.0,
177 | fit: BoxFit.cover,
178 | ),
179 | borderRadius: BorderRadius.all(Radius.circular(8.0)),
180 | clipBehavior: Clip.hardEdge,
181 | ),
182 | margin: EdgeInsets.only(
183 | bottom: isLastMessageRight(index) ? 20.0 : 10.0,
184 | right: 10.0),
185 | )
186 | // Sticker
187 | : Container(
188 | child: new Image.asset(
189 | 'assets/stickers/angry_cat/${document['content']}.png',
190 | width: 100.0,
191 | height: 100.0,
192 | fit: BoxFit.cover,
193 | ),
194 | margin: EdgeInsets.only(
195 | bottom: isLastMessageRight(index) ? 20.0 : 10.0,
196 | right: 10.0),
197 | ),
198 | ],
199 | mainAxisAlignment: MainAxisAlignment.end,
200 | );
201 | } else {
202 | // Left (peer message)
203 | return Container(
204 | child: Column(
205 | children: [
206 | Row(
207 | children: [
208 | Material(
209 | child: CachedNetworkImage(
210 | placeholder: (context, url) => Container(
211 | child: CircularProgressIndicator(
212 | strokeWidth: 1.0,
213 | valueColor:
214 | AlwaysStoppedAnimation(primaryColor),
215 | ),
216 | width: 35.0,
217 | height: 35.0,
218 | padding: EdgeInsets.all(10.0),
219 | ),
220 | imageUrl: chatInfo.toUser.avatar,
221 | width: 35.0,
222 | height: 35.0,
223 | fit: BoxFit.cover,
224 | ),
225 | borderRadius: BorderRadius.all(
226 | Radius.circular(18.0),
227 | ),
228 | clipBehavior: Clip.hardEdge,
229 | ),
230 | document['type'] == 0
231 | ? Container(
232 | child: Text(
233 | document['content'],
234 | style: TextStyle(color: Colors.white),
235 | ),
236 | padding: EdgeInsets.fromLTRB(15.0, 10.0, 15.0, 10.0),
237 | width: 200.0,
238 | decoration: BoxDecoration(
239 | color: primaryColor,
240 | borderRadius: BorderRadius.circular(8.0)),
241 | margin: EdgeInsets.only(left: 10.0),
242 | )
243 | : document['type'] == 1
244 | ? Container(
245 | child: Material(
246 | child: CachedNetworkImage(
247 | placeholder: (context, url) => Container(
248 | child: CircularProgressIndicator(
249 | valueColor:
250 | AlwaysStoppedAnimation(
251 | primaryColor),
252 | ),
253 | width: 200.0,
254 | height: 200.0,
255 | padding: EdgeInsets.all(70.0),
256 | decoration: BoxDecoration(
257 | color: bgGreyColor,
258 | borderRadius: BorderRadius.all(
259 | Radius.circular(8.0),
260 | ),
261 | ),
262 | ),
263 | errorWidget: (context, url, error) => Material(
264 | child: Container(
265 | width: 200,
266 | height: 200,
267 | color: bgGreyColor,
268 | child: Center(
269 | child: Icon(
270 | Icons.error,
271 | color: Colors.red,
272 | size: 64,
273 | )),
274 | ),
275 | borderRadius: BorderRadius.all(
276 | Radius.circular(8.0),
277 | ),
278 | clipBehavior: Clip.hardEdge,
279 | ),
280 | imageUrl: document['content'],
281 | width: 200.0,
282 | height: 200.0,
283 | fit: BoxFit.cover,
284 | ),
285 | borderRadius:
286 | BorderRadius.all(Radius.circular(8.0)),
287 | clipBehavior: Clip.hardEdge,
288 | ),
289 | margin: EdgeInsets.only(left: 10.0),
290 | )
291 | : Container(
292 | child: new Image.asset(
293 | 'assets/stickers/angry_cat/${document['content']}.png',
294 | width: 100.0,
295 | height: 100.0,
296 | fit: BoxFit.cover,
297 | ),
298 | margin: EdgeInsets.only(
299 | bottom: isLastMessageRight(index) ? 20.0 : 10.0,
300 | right: 10.0),
301 | ),
302 | ],
303 | ),
304 |
305 | // Time
306 | isLastMessageLeft(index)
307 | ? Container(
308 | child: Text(
309 | DateFormat('dd MMM kk:mm').format(
310 | DateTime.fromMillisecondsSinceEpoch(
311 | int.parse(document['timestamp']))),
312 | style: TextStyle(
313 | color: greyColor,
314 | fontSize: 12.0,
315 | fontStyle: FontStyle.italic),
316 | ),
317 | margin: EdgeInsets.only(left: 50.0, top: 5.0, bottom: 5.0),
318 | )
319 | : Container()
320 | ],
321 | crossAxisAlignment: CrossAxisAlignment.start,
322 | ),
323 | margin: EdgeInsets.only(bottom: 10.0),
324 | );
325 | }
326 | }
327 |
328 | bool isLastMessageLeft(int index) {
329 | if ((index > 0 &&
330 | listMessage != null &&
331 | listMessage[index - 1]['idFrom'] == chatInfo?.getGroupChatId()) ||
332 | index == 0) {
333 | return true;
334 | } else {
335 | return false;
336 | }
337 | }
338 |
339 | bool isLastMessageRight(int index) {
340 | if ((index > 0 &&
341 | listMessage != null &&
342 | listMessage[index - 1]['idFrom'] != chatInfo?.getGroupChatId()) ||
343 | index == 0) {
344 | return true;
345 | } else {
346 | return false;
347 | }
348 | }
349 |
350 | Future onBackPress() {
351 | if (_bloc.getShowSticker()) {
352 | _bloc.setShowSticker(false);
353 | } else {
354 | Navigator.pop(context);
355 | }
356 |
357 | return Future.value(false);
358 | }
359 |
360 | @override
361 | Widget build(BuildContext context) {
362 | return WillPopScope(
363 | child: Stack(
364 | children: [
365 | Column(
366 | children: [
367 | // List of messages
368 | buildListMessage(),
369 |
370 | // Sticker
371 | buildSticker(),
372 |
373 | // Input content
374 | buildInput(),
375 | ],
376 | ),
377 |
378 | // Loading
379 | buildLoading()
380 | ],
381 | ),
382 | onWillPop: onBackPress,
383 | );
384 | }
385 |
386 | Widget buildSticker() {
387 | // Todo: make dynamic, put into DB
388 | var angryCatStickerFiles = ['cat_1', 'cat_2', 'cat_3', 'cat_4', 'cat_5', 'cat_6'];
389 | var sticker = Sticker(
390 | id: '1', collection: 'angry_cat', files: angryCatStickerFiles, fileType: 'png');
391 |
392 | var stickerWidget = List();
393 | var stickerPerRow = 3;
394 | var stickerRowsLength = sticker.files.length / stickerPerRow;
395 | for (var i = 0; i < stickerRowsLength; i++) {
396 | var children = List();
397 | for (var j = 0; j < sticker.files.length / stickerRowsLength; j++) {
398 | children.add(FlatButton(
399 | onPressed: () => _bloc.onSendMessage(sticker.files[j], 2),
400 | child: new Image.asset(
401 | '${StringConstant.asset_sticker}/${sticker.collection}/${sticker.files[j]}.${sticker.fileType}',
402 | width: 50.0,
403 | height: 50.0,
404 | fit: BoxFit.cover,
405 | ),
406 | ));
407 | }
408 | stickerWidget.add(Row(
409 | children: children,
410 | mainAxisAlignment: MainAxisAlignment.spaceEvenly));
411 | }
412 |
413 | return StreamBuilder(
414 | stream: _bloc.showSticker,
415 | initialData: false,
416 | builder: (context, snapshot) {
417 | if (snapshot.data == false) {
418 | return new Container();
419 | } else {
420 | return Container(
421 | child: Column(
422 | children: stickerWidget,
423 | mainAxisAlignment: MainAxisAlignment.spaceEvenly,
424 | ),
425 | decoration: new BoxDecoration(
426 | border: new Border(
427 | top: new BorderSide(color: bgGreyColor, width: 0.5)),
428 | color: Colors.white),
429 | padding: EdgeInsets.all(5.0),
430 | height: 180.0,
431 | );
432 | }
433 | });
434 | }
435 |
436 | Widget buildLoading() {
437 | return Positioned(
438 | child: StreamBuilder(
439 | stream: _bloc.loadingObservable,
440 | initialData: false,
441 | builder: (context, snapshot) {
442 | if (snapshot.data == true) {
443 | return new Container(
444 | child: Center(
445 | child: CircularProgressIndicator(
446 | valueColor:
447 | AlwaysStoppedAnimation(primaryColor)),
448 | ),
449 | color: Colors.white.withOpacity(0.8),
450 | );
451 | } else {
452 | return new Container();
453 | }
454 | }));
455 | }
456 |
457 | Widget buildInput() {
458 | return Container(
459 | child: Row(
460 | children: [
461 | // Button send image
462 | Material(
463 | child: new Container(
464 | margin: new EdgeInsets.symmetric(horizontal: 1.0),
465 | child: new IconButton(
466 | icon: new Icon(Icons.image),
467 | onPressed: getImage,
468 | color: primaryColor,
469 | ),
470 | ),
471 | color: Colors.white,
472 | ),
473 | Material(
474 | child: new Container(
475 | margin: new EdgeInsets.symmetric(horizontal: 1.0),
476 | child: new IconButton(
477 | icon: new Icon(Icons.face),
478 | onPressed: getSticker,
479 | color: primaryColor,
480 | ),
481 | ),
482 | color: Colors.white,
483 | ),
484 |
485 | // Edit text
486 | Flexible(
487 | child: Container(
488 | child: TextField(
489 | style: TextStyle(color: textBlackColor, fontSize: 15.0),
490 | controller: textEditingController,
491 | decoration: InputDecoration.collapsed(
492 | hintText: StringConstant.chat_text_input_hint,
493 | hintStyle: TextStyle(color: greyColor),
494 | ),
495 | focusNode: focusNode,
496 | ),
497 | ),
498 | ),
499 |
500 | // Button send message
501 | Material(
502 | child: new Container(
503 | margin: new EdgeInsets.symmetric(horizontal: 8.0),
504 | child: new IconButton(
505 | icon: new Icon(Icons.send),
506 | onPressed: () =>
507 | _bloc.onSendMessage(textEditingController.text, 0),
508 | color: primaryColor,
509 | ),
510 | ),
511 | color: Colors.white,
512 | ),
513 | ],
514 | ),
515 | width: double.infinity,
516 | height: 50.0,
517 | decoration: new BoxDecoration(
518 | border:
519 | new Border(top: new BorderSide(color: bgGreyColor, width: 0.5)),
520 | color: Colors.white),
521 | );
522 | }
523 |
524 | Widget buildListMessage() {
525 | return Flexible(
526 | child: StreamBuilder(
527 | stream: _bloc.chatHistory,
528 | builder: (context, snapshot) {
529 | if (!snapshot.hasData) {
530 | return Center(
531 | child: CircularProgressIndicator(
532 | valueColor: AlwaysStoppedAnimation(primaryColor)));
533 | } else {
534 | listMessage = snapshot.data.documents;
535 | return ListView.builder(
536 | padding: EdgeInsets.all(10.0),
537 | itemBuilder: (context, index) =>
538 | buildItem(index, snapshot.data.documents[index]),
539 | itemCount: snapshot.data.documents.length,
540 | reverse: true,
541 | controller: listScrollController,
542 | );
543 | }
544 | },
545 | ),
546 | );
547 | }
548 | }
549 |
--------------------------------------------------------------------------------
/lib/src/widgets/screen_chat_list.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'dart:io';
3 |
4 | import 'package:cached_network_image/cached_network_image.dart';
5 | import 'package:flutter/material.dart';
6 | import 'package:flutter_bloc_firebase_chat/src/bloc/chat_list_bloc.dart';
7 | import 'package:flutter_bloc_firebase_chat/src/model/chat_info.dart';
8 | import 'package:flutter_bloc_firebase_chat/src/model/user.dart';
9 | import 'package:flutter_bloc_firebase_chat/src/services/auth_service.dart';
10 | import 'package:flutter_bloc_firebase_chat/src/utils/color_const.dart';
11 | import 'package:flutter_bloc_firebase_chat/src/utils/string_const.dart';
12 | import 'package:flutter_bloc_firebase_chat/src/utils/util_nav.dart';
13 | import 'package:flutter_bloc_firebase_chat/src/widgets/screen_chat.dart';
14 | import 'package:flutter_bloc_firebase_chat/src/widgets/helper/NavBarMenuItem.dart';
15 | import 'package:provider/provider.dart';
16 |
17 | import '../../main.dart';
18 |
19 | class ChatList extends StatelessWidget {
20 | final String currentUserId;
21 |
22 | ChatList({Key key, @required this.currentUserId}) : super(key: key);
23 |
24 | @override
25 | Widget build(BuildContext context) {
26 | return Provider(
27 | builder: (context) => ChatListBloc(),
28 | dispose: (context, bloc) => bloc.dispose(),
29 | child: ChatListScreen(currentUserId: currentUserId));
30 | }
31 | }
32 |
33 | class ChatListScreen extends StatefulWidget {
34 | final String currentUserId;
35 |
36 | ChatListScreen({Key key, @required this.currentUserId}) : super(key: key);
37 |
38 | @override
39 | State createState() => ChatListScreenState(currentUserId: currentUserId);
40 | }
41 |
42 | class ChatListScreenState extends State {
43 | ChatListBloc _bloc;
44 | final String currentUserId;
45 | static const int navBarSettings = 1;
46 | static const int navBarSignOut = 2;
47 |
48 | List navBarMenuItems = const [
49 | const NavBarMenuItem(
50 | key: navBarSettings,
51 | title: StringConstant.menu_user_settings,
52 | icon: Icons.settings),
53 | const NavBarMenuItem(
54 | key: navBarSignOut,
55 | title: StringConstant.menu_sign_out,
56 | icon: Icons.exit_to_app),
57 | ];
58 |
59 | /// Constructor
60 | ChatListScreenState({Key key, @required this.currentUserId});
61 |
62 | @override
63 | void didChangeDependencies() {
64 | super.didChangeDependencies();
65 | if (_bloc == null) {
66 | _bloc = Provider.of(context);
67 | _blocListener(context, _bloc);
68 | }
69 | }
70 |
71 | void _blocListener(BuildContext context, ChatListBloc chatListBloc) {
72 | final signOutListener = (bool signedOut) {
73 | if (signedOut) {
74 | navigateToAndRemoveUntil(context, StringConstant.route_sign_in, null);
75 | }
76 | };
77 | chatListBloc.signedOut.listen(signOutListener);
78 | }
79 |
80 | Future openDialog() async {
81 | switch (await showDialog(
82 | context: context,
83 | builder: (BuildContext context) {
84 | return SimpleDialog(
85 | contentPadding:
86 | EdgeInsets.only(left: 0.0, right: 0.0, top: 0.0, bottom: 0.0),
87 | children: [
88 | Container(
89 | color: primaryColor,
90 | margin: EdgeInsets.all(0.0),
91 | padding: EdgeInsets.only(bottom: 10.0, top: 10.0),
92 | height: 100.0,
93 | child: Column(
94 | children: [
95 | Container(
96 | child: Icon(
97 | Icons.exit_to_app,
98 | size: 30.0,
99 | color: Colors.white,
100 | ),
101 | margin: EdgeInsets.only(bottom: 10.0),
102 | ),
103 | Text(
104 | StringConstant.dialog_title_exit_app,
105 | style: TextStyle(
106 | color: Colors.white,
107 | fontSize: 18.0,
108 | fontWeight: FontWeight.bold),
109 | ),
110 | Text(
111 | StringConstant.dialog_title_exit_app_desc,
112 | style: TextStyle(color: Colors.white70, fontSize: 14.0),
113 | ),
114 | ],
115 | ),
116 | ),
117 | SimpleDialogOption(
118 | onPressed: () {
119 | Navigator.pop(context, 0);
120 | },
121 | child: Row(
122 | children: [
123 | Container(
124 | child: Icon(
125 | Icons.cancel,
126 | color: primaryColor,
127 | ),
128 | margin: EdgeInsets.only(right: 10.0),
129 | ),
130 | Text(
131 | StringConstant.cancel.toUpperCase(),
132 | style: TextStyle(
133 | color: primaryColor, fontWeight: FontWeight.bold),
134 | )
135 | ],
136 | ),
137 | ),
138 | SimpleDialogOption(
139 | onPressed: () {
140 | Navigator.pop(context, 1);
141 | },
142 | child: Row(
143 | children: [
144 | Container(
145 | child: Icon(
146 | Icons.check_circle,
147 | color: primaryColor,
148 | ),
149 | margin: EdgeInsets.only(right: 10.0),
150 | ),
151 | Text(
152 | StringConstant.yes.toUpperCase(),
153 | style: TextStyle(
154 | color: primaryColor, fontWeight: FontWeight.bold),
155 | )
156 | ],
157 | ),
158 | ),
159 | ],
160 | );
161 | })) {
162 | case 0:
163 | break;
164 | case 1:
165 | exit(0);
166 | break;
167 | }
168 | }
169 |
170 | @override
171 | Widget build(BuildContext context) {
172 | return Scaffold(
173 | appBar: AppBar(
174 | title: Text(
175 | StringConstant.title_chat_list,
176 | style: TextStyle(color: screenTitleColor, fontWeight: FontWeight.bold),
177 | ),
178 | centerTitle: true,
179 | actions: [
180 | PopupMenuButton(
181 | onSelected: onItemMenuPress,
182 | itemBuilder: (BuildContext context) {
183 | return navBarMenuItems.map((NavBarMenuItem choice) {
184 | return PopupMenuItem(
185 | value: choice,
186 | child: Row(
187 | children: [
188 | Icon(
189 | choice.icon,
190 | color: primaryColor,
191 | ),
192 | Container(
193 | width: 10.0,
194 | ),
195 | Text(
196 | choice.title,
197 | style: TextStyle(color: primaryColor),
198 | ),
199 | ],
200 | ));
201 | }).toList();
202 | },
203 | ),
204 | ],
205 | ),
206 | body: WillPopScope(
207 | child: Stack(
208 | children: [
209 | // List
210 | Container(
211 | child: StreamBuilder(
212 | stream: _bloc.chatList(),
213 | builder: (context, snapshot) {
214 | if (!snapshot.hasData) {
215 | return Center(
216 | child: CircularProgressIndicator(
217 | valueColor: AlwaysStoppedAnimation(primaryColor),
218 | ),
219 | );
220 | } else {
221 | return ListView.builder(
222 | padding: EdgeInsets.all(10.0),
223 | itemBuilder: (context, index) =>
224 | buildListItem(context, snapshot.data[index]),
225 | itemCount: snapshot.data.length,
226 | );
227 | }
228 | },
229 | ),
230 | ),
231 |
232 | // Loading
233 | Positioned(
234 | child: StreamBuilder(
235 | stream: _bloc.loadingObservable,
236 | builder: (context, snapshot) {
237 | if (snapshot.hasData && snapshot.data) {
238 | return new Container(
239 | child: Center(
240 | child: CircularProgressIndicator(
241 | valueColor: AlwaysStoppedAnimation(
242 | primaryColor)),
243 | ),
244 | color: Colors.white.withOpacity(0.8),
245 | );
246 | } else {
247 | return new Container();
248 | }
249 | }))
250 | ],
251 | ),
252 | onWillPop: onBackPress,
253 | ));
254 | }
255 |
256 | Widget buildListItem(BuildContext context, User user) {
257 | if (user.id == currentUserId) {
258 | return Container();
259 | } else {
260 | return Container(
261 | child: FlatButton(
262 | child: Row(
263 | children: [
264 | Material(
265 | child: CachedNetworkImage(
266 | placeholder: (context, url) => Container(
267 | child: CircularProgressIndicator(
268 | strokeWidth: 1.0,
269 | valueColor: AlwaysStoppedAnimation(primaryColor),
270 | ),
271 | width: 50.0,
272 | height: 50.0,
273 | padding: EdgeInsets.all(15.0),
274 | ),
275 | imageUrl: user.avatar,
276 | width: 50.0,
277 | height: 50.0,
278 | fit: BoxFit.cover,
279 | ),
280 | borderRadius: BorderRadius.all(Radius.circular(25.0)),
281 | clipBehavior: Clip.hardEdge,
282 | ),
283 | Flexible(
284 | child: Container(
285 | child: Column(
286 | children: [
287 | Container(
288 | child: Text(
289 | user.name,
290 | style: TextStyle(color: textBlackColor, fontSize: 18.0),
291 | ),
292 | alignment: Alignment.centerLeft,
293 | margin: EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 5.0),
294 | ),
295 | Container(
296 | child: Text(
297 | '${StringConstant.list_item_about_me_label}: ${user.aboutMe ?? StringConstant.list_item_about_me_not_available}',
298 | style: TextStyle(color: textDarkGrayColor),
299 | ),
300 | alignment: Alignment.centerLeft,
301 | margin: EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 0.0),
302 | ),
303 | ],
304 | ),
305 | margin: EdgeInsets.only(left: 20.0),
306 | ),
307 | ),
308 | ],
309 | ),
310 | onPressed: () {
311 | Navigator.push(
312 | context,
313 | MaterialPageRoute(
314 | builder: (context) => Chat(
315 | chatInfo: ChatInfo(
316 | locator().getCurrentUser(), user))));
317 | },
318 | color: bgGreyColor,
319 | padding: EdgeInsets.fromLTRB(25.0, 10.0, 25.0, 10.0),
320 | shape:
321 | RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0)),
322 | ),
323 | margin: EdgeInsets.only(bottom: 10.0, left: 5.0, right: 5.0),
324 | );
325 | }
326 | }
327 |
328 | Future onBackPress() async {
329 | openDialog();
330 | return Future.value(false);
331 | }
332 |
333 | void onItemMenuPress(NavBarMenuItem item) {
334 | if (item.key == navBarSignOut) {
335 | _bloc.handleSignOut();
336 | } else if (item.key == navBarSettings) {
337 | navigateTo(context, StringConstant.route_user_settings, null);
338 | }
339 | }
340 | }
341 |
--------------------------------------------------------------------------------
/lib/src/widgets/screen_sign_in.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/scheduler.dart';
3 | import 'package:flutter_bloc_firebase_chat/src/bloc/sign_in_bloc.dart';
4 | import 'package:flutter_bloc_firebase_chat/src/services/auth_service.dart';
5 | import 'package:flutter_bloc_firebase_chat/src/utils/color_const.dart';
6 | import 'package:flutter_bloc_firebase_chat/src/utils/string_const.dart';
7 | import 'package:flutter_bloc_firebase_chat/src/widgets/screen_chat_list.dart';
8 | import 'package:provider/provider.dart';
9 |
10 | import '../../main.dart';
11 |
12 | class SignIn extends StatelessWidget {
13 | @override
14 | Widget build(BuildContext context) {
15 | return Provider(
16 | builder: (context) => SignInBloc(),
17 | dispose: (context, bloc) => bloc.dispose(),
18 | child: Scaffold(
19 | appBar: AppBar(
20 | title: Text(
21 | StringConstant.title_login,
22 | style: TextStyle(
23 | color: screenTitleColor, fontWeight: FontWeight.bold),
24 | ),
25 | centerTitle: true,
26 | ),
27 | body: SignInScreen()));
28 | }
29 | }
30 |
31 | class SignInScreen extends StatefulWidget {
32 | @override
33 | SignInScreenState createState() {
34 | return SignInScreenState();
35 | }
36 | }
37 |
38 | class SignInScreenState extends State {
39 | SignInBloc _bloc;
40 |
41 | @override
42 | void didChangeDependencies() {
43 | super.didChangeDependencies();
44 | if (_bloc == null) {
45 | _bloc = Provider.of(context);
46 | SchedulerBinding.instance
47 | .addPostFrameCallback((_) => _bloc.isUserSignedIn());
48 | _listenStatus(context, _bloc);
49 | }
50 | }
51 |
52 | @override
53 | Widget build(BuildContext context) {
54 | return Container(
55 | alignment: Alignment(0.0, 0.0),
56 | child: Stack(children: [
57 | Column(
58 | children: [
59 | Row(
60 | mainAxisAlignment: MainAxisAlignment.center,
61 | children: [
62 | Container(
63 | padding: EdgeInsets.only(top: 50.0),
64 | child: FlutterLogo(size: 150),
65 | ),
66 | ],
67 | ),
68 | Row(
69 | mainAxisAlignment: MainAxisAlignment.center,
70 | children: [
71 | Container(
72 | padding: EdgeInsets.only(top: 20.0),
73 | child: Text(
74 | StringConstant.login_logo_desc,
75 | style: TextStyle(fontSize: 18.0),
76 | )),
77 | ],
78 | ),
79 | Row(
80 | mainAxisAlignment: MainAxisAlignment.center,
81 | children: [
82 | Container(
83 | padding: EdgeInsets.only(top: 50.0),
84 | child: FlatButton(
85 | onPressed: _bloc.handleUserSignIn,
86 | child: Text(
87 | StringConstant.btn_login_google,
88 | style: TextStyle(fontSize: 16.0),
89 | ),
90 | color: Color(0xffdd4b39),
91 | highlightColor: Color(0xffff7f7f),
92 | splashColor: Colors.transparent,
93 | textColor: Colors.white,
94 | padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 15.0)),
95 | ),
96 | ],
97 | )
98 | ],
99 | ),
100 |
101 | // Loading
102 | Positioned(
103 | child: StreamBuilder(
104 | stream: _bloc.loadingObservable,
105 | builder: (context, snapshot) {
106 | if (snapshot.hasData && snapshot.data) {
107 | return new Container(
108 | child: Center(
109 | child: CircularProgressIndicator(
110 | valueColor:
111 | AlwaysStoppedAnimation(primaryColor),
112 | ),
113 | ),
114 | color: Colors.white.withOpacity(0.8),
115 | );
116 | } else {
117 | return new Container();
118 | }
119 | }))
120 | ]));
121 | }
122 |
123 | void _listenStatus(BuildContext context, SignInBloc loginBloc) {
124 | final onData = (Status status) {
125 | if (status == Status.error) {
126 | showErrorMessage();
127 | } else if (status == Status.signedIn) {
128 | Navigator.push(
129 | context,
130 | MaterialPageRoute(
131 | builder: (context) => ChatList(
132 | currentUserId:
133 | locator().getCurrentUser().id)));
134 | }
135 | };
136 |
137 | loginBloc.status.listen(onData);
138 | }
139 |
140 | void showErrorMessage() {
141 | final snackBar = SnackBar(
142 | content: Text(StringConstant.error_login_sns),
143 | duration: new Duration(seconds: 2));
144 | Scaffold.of(context).showSnackBar(snackBar);
145 | }
146 | }
147 |
--------------------------------------------------------------------------------
/lib/src/widgets/screen_user_settings.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'dart:io';
3 |
4 | import 'package:cached_network_image/cached_network_image.dart';
5 | import 'package:flutter/material.dart';
6 | import 'package:flutter_bloc_firebase_chat/src/bloc/user_settings_bloc.dart';
7 | import 'package:flutter_bloc_firebase_chat/src/model/user.dart';
8 | import 'package:flutter_bloc_firebase_chat/src/services/auth_service.dart';
9 | import 'package:flutter_bloc_firebase_chat/src/utils/color_const.dart';
10 | import 'package:flutter_bloc_firebase_chat/src/utils/string_const.dart';
11 | import 'package:fluttertoast/fluttertoast.dart';
12 | import 'package:image_picker/image_picker.dart';
13 | import 'package:provider/provider.dart';
14 |
15 | import '../../main.dart';
16 | import 'helper/UiAction.dart';
17 |
18 | class UserSettings extends StatelessWidget {
19 | @override
20 | Widget build(BuildContext context) {
21 | return Provider(
22 | builder: (context) => UserSettingsBloc(),
23 | dispose: (context, bloc) => bloc.dispose(),
24 | child: Scaffold(
25 | appBar: new AppBar(
26 | title: new Text(
27 | StringConstant.title_user_settings,
28 | style:
29 | TextStyle(color: screenTitleColor, fontWeight: FontWeight.bold),
30 | ),
31 | centerTitle: true,
32 | ),
33 | body: new SettingsScreen(),
34 | ));
35 | }
36 | }
37 |
38 | class SettingsScreen extends StatefulWidget {
39 | @override
40 | State createState() => new SettingsScreenState();
41 | }
42 |
43 | class SettingsScreenState extends State {
44 | UserSettingsBloc _bloc;
45 | TextEditingController controllerNickname;
46 | TextEditingController controllerAboutMe;
47 |
48 | final FocusNode focusNodeNickname = new FocusNode();
49 | final FocusNode focusNodeAboutMe = new FocusNode();
50 |
51 | @override
52 | void didChangeDependencies() {
53 | super.didChangeDependencies();
54 | if (_bloc == null) {
55 | _bloc = Provider.of(context);
56 | _blocListener(context, _bloc);
57 | _bloc.initUser();
58 | initController();
59 | }
60 | }
61 |
62 | void _blocListener(BuildContext context, UserSettingsBloc userSettingsBloc) {
63 | final actionListener = (UiAction action) {
64 | if (action.action == ACTIONS.showToast.index) {
65 | Fluttertoast.showToast(msg: action.message);
66 | } else if (action.action == ACTIONS.error.index) {}
67 | };
68 | userSettingsBloc.actions.listen(actionListener);
69 | }
70 |
71 | void initController() {
72 | controllerNickname = new TextEditingController(
73 | text: locator().getCurrentUser().name);
74 | controllerAboutMe = new TextEditingController(
75 | text: locator().getCurrentUser().aboutMe);
76 | }
77 |
78 | Future getImage() async {
79 | File image = await ImagePicker.pickImage(source: ImageSource.gallery);
80 |
81 | if (image != null) {
82 | _bloc.setUserAvatar(image);
83 | }
84 | }
85 |
86 | void updateUserInfo() async {
87 | focusNodeNickname.unfocus();
88 | focusNodeAboutMe.unfocus();
89 | _bloc.updateUserInfo();
90 | }
91 |
92 | @override
93 | Widget build(BuildContext context) {
94 | return Stack(
95 | children: [
96 | SingleChildScrollView(
97 | child: Column(
98 | children: [
99 | // Avatar
100 | Container(
101 | child: Center(
102 | child: Stack(
103 | children: [
104 | StreamBuilder(
105 | stream: locator().currentUser,
106 | builder: (context, snapshot) {
107 | var user = snapshot.data as User;
108 | if (snapshot.hasData &&
109 | user != null &&
110 | user.avatar != null) {
111 | return Material(
112 | child: CachedNetworkImage(
113 | placeholder: (context, url) => Container(
114 | child: CircularProgressIndicator(
115 | strokeWidth: 2.0,
116 | valueColor:
117 | AlwaysStoppedAnimation(
118 | primaryColor),
119 | ),
120 | width: 90.0,
121 | height: 90.0,
122 | padding: EdgeInsets.all(20.0),
123 | ),
124 | imageUrl: user.avatar,
125 | width: 90.0,
126 | height: 90.0,
127 | fit: BoxFit.cover,
128 | ),
129 | borderRadius:
130 | BorderRadius.all(Radius.circular(45.0)),
131 | clipBehavior: Clip.hardEdge,
132 | );
133 | } else {
134 | return Icon(
135 | Icons.account_circle,
136 | size: 90.0,
137 | color: greyColor,
138 | );
139 | }
140 | }),
141 | IconButton(
142 | icon: Icon(
143 | Icons.camera_alt,
144 | color: primaryColor.withOpacity(0.5),
145 | ),
146 | onPressed: getImage,
147 | padding: EdgeInsets.all(30.0),
148 | splashColor: Colors.transparent,
149 | highlightColor: greyColor,
150 | iconSize: 30.0,
151 | ),
152 | ],
153 | ),
154 | ),
155 | width: double.infinity,
156 | margin: EdgeInsets.all(20.0),
157 | ),
158 |
159 | // Input
160 | Column(
161 | children: [
162 | // Username
163 | Container(
164 | child: Text(
165 | 'Name',
166 | style: TextStyle(
167 | fontStyle: FontStyle.italic,
168 | fontWeight: FontWeight.bold,
169 | color: primaryColor),
170 | ),
171 | margin: EdgeInsets.only(left: 10.0, bottom: 5.0, top: 10.0),
172 | ),
173 | Container(
174 | child: Theme(
175 | data: Theme.of(context)
176 | .copyWith(primaryColor: primaryColor),
177 | child: TextField(
178 | decoration: InputDecoration(
179 | hintText: 'Firstname Lastname',
180 | contentPadding: new EdgeInsets.all(5.0),
181 | hintStyle: TextStyle(color: greyColor),
182 | ),
183 | controller: controllerNickname,
184 | onChanged: (value) {
185 | _bloc.localUser.name = value;
186 | },
187 | focusNode: focusNodeNickname,
188 | ),
189 | ),
190 | margin: EdgeInsets.only(left: 30.0, right: 30.0),
191 | ),
192 |
193 | // About me
194 | Container(
195 | child: Text(
196 | 'About me',
197 | style: TextStyle(
198 | fontStyle: FontStyle.italic,
199 | fontWeight: FontWeight.bold,
200 | color: primaryColor),
201 | ),
202 | margin: EdgeInsets.only(left: 10.0, top: 30.0, bottom: 5.0),
203 | ),
204 | Container(
205 | child: Theme(
206 | data: Theme.of(context)
207 | .copyWith(primaryColor: primaryColor),
208 | child: TextField(
209 | decoration: InputDecoration(
210 | hintText: 'Fun, like travel and play PES...',
211 | contentPadding: EdgeInsets.all(5.0),
212 | hintStyle: TextStyle(color: greyColor),
213 | ),
214 | controller: controllerAboutMe,
215 | onChanged: (value) {
216 | _bloc.localUser.aboutMe = value;
217 | },
218 | focusNode: focusNodeAboutMe,
219 | ),
220 | ),
221 | margin: EdgeInsets.only(left: 30.0, right: 30.0),
222 | ),
223 | ],
224 | crossAxisAlignment: CrossAxisAlignment.start,
225 | ),
226 |
227 | // Button
228 | Container(
229 | child: FlatButton(
230 | onPressed: updateUserInfo,
231 | child: Text(
232 | 'UPDATE',
233 | style: TextStyle(fontSize: 16.0),
234 | ),
235 | color: primaryColor,
236 | highlightColor: new Color(0xff8d93a0),
237 | splashColor: Colors.transparent,
238 | textColor: Colors.white,
239 | padding: EdgeInsets.fromLTRB(30.0, 10.0, 30.0, 10.0),
240 | ),
241 | margin: EdgeInsets.only(top: 50.0, bottom: 50.0),
242 | ),
243 | ],
244 | ),
245 | padding: EdgeInsets.only(left: 15.0, right: 15.0),
246 | ),
247 |
248 | // Loading
249 | Positioned(
250 | child: StreamBuilder(
251 | stream: _bloc.loadingObservable,
252 | builder: (context, snapshot) {
253 | if (snapshot.hasData && snapshot.data) {
254 | return new Container(
255 | child: Center(
256 | child: CircularProgressIndicator(
257 | valueColor:
258 | AlwaysStoppedAnimation(primaryColor)),
259 | ),
260 | color: Colors.white.withOpacity(0.8),
261 | );
262 | } else {
263 | return new Container();
264 | }
265 | }),
266 | )
267 | ],
268 | );
269 | }
270 | }
271 |
--------------------------------------------------------------------------------
/pubspec.lock:
--------------------------------------------------------------------------------
1 | # Generated by pub
2 | # See https://www.dartlang.org/tools/pub/glossary#lockfile
3 | packages:
4 | async:
5 | dependency: transitive
6 | description:
7 | name: async
8 | url: "https://pub.dartlang.org"
9 | source: hosted
10 | version: "2.1.0"
11 | boolean_selector:
12 | dependency: transitive
13 | description:
14 | name: boolean_selector
15 | url: "https://pub.dartlang.org"
16 | source: hosted
17 | version: "1.0.4"
18 | cached_network_image:
19 | dependency: "direct main"
20 | description:
21 | name: cached_network_image
22 | url: "https://pub.dartlang.org"
23 | source: hosted
24 | version: "0.7.0"
25 | charcode:
26 | dependency: transitive
27 | description:
28 | name: charcode
29 | url: "https://pub.dartlang.org"
30 | source: hosted
31 | version: "1.1.2"
32 | cloud_firestore:
33 | dependency: "direct main"
34 | description:
35 | name: cloud_firestore
36 | url: "https://pub.dartlang.org"
37 | source: hosted
38 | version: "0.8.2+3"
39 | collection:
40 | dependency: transitive
41 | description:
42 | name: collection
43 | url: "https://pub.dartlang.org"
44 | source: hosted
45 | version: "1.14.11"
46 | convert:
47 | dependency: transitive
48 | description:
49 | name: convert
50 | url: "https://pub.dartlang.org"
51 | source: hosted
52 | version: "2.1.1"
53 | crypto:
54 | dependency: transitive
55 | description:
56 | name: crypto
57 | url: "https://pub.dartlang.org"
58 | source: hosted
59 | version: "2.0.6"
60 | cupertino_icons:
61 | dependency: "direct main"
62 | description:
63 | name: cupertino_icons
64 | url: "https://pub.dartlang.org"
65 | source: hosted
66 | version: "0.1.2"
67 | firebase_auth:
68 | dependency: "direct main"
69 | description:
70 | name: firebase_auth
71 | url: "https://pub.dartlang.org"
72 | source: hosted
73 | version: "0.7.0"
74 | firebase_core:
75 | dependency: transitive
76 | description:
77 | name: firebase_core
78 | url: "https://pub.dartlang.org"
79 | source: hosted
80 | version: "0.2.5+1"
81 | firebase_storage:
82 | dependency: "direct main"
83 | description:
84 | name: firebase_storage
85 | url: "https://pub.dartlang.org"
86 | source: hosted
87 | version: "1.0.4"
88 | flutter:
89 | dependency: "direct main"
90 | description: flutter
91 | source: sdk
92 | version: "0.0.0"
93 | flutter_cache_manager:
94 | dependency: transitive
95 | description:
96 | name: flutter_cache_manager
97 | url: "https://pub.dartlang.org"
98 | source: hosted
99 | version: "0.3.2"
100 | flutter_test:
101 | dependency: "direct dev"
102 | description: flutter
103 | source: sdk
104 | version: "0.0.0"
105 | fluttertoast:
106 | dependency: "direct main"
107 | description:
108 | name: fluttertoast
109 | url: "https://pub.dartlang.org"
110 | source: hosted
111 | version: "2.2.11"
112 | get_it:
113 | dependency: "direct main"
114 | description:
115 | name: get_it
116 | url: "https://pub.dartlang.org"
117 | source: hosted
118 | version: "1.0.3"
119 | google_sign_in:
120 | dependency: "direct main"
121 | description:
122 | name: google_sign_in
123 | url: "https://pub.dartlang.org"
124 | source: hosted
125 | version: "3.2.4"
126 | http:
127 | dependency: transitive
128 | description:
129 | name: http
130 | url: "https://pub.dartlang.org"
131 | source: hosted
132 | version: "0.12.0+2"
133 | http_parser:
134 | dependency: transitive
135 | description:
136 | name: http_parser
137 | url: "https://pub.dartlang.org"
138 | source: hosted
139 | version: "3.1.3"
140 | image_picker:
141 | dependency: "direct main"
142 | description:
143 | name: image_picker
144 | url: "https://pub.dartlang.org"
145 | source: hosted
146 | version: "0.4.12+1"
147 | intl:
148 | dependency: "direct main"
149 | description:
150 | name: intl
151 | url: "https://pub.dartlang.org"
152 | source: hosted
153 | version: "0.15.8"
154 | matcher:
155 | dependency: transitive
156 | description:
157 | name: matcher
158 | url: "https://pub.dartlang.org"
159 | source: hosted
160 | version: "0.12.5"
161 | meta:
162 | dependency: transitive
163 | description:
164 | name: meta
165 | url: "https://pub.dartlang.org"
166 | source: hosted
167 | version: "1.1.6"
168 | path:
169 | dependency: transitive
170 | description:
171 | name: path
172 | url: "https://pub.dartlang.org"
173 | source: hosted
174 | version: "1.6.2"
175 | path_provider:
176 | dependency: transitive
177 | description:
178 | name: path_provider
179 | url: "https://pub.dartlang.org"
180 | source: hosted
181 | version: "0.5.0+1"
182 | pedantic:
183 | dependency: transitive
184 | description:
185 | name: pedantic
186 | url: "https://pub.dartlang.org"
187 | source: hosted
188 | version: "1.5.0"
189 | provider:
190 | dependency: "direct main"
191 | description:
192 | name: provider
193 | url: "https://pub.dartlang.org"
194 | source: hosted
195 | version: "2.0.1"
196 | quiver:
197 | dependency: transitive
198 | description:
199 | name: quiver
200 | url: "https://pub.dartlang.org"
201 | source: hosted
202 | version: "2.0.2"
203 | rxdart:
204 | dependency: "direct main"
205 | description:
206 | name: rxdart
207 | url: "https://pub.dartlang.org"
208 | source: hosted
209 | version: "0.22.0"
210 | shared_preferences:
211 | dependency: "direct main"
212 | description:
213 | name: shared_preferences
214 | url: "https://pub.dartlang.org"
215 | source: hosted
216 | version: "0.4.3"
217 | sky_engine:
218 | dependency: transitive
219 | description: flutter
220 | source: sdk
221 | version: "0.0.99"
222 | source_span:
223 | dependency: transitive
224 | description:
225 | name: source_span
226 | url: "https://pub.dartlang.org"
227 | source: hosted
228 | version: "1.5.5"
229 | sqflite:
230 | dependency: transitive
231 | description:
232 | name: sqflite
233 | url: "https://pub.dartlang.org"
234 | source: hosted
235 | version: "1.1.5"
236 | stack_trace:
237 | dependency: transitive
238 | description:
239 | name: stack_trace
240 | url: "https://pub.dartlang.org"
241 | source: hosted
242 | version: "1.9.3"
243 | stream_channel:
244 | dependency: transitive
245 | description:
246 | name: stream_channel
247 | url: "https://pub.dartlang.org"
248 | source: hosted
249 | version: "2.0.0"
250 | string_scanner:
251 | dependency: transitive
252 | description:
253 | name: string_scanner
254 | url: "https://pub.dartlang.org"
255 | source: hosted
256 | version: "1.0.4"
257 | synchronized:
258 | dependency: transitive
259 | description:
260 | name: synchronized
261 | url: "https://pub.dartlang.org"
262 | source: hosted
263 | version: "2.1.0"
264 | term_glyph:
265 | dependency: transitive
266 | description:
267 | name: term_glyph
268 | url: "https://pub.dartlang.org"
269 | source: hosted
270 | version: "1.1.0"
271 | test_api:
272 | dependency: transitive
273 | description:
274 | name: test_api
275 | url: "https://pub.dartlang.org"
276 | source: hosted
277 | version: "0.2.4"
278 | typed_data:
279 | dependency: transitive
280 | description:
281 | name: typed_data
282 | url: "https://pub.dartlang.org"
283 | source: hosted
284 | version: "1.1.6"
285 | uuid:
286 | dependency: transitive
287 | description:
288 | name: uuid
289 | url: "https://pub.dartlang.org"
290 | source: hosted
291 | version: "2.0.1"
292 | vector_math:
293 | dependency: transitive
294 | description:
295 | name: vector_math
296 | url: "https://pub.dartlang.org"
297 | source: hosted
298 | version: "2.0.8"
299 | sdks:
300 | dart: ">=2.2.0 <3.0.0"
301 | flutter: ">=1.2.1 <2.0.0"
302 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: flutter_bloc_firebase_chat
2 | description: An example chat application based on bloc architecture and firebase backend.
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 | cupertino_icons: ^0.1.2
24 | firebase_auth: 0.7.0
25 | google_sign_in: 3.2.4
26 | cloud_firestore: 0.8.2+3
27 | fluttertoast: ^2.0.7
28 | image_picker: 0.4.12+1
29 | shared_preferences: 0.4.3
30 | firebase_storage: 1.0.4
31 | cached_network_image: ^0.7.0
32 | intl: ^0.15.7
33 | rxdart: ^0.22.0
34 | provider: ^2.0.1
35 | get_it: ^1.0.3
36 |
37 | dev_dependencies:
38 | flutter_test:
39 | sdk: flutter
40 |
41 |
42 | # For information on the generic Dart part of this file, see the
43 | # following page: https://www.dartlang.org/tools/pub/pubspec
44 |
45 | # The following section is specific to Flutter.
46 | flutter:
47 |
48 | # The following line ensures that the Material Icons font is
49 | # included with your application, so that you can use the icons in
50 | # the material Icons class.
51 | uses-material-design: true
52 |
53 | # To add assets to your application, add an assets section, like this:
54 | # assets:
55 | # - images/a_dot_burr.jpeg
56 | # - images/a_dot_ham.jpeg
57 | assets:
58 | - assets/stickers/angry_cat/
59 | - assets/images/
60 |
61 | # An image asset can refer to one or more resolution-specific "variants", see
62 | # https://flutter.io/assets-and-images/#resolution-aware.
63 |
64 | # For details regarding adding assets from package dependencies, see
65 | # https://flutter.io/assets-and-images/#from-packages
66 |
67 | # To add custom fonts to your application, add a fonts section here,
68 | # in this "flutter" section. Each entry in this list should have a
69 | # "family" key with the font family name, and a "fonts" key with a
70 | # list giving the asset and other descriptors for the font. For
71 | # example:
72 | # fonts:
73 | # - family: Schyler
74 | # fonts:
75 | # - asset: fonts/Schyler-Regular.ttf
76 | # - asset: fonts/Schyler-Italic.ttf
77 | # style: italic
78 | # - family: Trajan Pro
79 | # fonts:
80 | # - asset: fonts/TrajanPro.ttf
81 | # - asset: fonts/TrajanPro_Bold.ttf
82 | # weight: 700
83 | #
84 | # For details regarding fonts from package dependencies,
85 | # see https://flutter.io/custom-fonts/#from-packages
86 |
--------------------------------------------------------------------------------
/screenshots/Screenshot_chat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/screenshots/Screenshot_chat.png
--------------------------------------------------------------------------------
/screenshots/Screenshot_chat_list.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/screenshots/Screenshot_chat_list.png
--------------------------------------------------------------------------------
/screenshots/Screenshot_sign_in.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/screenshots/Screenshot_sign_in.png
--------------------------------------------------------------------------------
/screenshots/Screenshot_user_settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fintasys/Flutter-Bloc-Firebase-Chat/86b4c57e182fc31f034da067dbcebc8218af49a9/screenshots/Screenshot_user_settings.png
--------------------------------------------------------------------------------