├── lib ├── view_models │ ├── custom_sync.dart │ ├── all_users_view_model.dart │ ├── chat_view_model.dart │ └── user_view_model.dart ├── services │ ├── storage_base.dart │ ├── auth_base.dart │ ├── firebase_storage_service.dart │ ├── db_base.dart │ ├── notification_service.dart │ ├── fake_auth_service.dart │ ├── firebase_auth_service.dart │ └── firestore_db_service.dart ├── common_widgets │ ├── platform_widget.dart │ ├── sign_in_text_form_field.dart │ ├── social_log_in_button.dart │ └── platform_alert_dialog.dart ├── app │ ├── tab_items.dart │ ├── errors_exception.dart │ ├── landing_page.dart │ ├── my_custom_bottom_navi_bar.dart │ ├── profile_image_page.dart │ ├── home_page.dart │ ├── sign_in │ │ ├── reset_password.dart │ │ ├── sign_in_page.dart │ │ └── mail_and_pass_form.dart │ ├── users.dart │ ├── chat_history.dart │ ├── profile.dart │ └── chat_page.dart ├── locator.dart ├── models │ ├── message_model.dart │ ├── chats_model.dart │ └── user_model.dart ├── main.dart ├── notification_handler.dart └── repositories │ └── user_repository.dart ├── ios ├── Flutter │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── AppFrameworkInfo.plist ├── Runner │ ├── Runner-Bridging-Header.h │ ├── Assets.xcassets │ │ ├── LaunchImage.imageset │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ ├── README.md │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ └── Contents.json │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── Main.storyboard │ │ └── LaunchScreen.storyboard │ └── Info.plist ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── WorkspaceSettings.xcsettings │ │ └── IDEWorkspaceChecks.plist ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ └── IDEWorkspaceChecks.plist │ ├── xcshareddata │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ └── project.pbxproj └── .gitignore ├── README.md ├── assets └── images │ ├── logo.png │ ├── google-logo.png │ ├── facebook-logo.png │ ├── userNotFound.png │ ├── 2.0x │ ├── google-logo.png │ └── facebook-logo.png │ ├── 3.0x │ ├── google-logo.png │ └── facebook-logo.png │ ├── defaultUserPhoto.jpg │ └── signInPageImage.png ├── android ├── gradle.properties ├── app │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── drawable-hdpi │ │ │ │ │ └── ic_stat_message.png │ │ │ │ ├── drawable-mdpi │ │ │ │ │ └── ic_stat_message.png │ │ │ │ ├── drawable-xhdpi │ │ │ │ │ └── ic_stat_message.png │ │ │ │ ├── drawable-xxhdpi │ │ │ │ │ └── ic_stat_message.png │ │ │ │ ├── drawable-xxxhdpi │ │ │ │ │ └── ic_stat_message.png │ │ │ │ ├── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ └── values │ │ │ │ │ └── styles.xml │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── berkanaslan │ │ │ │ │ └── live_chat │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ ├── Application.java │ │ │ │ │ └── FirebaseCloudMessagingPluginRegistrant.java │ │ │ └── AndroidManifest.xml │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ └── profile │ │ │ └── AndroidManifest.xml │ └── build.gradle ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── .gitignore ├── settings.gradle └── build.gradle ├── .metadata ├── .vscode └── launch.json ├── .gitignore ├── test └── widget_test.dart ├── pubspec.yaml └── pubspec.lock /lib/view_models/custom_sync.dart: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | TODO: 2 | Since the images in the readme have been deleted, a new readme will be written soon. 3 | -------------------------------------------------------------------------------- /assets/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/assets/images/logo.png -------------------------------------------------------------------------------- /assets/images/google-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/assets/images/google-logo.png -------------------------------------------------------------------------------- /assets/images/facebook-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/assets/images/facebook-logo.png -------------------------------------------------------------------------------- /assets/images/userNotFound.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/assets/images/userNotFound.png -------------------------------------------------------------------------------- /assets/images/2.0x/google-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/assets/images/2.0x/google-logo.png -------------------------------------------------------------------------------- /assets/images/3.0x/google-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/assets/images/3.0x/google-logo.png -------------------------------------------------------------------------------- /assets/images/defaultUserPhoto.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/assets/images/defaultUserPhoto.jpg -------------------------------------------------------------------------------- /assets/images/signInPageImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/assets/images/signInPageImage.png -------------------------------------------------------------------------------- /assets/images/2.0x/facebook-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/assets/images/2.0x/facebook-logo.png -------------------------------------------------------------------------------- /assets/images/3.0x/facebook-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/assets/images/3.0x/facebook-logo.png -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-hdpi/ic_stat_message.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/android/app/src/main/res/drawable-hdpi/ic_stat_message.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-mdpi/ic_stat_message.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/android/app/src/main/res/drawable-mdpi/ic_stat_message.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xhdpi/ic_stat_message.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/android/app/src/main/res/drawable-xhdpi/ic_stat_message.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxhdpi/ic_stat_message.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/android/app/src/main/res/drawable-xxhdpi/ic_stat_message.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxxhdpi/ic_stat_message.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/android/app/src/main/res/drawable-xxxhdpi/ic_stat_message.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /lib/services/storage_base.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | abstract class StorageBase { 4 | Future uploadFile( 5 | String userID, String fileType, String fileName, File fileToUpload); 6 | } 7 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkanaslan/flutter_live_chat_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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-6.3-all.zip -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.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: fba99f6cf9a14512e461e3122c8ddfaa25394e89 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "live_chat", 9 | "request": "launch", 10 | "type": "dart" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /lib/services/auth_base.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_live_chat_app/models/user_model.dart'; 2 | 3 | abstract class AuthBase { 4 | Future currentUser(); 5 | Future signInAnonymously(); 6 | Future signOut(); 7 | Future signInWithGoogle(); 8 | Future signInWithMailAndPass(String mail, String pass); 9 | Future createWithMailAndPass(String mail, String pass); 10 | } 11 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /lib/common_widgets/platform_widget.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/material.dart'; 4 | 5 | abstract class PlatformWidget extends StatelessWidget { 6 | Widget buildAndroidWidget(BuildContext context); 7 | Widget buildIOSWidget(BuildContext context); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | if (Platform.isIOS) { 12 | return buildIOSWidget(context); 13 | } else { 14 | return buildAndroidWidget(context); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/berkanaslan/live_chat/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.berkanaslan.live_chat; 2 | 3 | import androidx.annotation.NonNull; 4 | import io.flutter.embedding.android.FlutterActivity; 5 | import io.flutter.embedding.engine.FlutterEngine; 6 | import io.flutter.plugins.GeneratedPluginRegistrant; 7 | 8 | public class MainActivity extends FlutterActivity { 9 | @Override 10 | public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) { 11 | GeneratedPluginRegistrant.registerWith(flutterEngine); 12 | } 13 | } -------------------------------------------------------------------------------- /lib/app/tab_items.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | enum TabItem { ChatHistory, AllUsers, Profile } 5 | 6 | class TabItemData { 7 | final String titleText; 8 | final IconData icon; 9 | 10 | TabItemData(this.titleText, this.icon); 11 | 12 | static Map allTabs = { 13 | TabItem.ChatHistory: TabItemData("Sohbetlerim", Icons.message), 14 | TabItem.AllUsers: TabItemData("Kulanıcılar", Icons.people), 15 | TabItem.Profile: TabItemData("Profil", Icons.person), 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /lib/app/errors_exception.dart: -------------------------------------------------------------------------------- 1 | class Errors { 2 | static String showError(String errorCode) { 3 | switch (errorCode) { 4 | case 'email-already-in-use': 5 | return "Bu e-posta adresi zaten kullanılıyor. Lütfen farklı bir e-posta adresi kullanınız."; 6 | case 'user-not-found': 7 | return "Bu e-posta adresi ile kayıtlı bir kullanıcı yok. Lütfen geçerli bir e-posta adresi deneyiniz."; 8 | case 'ınvalıd-emaıl': 9 | return "Yazdığınız e-posta sistemimizde kayıtlı değil. Lütfen doğru bir e-posta hesabı giriniz."; 10 | 11 | default: 12 | return "Üzgünüz, bir hata oluştu."; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.5.0' 9 | classpath 'com.google.gms:google-services:4.3.3' 10 | } 11 | } 12 | 13 | allprojects { 14 | repositories { 15 | google() 16 | jcenter() 17 | } 18 | } 19 | 20 | rootProject.buildDir = '../build' 21 | subprojects { 22 | project.buildDir = "${rootProject.buildDir}/${project.name}" 23 | } 24 | subprojects { 25 | project.evaluationDependsOn(':app') 26 | } 27 | 28 | task clean(type: Delete) { 29 | delete rootProject.buildDir 30 | } 31 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/berkanaslan/live_chat/Application.java: -------------------------------------------------------------------------------- 1 | package com.berkanaslan.live_chat; 2 | 3 | import io.flutter.app.FlutterApplication; 4 | import io.flutter.plugin.common.PluginRegistry; 5 | import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback; 6 | import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService; 7 | 8 | public class Application extends FlutterApplication implements PluginRegistrantCallback { 9 | 10 | @Override 11 | public void onCreate() { 12 | super.onCreate(); 13 | FlutterFirebaseMessagingService.setPluginRegistrant(this); 14 | } 15 | 16 | @Override 17 | public void registerWith(PluginRegistry registry) { 18 | FirebaseCloudMessagingPluginRegistrant.registerWith( registry); 19 | } 20 | } -------------------------------------------------------------------------------- /lib/services/firebase_storage_service.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:firebase_storage/firebase_storage.dart'; 4 | import 'package:flutter_live_chat_app/services/storage_base.dart'; 5 | 6 | class FirebaseStorageService implements StorageBase { 7 | final FirebaseStorage _firebaseStorage = FirebaseStorage.instance; 8 | StorageReference _storageReference; 9 | 10 | @override 11 | Future uploadFile( 12 | String userID, String fileType, String fileName, File fileToUpload) async { 13 | _storageReference = _firebaseStorage.ref().child(fileType).child(userID).child(fileName).child(fileName); 14 | StorageUploadTask _storageUploadTask = 15 | _storageReference.putFile(fileToUpload); 16 | 17 | var _fileDownloadUrl = 18 | await (await _storageUploadTask.onComplete).ref.getDownloadURL(); 19 | return _fileDownloadUrl; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/services/db_base.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_live_chat_app/models/chats_model.dart'; 2 | import 'package:flutter_live_chat_app/models/message_model.dart'; 3 | import 'package:flutter_live_chat_app/models/user_model.dart'; 4 | 5 | abstract class DBBase { 6 | Future saveUser(UserModel userModel); 7 | Future readUser(String userID); 8 | Future updateUserName(String userID, String userName); 9 | Future updateProfilePhoto(String userID, String profilePhotoUrl); 10 | Future> getAllUsersWithPagination( 11 | UserModel calledLastUser, int itemsPerPage); 12 | Future> getAllConversations(String currentUserID); 13 | Stream> getMessages( 14 | String currentUserID, String chatUserID); 15 | Future saveMessage(MessageModel sendingMessage); 16 | Future showTime(String userID); 17 | } 18 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Exceptions to above rules. 44 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 45 | 46 | 47 | android/app/google-services.json -------------------------------------------------------------------------------- /lib/locator.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_live_chat_app/repositories/user_repository.dart'; 2 | import 'package:flutter_live_chat_app/services/fake_auth_service.dart'; 3 | import 'package:flutter_live_chat_app/services/firebase_auth_service.dart'; 4 | import 'package:flutter_live_chat_app/services/firebase_storage_service.dart'; 5 | import 'package:flutter_live_chat_app/services/firestore_db_service.dart'; 6 | import 'package:flutter_live_chat_app/services/notification_service.dart'; 7 | import 'package:get_it/get_it.dart'; 8 | 9 | GetIt locator = GetIt.instance; 10 | 11 | void setupLocator() { 12 | locator.registerLazySingleton(() => FirebaseAuthService()); 13 | locator.registerLazySingleton(() => FakeAuthService()); 14 | locator.registerLazySingleton(() => UserRepository()); 15 | locator.registerLazySingleton(() => FirestoreDBService()); 16 | locator.registerLazySingleton(() => FirebaseStorageService()); 17 | locator.registerLazySingleton(() => NotificationService()); 18 | } 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /lib/app/landing_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_live_chat_app/app/home_page.dart'; 3 | import 'package:flutter_live_chat_app/app/sign_in/sign_in_page.dart'; 4 | import 'package:flutter_live_chat_app/view_models/user_view_model.dart'; 5 | import 'package:provider/provider.dart'; 6 | 7 | class LandingPage extends StatelessWidget { 8 | @override 9 | Widget build(BuildContext context) { 10 | final _userViewModel = Provider.of(context, listen: true); 11 | 12 | if (_userViewModel.state == ViewState.Idle) { 13 | if (_userViewModel.userModel == null) { 14 | return SignInPage(); 15 | } else { 16 | return HomePage( 17 | userModel: _userViewModel.userModel, 18 | ); 19 | } 20 | } else { 21 | return Scaffold( 22 | body: Center( 23 | child: Container( 24 | child: Image.asset( 25 | "assets/images/logo.png", 26 | width: (MediaQuery.of(context).size.width) * 2 / 3, 27 | ), 28 | ), 29 | ), 30 | ); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_live_chat_app/main.dart'; 10 | import 'package:flutter_test/flutter_test.dart'; 11 | 12 | void main() { 13 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 14 | // Build our app and trigger a frame. 15 | await tester.pumpWidget(RunApp()); 16 | 17 | // Verify that our counter starts at 0. 18 | expect(find.text('0'), findsOneWidget); 19 | expect(find.text('1'), findsNothing); 20 | 21 | // Tap the '+' icon and trigger a frame. 22 | await tester.tap(find.byIcon(Icons.add)); 23 | await tester.pump(); 24 | 25 | // Verify that our counter has incremented. 26 | expect(find.text('0'), findsNothing); 27 | expect(find.text('1'), findsOneWidget); 28 | }); 29 | } 30 | -------------------------------------------------------------------------------- /lib/models/message_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | 3 | class MessageModel { 4 | final String fromWho; 5 | final String toWho; 6 | final bool isFromMe; 7 | final String message; 8 | final String chatOwner; 9 | final Timestamp date; 10 | 11 | MessageModel( 12 | {this.fromWho, 13 | this.toWho, 14 | this.isFromMe, 15 | this.message, 16 | this.chatOwner, 17 | this.date}); 18 | 19 | Map toMap() { 20 | return { 21 | 'fromWho': fromWho, 22 | 'toWho': toWho, 23 | 'isFromMe': isFromMe, 24 | 'message': message, 25 | 'chatOwner': chatOwner, 26 | 'date': date ?? FieldValue.serverTimestamp(), 27 | }; 28 | } 29 | 30 | MessageModel.fromMap(Map map) 31 | : fromWho = map['fromWho'], 32 | toWho = map['toWho'], 33 | isFromMe = map['isFromMe'], 34 | message = map['message'], 35 | chatOwner = map['chatOwner'], 36 | date = map['date']; 37 | 38 | @override 39 | String toString() { 40 | return 'MessageModel{fromWho: $fromWho, toWho: $toWho, isFromMe: $isFromMe, message: $message, chatOwner: $chatOwner date: $date}'; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/services/notification_service.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_live_chat_app/models/message_model.dart'; 2 | import 'package:flutter_live_chat_app/models/user_model.dart'; 3 | import 'package:flutter_live_chat_app/services/firestore_db_service.dart'; 4 | import 'package:http/http.dart' as http; 5 | 6 | class NotificationService { 7 | sendNotification ( 8 | MessageModel messageModel, UserModel sender, String receiverToken) async { 9 | String endUrl = "https://fcm.googleapis.com/fcm/send"; 10 | String firebaseKey = await FirestoreDBService().getFirebaseNotificationKey(); 11 | 12 | Map headers = { 13 | "Content-type": "application/json", 14 | "Authorization": "key=$firebaseKey" 15 | }; 16 | 17 | String json = 18 | '{ "to": "$receiverToken", "data": { "title" : "@${sender.userName} yeni mesaj: ", "message" : "${messageModel.message}", "senderProfilePhotoUrl" : "${sender.profilePhotoUrl}", "senderUserID" : "${sender.userID}", "senderMail" : "${sender.mail}", "senderUserName" : "${sender.userName}" } }'; 19 | 20 | http.Response response = 21 | await http.post(endUrl, headers: headers, body: json); 22 | 23 | if (response.statusCode == 200) { 24 | print("İşlem başarılı"); 25 | } else { 26 | print("İşlem başarısız:" + response.statusCode.toString()); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/berkanaslan/live_chat/FirebaseCloudMessagingPluginRegistrant.java: -------------------------------------------------------------------------------- 1 | package com.berkanaslan.live_chat; 2 | 3 | import io.flutter.plugin.common.PluginRegistry; 4 | import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin; 5 | import com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin; 6 | 7 | 8 | import io.flutter.plugin.common.PluginRegistry; 9 | import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin; 10 | import com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin; 11 | 12 | public final class FirebaseCloudMessagingPluginRegistrant{ 13 | public static void registerWith(PluginRegistry registry) { 14 | if (alreadyRegisteredWith(registry)) { 15 | return; 16 | } 17 | FirebaseMessagingPlugin.registerWith(registry.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin")); 18 | FlutterLocalNotificationsPlugin.registerWith(registry.registrarFor("com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin")); 19 | } 20 | 21 | private static boolean alreadyRegisteredWith(PluginRegistry registry) { 22 | final String key = FirebaseCloudMessagingPluginRegistrant.class.getCanonicalName(); 23 | if (registry.hasPlugin(key)) { 24 | return true; 25 | } 26 | registry.registrarFor(key); 27 | return false; 28 | } 29 | } -------------------------------------------------------------------------------- /lib/services/fake_auth_service.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_live_chat_app/models/user_model.dart'; 2 | import 'package:flutter_live_chat_app/services/auth_base.dart'; 3 | 4 | class FakeAuthService implements AuthBase { 5 | String userID = "fake_user_id_123"; 6 | String mail = "fake@mail.com"; 7 | 8 | @override 9 | Future currentUser() async { 10 | return await Future.value(UserModel(userID: userID, mail: mail)); 11 | } 12 | 13 | @override 14 | Future signInAnonymously() async { 15 | return await Future.delayed( 16 | Duration(seconds: 1), 17 | () => UserModel(userID: userID, mail: mail), 18 | ); 19 | } 20 | 21 | @override 22 | Future signOut() async { 23 | return Future.value(true); 24 | } 25 | 26 | @override 27 | Future signInWithGoogle() async { 28 | return await Future.delayed( 29 | Duration(seconds: 1), 30 | () => UserModel(userID: userID, mail: mail), 31 | ); 32 | } 33 | 34 | @override 35 | Future createWithMailAndPass(String mail, String pass) async { 36 | return await Future.delayed( 37 | Duration(seconds: 1), 38 | () => UserModel(userID: userID, mail: mail), 39 | ); 40 | } 41 | 42 | @override 43 | Future signInWithMailAndPass(String mail, String pass) async { 44 | return await Future.delayed( 45 | Duration(seconds: 1), 46 | () => UserModel(userID: userID, mail: mail), 47 | ); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /lib/models/chats_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | 3 | class ChatModel { 4 | final String chatOwner; 5 | final String chatUser; 6 | final Timestamp createdAt; 7 | final bool isRead; 8 | final String lastMessage; 9 | final Timestamp readedTime; 10 | String chatUserUserName; 11 | String chatUserProfilePhotoUrl; 12 | String chatUserMail; 13 | DateTime lastSeenTime; 14 | String timeDifference; 15 | 16 | ChatModel(this.chatOwner, this.chatUser, this.createdAt, this.isRead, 17 | this.lastMessage, this.readedTime); 18 | 19 | Map toMap() { 20 | return { 21 | 'chatOwner': chatOwner, 22 | 'chatUser': chatUser, 23 | 'createdAt': createdAt ?? FieldValue.serverTimestamp(), 24 | 'isRead': isRead, 25 | 'lastMessage': lastMessage, 26 | 'readedTime': readedTime ?? FieldValue.serverTimestamp(), 27 | }; 28 | } 29 | 30 | ChatModel.fromMap(Map map) 31 | : chatOwner = map['chatOwner'], 32 | chatUser = map['chatUser'], 33 | createdAt = map['createdAt'], 34 | isRead = map['isRead'], 35 | lastMessage = map['lastMessage'], 36 | readedTime = map['readedTime']; 37 | 38 | @override 39 | String toString() { 40 | return 'ChatModel{chatOwner: $chatOwner, chatUser: $chatUser, createdAt: $createdAt, isRead: $isRead, lastMessage: $lastMessage, readedTime: $readedTime, chatUserUserName: $chatUserUserName, chatUserProfilePhotoUrl: $chatUserProfilePhotoUrl}'; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | live_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 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:firebase_core/firebase_core.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter/services.dart'; 4 | import 'package:flutter_live_chat_app/app/landing_page.dart'; 5 | import 'package:flutter_live_chat_app/locator.dart'; 6 | import 'package:flutter_live_chat_app/view_models/user_view_model.dart'; 7 | import 'package:google_fonts/google_fonts.dart'; 8 | import 'package:provider/provider.dart'; 9 | 10 | void main() async { 11 | WidgetsFlutterBinding.ensureInitialized(); 12 | 13 | SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( 14 | statusBarColor: Colors.teal, 15 | statusBarIconBrightness: Brightness.light, 16 | )); 17 | 18 | await Firebase.initializeApp(); 19 | setupLocator(); 20 | 21 | SystemChrome.setPreferredOrientations( 22 | [DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]).then((_) { 23 | runApp(RunApp()); 24 | }); 25 | } 26 | 27 | class RunApp extends StatelessWidget { 28 | @override 29 | Widget build(BuildContext context) { 30 | return ChangeNotifierProvider( 31 | create: (context) => UserViewModel(), 32 | child: MaterialApp( 33 | debugShowCheckedModeBanner: false, 34 | title: 'Flutter Live Chat', 35 | theme: ThemeData( 36 | appBarTheme: AppBarTheme( 37 | // color: Color(0xFFF2F6FA), 38 | elevation: 0, 39 | textTheme: GoogleFonts.poppinsTextTheme(), 40 | ), 41 | primarySwatch: Colors.teal, 42 | canvasColor: Color(0xFFF2F6FA), 43 | cardColor: Colors.white, 44 | textTheme: GoogleFonts.poppinsTextTheme(), 45 | ), 46 | home: LandingPage(), 47 | ), 48 | ); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /lib/app/my_custom_bottom_navi_bar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_live_chat_app/app/tab_items.dart'; 4 | 5 | class MyCustomBottomNavigationBar extends StatelessWidget { 6 | final TabItem currentTab; 7 | final ValueChanged onSelectedTab; 8 | final Map pageCreator; 9 | final Map> navigatorKeys; 10 | 11 | const MyCustomBottomNavigationBar( 12 | {Key key, 13 | @required this.currentTab, 14 | @required this.onSelectedTab, 15 | @required this.pageCreator, 16 | @required this.navigatorKeys}) 17 | : super(key: key); 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | return CupertinoTabScaffold( 22 | tabBar: CupertinoTabBar( 23 | backgroundColor: Theme.of(context).canvasColor, 24 | items: [ 25 | _createNavItem(TabItem.ChatHistory), 26 | _createNavItem(TabItem.AllUsers), 27 | _createNavItem(TabItem.Profile), 28 | ], 29 | onTap: (index) => onSelectedTab(TabItem.values[index]), 30 | ), 31 | tabBuilder: (context, index) { 32 | final pageIndex = TabItem.values[index]; 33 | return CupertinoTabView( 34 | navigatorKey: navigatorKeys[pageIndex], 35 | builder: (context) { 36 | return pageCreator[pageIndex]; 37 | }, 38 | ); 39 | }, 40 | ); 41 | } 42 | 43 | BottomNavigationBarItem _createNavItem(TabItem tabItem) { 44 | final buildTab = TabItemData.allTabs[tabItem]; 45 | 46 | return BottomNavigationBarItem( 47 | icon: Icon(buildTab.icon), 48 | label: buildTab.titleText, 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/common_widgets/sign_in_text_form_field.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class SignInTextFormField extends StatelessWidget { 4 | final String hintText; 5 | final bool obscureText; 6 | final String errorText; 7 | final Widget prefixIcon; 8 | final FormFieldValidator validator; 9 | final FormFieldSetter onSaved; 10 | final TextInputType keyboardType; 11 | final String initialValue; 12 | final bool readOnly; 13 | final TextEditingController controller; 14 | 15 | const SignInTextFormField({ 16 | Key key, 17 | this.hintText, 18 | this.obscureText: false, 19 | this.prefixIcon, 20 | this.onSaved, 21 | this.validator, 22 | this.keyboardType, 23 | this.errorText, 24 | this.initialValue, 25 | this.readOnly: false, 26 | this.controller, 27 | }) : super(key: key); 28 | 29 | @override 30 | Widget build(BuildContext context) { 31 | return TextFormField( 32 | controller: controller, 33 | readOnly: readOnly, 34 | keyboardType: keyboardType, 35 | obscureText: obscureText, 36 | initialValue: initialValue, 37 | cursorColor: Colors.grey.shade700, 38 | decoration: InputDecoration( 39 | errorText: errorText, 40 | prefixIcon: prefixIcon, 41 | hintText: hintText, 42 | border: OutlineInputBorder( 43 | borderRadius: BorderRadius.circular(5), 44 | borderSide: BorderSide( 45 | color: Colors.grey.shade700, 46 | ), 47 | ), 48 | filled: true, 49 | fillColor: Colors.white, 50 | contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 10), 51 | ), 52 | style: TextStyle( 53 | color: Colors.grey.shade700, 54 | fontSize: 16, 55 | ), 56 | validator: validator, 57 | onSaved: onSaved, 58 | ); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /lib/models/user_model.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:cloud_firestore/cloud_firestore.dart'; 4 | import 'package:flutter/cupertino.dart'; 5 | 6 | class UserModel { 7 | final String userID; 8 | String mail; 9 | String userName; 10 | String profilePhotoUrl; 11 | DateTime createdAt; 12 | DateTime updatedAt; 13 | int level; 14 | 15 | UserModel({@required this.userID, @required this.mail}); 16 | 17 | UserModel.forChatPage( 18 | {this.userID, this.profilePhotoUrl, this.userName, this.mail}); 19 | 20 | Map toMap() { 21 | return { 22 | 'userID': userID, 23 | 'mail': mail, 24 | 'userName': userName ?? 25 | mail.substring(0, mail.indexOf('@')) + buildRandomUserNameID(), 26 | 'profilePhotoUrl': profilePhotoUrl ?? 27 | 'https://firebasestorage.googleapis.com/v0/b/flutter-live-chat-2020.appspot.com/o/images%2FdefaultUserPhoto.jpg?alt=media&token=fc1dcf75-1776-404a-a29c-4f7d71f17147', 28 | 'createdAt': createdAt ?? FieldValue.serverTimestamp(), 29 | 'updatedAt': updatedAt ?? FieldValue.serverTimestamp(), 30 | 'level': level ?? 1, 31 | }; 32 | } 33 | 34 | UserModel.fromMap(Map map) 35 | : userID = map['userID'], 36 | mail = map['mail'], 37 | userName = map['userName'], 38 | profilePhotoUrl = map['profilePhotoUrl'], 39 | createdAt = (map['createdAt'] as Timestamp).toDate(), 40 | updatedAt = (map['updatedAt'] as Timestamp).toDate(), 41 | level = map['level']; 42 | 43 | @override 44 | String toString() { 45 | return 'UserModel{userID: $userID, mail: $mail, userName: $userName, profilePhotoUrl: $profilePhotoUrl, createdAt: $createdAt, updatedAt: $updatedAt, level: $level}'; 46 | } 47 | 48 | String buildRandomUserNameID() { 49 | int random = Random().nextInt(99999999); 50 | return random.toString(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /lib/common_widgets/social_log_in_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class SocialLogInButton extends StatelessWidget { 4 | final String buttonText; 5 | final Color buttonTextColor; 6 | final Color buttonBgColor; 7 | final Widget buttonIcon; 8 | final VoidCallback onPressed; 9 | final Color borderColor; 10 | 11 | const SocialLogInButton( 12 | {Key key, 13 | @required this.buttonText, 14 | this.buttonTextColor: Colors.white, 15 | this.buttonBgColor: Colors.indigoAccent, 16 | this.buttonIcon, 17 | this.borderColor, 18 | this.onPressed}) 19 | : assert(buttonText != null), 20 | super(key: key); 21 | 22 | @override 23 | Widget build(BuildContext context) { 24 | return Padding( 25 | padding: const EdgeInsets.only(top: 8.0, bottom: 8.0), 26 | child: Container( 27 | height: 50, 28 | child: RaisedButton( 29 | onPressed: onPressed, 30 | color: buttonBgColor, 31 | child: Row( 32 | mainAxisSize: MainAxisSize.max, 33 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 34 | children: [ 35 | // Spreads, Collection if, Collection for: Dart 2.0+ 36 | if (buttonIcon != null) ...[ 37 | Opacity(opacity: 0, child: buttonIcon), 38 | Text( 39 | buttonText, 40 | style: TextStyle(color: buttonTextColor), 41 | ), 42 | buttonIcon, 43 | ], 44 | if (buttonIcon == null) ...[ 45 | Container(), 46 | Text( 47 | buttonText, 48 | style: TextStyle(color: buttonTextColor), 49 | ), 50 | Container(), 51 | ] 52 | ], 53 | ), 54 | ), 55 | decoration: BoxDecoration( 56 | border: Border.all( 57 | width: 1.5, 58 | color: borderColor == null ? Theme.of(context).primaryColor : borderColor, 59 | ), 60 | borderRadius: BorderRadius.all( 61 | Radius.circular(5.0), 62 | ), 63 | ), 64 | ), 65 | ); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /lib/app/profile_image_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_live_chat_app/models/user_model.dart'; 3 | 4 | // ignore: must_be_immutable 5 | class ProfilePhotoDetail extends StatefulWidget { 6 | UserModel user; 7 | 8 | ProfilePhotoDetail({this.user}); 9 | 10 | @override 11 | _ProfilePhotoDetailState createState() => _ProfilePhotoDetailState(); 12 | } 13 | 14 | class _ProfilePhotoDetailState extends State { 15 | @override 16 | Widget build(BuildContext context) { 17 | return Scaffold( 18 | appBar: AppBar( 19 | leading: IconButton( 20 | alignment: Alignment.centerLeft, 21 | highlightColor: Colors.transparent, 22 | splashColor: Colors.transparent, 23 | icon: Icon( 24 | Icons.arrow_back_ios, 25 | size: 16, 26 | ), 27 | color: Colors.white, 28 | onPressed: () { 29 | Navigator.maybePop(context); 30 | }, 31 | ), 32 | titleSpacing: -20, 33 | title: ListTile( 34 | contentPadding: EdgeInsets.zero, 35 | title: Text( 36 | "@" + widget.user.userName, 37 | style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), 38 | ), 39 | ), 40 | ), 41 | floatingActionButton: FloatingActionButton( 42 | child: Center(child: Icon(Icons.message)), 43 | backgroundColor: Theme.of(context).primaryColor, 44 | onPressed: () { 45 | Navigator.maybePop(context); 46 | }, 47 | ), 48 | body: Column( 49 | crossAxisAlignment: CrossAxisAlignment.end, 50 | children: [ 51 | Hero( 52 | tag: 'profilePhoto', 53 | child: Center( 54 | child: Padding( 55 | padding: const EdgeInsets.all(8.0), 56 | child: Container( 57 | width: (MediaQuery.of(context).size.width) * 2 / 3, 58 | height: (MediaQuery.of(context).size.height) * 2 / 3, 59 | decoration: BoxDecoration( 60 | image: DecorationImage( 61 | image: NetworkImage(widget.user.profilePhotoUrl), 62 | fit: BoxFit.contain)), 63 | ), 64 | ), 65 | ), 66 | ), 67 | ], 68 | ), 69 | ); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /lib/view_models/all_users_view_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_live_chat_app/locator.dart'; 3 | import 'package:flutter_live_chat_app/models/user_model.dart'; 4 | import 'package:flutter_live_chat_app/repositories/user_repository.dart'; 5 | 6 | enum AllUsersViewState { Idle, Busy, Loaded } 7 | 8 | class AllUsersViewModel with ChangeNotifier { 9 | AllUsersViewState _state = AllUsersViewState.Idle; 10 | UserRepository _userRepository = locator(); 11 | List _allUsers; 12 | UserModel _lastCalledUser; 13 | static final itemsPerPage = 15; 14 | bool _hasMore = true; 15 | 16 | List get allUsers => _allUsers; 17 | AllUsersViewState get state => _state; 18 | bool get hasMore => _hasMore; 19 | 20 | set state(AllUsersViewState value) { 21 | _state = value; 22 | notifyListeners(); 23 | } 24 | 25 | AllUsersViewModel() { 26 | _allUsers = []; 27 | _lastCalledUser = null; 28 | getUsersWithPagination(_lastCalledUser, false); 29 | } 30 | 31 | // RefreshIndicator ve Pagination için 32 | // isNewItems = true yapılır. 33 | // İlk açılış için isNewITems = false yapılır. 34 | 35 | getUsersWithPagination(UserModel lastCalledUser, bool isNewItems) async { 36 | if (_allUsers.length > 0) { 37 | _lastCalledUser = _allUsers.last; 38 | print("En son getirilen kullanıcı adı: " + _lastCalledUser.userName); 39 | } 40 | 41 | if (isNewItems) { 42 | } else { 43 | state = AllUsersViewState.Busy; 44 | } 45 | 46 | List _newList = await _userRepository.getAllUsersWithPagination( 47 | _lastCalledUser, itemsPerPage); 48 | 49 | if (_newList.length < itemsPerPage) { 50 | _hasMore = false; 51 | } 52 | 53 | _newList.forEach((element) => 54 | print("Çağırılan kullanıcının kullanıcı adı: " + element.userName)); 55 | 56 | _allUsers.addAll(_newList); 57 | 58 | state = AllUsersViewState.Loaded; 59 | } 60 | 61 | Future getMoreUsers() async { 62 | await Future.delayed(Duration(seconds: 1)); 63 | print("getMoreUsers() tetiklendi. AllUsersViewModel"); 64 | if (_hasMore) { 65 | getUsersWithPagination(_lastCalledUser, true); 66 | } else { 67 | print("Daha fazla kullanıcı olmadığı için getMoreUser() çağırılmayacak."); 68 | } 69 | } 70 | 71 | Future listRefresh() async { 72 | _hasMore = true; 73 | _lastCalledUser = null; 74 | _allUsers = []; 75 | getUsersWithPagination(_lastCalledUser, true); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /lib/app/home_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_live_chat_app/app/chat_history.dart'; 3 | import 'package:flutter_live_chat_app/app/my_custom_bottom_navi_bar.dart'; 4 | import 'package:flutter_live_chat_app/app/profile.dart'; 5 | import 'package:flutter_live_chat_app/app/tab_items.dart'; 6 | import 'package:flutter_live_chat_app/app/users.dart'; 7 | import 'package:flutter_live_chat_app/models/user_model.dart'; 8 | import 'package:flutter_live_chat_app/notification_handler.dart'; 9 | import 'package:flutter_live_chat_app/view_models/all_users_view_model.dart'; 10 | import 'package:provider/provider.dart'; 11 | 12 | class HomePage extends StatefulWidget { 13 | final UserModel userModel; 14 | 15 | const HomePage({Key key, @required this.userModel}) : super(key: key); 16 | 17 | @override 18 | _HomePageState createState() => _HomePageState(); 19 | } 20 | 21 | class _HomePageState extends State { 22 | TabItem _currentTab = TabItem.AllUsers; 23 | 24 | Map> navigatorKeys = { 25 | TabItem.ChatHistory: GlobalKey(), 26 | TabItem.AllUsers: GlobalKey(), 27 | TabItem.Profile: GlobalKey(), 28 | }; 29 | 30 | Map allPages() { 31 | return { 32 | TabItem.ChatHistory: ChatHistory(), 33 | TabItem.AllUsers: ChangeNotifierProvider( 34 | create: (context) => AllUsersViewModel(), 35 | child: UsersPage(), 36 | ), 37 | TabItem.Profile: ProfilePage(), 38 | }; 39 | } 40 | 41 | @override 42 | void initState() { 43 | super.initState(); 44 | NotificationHandler().initializeFCMNotification(context); 45 | } 46 | 47 | @override 48 | Widget build(BuildContext context) { 49 | return Container( 50 | child: WillPopScope( 51 | onWillPop: () async => 52 | !await navigatorKeys[_currentTab].currentState.maybePop(), 53 | child: MyCustomBottomNavigationBar( 54 | navigatorKeys: navigatorKeys, 55 | currentTab: _currentTab, 56 | pageCreator: allPages(), 57 | onSelectedTab: (selectedTab) { 58 | if (selectedTab == _currentTab) { 59 | navigatorKeys[selectedTab] 60 | .currentState 61 | .popUntil((route) => route.isFirst); 62 | } else { 63 | setState(() { 64 | _currentTab = selectedTab; 65 | }); 66 | } 67 | }, 68 | ), 69 | ), 70 | ); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /lib/common_widgets/platform_alert_dialog.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter/cupertino.dart'; 5 | import 'package:flutter_live_chat_app/common_widgets/platform_widget.dart'; 6 | 7 | class PlatformAlertDialog extends PlatformWidget { 8 | final String title; 9 | final String message; 10 | final String mainActionText; 11 | final String secondActionText; 12 | 13 | PlatformAlertDialog( 14 | {@required this.title, 15 | @required this.message, 16 | @required this.mainActionText, 17 | this.secondActionText}); 18 | 19 | Future show(BuildContext context) async { 20 | return Platform.isIOS 21 | ? await showCupertinoDialog( 22 | context: context, builder: (context) => this) 23 | : await showDialog( 24 | context: context, 25 | builder: (context) => this, 26 | barrierDismissible: false); 27 | } 28 | 29 | @override 30 | Widget buildAndroidWidget(BuildContext context) { 31 | return AlertDialog( 32 | title: Text(title), 33 | content: Text(message), 34 | actions: _buildDialogActions(context), 35 | ); 36 | } 37 | 38 | @override 39 | Widget buildIOSWidget(BuildContext context) { 40 | return CupertinoAlertDialog( 41 | title: Text(title), 42 | content: Text(message), 43 | actions: _buildDialogActions(context), 44 | ); 45 | } 46 | 47 | _buildDialogActions(BuildContext context) { 48 | final allActions = []; 49 | 50 | if (Platform.isIOS) { 51 | allActions.add( 52 | CupertinoDialogAction( 53 | child: Text(mainActionText), 54 | onPressed: () { 55 | Navigator.of(context).pop(true); 56 | }, 57 | ), 58 | ); 59 | 60 | if (secondActionText != null) { 61 | allActions.add( 62 | CupertinoDialogAction( 63 | child: Text(secondActionText), 64 | onPressed: () { 65 | Navigator.of(context).pop(false); 66 | }, 67 | ), 68 | ); 69 | } 70 | } else { 71 | allActions.add( 72 | FlatButton( 73 | child: Text(mainActionText), 74 | onPressed: () { 75 | Navigator.of(context).pop(true); 76 | }, 77 | ), 78 | ); 79 | 80 | if (secondActionText != null) { 81 | allActions.add( 82 | FlatButton( 83 | child: Text(secondActionText), 84 | onPressed: () { 85 | Navigator.of(context).pop(false); 86 | }, 87 | ), 88 | ); 89 | } 90 | } 91 | 92 | return allActions; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | apply plugin: 'com.google.gms.google-services' 27 | 28 | dependencies { 29 | // add the Firebase SDK for Google Analytics 30 | implementation 'com.google.firebase:firebase-analytics:17.5.0' 31 | // add SDKs for any other desired Firebase products 32 | // https://firebase.google.com/docs/android/setup#available-libraries 33 | implementation 'com.google.firebase:firebase-messaging:20.2.4' 34 | 35 | } 36 | 37 | def keystoreProperties = new Properties() 38 | def keystorePropertiesFile = rootProject.file('key.properties') 39 | if (keystorePropertiesFile.exists()) { 40 | keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) 41 | } 42 | 43 | android { 44 | compileSdkVersion 28 45 | 46 | lintOptions { 47 | disable 'InvalidPackage' 48 | } 49 | 50 | defaultConfig { 51 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 52 | applicationId "com.berkanaslan.live_chat" 53 | minSdkVersion 16 54 | targetSdkVersion 28 55 | multiDexEnabled true 56 | versionCode flutterVersionCode.toInteger() 57 | versionName flutterVersionName 58 | } 59 | 60 | signingConfigs { 61 | release { 62 | keyAlias keystoreProperties['keyAlias'] 63 | keyPassword keystoreProperties['keyPassword'] 64 | storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null 65 | storePassword keystoreProperties['storePassword'] 66 | } 67 | } 68 | buildTypes { 69 | release { 70 | signingConfig signingConfigs.release 71 | } 72 | } 73 | 74 | } 75 | 76 | flutter { 77 | source '../..' 78 | } 79 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 18 | 25 | 29 | 33 | 38 | 42 | 43 | 44 | 45 | 46 | 47 | 49 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /lib/services/firebase_auth_service.dart: -------------------------------------------------------------------------------- 1 | import 'package:firebase_auth/firebase_auth.dart'; 2 | import 'package:flutter_live_chat_app/models/user_model.dart'; 3 | import 'package:flutter_live_chat_app/services/auth_base.dart'; 4 | import 'package:google_sign_in/google_sign_in.dart'; 5 | 6 | class FirebaseAuthService implements AuthBase { 7 | final FirebaseAuth _firebaseAuth = FirebaseAuth.instance; 8 | 9 | UserModel _userFromFirebase(User user) { 10 | if (user == null) { 11 | return null; 12 | } else { 13 | return UserModel(userID: user.uid, mail: user.email); 14 | } 15 | } 16 | 17 | @override 18 | Future currentUser() async { 19 | try { 20 | User user = await Future.value(_firebaseAuth.currentUser); 21 | return _userFromFirebase(user); 22 | } catch (e) { 23 | print("FirebaseAuthService currentUser() hatası: " + e.toString()); 24 | return null; 25 | } 26 | } 27 | 28 | @override 29 | Future signInAnonymously() async { 30 | try { 31 | UserCredential userCredential = await _firebaseAuth.signInAnonymously(); 32 | return _userFromFirebase(userCredential.user); 33 | } catch (e) { 34 | print("FirebaseAuthService signInAnonymously hatası: " + e.toString()); 35 | return null; 36 | } 37 | } 38 | 39 | @override 40 | Future signOut() async { 41 | try { 42 | final GoogleSignIn _googleSignIn = GoogleSignIn(); 43 | _googleSignIn.signOut(); 44 | await _firebaseAuth.signOut(); 45 | return true; 46 | } catch (e) { 47 | print("FirebaseAuthService signOut() hatası: " + e.toString()); 48 | return false; 49 | } 50 | } 51 | 52 | @override 53 | Future signInWithGoogle() async { 54 | try { 55 | GoogleSignIn _googleSignIn = GoogleSignIn(); 56 | GoogleSignInAccount _googleUser = await _googleSignIn.signIn(); 57 | if (_googleUser != null) { 58 | GoogleSignInAuthentication _googleAuth = 59 | await _googleUser.authentication; 60 | if (_googleAuth.idToken != null && _googleAuth.accessToken != null) { 61 | UserCredential credential = await _firebaseAuth.signInWithCredential( 62 | GoogleAuthProvider.credential( 63 | idToken: _googleAuth.idToken, 64 | accessToken: _googleAuth.accessToken)); 65 | User _user = credential.user; 66 | return _userFromFirebase(_user); 67 | } else { 68 | return null; 69 | } 70 | } else { 71 | return null; 72 | } 73 | } catch (e) { 74 | print("FirebaseAuthService signInWithGoogle() hatası: " + e.toString()); 75 | return null; 76 | } 77 | } 78 | 79 | @override 80 | Future createWithMailAndPass(String mail, String pass) async { 81 | UserCredential userCredential = await _firebaseAuth 82 | .createUserWithEmailAndPassword(email: mail, password: pass); 83 | return _userFromFirebase(userCredential.user); 84 | } 85 | 86 | @override 87 | Future signInWithMailAndPass(String mail, String pass) async { 88 | UserCredential userCredential = await _firebaseAuth 89 | .signInWithEmailAndPassword(email: mail, password: pass); 90 | return _userFromFirebase(userCredential.user); 91 | } 92 | 93 | Future resetPassword(String mail) async { 94 | await _firebaseAuth.sendPasswordResetEmail(email: mail); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_live_chat_app 2 | description: A new Flutter live chat application with Firebase. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | version: 1.2.0+1 19 | 20 | environment: 21 | sdk: ">=2.7.0 <3.0.0" 22 | 23 | dependencies: 24 | flutter: 25 | sdk: flutter 26 | 27 | 28 | # The following adds the Cupertino Icons font to your application. 29 | # Use with the CupertinoIcons class for iOS style icons. 30 | cupertino_icons: ^0.1.3 31 | firebase_core: ^0.5.0 32 | firebase_auth: ^0.18.0+1 33 | get_it: ^4.0.4 34 | provider: ^4.3.2+1 35 | google_sign_in: ^4.5.3 36 | cloud_firestore: ^0.14.0+2 37 | image_picker: ^0.6.7+7 38 | firebase_storage: ^4.0.0 39 | google_fonts: ^1.1.0 40 | bubble: ^1.1.9+1 41 | intl: ^0.16.1 42 | timeago: ^2.0.27 43 | firebase_messaging: ^7.0.0 44 | flutter_local_notifications: ^1.4.4+4 45 | http: ^0.12.2 46 | 47 | dev_dependencies: 48 | flutter_test: 49 | sdk: flutter 50 | 51 | # For information on the generic Dart part of this file, see the 52 | # following page: https://dart.dev/tools/pub/pubspec 53 | 54 | # The following section is specific to Flutter. 55 | flutter: 56 | 57 | # The following line ensures that the Material Icons font is 58 | # included with your application, so that you can use the icons in 59 | # the material Icons class. 60 | uses-material-design: true 61 | 62 | # To add assets to your application, add an assets section, like this: 63 | assets: 64 | - assets/images/ 65 | 66 | # An image asset can refer to one or more resolution-specific "variants", see 67 | # https://flutter.dev/assets-and-images/#resolution-aware. 68 | 69 | # For details regarding adding assets from package dependencies, see 70 | # https://flutter.dev/assets-and-images/#from-packa ges 71 | 72 | # To add custom fonts to your application, add a fonts section here, 73 | # in this "flutter" section. Each entry in this list should have a 74 | # "family" key with the font family name, and a "fonts" key with a 75 | # list giving the asset and other descriptors for the font. For 76 | # example: 77 | # fonts: 78 | # - family: Schyler 79 | # fonts: 80 | # - asset: fonts/Schyler-Regular.ttf 81 | # - asset: fonts/Schyler-Italic.ttf 82 | # style: italic 83 | # - family: Trajan Pro 84 | # fonts: 85 | # - asset: fonts/TrajanPro.ttf 86 | # - asset: fonts/TrajanPro_Bold.ttf 87 | # weight: 700 88 | # 89 | # For details regarding fonts from package dependencies, 90 | # see https://flutter.dev/custom-fonts/#from-packages 91 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /lib/app/sign_in/reset_password.dart: -------------------------------------------------------------------------------- 1 | import 'package:firebase_auth/firebase_auth.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_live_chat_app/app/errors_exception.dart'; 4 | import 'package:flutter_live_chat_app/common_widgets/platform_alert_dialog.dart'; 5 | import 'package:flutter_live_chat_app/common_widgets/sign_in_text_form_field.dart'; 6 | import 'package:flutter_live_chat_app/common_widgets/social_log_in_button.dart'; 7 | import 'package:flutter_live_chat_app/view_models/user_view_model.dart'; 8 | import 'package:provider/provider.dart'; 9 | 10 | class ResetPassword extends StatefulWidget { 11 | @override 12 | _ResetPasswordState createState() => _ResetPasswordState(); 13 | } 14 | 15 | class _ResetPasswordState extends State { 16 | final _formKey = GlobalKey(); 17 | String _mail; 18 | 19 | _formSubmit() async { 20 | setState(() {}); 21 | _formKey.currentState.save(); 22 | final _userViewModel = Provider.of(context, listen: false); 23 | 24 | try { 25 | await _userViewModel.resetPassword(_mail); 26 | return PlatformAlertDialog( 27 | title: "Başarılı!", 28 | message: 29 | "Şifrenizi sıfırlamanız için E-Posta adresinize bir mail gönderdik. Spam klasörünüzü kontrol etmeyi unutmayın.", 30 | mainActionText: "Tamam", 31 | ).show(context); 32 | } on FirebaseException catch (e) { 33 | return PlatformAlertDialog( 34 | title: "Oturum açarken hata!", 35 | message: Errors.showError(e.code.toString()), 36 | mainActionText: "Tamam", 37 | ).show(context); 38 | } 39 | } 40 | 41 | @override 42 | Widget build(BuildContext context) { 43 | final _userViewModel = Provider.of(context, listen: true); 44 | return Scaffold( 45 | appBar: AppBar( 46 | title: Text( 47 | "Parola sıfırla", 48 | style: TextStyle( 49 | fontSize: 18, 50 | color: Color(0xFFF2F6FA), 51 | ), 52 | ), 53 | ), 54 | body: _userViewModel.state == ViewState.Idle 55 | ? SingleChildScrollView( 56 | child: Form( 57 | key: _formKey, 58 | child: Padding( 59 | padding: const EdgeInsets.all(8.0), 60 | child: Column( 61 | crossAxisAlignment: CrossAxisAlignment.start, 62 | children: [ 63 | Text( 64 | "E-Posta", 65 | textAlign: TextAlign.end, 66 | style: TextStyle( 67 | fontSize: 14, 68 | fontWeight: FontWeight.bold, 69 | ), 70 | ), 71 | SignInTextFormField( 72 | obscureText: false, 73 | hintText: "E-Posta adresinizi giriniz", 74 | keyboardType: TextInputType.emailAddress, 75 | errorText: 76 | _userViewModel.mailErrorMessageForReset != null 77 | ? _userViewModel.mailErrorMessageForReset 78 | : null, 79 | onSaved: (String inputMail) { 80 | _mail = inputMail; 81 | }, 82 | ), 83 | SocialLogInButton( 84 | buttonText: "Gönder", 85 | buttonBgColor: Theme.of(context).primaryColor, 86 | onPressed: () => _formSubmit(), 87 | ), 88 | ], 89 | ), 90 | ), 91 | ), 92 | ) 93 | : Center( 94 | child: CircularProgressIndicator(), 95 | ), 96 | ); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /lib/app/sign_in/sign_in_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_live_chat_app/app/sign_in/mail_and_pass_form.dart'; 4 | import 'package:flutter_live_chat_app/common_widgets/social_log_in_button.dart'; 5 | import 'package:flutter_live_chat_app/models/user_model.dart'; 6 | import 'package:flutter_live_chat_app/view_models/user_view_model.dart'; 7 | import 'package:google_fonts/google_fonts.dart'; 8 | import 'package:provider/provider.dart'; 9 | 10 | class SignInPage extends StatelessWidget { 11 | @override 12 | Widget build(BuildContext context) { 13 | return Scaffold( 14 | appBar: AppBar( 15 | centerTitle: true, 16 | elevation: 0, 17 | backgroundColor: Theme.of(context).canvasColor, 18 | iconTheme: IconThemeData( 19 | color: Colors.black, 20 | ), 21 | title: Text( 22 | "flutterlivechat.", 23 | style: GoogleFonts.itim( 24 | textStyle: TextStyle( 25 | color: Colors.black, 26 | fontSize: 30, 27 | fontWeight: FontWeight.bold, 28 | ), 29 | ), 30 | ), 31 | ), 32 | body: Padding( 33 | padding: const EdgeInsets.all(8.0), 34 | child: Column( 35 | mainAxisSize: MainAxisSize.max, 36 | mainAxisAlignment: MainAxisAlignment.start, 37 | crossAxisAlignment: CrossAxisAlignment.stretch, 38 | children: [ 39 | Container( 40 | height: ((MediaQuery.of(context).size.height) * 3 / 5), 41 | child: Image.asset( 42 | "assets/images/signInPageImage.png", 43 | fit: BoxFit.contain, 44 | ), 45 | ), 46 | SocialLogInButton( 47 | buttonBgColor: Theme.of(context).primaryColor, 48 | buttonText: "E-Posta ile devam et", 49 | buttonIcon: Icon( 50 | Icons.mail, 51 | size: 32, 52 | color: Colors.white, 53 | ), 54 | onPressed: () => signInWithMailAndPass(context), 55 | ), 56 | SocialLogInButton( 57 | buttonBgColor: Colors.white, 58 | buttonText: "Google ile devam et", 59 | buttonTextColor: Colors.black, 60 | buttonIcon: Image.asset("assets/images/google-logo.png"), 61 | onPressed: () => _signInWithGoogle(context), 62 | ), 63 | 64 | /* 65 | SocialLogInButton( 66 | buttonBgColor: Color(0xFF334D92), 67 | buttonText: "Misafir olarak devam et", 68 | buttonIcon: Icon( 69 | Icons.supervised_user_circle, 70 | size: 32, 71 | color: Colors.white, 72 | ), 73 | onPressed: () { 74 | SignIn Anon kaldırıldı. 75 | _signInAnonymously(context), 76 | }, 77 | ), 78 | */ 79 | ], 80 | ), 81 | ), 82 | ); 83 | } 84 | 85 | /* 86 | Anon kaldırıldı: 87 | void _signInAnonymously(BuildContext context) async { 88 | final _userViewModel = Provider.of(context, listen: false); 89 | UserModel _userModel = await _userViewModel.signInAnonymously(); 90 | if (_userModel != null) 91 | print("Giriş yapan misafir: " + _userModel.userID.toString()); 92 | } 93 | */ 94 | 95 | void _signInWithGoogle(BuildContext context) async { 96 | final _userViewModel = Provider.of(context, listen: false); 97 | UserModel _userModel = await _userViewModel.signInWithGoogle(); 98 | if (_userModel != null) 99 | print("Google ile giriş yapan üye: " + _userModel.userID.toString()); 100 | } 101 | 102 | void signInWithMailAndPass(BuildContext context) async { 103 | Navigator.of(context).push( 104 | MaterialPageRoute( 105 | fullscreenDialog: true, 106 | builder: (context) => MailAndPassForm(), 107 | ), 108 | ); 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /lib/notification_handler.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:cloud_firestore/cloud_firestore.dart'; 4 | import 'package:firebase_auth/firebase_auth.dart'; 5 | import 'package:firebase_messaging/firebase_messaging.dart'; 6 | import 'package:flutter/material.dart'; 7 | import 'package:flutter_live_chat_app/app/chat_page.dart'; 8 | import 'package:flutter_live_chat_app/models/user_model.dart'; 9 | import 'package:flutter_live_chat_app/view_models/chat_view_model.dart'; 10 | import 'package:flutter_live_chat_app/view_models/user_view_model.dart'; 11 | import 'package:flutter_local_notifications/flutter_local_notifications.dart'; 12 | import 'package:provider/provider.dart'; 13 | 14 | final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = 15 | FlutterLocalNotificationsPlugin(); 16 | 17 | Future myBackgroundMessageHandler(Map message) { 18 | if (message.containsKey('data')) { 19 | // Handle data message 20 | print("Arka planda gelen data:" + message["data"].toString()); 21 | NotificationHandler.showNotification(message); 22 | } 23 | 24 | return Future.value(); 25 | } 26 | 27 | class NotificationHandler { 28 | FirebaseMessaging _fcm = FirebaseMessaging(); 29 | 30 | static final NotificationHandler _singleton = NotificationHandler._internal(); 31 | 32 | factory NotificationHandler() { 33 | return _singleton; 34 | } 35 | 36 | NotificationHandler._internal(); 37 | 38 | BuildContext myContext; 39 | 40 | initializeFCMNotification(BuildContext context) async { 41 | myContext = context; 42 | var initializationSettingsAndroid = 43 | AndroidInitializationSettings('@drawable/ic_stat_message'); 44 | var initializationSettingsIOS = IOSInitializationSettings( 45 | onDidReceiveLocalNotification: onDidReceiveLocalNotification); 46 | var initializationSettings = InitializationSettings( 47 | initializationSettingsAndroid, initializationSettingsIOS); 48 | flutterLocalNotificationsPlugin.initialize(initializationSettings, 49 | onSelectNotification: onSelectNotification); 50 | 51 | _fcm.onTokenRefresh.listen((newToken) async { 52 | User _currentUser = FirebaseAuth.instance.currentUser; 53 | await FirebaseFirestore.instance 54 | .doc("tokens/" + _currentUser.uid) 55 | .set({"token": newToken}); 56 | }); 57 | 58 | String token = await _fcm.getToken(); 59 | print("token :" + token); 60 | 61 | _fcm.configure( 62 | onMessage: (Map message) async { 63 | print("onMessage tetiklendi: $message"); 64 | showNotification(message); 65 | }, 66 | onBackgroundMessage: myBackgroundMessageHandler, 67 | onLaunch: (Map message) async { 68 | print("onLaunch tetiklendi: $message"); 69 | }, 70 | onResume: (Map message) async { 71 | print("onResume tetiklendi: $message"); 72 | }, 73 | ); 74 | } 75 | 76 | static void showNotification(Map message) async { 77 | var mesaj = Person( 78 | key: '1', 79 | name: message["data"]["title"], 80 | ); 81 | var mesajStyle = MessagingStyleInformation(mesaj, 82 | messages: [Message(message["data"]["message"], DateTime.now(), mesaj)]); 83 | 84 | var androidPlatformChannelSpecifics = AndroidNotificationDetails( 85 | '1234', 'Yeni Mesaj', 'your channel description', 86 | styleInformation: mesajStyle, 87 | importance: Importance.Max, 88 | priority: Priority.High, 89 | ticker: 'ticker'); 90 | var iOSPlatformChannelSpecifics = IOSNotificationDetails(); 91 | var platformChannelSpecifics = NotificationDetails( 92 | androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); 93 | await flutterLocalNotificationsPlugin.show( 94 | 0, 95 | message["data"]["title"], 96 | message["data"]["message"], 97 | platformChannelSpecifics, 98 | payload: jsonEncode(message), 99 | ); 100 | } 101 | 102 | Future onSelectNotification(String payload) async { 103 | final _userViewModel = Provider.of(myContext, listen: false); 104 | if (payload != null) { 105 | debugPrint('notification payload: ' + payload); 106 | Map incomingMessageMap = await jsonDecode(payload); 107 | Navigator.of(myContext, rootNavigator: true).push( 108 | MaterialPageRoute( 109 | builder: (context) => ChangeNotifierProvider( 110 | create: (context) => ChatViewModel( 111 | currentUser: _userViewModel.userModel, 112 | chatUser: UserModel.forChatPage( 113 | userID: incomingMessageMap["data"]["senderUserID"], 114 | profilePhotoUrl: incomingMessageMap["data"] 115 | ["senderProfilePhotoUrl"], 116 | userName: incomingMessageMap["data"]["senderUserName"], 117 | mail: incomingMessageMap["data"]["senderMail"], 118 | ), 119 | ), 120 | child: ChatPage(), 121 | ), 122 | ), 123 | ); 124 | } 125 | } 126 | 127 | Future onDidReceiveLocalNotification( 128 | int id, String title, String body, String payload) { 129 | return Future.value(); 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /lib/view_models/chat_view_model.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:cloud_firestore/cloud_firestore.dart'; 4 | import 'package:flutter/cupertino.dart'; 5 | import 'package:flutter_live_chat_app/locator.dart'; 6 | import 'package:flutter_live_chat_app/models/message_model.dart'; 7 | import 'package:flutter_live_chat_app/models/user_model.dart'; 8 | import 'package:flutter_live_chat_app/repositories/user_repository.dart'; 9 | 10 | enum ChatViewState { Idle, Busy, Loaded } 11 | 12 | class ChatViewModel with ChangeNotifier { 13 | UserRepository _userRepository = locator(); 14 | List _allMessages; 15 | ChatViewState _state = ChatViewState.Idle; 16 | final UserModel currentUser; 17 | final UserModel chatUser; 18 | static final itemsPerPage = 15; 19 | MessageModel _firstIndexInMessageList; 20 | MessageModel _lastCalledMessage; 21 | bool _hasMore = true; 22 | bool _newMessageListener = false; 23 | StreamSubscription _streamSubscription; 24 | 25 | List get allMessages => _allMessages; 26 | ChatViewState get state => _state; 27 | bool get hasMore => _hasMore; 28 | 29 | set state(ChatViewState value) { 30 | _state = value; 31 | notifyListeners(); 32 | } 33 | 34 | @override 35 | dispose() { 36 | _streamSubscription.cancel(); 37 | super.dispose(); 38 | } 39 | 40 | ChatViewModel({this.currentUser, this.chatUser}) { 41 | _allMessages = []; 42 | getMessagesWithPagination(false); 43 | } 44 | 45 | Future sendMessage(MessageModel sendingMessage, UserModel z) async { 46 | return await _userRepository.sendMessage(sendingMessage, currentUser); 47 | } 48 | 49 | void getMessagesWithPagination(bool newMessagesIsComing) async { 50 | if (_allMessages.length > 0) { 51 | _lastCalledMessage = allMessages.last; 52 | } 53 | 54 | if (!newMessagesIsComing) { 55 | state = ChatViewState.Busy; 56 | } 57 | var _calledMessages = await _userRepository.getMessagesWithPagination( 58 | currentUser.userID, chatUser.userID, _lastCalledMessage, itemsPerPage); 59 | 60 | if (_calledMessages.length < itemsPerPage) { 61 | _hasMore = false; 62 | } 63 | 64 | _allMessages.addAll(_calledMessages); 65 | if (_allMessages.length > 0) { 66 | _firstIndexInMessageList = _allMessages.first; 67 | } 68 | state = ChatViewState.Loaded; 69 | 70 | if (_newMessageListener == false) { 71 | _newMessageListener = true; 72 | addNewMessageListener(); 73 | } 74 | } 75 | 76 | getMoreOldMessages() async { 77 | await Future.delayed(Duration(seconds: 1)); 78 | if (_hasMore) { 79 | getMessagesWithPagination(true); 80 | } else { 81 | print("Daha fazla kullanıcı olmadığı için getMoreUser() çağırılmayacak."); 82 | } 83 | } 84 | 85 | addNewMessageListener() { 86 | _streamSubscription = _userRepository 87 | .getMessages(currentUser.userID, chatUser.userID) 88 | .listen((newMessage) { 89 | if (newMessage.isNotEmpty) { 90 | if (newMessage[0].date != null) { 91 | if (_firstIndexInMessageList == null) { 92 | _allMessages.insert(0, newMessage[0]); 93 | } else if (_firstIndexInMessageList.date.millisecondsSinceEpoch != 94 | newMessage[0].date.millisecondsSinceEpoch) { 95 | _allMessages.insert(0, newMessage[0]); 96 | } 97 | } 98 | state = ChatViewState.Loaded; 99 | } 100 | }); 101 | } 102 | 103 | String formatDateyMd(Timestamp dateOrg) { 104 | DateTime tm = dateOrg.toDate(); 105 | 106 | DateTime today = new DateTime.now(); 107 | Duration oneDay = new Duration(days: 1); 108 | Duration twoDay = new Duration(days: 2); 109 | Duration oneWeek = new Duration(days: 7); 110 | String month; 111 | switch (tm.month) { 112 | case 1: 113 | month = "OCAK"; 114 | break; 115 | case 2: 116 | month = "ŞUBAT"; 117 | break; 118 | case 3: 119 | month = "MART"; 120 | break; 121 | case 4: 122 | month = "NİSAN"; 123 | break; 124 | case 5: 125 | month = "MAYIS"; 126 | break; 127 | case 6: 128 | month = "HAZİRAN"; 129 | break; 130 | case 7: 131 | month = "TEMMUZ"; 132 | break; 133 | case 8: 134 | month = "AĞUSTOS"; 135 | break; 136 | case 9: 137 | month = "EYLÜL"; 138 | break; 139 | case 10: 140 | month = "EKİM"; 141 | break; 142 | case 11: 143 | month = "KASIM"; 144 | break; 145 | case 12: 146 | month = "ARALIK"; 147 | break; 148 | } 149 | 150 | Duration difference = today.difference(tm); 151 | 152 | if (difference.compareTo(oneDay) < 1) { 153 | return "BUGÜN"; 154 | } else if (difference.compareTo(twoDay) < 1) { 155 | return "DÜN"; 156 | } else if (difference.compareTo(oneWeek) < 1) { 157 | switch (tm.weekday) { 158 | case 1: 159 | return "PAZARTESİ"; 160 | case 2: 161 | return "SALI"; 162 | case 3: 163 | return "ÇARŞAMBA"; 164 | case 4: 165 | return "PERŞEMBE"; 166 | case 5: 167 | return "CUMA"; 168 | case 6: 169 | return "CUMARTESİ"; 170 | case 7: 171 | return "PAZAR"; 172 | } 173 | } else if (tm.year == today.year) { 174 | return '${tm.day} $month'; 175 | } else { 176 | return '${tm.day} $month ${tm.year}'; 177 | } 178 | 179 | return '${tm.day} $month ${tm.year}'; 180 | } 181 | } 182 | -------------------------------------------------------------------------------- /lib/view_models/user_view_model.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_live_chat_app/locator.dart'; 5 | import 'package:flutter_live_chat_app/models/chats_model.dart'; 6 | import 'package:flutter_live_chat_app/models/message_model.dart'; 7 | import 'package:flutter_live_chat_app/models/user_model.dart'; 8 | import 'package:flutter_live_chat_app/repositories/user_repository.dart'; 9 | import 'package:flutter_live_chat_app/services/auth_base.dart'; 10 | 11 | enum ViewState { Idle, Busy } 12 | 13 | class UserViewModel with ChangeNotifier implements AuthBase { 14 | ViewState _state = ViewState.Idle; 15 | UserRepository _userRepository = locator(); 16 | UserModel _userModel; 17 | String mailErrorMessage; 18 | String passErrorMessage; 19 | String mailErrorMessageForReset; 20 | 21 | UserModel get userModel => _userModel; 22 | ViewState get state => _state; 23 | 24 | set state(ViewState value) { 25 | _state = value; 26 | notifyListeners(); 27 | } 28 | 29 | UserViewModel() { 30 | currentUser(); 31 | } 32 | 33 | @override 34 | Future currentUser() async { 35 | try { 36 | state = ViewState.Busy; 37 | _userModel = await _userRepository.currentUser(); 38 | if (_userModel != null) { 39 | return _userModel; 40 | } else { 41 | return null; 42 | } 43 | } catch (e) { 44 | print("ViewModel currentUser() hatası: " + e.toString()); 45 | return null; 46 | } finally { 47 | state = ViewState.Idle; 48 | } 49 | } 50 | 51 | @override 52 | Future signInAnonymously() async { 53 | try { 54 | state = ViewState.Busy; 55 | _userModel = await _userRepository.signInAnonymously(); 56 | return _userModel; 57 | } catch (e) { 58 | print("ViewModel currentUser() hatası: " + e.toString()); 59 | return null; 60 | } finally { 61 | state = ViewState.Idle; 62 | } 63 | } 64 | 65 | @override 66 | Future signOut() async { 67 | try { 68 | state = ViewState.Busy; 69 | bool result = await _userRepository.signOut(); 70 | _userModel = null; 71 | return result; 72 | } catch (e) { 73 | print("ViewModel currentUser() hatası: " + e.toString()); 74 | return false; 75 | } finally { 76 | state = ViewState.Idle; 77 | } 78 | } 79 | 80 | @override 81 | Future signInWithGoogle() async { 82 | try { 83 | state = ViewState.Busy; 84 | _userModel = await _userRepository.signInWithGoogle(); 85 | return _userModel; 86 | } catch (e) { 87 | print("ViewModel signInWithGoogle() hatası: " + e.toString()); 88 | return null; 89 | } finally { 90 | state = ViewState.Idle; 91 | } 92 | } 93 | 94 | @override 95 | Future createWithMailAndPass(String mail, String pass) async { 96 | if (_mailAndPassControl(mail, pass)) { 97 | try { 98 | state = ViewState.Busy; 99 | _userModel = await _userRepository.createWithMailAndPass(mail, pass); 100 | return _userModel; 101 | } finally { 102 | state = ViewState.Idle; 103 | } 104 | } else { 105 | return null; 106 | } 107 | } 108 | 109 | Future resetPassword(String mail) async { 110 | if (_mailCheck(mail)) { 111 | state = ViewState.Busy; 112 | try { 113 | await _userRepository.resetPassword(mail); 114 | } finally { 115 | state = ViewState.Idle; 116 | } 117 | } 118 | } 119 | 120 | @override 121 | Future signInWithMailAndPass(String mail, String pass) async { 122 | if (_mailAndPassControl(mail, pass)) { 123 | try { 124 | state = ViewState.Busy; 125 | _userModel = await _userRepository.signInWithMailAndPass(mail, pass); 126 | return _userModel; 127 | } finally { 128 | state = ViewState.Idle; 129 | } 130 | } else { 131 | return null; 132 | } 133 | } 134 | 135 | bool _mailCheck(String mail) { 136 | var result = true; 137 | if (!mail.contains('@')) { 138 | mailErrorMessageForReset = "Lütfen geçerli bir e-posta adresi giriniz."; 139 | result = false; 140 | } else { 141 | mailErrorMessageForReset = null; 142 | } 143 | return result; 144 | } 145 | 146 | bool _mailAndPassControl(String mail, String pass) { 147 | var result = true; 148 | 149 | if (pass.length < 6) { 150 | passErrorMessage = "Şifreniz en az 6 karakterden oluşmalıdır."; 151 | result = false; 152 | } else { 153 | passErrorMessage = null; 154 | } 155 | if (!mail.contains('@')) { 156 | mailErrorMessage = "Lütfen geçerli bir e-posta adresi giriniz."; 157 | result = false; 158 | } else { 159 | mailErrorMessage = null; 160 | } 161 | 162 | return result; 163 | } 164 | 165 | Future updateUserName(String userID, String userName) async { 166 | bool result = await _userRepository.updateUserName(userID, userName); 167 | return result; 168 | } 169 | 170 | Future uploadFile(String userID, String fileType, String fileName, 171 | File profilePhoto) async { 172 | var downloadUrl = await _userRepository.uploadFile( 173 | userID, fileType, fileName, profilePhoto); 174 | return downloadUrl; 175 | } 176 | 177 | Stream> getMessages( 178 | String currentUserID, String chatUserID) { 179 | return _userRepository.getMessages(currentUserID, chatUserID); 180 | } 181 | 182 | Future> getAllConversations(String userID) { 183 | return _userRepository.getAllConversations(userID); 184 | } 185 | 186 | Future getUser(String userID) { 187 | return _userRepository.getUser(userID); 188 | } 189 | 190 | Future> getAllUsersWithPagination( 191 | UserModel calledLastUser, int itemsPerPage) async { 192 | return await _userRepository.getAllUsersWithPagination( 193 | calledLastUser, itemsPerPage); 194 | } 195 | } 196 | -------------------------------------------------------------------------------- /lib/app/users.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_live_chat_app/app/chat_page.dart'; 3 | import 'package:flutter_live_chat_app/view_models/all_users_view_model.dart'; 4 | import 'package:flutter_live_chat_app/view_models/chat_view_model.dart'; 5 | import 'package:flutter_live_chat_app/view_models/user_view_model.dart'; 6 | import 'package:provider/provider.dart'; 7 | 8 | class UsersPage extends StatefulWidget { 9 | @override 10 | _UsersPageState createState() => _UsersPageState(); 11 | } 12 | 13 | class _UsersPageState extends State { 14 | bool _isLoading = false; 15 | ScrollController _scrollController = ScrollController(); 16 | 17 | @override 18 | void initState() { 19 | super.initState(); 20 | _scrollController.addListener(_listControlListener); 21 | } 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | return Scaffold( 26 | backgroundColor: Color(0x91adc7), 27 | appBar: AppBar( 28 | title: Text( 29 | "Kullanıcılar", 30 | style: TextStyle( 31 | fontSize: 18, 32 | color: Color(0xFFF2F6FA), 33 | ), 34 | ), 35 | ), 36 | body: Consumer( 37 | builder: (context, model, child) { 38 | if (model.state == AllUsersViewState.Busy) { 39 | return _buildNewUsersCircularProgressIndicator(); 40 | } else if (model.state == AllUsersViewState.Loaded) { 41 | return RefreshIndicator( 42 | onRefresh: model.listRefresh, 43 | child: ListView.builder( 44 | physics: AlwaysScrollableScrollPhysics(), 45 | controller: _scrollController, 46 | itemBuilder: (context, index) { 47 | if (model.allUsers.length == 1) { 48 | return buildUsersListIsEmpty(); 49 | } else if (model.hasMore == true && 50 | index == model.allUsers.length) { 51 | return _buildNewUsersCircularProgressIndicator(); 52 | } else { 53 | return buildListTile(index); 54 | } 55 | }, 56 | itemCount: model.hasMore == true 57 | ? model.allUsers.length + 1 58 | : model.allUsers.length, 59 | ), 60 | ); 61 | } else { 62 | return Container(); 63 | } 64 | }, 65 | ), 66 | ); 67 | } 68 | 69 | Widget buildUsersListIsEmpty() { 70 | final _allUsersViewModel = Provider.of(context); 71 | return RefreshIndicator( 72 | onRefresh: _allUsersViewModel.listRefresh, 73 | child: SingleChildScrollView( 74 | physics: AlwaysScrollableScrollPhysics(), 75 | child: Container( 76 | height: MediaQuery.of(context).size.height - 92, 77 | child: Center( 78 | child: Column( 79 | mainAxisAlignment: MainAxisAlignment.center, 80 | crossAxisAlignment: CrossAxisAlignment.center, 81 | children: [ 82 | Container( 83 | height: ((MediaQuery.of(context).size.height) * 2 / 6), 84 | child: Image.asset( 85 | "assets/images/userNotFound.png", 86 | fit: BoxFit.contain, 87 | ), 88 | ), 89 | Text( 90 | "Sistemde kayıtlı kullanıcı bulunamadı.", 91 | style: TextStyle(fontSize: 16), 92 | textAlign: TextAlign.center, 93 | ), 94 | ], 95 | ), 96 | ), 97 | ), 98 | ), 99 | ); 100 | } 101 | 102 | Widget buildListTile(int index) { 103 | final _allUsersViewModel = Provider.of(context); 104 | final _userViewModel = Provider.of(context); 105 | var _currentUser = _allUsersViewModel.allUsers[index]; 106 | 107 | // Tüm kullanıcı listesi içerisinde mevcut kullanıcıyı dışladım: 108 | if (_currentUser.userID == _userViewModel.userModel.userID) { 109 | return Container(); 110 | } 111 | 112 | return ListTile( 113 | leading: ClipRRect( 114 | borderRadius: BorderRadius.circular(24.0), 115 | child: FadeInImage.assetNetwork( 116 | placeholder: "assets/images/defaultUserPhoto.jpg", 117 | image: _currentUser.profilePhotoUrl, 118 | fit: BoxFit.cover, 119 | height: 48, 120 | width: 48, 121 | repeat: ImageRepeat.noRepeat, 122 | ), 123 | ), 124 | title: Text( 125 | "@" + _currentUser.userName, 126 | style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold), 127 | ), 128 | subtitle: Text( 129 | _currentUser.mail, 130 | style: TextStyle(fontSize: 13), 131 | ), 132 | onTap: () { 133 | Navigator.of(context, rootNavigator: true).push( 134 | MaterialPageRoute( 135 | builder: (context) => ChangeNotifierProvider( 136 | create: (context) => ChatViewModel( 137 | currentUser: _userViewModel.userModel, 138 | chatUser: _currentUser), 139 | child: ChatPage(), 140 | ), 141 | ), 142 | ); 143 | }, 144 | ); 145 | } 146 | 147 | getMoreUsers() async { 148 | final _allUsersViewModel = Provider.of(context, listen: false); 149 | if (_isLoading == false) { 150 | _isLoading = true; 151 | await _allUsersViewModel.getMoreUsers(); 152 | _isLoading = false; 153 | } 154 | } 155 | 156 | Widget _buildNewUsersCircularProgressIndicator() { 157 | return Center( 158 | child: Column( 159 | crossAxisAlignment: CrossAxisAlignment.center, 160 | mainAxisAlignment: MainAxisAlignment.center, 161 | children: [ 162 | CircularProgressIndicator(), 163 | SizedBox( 164 | height: 10, 165 | ), 166 | Text("Kullanıcılar getiriliyor."), 167 | ], 168 | ), 169 | ); 170 | } 171 | 172 | void _listControlListener() { 173 | if (_scrollController.offset >= 174 | _scrollController.position.maxScrollExtent && 175 | !_scrollController.position.outOfRange) { 176 | getMoreUsers(); 177 | } 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /lib/app/chat_history.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_live_chat_app/app/chat_page.dart'; 3 | import 'package:flutter_live_chat_app/models/chats_model.dart'; 4 | import 'package:flutter_live_chat_app/models/user_model.dart'; 5 | import 'package:flutter_live_chat_app/view_models/chat_view_model.dart'; 6 | import 'package:flutter_live_chat_app/view_models/user_view_model.dart'; 7 | import 'package:provider/provider.dart'; 8 | 9 | class ChatHistory extends StatefulWidget { 10 | @override 11 | _ChatHistoryState createState() => _ChatHistoryState(); 12 | } 13 | 14 | class _ChatHistoryState extends State { 15 | @override 16 | Widget build(BuildContext context) { 17 | UserViewModel _userViewModel = Provider.of(context); 18 | return Scaffold( 19 | appBar: AppBar( 20 | title: Text( 21 | "Konuşmalarım", 22 | style: TextStyle( 23 | fontSize: 18, 24 | color: Color(0xFFF2F6FA), 25 | ), 26 | ), 27 | ), 28 | body: FutureBuilder>( 29 | future: 30 | _userViewModel.getAllConversations(_userViewModel.userModel.userID), 31 | builder: (context, future) { 32 | if (future.hasData) { 33 | if (future.data.length > 0) { 34 | return RefreshIndicator( 35 | onRefresh: _refreshChatHistory, 36 | child: ListView.builder( 37 | itemCount: future.data.length, 38 | itemBuilder: (context, index) { 39 | return ListTile( 40 | leading: ClipRRect( 41 | borderRadius: BorderRadius.circular(24.0), 42 | child: FadeInImage.assetNetwork( 43 | placeholder: "assets/images/defaultUserPhoto.jpg", 44 | image: future.data[index].chatUserProfilePhotoUrl, 45 | fit: BoxFit.cover, 46 | height: 48, 47 | width: 48, 48 | repeat: ImageRepeat.noRepeat, 49 | ), 50 | ), 51 | title: Text( 52 | "@" + future.data[index].chatUserUserName, 53 | style: TextStyle( 54 | fontSize: 14, fontWeight: FontWeight.w600), 55 | ), 56 | subtitle: future.data[index].lastMessage.length > 25 57 | ? Text( 58 | future.data[index].lastMessage 59 | .substring(0, 25) + 60 | "...", 61 | style: TextStyle(fontSize: 13), 62 | ) 63 | : Text( 64 | future.data[index].lastMessage, 65 | style: TextStyle(fontSize: 13), 66 | ), 67 | trailing: Text(future.data[index].timeDifference), 68 | onTap: () { 69 | Navigator.of(context, rootNavigator: true).push( 70 | MaterialPageRoute( 71 | builder: (context) => 72 | ChangeNotifierProvider( 73 | create: (context) => ChatViewModel( 74 | currentUser: _userViewModel.userModel, 75 | chatUser: UserModel.forChatPage( 76 | userID: future.data[index].chatUser, 77 | profilePhotoUrl: future 78 | .data[index].chatUserProfilePhotoUrl, 79 | userName: 80 | future.data[index].chatUserUserName, 81 | mail: future.data[index].chatUserMail), 82 | ), 83 | child: ChatPage(), 84 | ), 85 | ), 86 | ); 87 | }, 88 | ); 89 | }), 90 | ); 91 | } else { 92 | return RefreshIndicator( 93 | onRefresh: _refreshChatHistory, 94 | child: SingleChildScrollView( 95 | physics: AlwaysScrollableScrollPhysics(), 96 | child: Container( 97 | height: MediaQuery.of(context).size.height - 92, 98 | child: Center( 99 | child: Column( 100 | mainAxisAlignment: MainAxisAlignment.center, 101 | crossAxisAlignment: CrossAxisAlignment.center, 102 | children: [ 103 | Container( 104 | height: 105 | ((MediaQuery.of(context).size.height) * 2 / 6), 106 | child: Image.asset( 107 | "assets/images/userNotFound.png", 108 | fit: BoxFit.contain, 109 | ), 110 | ), 111 | Text( 112 | "Henüz kimseyle sohbet etmediniz..", 113 | style: TextStyle(fontSize: 16), 114 | textAlign: TextAlign.center, 115 | ), 116 | ], 117 | ), 118 | ), 119 | ), 120 | ), 121 | ); 122 | } 123 | } else { 124 | return Center( 125 | child: Column( 126 | crossAxisAlignment: CrossAxisAlignment.center, 127 | mainAxisAlignment: MainAxisAlignment.center, 128 | children: [ 129 | CircularProgressIndicator(), 130 | SizedBox( 131 | height: 10, 132 | ), 133 | Text("Mesaj geçmişi getiriliyor"), 134 | ], 135 | ), 136 | ); 137 | } 138 | }, 139 | ), 140 | ); 141 | } 142 | 143 | Future _refreshChatHistory() async { 144 | await Future.delayed(Duration(milliseconds: 500)); 145 | setState(() {}); 146 | return null; 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /lib/app/profile.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_live_chat_app/common_widgets/platform_alert_dialog.dart'; 4 | import 'package:flutter_live_chat_app/common_widgets/sign_in_text_form_field.dart'; 5 | import 'package:flutter_live_chat_app/common_widgets/social_log_in_button.dart'; 6 | import 'package:flutter_live_chat_app/view_models/user_view_model.dart'; 7 | import 'package:image_picker/image_picker.dart'; 8 | import 'package:provider/provider.dart'; 9 | 10 | class ProfilePage extends StatefulWidget { 11 | @override 12 | _ProfilePageState createState() => _ProfilePageState(); 13 | } 14 | 15 | class _ProfilePageState extends State { 16 | TextEditingController _controllerUserName; 17 | File _profilePhoto; 18 | 19 | @override 20 | void initState() { 21 | super.initState(); 22 | _controllerUserName = TextEditingController(); 23 | } 24 | 25 | @override 26 | void dispose() { 27 | _controllerUserName.dispose(); 28 | super.dispose(); 29 | } 30 | 31 | @override 32 | Widget build(BuildContext context) { 33 | UserViewModel _userViewModel = 34 | Provider.of(context, listen: false); 35 | _controllerUserName.text = _userViewModel.userModel.userName; 36 | 37 | return Scaffold( 38 | appBar: AppBar( 39 | elevation: 0, 40 | title: Text( 41 | "Profil", 42 | style: TextStyle( 43 | fontSize: 18, 44 | color: Color(0xFFF2F6FA), 45 | ), 46 | ), 47 | ), 48 | body: SingleChildScrollView( 49 | child: Padding( 50 | padding: const EdgeInsets.all(8.0), 51 | child: Center( 52 | child: Column( 53 | crossAxisAlignment: CrossAxisAlignment.start, 54 | children: [ 55 | Center( 56 | child: GestureDetector( 57 | child: CircleAvatar( 58 | backgroundColor: Colors.grey, 59 | radius: 75, 60 | backgroundImage: _profilePhoto == null 61 | ? NetworkImage( 62 | _userViewModel.userModel.profilePhotoUrl) 63 | : FileImage(_profilePhoto), 64 | ), 65 | onTap: () => _showBottomSheet(context), 66 | ), 67 | ), 68 | Padding( 69 | padding: const EdgeInsets.only(top: 8, bottom: 8), 70 | child: Text( 71 | "E-Posta", 72 | textAlign: TextAlign.end, 73 | style: TextStyle( 74 | fontSize: 14, 75 | fontWeight: FontWeight.bold, 76 | ), 77 | ), 78 | ), 79 | SignInTextFormField( 80 | prefixIcon: Icon(Icons.mail), 81 | initialValue: _userViewModel.userModel.mail, 82 | readOnly: true, 83 | ), 84 | Padding( 85 | padding: const EdgeInsets.only(top: 8, bottom: 8), 86 | child: Text( 87 | "Kullanıcı Adı", 88 | textAlign: TextAlign.end, 89 | style: TextStyle( 90 | fontSize: 14, 91 | fontWeight: FontWeight.bold, 92 | ), 93 | ), 94 | ), 95 | SignInTextFormField( 96 | controller: _controllerUserName, 97 | prefixIcon: Icon(Icons.person), 98 | ), 99 | SocialLogInButton( 100 | buttonText: "Değişiklikleri kaydet", 101 | buttonBgColor: Theme.of(context).primaryColor, 102 | onPressed: () { 103 | _savedUserName(context); 104 | _updateProfilePhoto(context); 105 | }, 106 | ), 107 | SocialLogInButton( 108 | buttonText: "Çıkış yap", 109 | buttonTextColor: Colors.white, 110 | buttonBgColor: Colors.redAccent, 111 | borderColor: Colors.redAccent, 112 | onPressed: () { 113 | _buildSignOutAlertDialog(context); 114 | }, 115 | ), 116 | ], 117 | ), 118 | ), 119 | ), 120 | ), 121 | ); 122 | } 123 | 124 | Future _signOut(BuildContext context) async { 125 | final _userViewModel = Provider.of(context, listen: false); 126 | bool result = await _userViewModel.signOut(); 127 | return result; 128 | } 129 | 130 | Future _buildSignOutAlertDialog(BuildContext context) async { 131 | final result = await PlatformAlertDialog( 132 | title: "Emin misiniz?", 133 | message: "Çıkmak istediğinizden emin misiniz?", 134 | mainActionText: "Çıkış yap", 135 | secondActionText: "Vazgeç", 136 | ).show(context); 137 | 138 | if (result) { 139 | _signOut(context); 140 | } 141 | } 142 | 143 | void _savedUserName(BuildContext context) async { 144 | final _userViewModel = Provider.of(context, listen: false); 145 | if (_userViewModel.userModel.userName != _controllerUserName.text) { 146 | var result = await _userViewModel.updateUserName( 147 | _userViewModel.userModel.userID, _controllerUserName.text); 148 | 149 | if (result) { 150 | _userViewModel.userModel.userName = _controllerUserName.text; 151 | PlatformAlertDialog( 152 | title: "Başarılı!", 153 | message: "Kullanıcı adı değiştirildi.", 154 | mainActionText: "Tamam", 155 | ).show(context); 156 | } else { 157 | _userViewModel.userModel.userName = _controllerUserName.text; 158 | PlatformAlertDialog( 159 | title: "Hata!", 160 | message: 161 | "Kullanıcı adı kullanılıyor. Farklı bir kullanıcı adı deneyin.", 162 | mainActionText: "Tamam", 163 | ).show(context); 164 | } 165 | } 166 | } 167 | 168 | _showBottomSheet(BuildContext context) { 169 | showModalBottomSheet( 170 | useRootNavigator: true, 171 | context: context, 172 | builder: (context) { 173 | return Container( 174 | height: (MediaQuery.of(context).size.height / 5) + 8, 175 | child: Column(children: [ 176 | ListTile( 177 | leading: CircleAvatar( 178 | child: Icon(Icons.camera), 179 | ), 180 | title: Text("Kamera"), 181 | subtitle: Text("Kamera ile yeni profil fotoğrafı edinin."), 182 | onTap: () { 183 | _newProfilePhotoFromCamera(); 184 | // After closing bottom sheet 185 | Navigator.of(context).pop(); 186 | }, 187 | ), 188 | ListTile( 189 | leading: CircleAvatar( 190 | child: Icon(Icons.photo), 191 | ), 192 | title: Text("Galeri"), 193 | subtitle: Text("Galeriden yeni bir profil fotoğrafı seçin."), 194 | onTap: () { 195 | _newProfilePhotoFromGallery(); 196 | // After closing bottom sheet 197 | Navigator.of(context).pop(); 198 | }, 199 | ), 200 | ]), 201 | ); 202 | }, 203 | ); 204 | } 205 | 206 | void _newProfilePhotoFromCamera() async { 207 | final image = await ImagePicker().getImage(source: ImageSource.camera); 208 | if (image != null) { 209 | setState(() { 210 | _profilePhoto = File(image.path); 211 | }); 212 | } 213 | } 214 | 215 | void _newProfilePhotoFromGallery() async { 216 | final image = await ImagePicker().getImage(source: ImageSource.gallery); 217 | if (image != null) { 218 | setState(() { 219 | _profilePhoto = File(image.path); 220 | }); 221 | } 222 | } 223 | 224 | void _updateProfilePhoto(BuildContext context) async { 225 | final _userViewModel = Provider.of(context, listen: false); 226 | if (_profilePhoto != null) { 227 | String url = await _userViewModel.uploadFile( 228 | _userViewModel.userModel.userID, 229 | "images", 230 | "profile_photo", 231 | _profilePhoto); 232 | 233 | if (url != null) { 234 | PlatformAlertDialog( 235 | title: "Başarılı", 236 | message: "Profil fotoğrafınız güncellendi.", 237 | mainActionText: 'Kapat', 238 | ).show(context); 239 | } 240 | } 241 | } 242 | } 243 | -------------------------------------------------------------------------------- /lib/app/sign_in/mail_and_pass_form.dart: -------------------------------------------------------------------------------- 1 | import 'package:firebase_core/firebase_core.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_live_chat_app/app/errors_exception.dart'; 4 | import 'package:flutter_live_chat_app/app/sign_in/reset_password.dart'; 5 | import 'package:flutter_live_chat_app/common_widgets/platform_alert_dialog.dart'; 6 | import 'package:flutter_live_chat_app/common_widgets/sign_in_text_form_field.dart'; 7 | import 'package:flutter_live_chat_app/common_widgets/social_log_in_button.dart'; 8 | import 'package:flutter_live_chat_app/models/user_model.dart'; 9 | import 'package:flutter_live_chat_app/view_models/user_view_model.dart'; 10 | import 'package:provider/provider.dart'; 11 | 12 | enum FormType { Register, LogIn } 13 | 14 | class MailAndPassForm extends StatefulWidget { 15 | @override 16 | _MailAndPassFormState createState() => _MailAndPassFormState(); 17 | } 18 | 19 | class _MailAndPassFormState extends State { 20 | String _mail, _pass; 21 | String _buttonText, _linkDescribeText, _linkText; 22 | FormType _formType = FormType.LogIn; 23 | final _formKey = GlobalKey(); 24 | 25 | _changeFormType() { 26 | setState(() { 27 | _formType == FormType.LogIn 28 | ? _formType = FormType.Register 29 | : _formType = FormType.LogIn; 30 | }); 31 | } 32 | 33 | _formSubmit() async { 34 | setState(() {}); 35 | _formKey.currentState.save(); 36 | final _userViewModel = Provider.of(context, listen: false); 37 | 38 | if (_formType == FormType.LogIn) { 39 | try { 40 | UserModel _loggedInUser = 41 | await _userViewModel.signInWithMailAndPass(_mail, _pass); 42 | if (_loggedInUser != null) { 43 | print("Oturum açan kullanıcı ID: " + _loggedInUser.userID.toString()); 44 | } 45 | } on FirebaseException catch (e) { 46 | return PlatformAlertDialog( 47 | title: "Oturum açarken hata!", 48 | message: Errors.showError(e.code.toString()), 49 | mainActionText: "Tamam", 50 | ).show(context); 51 | } 52 | } else { 53 | try { 54 | UserModel _createdUser = 55 | await _userViewModel.createWithMailAndPass(_mail, _pass); 56 | if (_createdUser != null) { 57 | print("Kayıt olan kullanıcı ID: " + _createdUser.userID.toString()); 58 | } 59 | } on FirebaseException catch (e) { 60 | return PlatformAlertDialog( 61 | title: "Kullanıcı oluşturulurken hata!", 62 | message: Errors.showError(e.code.toString()), 63 | mainActionText: "Tamam", 64 | ).show(context); 65 | } 66 | } 67 | } 68 | 69 | @override 70 | Widget build(BuildContext context) { 71 | _buttonText = _formType == FormType.LogIn ? "Giriş yap" : "Kayıt ol"; 72 | _linkDescribeText = 73 | _formType == FormType.LogIn ? "Hesabınız yok mu?" : "Hesabınız var mı?"; 74 | _linkText = _formType == FormType.LogIn ? " Kayıt olun." : " Giriş yapın."; 75 | 76 | final _userViewModel = Provider.of(context, listen: true); 77 | 78 | if (_userViewModel.userModel != null) { 79 | Future.delayed(Duration(milliseconds: 1), () { 80 | Navigator.of(context).popUntil(ModalRoute.withName("/")); 81 | }); 82 | } 83 | 84 | return Scaffold( 85 | appBar: AppBar( 86 | title: Text( 87 | _buttonText, 88 | style: TextStyle( 89 | fontSize: 18, 90 | color: Color(0xFFF2F6FA), 91 | ), 92 | ), 93 | ), 94 | body: _userViewModel.state == ViewState.Idle 95 | ? SingleChildScrollView( 96 | child: Padding( 97 | padding: const EdgeInsets.all(8.0), 98 | child: Form( 99 | key: _formKey, 100 | child: Column( 101 | crossAxisAlignment: CrossAxisAlignment.start, 102 | children: [ 103 | Padding( 104 | padding: const EdgeInsets.only(bottom: 8), 105 | child: Text( 106 | "E-Posta", 107 | textAlign: TextAlign.end, 108 | style: TextStyle( 109 | fontSize: 14, 110 | fontWeight: FontWeight.bold, 111 | ), 112 | ), 113 | ), 114 | SignInTextFormField( 115 | obscureText: false, 116 | hintText: "E-Posta adresinizi giriniz", 117 | keyboardType: TextInputType.emailAddress, 118 | errorText: _userViewModel.mailErrorMessage != null 119 | ? _userViewModel.mailErrorMessage 120 | : null, 121 | onSaved: (String inputMail) { 122 | _mail = inputMail; 123 | }, 124 | ), 125 | Padding( 126 | padding: const EdgeInsets.only(top: 8, bottom: 8), 127 | child: Text( 128 | "Parola", 129 | textAlign: TextAlign.end, 130 | style: TextStyle( 131 | fontSize: 14, 132 | fontWeight: FontWeight.bold, 133 | ), 134 | ), 135 | ), 136 | SignInTextFormField( 137 | obscureText: true, 138 | hintText: "Parolanızı giriniz", 139 | errorText: _userViewModel.passErrorMessage != null 140 | ? _userViewModel.passErrorMessage 141 | : null, 142 | onSaved: (String inputPass) { 143 | _pass = inputPass; 144 | }, 145 | ), 146 | SizedBox( 147 | height: 10, 148 | ), 149 | SocialLogInButton( 150 | buttonText: _buttonText, 151 | buttonBgColor: Theme.of(context).primaryColor, 152 | onPressed: () => _formSubmit(), 153 | ), 154 | Row( 155 | mainAxisAlignment: MainAxisAlignment.end, 156 | children: [ 157 | Padding( 158 | padding: const EdgeInsets.all(8.0), 159 | child: GestureDetector( 160 | child: Text( 161 | "Parolamı unuttum", 162 | textAlign: TextAlign.end, 163 | style: TextStyle( 164 | fontWeight: FontWeight.w500, 165 | color: Theme.of(context).primaryColor), 166 | ), 167 | onTap: () { 168 | Navigator.of(context).push(MaterialPageRoute( 169 | builder: (context) => ResetPassword())); 170 | }, 171 | ), 172 | ), 173 | ], 174 | ), 175 | SizedBox( 176 | height: 10, 177 | ), 178 | Row( 179 | mainAxisAlignment: MainAxisAlignment.center, 180 | children: [ 181 | Text( 182 | _linkDescribeText, 183 | style: TextStyle(fontWeight: FontWeight.w500), 184 | textAlign: TextAlign.center, 185 | ), 186 | GestureDetector( 187 | child: Text( 188 | _linkText, 189 | style: TextStyle( 190 | fontWeight: FontWeight.w800, 191 | color: Theme.of(context).primaryColor), 192 | ), 193 | onTap: () => _changeFormType(), 194 | ), 195 | ], 196 | ), 197 | ], 198 | ), 199 | ), 200 | ), 201 | ) 202 | : Center( 203 | child: CircularProgressIndicator(), 204 | ), 205 | ); 206 | } 207 | } 208 | -------------------------------------------------------------------------------- /lib/services/firestore_db_service.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | import 'package:flutter_live_chat_app/models/chats_model.dart'; 3 | import 'package:flutter_live_chat_app/models/message_model.dart'; 4 | import 'package:flutter_live_chat_app/models/user_model.dart'; 5 | import 'package:flutter_live_chat_app/services/db_base.dart'; 6 | 7 | class FirestoreDBService implements DBBase { 8 | final FirebaseFirestore _firestore = FirebaseFirestore.instance; 9 | 10 | @override 11 | Future saveUser(UserModel userModel) async { 12 | await _firestore 13 | .collection("users") 14 | .doc(userModel.userID) 15 | .set(userModel.toMap()); 16 | 17 | return true; 18 | } 19 | 20 | @override 21 | Future readUser(String userID) async { 22 | DocumentSnapshot _readingValues = 23 | await _firestore.collection('users').doc(userID).get(); 24 | 25 | Map _readingValuesMap = _readingValues.data(); 26 | UserModel _userModelObject = UserModel.fromMap(_readingValuesMap); 27 | print("Okunan UserModel nesnesi: " + _userModelObject.toString()); 28 | return _userModelObject; 29 | } 30 | 31 | @override 32 | Future updateUserName(String userID, String userName) async { 33 | var otherUserNames = await _firestore 34 | .collection('users') 35 | .where('userName', isEqualTo: userName) 36 | .get(); 37 | 38 | if (otherUserNames.docs.isNotEmpty) { 39 | return false; 40 | } else { 41 | await _firestore 42 | .collection('users') 43 | .doc(userID) 44 | .update({'userName': userName}); 45 | return true; 46 | } 47 | } 48 | 49 | Future updateProfilePhoto(String userID, String profilePhotoUrl) async { 50 | await _firestore 51 | .collection('users') 52 | .doc(userID) 53 | .update({'profilePhotoUrl': profilePhotoUrl}); 54 | return true; 55 | } 56 | 57 | Future checkUserDocExist(String userID) async { 58 | DocumentSnapshot _snapshot = 59 | await _firestore.collection('users').doc(userID).get(); 60 | if (_snapshot.exists) { 61 | print("Kullanıcı veritabanına kayıtlı."); 62 | return true; 63 | } else { 64 | print("Kullanıcı veritabanına kayıtlı değil"); 65 | return false; 66 | } 67 | } 68 | 69 | @override 70 | Stream> getMessages( 71 | String currentUserID, String chatUserID) { 72 | var docID = currentUserID + "--" + chatUserID; 73 | var snapshots = _firestore 74 | .collection("chats") 75 | .doc(docID) 76 | .collection("messages") 77 | .where("chatOwner", isEqualTo: currentUserID) 78 | .orderBy("date", descending: true) 79 | .limit(1) 80 | .snapshots(); 81 | 82 | return snapshots.map((msgList) => 83 | msgList.docs.map((msg) => MessageModel.fromMap(msg.data())).toList()); 84 | } 85 | 86 | Future saveMessage(MessageModel sendingMessage) async { 87 | var _msgID = _firestore.collection("chats").doc().id; 88 | var _myDocID = sendingMessage.fromWho + "--" + sendingMessage.toWho; 89 | var _receiverDocID = sendingMessage.toWho + "--" + sendingMessage.fromWho; 90 | 91 | var _sendingMessageMap = sendingMessage.toMap(); 92 | 93 | await _firestore 94 | .collection("chats") 95 | .doc(_myDocID) 96 | .collection("messages") 97 | .doc(_msgID) 98 | .set(_sendingMessageMap); 99 | 100 | await _firestore.collection("chats").doc(_myDocID).set({ 101 | 'chatOwner': sendingMessage.fromWho, 102 | 'chatUser': sendingMessage.toWho, 103 | 'createdAt': FieldValue.serverTimestamp(), 104 | 'isRead': true, 105 | 'lastMessage': sendingMessage.message, 106 | 'readedTime': FieldValue.serverTimestamp(), 107 | }); 108 | 109 | _sendingMessageMap.update("isFromMe", (value) => false); 110 | _sendingMessageMap.update("chatOwner", (value) => sendingMessage.toWho); 111 | 112 | await _firestore 113 | .collection("chats") 114 | .doc(_receiverDocID) 115 | .collection("messages") 116 | .doc(_msgID) 117 | .set(_sendingMessageMap); 118 | 119 | await _firestore.collection("chats").doc(_receiverDocID).set({ 120 | 'chatOwner': sendingMessage.toWho, 121 | 'chatUser': sendingMessage.fromWho, 122 | 'createdAt': FieldValue.serverTimestamp(), 123 | 'isRead': true, 124 | 'lastMessage': sendingMessage.message, 125 | 'readedTime': FieldValue.serverTimestamp(), 126 | }); 127 | 128 | return true; 129 | } 130 | 131 | @override 132 | Future> getAllConversations(String currentUserID) async { 133 | QuerySnapshot _querySnapshot = await _firestore 134 | .collection("chats") 135 | .where("chatOwner", isEqualTo: currentUserID) 136 | .orderBy("createdAt", descending: true) 137 | .get(); 138 | 139 | List _allConversations = []; 140 | 141 | for (DocumentSnapshot _singleMap in _querySnapshot.docs) { 142 | ChatModel _single = ChatModel.fromMap(_singleMap.data()); 143 | _allConversations.add(_single); 144 | } 145 | 146 | return _allConversations; 147 | } 148 | 149 | Future getUser(String userID) async { 150 | DocumentSnapshot _docSnapshot = 151 | await _firestore.collection("users").doc(userID).get(); 152 | UserModel _user = UserModel.fromMap(_docSnapshot.data()); 153 | return _user; 154 | } 155 | 156 | @override 157 | Future showTime(String userID) async { 158 | await _firestore.collection("server").doc(userID).set( 159 | { 160 | "time": FieldValue.serverTimestamp(), 161 | }, 162 | ); 163 | 164 | DocumentSnapshot _s = 165 | await _firestore.collection("server").doc(userID).get(); 166 | 167 | Timestamp _data = _s.data()["time"]; 168 | return _data.toDate(); 169 | } 170 | 171 | @override 172 | Future> getAllUsersWithPagination( 173 | UserModel calledLastUser, int itemsPerPage) async { 174 | QuerySnapshot _querySnapshot; 175 | List _allUsers = []; 176 | 177 | if (calledLastUser == null) { 178 | _querySnapshot = await _firestore 179 | .collection("users") 180 | .orderBy("userName") 181 | .limit(itemsPerPage) 182 | .get(); 183 | } else { 184 | _querySnapshot = await _firestore 185 | .collection("users") 186 | .orderBy("userName") 187 | .startAfter([calledLastUser.userName]) 188 | .limit(itemsPerPage) 189 | .get(); 190 | 191 | await Future.delayed(Duration(seconds: 1)); 192 | } 193 | 194 | for (DocumentSnapshot snap in _querySnapshot.docs) { 195 | UserModel _singleUser = UserModel.fromMap(snap.data()); 196 | _allUsers.add(_singleUser); 197 | } 198 | 199 | return _allUsers; 200 | } 201 | 202 | Future> getMessagesWithPagination( 203 | String currentUserID, 204 | String chatUserID, 205 | MessageModel lastCalledMessage, 206 | int itemsPerPage) async { 207 | QuerySnapshot _querySnapshot; 208 | List _allMessages = []; 209 | var docID = currentUserID + "--" + chatUserID; 210 | 211 | if (lastCalledMessage == null) { 212 | _querySnapshot = await _firestore 213 | .collection("chats") 214 | .doc(docID) 215 | .collection("messages") 216 | .where("chatOwner", isEqualTo: currentUserID) 217 | .orderBy("date", descending: true) 218 | .limit(itemsPerPage) 219 | .get(); 220 | } else { 221 | _querySnapshot = await _firestore 222 | .collection("chats") 223 | .doc(docID) 224 | .collection("messages") 225 | .where("chatOwner", isEqualTo: currentUserID) 226 | .orderBy("date", descending: true) 227 | .startAfter([lastCalledMessage.date]) 228 | .limit(itemsPerPage) 229 | .get(); 230 | 231 | await Future.delayed(Duration(seconds: 1)); 232 | } 233 | 234 | for (DocumentSnapshot snap in _querySnapshot.docs) { 235 | MessageModel _singleMessage = MessageModel.fromMap(snap.data()); 236 | _allMessages.add(_singleMessage); 237 | } 238 | 239 | return _allMessages; 240 | } 241 | 242 | Future getUserToken(String toWho) async { 243 | DocumentSnapshot _doc = await _firestore.doc("tokens/" + toWho).get(); 244 | if (_doc != null) { 245 | Map _data = _doc.data(); 246 | return _data["token"]; 247 | } else { 248 | return null; 249 | } 250 | } 251 | 252 | Future getFirebaseNotificationKey() async { 253 | QuerySnapshot _snapshot = await _firestore.collection("firebaseKey").get(); 254 | DocumentSnapshot _doc = _snapshot.docs.last; 255 | Map _key = _doc.data(); 256 | return _key["key"]; 257 | } 258 | } 259 | -------------------------------------------------------------------------------- /lib/repositories/user_repository.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io'; 3 | 4 | import 'package:flutter_live_chat_app/locator.dart'; 5 | import 'package:flutter_live_chat_app/models/chats_model.dart'; 6 | import 'package:flutter_live_chat_app/models/message_model.dart'; 7 | import 'package:flutter_live_chat_app/models/user_model.dart'; 8 | import 'package:flutter_live_chat_app/services/auth_base.dart'; 9 | import 'package:flutter_live_chat_app/services/fake_auth_service.dart'; 10 | import 'package:flutter_live_chat_app/services/firebase_auth_service.dart'; 11 | import 'package:flutter_live_chat_app/services/firebase_storage_service.dart'; 12 | import 'package:flutter_live_chat_app/services/firestore_db_service.dart'; 13 | import 'package:flutter_live_chat_app/services/notification_service.dart'; 14 | import 'package:timeago/timeago.dart' as timeago; 15 | 16 | enum AppMode { DEBUG, RELEASE } 17 | 18 | class UserRepository implements AuthBase { 19 | FirebaseAuthService _firebaseAuthService = locator(); 20 | FakeAuthService _fakeAuthService = locator(); 21 | FirestoreDBService _firestoreDBService = locator(); 22 | NotificationService _notificationService = locator(); 23 | FirebaseStorageService _firebaseStorageService = 24 | locator(); 25 | 26 | AppMode appMode = AppMode.RELEASE; 27 | List allUsersList = []; 28 | Map _userToken = Map(); 29 | 30 | @override 31 | Future currentUser() async { 32 | if (appMode == AppMode.DEBUG) { 33 | return await _fakeAuthService.currentUser(); 34 | } else { 35 | UserModel _userModel = await _firebaseAuthService.currentUser(); 36 | if (_userModel != null) 37 | return await _firestoreDBService.readUser(_userModel.userID); 38 | else 39 | return null; 40 | } 41 | } 42 | 43 | @override 44 | Future signInAnonymously() async { 45 | if (appMode == AppMode.DEBUG) { 46 | return await _fakeAuthService.signInAnonymously(); 47 | } else { 48 | return await _firebaseAuthService.signInAnonymously(); 49 | } 50 | } 51 | 52 | @override 53 | Future signOut() async { 54 | if (appMode == AppMode.DEBUG) { 55 | return await _fakeAuthService.signOut(); 56 | } else { 57 | return await _firebaseAuthService.signOut(); 58 | } 59 | } 60 | 61 | @override 62 | Future signInWithGoogle() async { 63 | if (appMode == AppMode.DEBUG) { 64 | return await _fakeAuthService.signInWithGoogle(); 65 | } else { 66 | UserModel _userModel = await _firebaseAuthService.signInWithGoogle(); 67 | 68 | bool _userDocExistResult = 69 | await _firestoreDBService.checkUserDocExist(_userModel.userID); 70 | 71 | if (_userDocExistResult) { 72 | return await _firestoreDBService.readUser(_userModel.userID); 73 | } else { 74 | bool _result = await _firestoreDBService.saveUser(_userModel); 75 | if (_result) { 76 | return await _firestoreDBService.readUser(_userModel.userID); 77 | } else { 78 | return null; 79 | } 80 | } 81 | } 82 | } 83 | 84 | @override 85 | Future createWithMailAndPass(String mail, String pass) async { 86 | if (appMode == AppMode.DEBUG) { 87 | return await _fakeAuthService.createWithMailAndPass(mail, pass); 88 | } else { 89 | UserModel _userModel = 90 | await _firebaseAuthService.createWithMailAndPass(mail, pass); 91 | bool _result = await _firestoreDBService.saveUser(_userModel); 92 | if (_result) { 93 | return await _firestoreDBService.readUser(_userModel.userID); 94 | } else { 95 | return null; 96 | } 97 | } 98 | } 99 | 100 | @override 101 | Future signInWithMailAndPass(String mail, String pass) async { 102 | if (appMode == AppMode.DEBUG) { 103 | return await _fakeAuthService.signInWithMailAndPass(mail, pass); 104 | } else { 105 | UserModel _userModel = 106 | await _firebaseAuthService.signInWithMailAndPass(mail, pass); 107 | return await _firestoreDBService.readUser(_userModel.userID); 108 | } 109 | } 110 | 111 | Future updateUserName(String userID, String userName) async { 112 | if (appMode == AppMode.DEBUG) { 113 | return false; 114 | } else { 115 | bool result = await _firestoreDBService.updateUserName(userID, userName); 116 | return result; 117 | } 118 | } 119 | 120 | Future uploadFile(String userID, String fileType, String fileName, 121 | File profilePhoto) async { 122 | if (appMode == AppMode.DEBUG) { 123 | return "file_download_url"; 124 | } else { 125 | var _profilePhotoUrl = await _firebaseStorageService.uploadFile( 126 | userID, fileType, fileName, profilePhoto); 127 | await _firestoreDBService.updateProfilePhoto(userID, _profilePhotoUrl); 128 | return _profilePhotoUrl; 129 | } 130 | } 131 | 132 | Stream> getMessages( 133 | String currentUserID, String chatUserID) { 134 | if (appMode == AppMode.DEBUG) { 135 | return Stream.empty(); 136 | } else { 137 | return _firestoreDBService.getMessages(currentUserID, chatUserID); 138 | } 139 | } 140 | 141 | Future sendMessage( 142 | MessageModel sendingMessage, UserModel currentUser) async { 143 | if (appMode == AppMode.DEBUG) { 144 | return true; 145 | } else { 146 | var _writePrcs = await _firestoreDBService.saveMessage(sendingMessage); 147 | if (_writePrcs) { 148 | var _token = ""; 149 | if (_userToken.containsKey(sendingMessage.toWho)) { 150 | _token = _userToken[sendingMessage.toWho]; 151 | print("Token lokalden geldi."); 152 | } else { 153 | _token = await _firestoreDBService.getUserToken(sendingMessage.toWho); 154 | _userToken[sendingMessage.toWho] = _token; 155 | 156 | print("Token veritabanından geldi."); 157 | } 158 | 159 | await _notificationService.sendNotification( 160 | sendingMessage, currentUser, _token); 161 | } 162 | return true; 163 | } 164 | } 165 | 166 | Future> getAllConversations(String userID) async { 167 | if (appMode == AppMode.DEBUG) { 168 | return []; 169 | } else { 170 | DateTime time = await _firestoreDBService.showTime(userID); 171 | 172 | var chatHistoryList = 173 | await _firestoreDBService.getAllConversations(userID); 174 | 175 | for (ChatModel currentC in chatHistoryList) { 176 | var userInUserList = findUserInUserList(currentC.chatUser); 177 | 178 | if (userInUserList != null) { 179 | print("Konuşulan kişinin verileri local cache'den çağırıldı."); 180 | currentC.chatUserProfilePhotoUrl = userInUserList.profilePhotoUrl; 181 | currentC.chatUserUserName = userInUserList.userName; 182 | currentC.chatUserMail = userInUserList.mail; 183 | } else { 184 | print("Konuşulan kişinin verileri veritabanından çağırıldı."); 185 | var userDetailsInDatabase = 186 | await _firestoreDBService.readUser(currentC.chatUser); 187 | currentC.chatUserProfilePhotoUrl = 188 | userDetailsInDatabase.profilePhotoUrl; 189 | currentC.chatUserUserName = userDetailsInDatabase.userName; 190 | currentC.chatUserMail = userDetailsInDatabase.mail; 191 | } 192 | 193 | calculateTimeAgo(currentC, time); 194 | } 195 | return chatHistoryList; 196 | } 197 | } 198 | 199 | UserModel findUserInUserList(String userID) { 200 | for (int i = 0; i < allUsersList.length; i++) { 201 | if (allUsersList[i].userID == userID) { 202 | return allUsersList[i]; 203 | } 204 | } 205 | 206 | return null; 207 | } 208 | 209 | Future getUser(String userID) async { 210 | if (appMode == AppMode.DEBUG) { 211 | return null; 212 | } else { 213 | return await _firestoreDBService.getUser(userID); 214 | } 215 | } 216 | 217 | void calculateTimeAgo(ChatModel currentC, DateTime time) { 218 | currentC.lastSeenTime = time; 219 | timeago.setLocaleMessages("tr", timeago.TrMessages()); 220 | 221 | var _duration = time.difference(currentC.createdAt.toDate()); 222 | currentC.timeDifference = 223 | timeago.format(time.subtract(_duration), locale: "tr"); 224 | } 225 | 226 | Future> getAllUsersWithPagination( 227 | UserModel calledLastUser, int itemsPerPage) async { 228 | if (appMode == AppMode.DEBUG) { 229 | return []; 230 | } else { 231 | List _userList = await _firestoreDBService 232 | .getAllUsersWithPagination(calledLastUser, itemsPerPage); 233 | allUsersList.addAll(_userList); 234 | 235 | return _userList; 236 | } 237 | } 238 | 239 | Future> getMessagesWithPagination( 240 | String currentUserID, 241 | String chatUserID, 242 | MessageModel lastCalledMessage, 243 | int itemsPerPage) async { 244 | if (appMode == AppMode.DEBUG) { 245 | return []; 246 | } else { 247 | return await _firestoreDBService.getMessagesWithPagination( 248 | currentUserID, chatUserID, lastCalledMessage, itemsPerPage); 249 | } 250 | } 251 | 252 | Future resetPassword(String mail) { 253 | if (appMode == AppMode.DEBUG) { 254 | return null; 255 | } else { 256 | return _firebaseAuthService.resetPassword(mail); 257 | } 258 | } 259 | } 260 | -------------------------------------------------------------------------------- /lib/app/chat_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:bubble/bubble.dart'; 2 | import 'package:cloud_firestore/cloud_firestore.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_live_chat_app/app/profile_image_page.dart'; 5 | import 'package:flutter_live_chat_app/models/message_model.dart'; 6 | import 'package:flutter_live_chat_app/view_models/chat_view_model.dart'; 7 | import 'package:intl/intl.dart'; 8 | import 'package:provider/provider.dart'; 9 | 10 | class ChatPage extends StatefulWidget { 11 | @override 12 | _ChatPageState createState() => _ChatPageState(); 13 | } 14 | 15 | class _ChatPageState extends State { 16 | var _messageController = TextEditingController(); 17 | ScrollController _scrollController = ScrollController(); 18 | bool _isLoading = false; 19 | 20 | @override 21 | void initState() { 22 | super.initState(); 23 | _scrollController.addListener(_listScrollListener); 24 | } 25 | 26 | @override 27 | Widget build(BuildContext context) { 28 | final _chatViewModel = Provider.of(context); 29 | 30 | return Scaffold( 31 | appBar: AppBar( 32 | leading: IconButton( 33 | alignment: Alignment.centerLeft, 34 | highlightColor: Colors.transparent, 35 | splashColor: Colors.transparent, 36 | icon: Icon( 37 | Icons.arrow_back_ios, 38 | size: 16, 39 | color: Color(0xFFF2F6FA), 40 | ), 41 | color: Colors.white, 42 | onPressed: () { 43 | Navigator.maybePop(context); 44 | }, 45 | ), 46 | titleSpacing: -20, 47 | title: ListTile( 48 | contentPadding: EdgeInsets.zero, 49 | leading: GestureDetector( 50 | child: Container( 51 | child: Hero( 52 | tag: 'profilePhoto', 53 | child: CircleAvatar( 54 | backgroundImage: NetworkImage( 55 | _chatViewModel.chatUser.profilePhotoUrl, 56 | ), 57 | ), 58 | ), 59 | ), 60 | onTap: () { 61 | Navigator.of(context).push(MaterialPageRoute( 62 | builder: (context) => 63 | ProfilePhotoDetail(user: _chatViewModel.chatUser))); 64 | }, 65 | ), 66 | title: Text( 67 | "@" + _chatViewModel.chatUser.userName, 68 | style: TextStyle( 69 | color: Color(0xFFF2F6FA), 70 | fontWeight: FontWeight.bold, 71 | fontSize: 14), 72 | ), 73 | subtitle: Text( 74 | _chatViewModel.chatUser.mail, 75 | style: TextStyle(color: Color(0xFFF2F6FA), fontSize: 12), 76 | ), 77 | ), 78 | ), 79 | body: _chatViewModel.state == ChatViewState.Busy 80 | ? Center( 81 | child: CircularProgressIndicator(), 82 | ) 83 | : Center( 84 | child: Column( 85 | children: [ 86 | buildMessageList(), 87 | buildMessageInputArea(), 88 | ], 89 | ), 90 | )); 91 | } 92 | 93 | Widget buildMessageList() { 94 | return Consumer(builder: (context, model, child) { 95 | return Expanded( 96 | child: ListView.builder( 97 | reverse: true, 98 | controller: _scrollController, 99 | itemCount: model.hasMore 100 | ? model.allMessages.length + 1 101 | : model.allMessages.length, 102 | itemBuilder: (context, index) { 103 | if (model.hasMore && model.allMessages.length == index) { 104 | return _buildOldMessagesCircularProgressIndicator(); 105 | } else { 106 | if ((model.allMessages.length - 1) == index) { 107 | var _dateyMd = 108 | model.formatDateyMd(model.allMessages.last.date); 109 | return Column( 110 | children: [ 111 | Padding( 112 | padding: const EdgeInsets.only(top: 8.0, bottom: 8), 113 | child: Bubble( 114 | alignment: Alignment.center, 115 | color: Color.fromRGBO(212, 234, 244, 1.0), 116 | child: Text(_dateyMd.toString(), 117 | textAlign: TextAlign.center, 118 | style: TextStyle(fontSize: 10.0)), 119 | ), 120 | ), 121 | _buildMessageBalloon(model.allMessages.last), 122 | ], 123 | ); 124 | } else { 125 | var _dateyMd = 126 | model.formatDateyMd(model.allMessages[index].date); 127 | var _prevDateyMd = 128 | model.formatDateyMd(model.allMessages[index + 1].date); 129 | 130 | if (_dateyMd == _prevDateyMd) { 131 | return _buildMessageBalloon(model.allMessages[index]); 132 | } else { 133 | return Column( 134 | children: [ 135 | Padding( 136 | padding: const EdgeInsets.only(bottom: 8), 137 | child: Bubble( 138 | alignment: Alignment.center, 139 | color: Color.fromRGBO(212, 234, 244, 1.0), 140 | child: Text(_dateyMd.toString(), 141 | textAlign: TextAlign.center, 142 | style: TextStyle(fontSize: 10.0)), 143 | ), 144 | ), 145 | _buildMessageBalloon(model.allMessages[index]), 146 | ], 147 | ); 148 | } 149 | } 150 | } 151 | }), 152 | ); 153 | }); 154 | } 155 | 156 | Widget buildMessageInputArea() { 157 | final _chatViewModel = Provider.of(context); 158 | 159 | return Padding( 160 | padding: const EdgeInsets.all(8.0), 161 | child: Container( 162 | height: 100, 163 | padding: EdgeInsets.only(bottom: 0, left: 0), 164 | child: Row( 165 | children: [ 166 | Expanded( 167 | child: TextField( 168 | keyboardType: TextInputType.multiline, 169 | minLines: 4, 170 | maxLines: null, 171 | controller: _messageController, 172 | cursorColor: Theme.of(context).primaryColor, 173 | style: TextStyle( 174 | fontSize: 16, 175 | color: Colors.black, 176 | ), 177 | decoration: InputDecoration( 178 | fillColor: Colors.white, 179 | filled: true, 180 | hintText: "Bir mesaj yazın", 181 | border: OutlineInputBorder( 182 | borderRadius: BorderRadius.circular(20), 183 | borderSide: BorderSide.none, 184 | ), 185 | ), 186 | ), 187 | ), 188 | Container( 189 | height: 48, 190 | margin: EdgeInsets.symmetric(horizontal: 4), 191 | child: IconButton( 192 | splashColor: Colors.transparent, 193 | highlightColor: Colors.transparent, 194 | icon: Icon( 195 | Icons.send, 196 | size: 24, 197 | color: Color(0xFF414651), 198 | ), 199 | onPressed: () async { 200 | if (_messageController.text.trim().length > 0) { 201 | MessageModel _sendingMessage = MessageModel( 202 | fromWho: _chatViewModel.currentUser.userID, 203 | toWho: _chatViewModel.chatUser.userID, 204 | isFromMe: true, 205 | message: _messageController.text, 206 | chatOwner: _chatViewModel.currentUser.userID); 207 | 208 | _messageController.clear(); 209 | 210 | var _result = await _chatViewModel.sendMessage( 211 | _sendingMessage, _chatViewModel.currentUser); 212 | 213 | if (_result) { 214 | _scrollController.animateTo(0, 215 | duration: Duration(milliseconds: 50), 216 | curve: Curves.easeInCubic); 217 | } 218 | } 219 | }, 220 | ), 221 | ), 222 | ], 223 | ), 224 | ), 225 | ); 226 | } 227 | 228 | Widget _buildMessageBalloon(MessageModel currentMessage) { 229 | var _myMessage = currentMessage.isFromMe; 230 | var _dateHm = _formatDateHm(currentMessage.date); 231 | 232 | return _myMessage == true 233 | ? Column( 234 | crossAxisAlignment: CrossAxisAlignment.end, 235 | children: [ 236 | Bubble( 237 | stick: true, 238 | margin: BubbleEdges.all(5), 239 | alignment: Alignment.topRight, 240 | nip: BubbleNip.no, 241 | color: Colors.teal, 242 | child: Text( 243 | currentMessage.message, 244 | textAlign: TextAlign.right, 245 | style: TextStyle(color: Colors.white, fontSize: 13), 246 | ), 247 | ), 248 | Padding( 249 | padding: const EdgeInsets.only(right: 8.0), 250 | child: Text( 251 | _dateHm.toString(), 252 | textAlign: TextAlign.right, 253 | style: TextStyle(color: Colors.grey, fontSize: 10), 254 | ), 255 | ), 256 | ], 257 | ) 258 | : Column( 259 | crossAxisAlignment: CrossAxisAlignment.start, 260 | children: [ 261 | Bubble( 262 | stick: true, 263 | margin: BubbleEdges.all(5), 264 | alignment: Alignment.topLeft, 265 | nip: BubbleNip.no, 266 | color: Colors.white, 267 | child: Text( 268 | currentMessage.message, 269 | textAlign: TextAlign.right, 270 | style: TextStyle(color: Colors.black, fontSize: 13), 271 | ), 272 | ), 273 | Padding( 274 | padding: const EdgeInsets.only(left: 8.0), 275 | child: Text( 276 | _dateHm.toString(), 277 | textAlign: TextAlign.right, 278 | style: TextStyle(color: Colors.grey, fontSize: 10), 279 | ), 280 | ), 281 | ], 282 | ); 283 | } 284 | 285 | String _formatDateHm(Timestamp date) { 286 | var dateFormat = DateFormat.Hm(); 287 | var _formatter = dateFormat; 288 | var _formattedDate = _formatter.format(date.toDate()); 289 | return _formattedDate; 290 | } 291 | 292 | void _listScrollListener() { 293 | if (_scrollController.offset >= 294 | _scrollController.position.maxScrollExtent && 295 | !_scrollController.position.outOfRange) { 296 | getMoreOldMessages(); 297 | } 298 | } 299 | 300 | void getMoreOldMessages() async { 301 | final _chatViewModel = Provider.of(context, listen: false); 302 | if (_isLoading == false) { 303 | _isLoading = true; 304 | await _chatViewModel.getMoreOldMessages(); 305 | _isLoading = false; 306 | } 307 | } 308 | 309 | Widget _buildOldMessagesCircularProgressIndicator() { 310 | return Padding( 311 | padding: EdgeInsets.all(8), 312 | child: Center( 313 | child: CircularProgressIndicator(), 314 | ), 315 | ); 316 | } 317 | } 318 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/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.5.0" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.1.0" 18 | bubble: 19 | dependency: "direct main" 20 | description: 21 | name: bubble 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.1.9+1" 25 | characters: 26 | dependency: transitive 27 | description: 28 | name: characters 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.1.0" 32 | charcode: 33 | dependency: transitive 34 | description: 35 | name: charcode 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.2.0" 39 | clock: 40 | dependency: transitive 41 | description: 42 | name: clock 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.1.0" 46 | cloud_firestore: 47 | dependency: "direct main" 48 | description: 49 | name: cloud_firestore 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "0.14.1+3" 53 | cloud_firestore_platform_interface: 54 | dependency: transitive 55 | description: 56 | name: cloud_firestore_platform_interface 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "2.1.2" 60 | cloud_firestore_web: 61 | dependency: transitive 62 | description: 63 | name: cloud_firestore_web 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "0.2.0+4" 67 | collection: 68 | dependency: transitive 69 | description: 70 | name: collection 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "1.15.0" 74 | convert: 75 | dependency: transitive 76 | description: 77 | name: convert 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "2.1.1" 81 | crypto: 82 | dependency: transitive 83 | description: 84 | name: crypto 85 | url: "https://pub.dartlang.org" 86 | source: hosted 87 | version: "2.1.5" 88 | cupertino_icons: 89 | dependency: "direct main" 90 | description: 91 | name: cupertino_icons 92 | url: "https://pub.dartlang.org" 93 | source: hosted 94 | version: "0.1.3" 95 | fake_async: 96 | dependency: transitive 97 | description: 98 | name: fake_async 99 | url: "https://pub.dartlang.org" 100 | source: hosted 101 | version: "1.2.0" 102 | ffi: 103 | dependency: transitive 104 | description: 105 | name: ffi 106 | url: "https://pub.dartlang.org" 107 | source: hosted 108 | version: "0.1.3" 109 | file: 110 | dependency: transitive 111 | description: 112 | name: file 113 | url: "https://pub.dartlang.org" 114 | source: hosted 115 | version: "5.2.1" 116 | firebase: 117 | dependency: transitive 118 | description: 119 | name: firebase 120 | url: "https://pub.dartlang.org" 121 | source: hosted 122 | version: "7.3.2" 123 | firebase_auth: 124 | dependency: "direct main" 125 | description: 126 | name: firebase_auth 127 | url: "https://pub.dartlang.org" 128 | source: hosted 129 | version: "0.18.1+2" 130 | firebase_auth_platform_interface: 131 | dependency: transitive 132 | description: 133 | name: firebase_auth_platform_interface 134 | url: "https://pub.dartlang.org" 135 | source: hosted 136 | version: "2.1.1" 137 | firebase_auth_web: 138 | dependency: transitive 139 | description: 140 | name: firebase_auth_web 141 | url: "https://pub.dartlang.org" 142 | source: hosted 143 | version: "0.3.1+1" 144 | firebase_core: 145 | dependency: "direct main" 146 | description: 147 | name: firebase_core 148 | url: "https://pub.dartlang.org" 149 | source: hosted 150 | version: "0.5.0+1" 151 | firebase_core_platform_interface: 152 | dependency: transitive 153 | description: 154 | name: firebase_core_platform_interface 155 | url: "https://pub.dartlang.org" 156 | source: hosted 157 | version: "2.0.0" 158 | firebase_core_web: 159 | dependency: transitive 160 | description: 161 | name: firebase_core_web 162 | url: "https://pub.dartlang.org" 163 | source: hosted 164 | version: "0.2.0" 165 | firebase_messaging: 166 | dependency: "direct main" 167 | description: 168 | name: firebase_messaging 169 | url: "https://pub.dartlang.org" 170 | source: hosted 171 | version: "7.0.3" 172 | firebase_storage: 173 | dependency: "direct main" 174 | description: 175 | name: firebase_storage 176 | url: "https://pub.dartlang.org" 177 | source: hosted 178 | version: "4.0.1" 179 | flutter: 180 | dependency: "direct main" 181 | description: flutter 182 | source: sdk 183 | version: "0.0.0" 184 | flutter_local_notifications: 185 | dependency: "direct main" 186 | description: 187 | name: flutter_local_notifications 188 | url: "https://pub.dartlang.org" 189 | source: hosted 190 | version: "1.5.0+1" 191 | flutter_local_notifications_platform_interface: 192 | dependency: transitive 193 | description: 194 | name: flutter_local_notifications_platform_interface 195 | url: "https://pub.dartlang.org" 196 | source: hosted 197 | version: "1.0.1" 198 | flutter_plugin_android_lifecycle: 199 | dependency: transitive 200 | description: 201 | name: flutter_plugin_android_lifecycle 202 | url: "https://pub.dartlang.org" 203 | source: hosted 204 | version: "1.0.11" 205 | flutter_test: 206 | dependency: "direct dev" 207 | description: flutter 208 | source: sdk 209 | version: "0.0.0" 210 | flutter_web_plugins: 211 | dependency: transitive 212 | description: flutter 213 | source: sdk 214 | version: "0.0.0" 215 | get_it: 216 | dependency: "direct main" 217 | description: 218 | name: get_it 219 | url: "https://pub.dartlang.org" 220 | source: hosted 221 | version: "4.0.4" 222 | google_fonts: 223 | dependency: "direct main" 224 | description: 225 | name: google_fonts 226 | url: "https://pub.dartlang.org" 227 | source: hosted 228 | version: "1.1.1" 229 | google_sign_in: 230 | dependency: "direct main" 231 | description: 232 | name: google_sign_in 233 | url: "https://pub.dartlang.org" 234 | source: hosted 235 | version: "4.5.5" 236 | google_sign_in_platform_interface: 237 | dependency: transitive 238 | description: 239 | name: google_sign_in_platform_interface 240 | url: "https://pub.dartlang.org" 241 | source: hosted 242 | version: "1.1.2" 243 | google_sign_in_web: 244 | dependency: transitive 245 | description: 246 | name: google_sign_in_web 247 | url: "https://pub.dartlang.org" 248 | source: hosted 249 | version: "0.9.2" 250 | http: 251 | dependency: "direct main" 252 | description: 253 | name: http 254 | url: "https://pub.dartlang.org" 255 | source: hosted 256 | version: "0.12.2" 257 | http_parser: 258 | dependency: transitive 259 | description: 260 | name: http_parser 261 | url: "https://pub.dartlang.org" 262 | source: hosted 263 | version: "3.1.4" 264 | image_picker: 265 | dependency: "direct main" 266 | description: 267 | name: image_picker 268 | url: "https://pub.dartlang.org" 269 | source: hosted 270 | version: "0.6.7+12" 271 | image_picker_platform_interface: 272 | dependency: transitive 273 | description: 274 | name: image_picker_platform_interface 275 | url: "https://pub.dartlang.org" 276 | source: hosted 277 | version: "1.1.1" 278 | intl: 279 | dependency: "direct main" 280 | description: 281 | name: intl 282 | url: "https://pub.dartlang.org" 283 | source: hosted 284 | version: "0.16.1" 285 | js: 286 | dependency: transitive 287 | description: 288 | name: js 289 | url: "https://pub.dartlang.org" 290 | source: hosted 291 | version: "0.6.3" 292 | matcher: 293 | dependency: transitive 294 | description: 295 | name: matcher 296 | url: "https://pub.dartlang.org" 297 | source: hosted 298 | version: "0.12.10" 299 | meta: 300 | dependency: transitive 301 | description: 302 | name: meta 303 | url: "https://pub.dartlang.org" 304 | source: hosted 305 | version: "1.3.0" 306 | nested: 307 | dependency: transitive 308 | description: 309 | name: nested 310 | url: "https://pub.dartlang.org" 311 | source: hosted 312 | version: "0.0.4" 313 | path: 314 | dependency: transitive 315 | description: 316 | name: path 317 | url: "https://pub.dartlang.org" 318 | source: hosted 319 | version: "1.8.0" 320 | path_provider: 321 | dependency: transitive 322 | description: 323 | name: path_provider 324 | url: "https://pub.dartlang.org" 325 | source: hosted 326 | version: "1.6.21" 327 | path_provider_linux: 328 | dependency: transitive 329 | description: 330 | name: path_provider_linux 331 | url: "https://pub.dartlang.org" 332 | source: hosted 333 | version: "0.0.1+2" 334 | path_provider_macos: 335 | dependency: transitive 336 | description: 337 | name: path_provider_macos 338 | url: "https://pub.dartlang.org" 339 | source: hosted 340 | version: "0.0.4+4" 341 | path_provider_platform_interface: 342 | dependency: transitive 343 | description: 344 | name: path_provider_platform_interface 345 | url: "https://pub.dartlang.org" 346 | source: hosted 347 | version: "1.0.3" 348 | path_provider_windows: 349 | dependency: transitive 350 | description: 351 | name: path_provider_windows 352 | url: "https://pub.dartlang.org" 353 | source: hosted 354 | version: "0.0.4+1" 355 | pedantic: 356 | dependency: transitive 357 | description: 358 | name: pedantic 359 | url: "https://pub.dartlang.org" 360 | source: hosted 361 | version: "1.9.2" 362 | platform: 363 | dependency: transitive 364 | description: 365 | name: platform 366 | url: "https://pub.dartlang.org" 367 | source: hosted 368 | version: "2.2.1" 369 | plugin_platform_interface: 370 | dependency: transitive 371 | description: 372 | name: plugin_platform_interface 373 | url: "https://pub.dartlang.org" 374 | source: hosted 375 | version: "1.0.3" 376 | process: 377 | dependency: transitive 378 | description: 379 | name: process 380 | url: "https://pub.dartlang.org" 381 | source: hosted 382 | version: "3.0.13" 383 | provider: 384 | dependency: "direct main" 385 | description: 386 | name: provider 387 | url: "https://pub.dartlang.org" 388 | source: hosted 389 | version: "4.3.2+2" 390 | quiver: 391 | dependency: transitive 392 | description: 393 | name: quiver 394 | url: "https://pub.dartlang.org" 395 | source: hosted 396 | version: "2.1.3" 397 | sky_engine: 398 | dependency: transitive 399 | description: flutter 400 | source: sdk 401 | version: "0.0.99" 402 | source_span: 403 | dependency: transitive 404 | description: 405 | name: source_span 406 | url: "https://pub.dartlang.org" 407 | source: hosted 408 | version: "1.8.0" 409 | stack_trace: 410 | dependency: transitive 411 | description: 412 | name: stack_trace 413 | url: "https://pub.dartlang.org" 414 | source: hosted 415 | version: "1.10.0" 416 | stream_channel: 417 | dependency: transitive 418 | description: 419 | name: stream_channel 420 | url: "https://pub.dartlang.org" 421 | source: hosted 422 | version: "2.1.0" 423 | string_scanner: 424 | dependency: transitive 425 | description: 426 | name: string_scanner 427 | url: "https://pub.dartlang.org" 428 | source: hosted 429 | version: "1.1.0" 430 | term_glyph: 431 | dependency: transitive 432 | description: 433 | name: term_glyph 434 | url: "https://pub.dartlang.org" 435 | source: hosted 436 | version: "1.2.0" 437 | test_api: 438 | dependency: transitive 439 | description: 440 | name: test_api 441 | url: "https://pub.dartlang.org" 442 | source: hosted 443 | version: "0.2.19" 444 | timeago: 445 | dependency: "direct main" 446 | description: 447 | name: timeago 448 | url: "https://pub.dartlang.org" 449 | source: hosted 450 | version: "2.0.27" 451 | typed_data: 452 | dependency: transitive 453 | description: 454 | name: typed_data 455 | url: "https://pub.dartlang.org" 456 | source: hosted 457 | version: "1.3.0" 458 | vector_math: 459 | dependency: transitive 460 | description: 461 | name: vector_math 462 | url: "https://pub.dartlang.org" 463 | source: hosted 464 | version: "2.1.0" 465 | win32: 466 | dependency: transitive 467 | description: 468 | name: win32 469 | url: "https://pub.dartlang.org" 470 | source: hosted 471 | version: "1.7.3" 472 | xdg_directories: 473 | dependency: transitive 474 | description: 475 | name: xdg_directories 476 | url: "https://pub.dartlang.org" 477 | source: hosted 478 | version: "0.1.2" 479 | sdks: 480 | dart: ">=2.12.0-0.0 <3.0.0" 481 | flutter: ">=1.17.0" 482 | -------------------------------------------------------------------------------- /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 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXCopyFilesBuildPhase section */ 19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 20 | isa = PBXCopyFilesBuildPhase; 21 | buildActionMask = 2147483647; 22 | dstPath = ""; 23 | dstSubfolderSpec = 10; 24 | files = ( 25 | ); 26 | name = "Embed Frameworks"; 27 | runOnlyForDeploymentPostprocessing = 0; 28 | }; 29 | /* End PBXCopyFilesBuildPhase section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 9740EEB11CF90186004384FC /* Flutter */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 65 | ); 66 | name = Flutter; 67 | sourceTree = ""; 68 | }; 69 | 97C146E51CF9000F007C117D = { 70 | isa = PBXGroup; 71 | children = ( 72 | 9740EEB11CF90186004384FC /* Flutter */, 73 | 97C146F01CF9000F007C117D /* Runner */, 74 | 97C146EF1CF9000F007C117D /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 97C146EF1CF9000F007C117D /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 97C146EE1CF9000F007C117D /* Runner.app */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | 97C146F01CF9000F007C117D /* Runner */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 92 | 97C147021CF9000F007C117D /* Info.plist */, 93 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 94 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 95 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 96 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 97 | ); 98 | path = Runner; 99 | sourceTree = ""; 100 | }; 101 | /* End PBXGroup section */ 102 | 103 | /* Begin PBXNativeTarget section */ 104 | 97C146ED1CF9000F007C117D /* Runner */ = { 105 | isa = PBXNativeTarget; 106 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 107 | buildPhases = ( 108 | 9740EEB61CF901F6004384FC /* Run Script */, 109 | 97C146EA1CF9000F007C117D /* Sources */, 110 | 97C146EB1CF9000F007C117D /* Frameworks */, 111 | 97C146EC1CF9000F007C117D /* Resources */, 112 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 113 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 114 | ); 115 | buildRules = ( 116 | ); 117 | dependencies = ( 118 | ); 119 | name = Runner; 120 | productName = Runner; 121 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 122 | productType = "com.apple.product-type.application"; 123 | }; 124 | /* End PBXNativeTarget section */ 125 | 126 | /* Begin PBXProject section */ 127 | 97C146E61CF9000F007C117D /* Project object */ = { 128 | isa = PBXProject; 129 | attributes = { 130 | LastUpgradeCheck = 1020; 131 | ORGANIZATIONNAME = ""; 132 | TargetAttributes = { 133 | 97C146ED1CF9000F007C117D = { 134 | CreatedOnToolsVersion = 7.3.1; 135 | LastSwiftMigration = 1100; 136 | }; 137 | }; 138 | }; 139 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 140 | compatibilityVersion = "Xcode 9.3"; 141 | developmentRegion = en; 142 | hasScannedForEncodings = 0; 143 | knownRegions = ( 144 | en, 145 | Base, 146 | ); 147 | mainGroup = 97C146E51CF9000F007C117D; 148 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 149 | projectDirPath = ""; 150 | projectRoot = ""; 151 | targets = ( 152 | 97C146ED1CF9000F007C117D /* Runner */, 153 | ); 154 | }; 155 | /* End PBXProject section */ 156 | 157 | /* Begin PBXResourcesBuildPhase section */ 158 | 97C146EC1CF9000F007C117D /* Resources */ = { 159 | isa = PBXResourcesBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 163 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 164 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 165 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXResourcesBuildPhase section */ 170 | 171 | /* Begin PBXShellScriptBuildPhase section */ 172 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 173 | isa = PBXShellScriptBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | ); 177 | inputPaths = ( 178 | ); 179 | name = "Thin Binary"; 180 | outputPaths = ( 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | shellPath = /bin/sh; 184 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 185 | }; 186 | 9740EEB61CF901F6004384FC /* Run Script */ = { 187 | isa = PBXShellScriptBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | ); 191 | inputPaths = ( 192 | ); 193 | name = "Run Script"; 194 | outputPaths = ( 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | shellPath = /bin/sh; 198 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 199 | }; 200 | /* End PBXShellScriptBuildPhase section */ 201 | 202 | /* Begin PBXSourcesBuildPhase section */ 203 | 97C146EA1CF9000F007C117D /* Sources */ = { 204 | isa = PBXSourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 208 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 209 | ); 210 | runOnlyForDeploymentPostprocessing = 0; 211 | }; 212 | /* End PBXSourcesBuildPhase section */ 213 | 214 | /* Begin PBXVariantGroup section */ 215 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 216 | isa = PBXVariantGroup; 217 | children = ( 218 | 97C146FB1CF9000F007C117D /* Base */, 219 | ); 220 | name = Main.storyboard; 221 | sourceTree = ""; 222 | }; 223 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 224 | isa = PBXVariantGroup; 225 | children = ( 226 | 97C147001CF9000F007C117D /* Base */, 227 | ); 228 | name = LaunchScreen.storyboard; 229 | sourceTree = ""; 230 | }; 231 | /* End PBXVariantGroup section */ 232 | 233 | /* Begin XCBuildConfiguration section */ 234 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 235 | isa = XCBuildConfiguration; 236 | buildSettings = { 237 | ALWAYS_SEARCH_USER_PATHS = NO; 238 | CLANG_ANALYZER_NONNULL = YES; 239 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 240 | CLANG_CXX_LIBRARY = "libc++"; 241 | CLANG_ENABLE_MODULES = YES; 242 | CLANG_ENABLE_OBJC_ARC = YES; 243 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 244 | CLANG_WARN_BOOL_CONVERSION = YES; 245 | CLANG_WARN_COMMA = YES; 246 | CLANG_WARN_CONSTANT_CONVERSION = YES; 247 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 248 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 249 | CLANG_WARN_EMPTY_BODY = YES; 250 | CLANG_WARN_ENUM_CONVERSION = YES; 251 | CLANG_WARN_INFINITE_RECURSION = YES; 252 | CLANG_WARN_INT_CONVERSION = YES; 253 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 254 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 255 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 256 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 257 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 258 | CLANG_WARN_STRICT_PROTOTYPES = YES; 259 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 260 | CLANG_WARN_UNREACHABLE_CODE = YES; 261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 262 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 263 | COPY_PHASE_STRIP = NO; 264 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 265 | ENABLE_NS_ASSERTIONS = NO; 266 | ENABLE_STRICT_OBJC_MSGSEND = YES; 267 | GCC_C_LANGUAGE_STANDARD = gnu99; 268 | GCC_NO_COMMON_BLOCKS = YES; 269 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 270 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 271 | GCC_WARN_UNDECLARED_SELECTOR = YES; 272 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 273 | GCC_WARN_UNUSED_FUNCTION = YES; 274 | GCC_WARN_UNUSED_VARIABLE = YES; 275 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 276 | MTL_ENABLE_DEBUG_INFO = NO; 277 | SDKROOT = iphoneos; 278 | SUPPORTED_PLATFORMS = iphoneos; 279 | TARGETED_DEVICE_FAMILY = "1,2"; 280 | VALIDATE_PRODUCT = YES; 281 | }; 282 | name = Profile; 283 | }; 284 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 285 | isa = XCBuildConfiguration; 286 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 287 | buildSettings = { 288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 289 | CLANG_ENABLE_MODULES = YES; 290 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 291 | ENABLE_BITCODE = NO; 292 | FRAMEWORK_SEARCH_PATHS = ( 293 | "$(inherited)", 294 | "$(PROJECT_DIR)/Flutter", 295 | ); 296 | INFOPLIST_FILE = Runner/Info.plist; 297 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 298 | LIBRARY_SEARCH_PATHS = ( 299 | "$(inherited)", 300 | "$(PROJECT_DIR)/Flutter", 301 | ); 302 | PRODUCT_BUNDLE_IDENTIFIER = com.berkanaslan.liveChat; 303 | PRODUCT_NAME = "$(TARGET_NAME)"; 304 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 305 | SWIFT_VERSION = 5.0; 306 | VERSIONING_SYSTEM = "apple-generic"; 307 | }; 308 | name = Profile; 309 | }; 310 | 97C147031CF9000F007C117D /* Debug */ = { 311 | isa = XCBuildConfiguration; 312 | buildSettings = { 313 | ALWAYS_SEARCH_USER_PATHS = NO; 314 | CLANG_ANALYZER_NONNULL = YES; 315 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 316 | CLANG_CXX_LIBRARY = "libc++"; 317 | CLANG_ENABLE_MODULES = YES; 318 | CLANG_ENABLE_OBJC_ARC = YES; 319 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 320 | CLANG_WARN_BOOL_CONVERSION = YES; 321 | CLANG_WARN_COMMA = YES; 322 | CLANG_WARN_CONSTANT_CONVERSION = YES; 323 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 324 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 325 | CLANG_WARN_EMPTY_BODY = YES; 326 | CLANG_WARN_ENUM_CONVERSION = YES; 327 | CLANG_WARN_INFINITE_RECURSION = YES; 328 | CLANG_WARN_INT_CONVERSION = YES; 329 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 330 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 331 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 332 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 333 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 334 | CLANG_WARN_STRICT_PROTOTYPES = YES; 335 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 336 | CLANG_WARN_UNREACHABLE_CODE = YES; 337 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 338 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 339 | COPY_PHASE_STRIP = NO; 340 | DEBUG_INFORMATION_FORMAT = dwarf; 341 | ENABLE_STRICT_OBJC_MSGSEND = YES; 342 | ENABLE_TESTABILITY = YES; 343 | GCC_C_LANGUAGE_STANDARD = gnu99; 344 | GCC_DYNAMIC_NO_PIC = NO; 345 | GCC_NO_COMMON_BLOCKS = YES; 346 | GCC_OPTIMIZATION_LEVEL = 0; 347 | GCC_PREPROCESSOR_DEFINITIONS = ( 348 | "DEBUG=1", 349 | "$(inherited)", 350 | ); 351 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 352 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 353 | GCC_WARN_UNDECLARED_SELECTOR = YES; 354 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 355 | GCC_WARN_UNUSED_FUNCTION = YES; 356 | GCC_WARN_UNUSED_VARIABLE = YES; 357 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 358 | MTL_ENABLE_DEBUG_INFO = YES; 359 | ONLY_ACTIVE_ARCH = YES; 360 | SDKROOT = iphoneos; 361 | TARGETED_DEVICE_FAMILY = "1,2"; 362 | }; 363 | name = Debug; 364 | }; 365 | 97C147041CF9000F007C117D /* Release */ = { 366 | isa = XCBuildConfiguration; 367 | buildSettings = { 368 | ALWAYS_SEARCH_USER_PATHS = NO; 369 | CLANG_ANALYZER_NONNULL = YES; 370 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 371 | CLANG_CXX_LIBRARY = "libc++"; 372 | CLANG_ENABLE_MODULES = YES; 373 | CLANG_ENABLE_OBJC_ARC = YES; 374 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 375 | CLANG_WARN_BOOL_CONVERSION = YES; 376 | CLANG_WARN_COMMA = YES; 377 | CLANG_WARN_CONSTANT_CONVERSION = YES; 378 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 379 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 380 | CLANG_WARN_EMPTY_BODY = YES; 381 | CLANG_WARN_ENUM_CONVERSION = YES; 382 | CLANG_WARN_INFINITE_RECURSION = YES; 383 | CLANG_WARN_INT_CONVERSION = YES; 384 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 385 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 386 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 387 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 388 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 389 | CLANG_WARN_STRICT_PROTOTYPES = YES; 390 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 391 | CLANG_WARN_UNREACHABLE_CODE = YES; 392 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 393 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 394 | COPY_PHASE_STRIP = NO; 395 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 396 | ENABLE_NS_ASSERTIONS = NO; 397 | ENABLE_STRICT_OBJC_MSGSEND = YES; 398 | GCC_C_LANGUAGE_STANDARD = gnu99; 399 | GCC_NO_COMMON_BLOCKS = YES; 400 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 401 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 402 | GCC_WARN_UNDECLARED_SELECTOR = YES; 403 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 404 | GCC_WARN_UNUSED_FUNCTION = YES; 405 | GCC_WARN_UNUSED_VARIABLE = YES; 406 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 407 | MTL_ENABLE_DEBUG_INFO = NO; 408 | SDKROOT = iphoneos; 409 | SUPPORTED_PLATFORMS = iphoneos; 410 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 411 | TARGETED_DEVICE_FAMILY = "1,2"; 412 | VALIDATE_PRODUCT = YES; 413 | }; 414 | name = Release; 415 | }; 416 | 97C147061CF9000F007C117D /* Debug */ = { 417 | isa = XCBuildConfiguration; 418 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 419 | buildSettings = { 420 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 421 | CLANG_ENABLE_MODULES = YES; 422 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 423 | ENABLE_BITCODE = NO; 424 | FRAMEWORK_SEARCH_PATHS = ( 425 | "$(inherited)", 426 | "$(PROJECT_DIR)/Flutter", 427 | ); 428 | INFOPLIST_FILE = Runner/Info.plist; 429 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 430 | LIBRARY_SEARCH_PATHS = ( 431 | "$(inherited)", 432 | "$(PROJECT_DIR)/Flutter", 433 | ); 434 | PRODUCT_BUNDLE_IDENTIFIER = com.berkanaslan.liveChat; 435 | PRODUCT_NAME = "$(TARGET_NAME)"; 436 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 437 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 438 | SWIFT_VERSION = 5.0; 439 | VERSIONING_SYSTEM = "apple-generic"; 440 | }; 441 | name = Debug; 442 | }; 443 | 97C147071CF9000F007C117D /* Release */ = { 444 | isa = XCBuildConfiguration; 445 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 446 | buildSettings = { 447 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 448 | CLANG_ENABLE_MODULES = YES; 449 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 450 | ENABLE_BITCODE = NO; 451 | FRAMEWORK_SEARCH_PATHS = ( 452 | "$(inherited)", 453 | "$(PROJECT_DIR)/Flutter", 454 | ); 455 | INFOPLIST_FILE = Runner/Info.plist; 456 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 457 | LIBRARY_SEARCH_PATHS = ( 458 | "$(inherited)", 459 | "$(PROJECT_DIR)/Flutter", 460 | ); 461 | PRODUCT_BUNDLE_IDENTIFIER = com.berkanaslan.liveChat; 462 | PRODUCT_NAME = "$(TARGET_NAME)"; 463 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 464 | SWIFT_VERSION = 5.0; 465 | VERSIONING_SYSTEM = "apple-generic"; 466 | }; 467 | name = Release; 468 | }; 469 | /* End XCBuildConfiguration section */ 470 | 471 | /* Begin XCConfigurationList section */ 472 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 473 | isa = XCConfigurationList; 474 | buildConfigurations = ( 475 | 97C147031CF9000F007C117D /* Debug */, 476 | 97C147041CF9000F007C117D /* Release */, 477 | 249021D3217E4FDB00AE95B9 /* Profile */, 478 | ); 479 | defaultConfigurationIsVisible = 0; 480 | defaultConfigurationName = Release; 481 | }; 482 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 483 | isa = XCConfigurationList; 484 | buildConfigurations = ( 485 | 97C147061CF9000F007C117D /* Debug */, 486 | 97C147071CF9000F007C117D /* Release */, 487 | 249021D4217E4FDB00AE95B9 /* Profile */, 488 | ); 489 | defaultConfigurationIsVisible = 0; 490 | defaultConfigurationName = Release; 491 | }; 492 | /* End XCConfigurationList section */ 493 | }; 494 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 495 | } 496 | --------------------------------------------------------------------------------