├── firebase.json ├── functions ├── .gitignore ├── package.json └── index.js ├── 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 ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ ├── xcshareddata │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ └── project.pbxproj └── .gitignore ├── .firebaserc ├── assets ├── images │ ├── search.png │ ├── upload.png │ ├── no_content.png │ ├── activity_feed.png │ ├── google_signin_button.png │ └── upload.svg ├── fonts │ ├── Signatra.otf │ ├── Signatra.ttf │ ├── Indie_Flower.zip │ ├── IndieFlower-Regular.ttf │ └── OFL.txt └── gitimages │ ├── insta0.JPG │ ├── insta1.JPG │ ├── insta2.JPG │ ├── insta3.JPG │ ├── insta4.JPG │ ├── insta5.JPG │ ├── insta6.JPG │ ├── insta7.JPG │ ├── insta8.JPG │ ├── insta9.JPG │ ├── insta10.JPG │ ├── insta11.JPG │ └── insta12.JPG ├── android ├── gradle.properties ├── .gitignore ├── 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 │ │ │ │ ├── values │ │ │ │ │ └── styles.xml │ │ │ │ └── drawable │ │ │ │ │ └── launch_background.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── socialmedia │ │ │ │ │ └── MainActivity.kt │ │ │ └── AndroidManifest.xml │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── google-services.json │ └── build.gradle ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── settings.gradle └── build.gradle ├── .metadata ├── lib ├── main.dart ├── widgets │ ├── custome_image.dart │ ├── progress.dart │ ├── post_tile.dart │ ├── header.dart │ └── post.dart ├── model │ └── user.dart └── pages │ ├── post_screen.dart │ ├── create_account.dart │ ├── timeline.dart │ ├── comment.dart │ ├── search.dart │ ├── activity_feed.dart │ ├── edit_profile.dart │ ├── home.dart │ ├── upload.dart │ └── profile.dart ├── .gitignore ├── test └── widget_test.dart ├── README.md ├── pubspec.yaml └── pubspec.lock /firebase.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /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" -------------------------------------------------------------------------------- /.firebaserc: -------------------------------------------------------------------------------- 1 | { 2 | "projects": { 3 | "default": "socialmediafirestore" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /assets/images/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/HEAD/assets/images/search.png -------------------------------------------------------------------------------- /assets/images/upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/HEAD/assets/images/upload.png -------------------------------------------------------------------------------- /assets/fonts/Signatra.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/HEAD/assets/fonts/Signatra.otf -------------------------------------------------------------------------------- /assets/fonts/Signatra.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/HEAD/assets/fonts/Signatra.ttf -------------------------------------------------------------------------------- /assets/gitimages/insta0.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/HEAD/assets/gitimages/insta0.JPG -------------------------------------------------------------------------------- /assets/gitimages/insta1.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/HEAD/assets/gitimages/insta1.JPG -------------------------------------------------------------------------------- /assets/gitimages/insta2.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/HEAD/assets/gitimages/insta2.JPG -------------------------------------------------------------------------------- /assets/gitimages/insta3.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/HEAD/assets/gitimages/insta3.JPG -------------------------------------------------------------------------------- /assets/gitimages/insta4.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/HEAD/assets/gitimages/insta4.JPG -------------------------------------------------------------------------------- /assets/gitimages/insta5.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/HEAD/assets/gitimages/insta5.JPG -------------------------------------------------------------------------------- /assets/gitimages/insta6.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/HEAD/assets/gitimages/insta6.JPG -------------------------------------------------------------------------------- /assets/gitimages/insta7.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/HEAD/assets/gitimages/insta7.JPG -------------------------------------------------------------------------------- /assets/gitimages/insta8.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/HEAD/assets/gitimages/insta8.JPG -------------------------------------------------------------------------------- /assets/gitimages/insta9.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/HEAD/assets/gitimages/insta9.JPG -------------------------------------------------------------------------------- /assets/fonts/Indie_Flower.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/HEAD/assets/fonts/Indie_Flower.zip -------------------------------------------------------------------------------- /assets/gitimages/insta10.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/HEAD/assets/gitimages/insta10.JPG -------------------------------------------------------------------------------- /assets/gitimages/insta11.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/HEAD/assets/gitimages/insta11.JPG -------------------------------------------------------------------------------- /assets/gitimages/insta12.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/HEAD/assets/gitimages/insta12.JPG -------------------------------------------------------------------------------- /assets/images/no_content.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/HEAD/assets/images/no_content.png -------------------------------------------------------------------------------- /assets/images/activity_feed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/HEAD/assets/images/activity_feed.png -------------------------------------------------------------------------------- /assets/fonts/IndieFlower-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/HEAD/assets/fonts/IndieFlower-Regular.ttf -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /assets/images/google_signin_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/HEAD/assets/images/google_signin_button.png -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/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/sudoosama/Instagram-clone-flutter/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/sudoosama/Instagram-clone-flutter/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/sudoosama/Instagram-clone-flutter/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/sudoosama/Instagram-clone-flutter/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/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/sudoosama/Instagram-clone-flutter/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/sudoosama/Instagram-clone-flutter/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/sudoosama/Instagram-clone-flutter/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/sudoosama/Instagram-clone-flutter/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/sudoosama/Instagram-clone-flutter/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/sudoosama/Instagram-clone-flutter/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/sudoosama/Instagram-clone-flutter/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/sudoosama/Instagram-clone-flutter/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/sudoosama/Instagram-clone-flutter/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/sudoosama/Instagram-clone-flutter/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/sudoosama/Instagram-clone-flutter/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/sudoosama/Instagram-clone-flutter/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/sudoosama/Instagram-clone-flutter/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudoosama/Instagram-clone-flutter/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/sudoosama/Instagram-clone-flutter/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-5.6.2-all.zip 7 | -------------------------------------------------------------------------------- /.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: 27321ebbad34b0a3fafe99fac037102196d655ff 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. -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | //import 'package:cloud_firestore/cloud_firestore.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:socialmedia/pages/home.dart'; 4 | 5 | void main() { 6 | 7 | runApp(MyApp()); 8 | } 9 | 10 | class MyApp extends StatelessWidget { 11 | @override 12 | Widget build(BuildContext context) { 13 | return MaterialApp( 14 | title: 'Social Media App', 15 | debugShowCheckedModeBanner: false, 16 | home: Home(), 17 | ); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /lib/widgets/custome_image.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:cached_network_image/cached_network_image.dart'; 3 | 4 | Widget cachedNetworkImage(mediaUrl){ 5 | return CachedNetworkImage(imageUrl: mediaUrl, 6 | fit: BoxFit.cover, 7 | placeholder: (context,url)=>Padding( 8 | child: CircularProgressIndicator(), 9 | padding: EdgeInsets.all(20.0) 10 | ), 11 | errorWidget: (context,url,error)=> 12 | Icon(Icons.error), 13 | ); 14 | } -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/socialmedia/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.socialmedia 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 | class MainActivity: FlutterActivity() { 9 | override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { 10 | GeneratedPluginRegistrant.registerWith(flutterEngine); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /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/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /lib/widgets/progress.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | circularProgress(){ 4 | return Container( 5 | alignment: Alignment.center, 6 | padding: EdgeInsets.only(top: 10.0), 7 | child: CircularProgressIndicator( 8 | valueColor: AlwaysStoppedAnimation(Colors.purple), 9 | ), 10 | ); 11 | } 12 | 13 | Container linearProgress(){ 14 | return Container( 15 | padding: EdgeInsets.only(bottom: 10.0), 16 | child: LinearProgressIndicator( 17 | valueColor: AlwaysStoppedAnimation(Colors.purple), 18 | ), 19 | ); 20 | } -------------------------------------------------------------------------------- /functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "description": "Cloud Functions for Firebase", 4 | "scripts": { 5 | "serve": "firebase emulators:start --only functions", 6 | "shell": "firebase functions:shell", 7 | "start": "npm run shell", 8 | "deploy": "firebase deploy --only functions", 9 | "logs": "firebase functions:log" 10 | }, 11 | "engines": { 12 | "node": "8" 13 | }, 14 | "dependencies": { 15 | "firebase-admin": "^8.9.0", 16 | "firebase-functions": "^3.3.0" 17 | }, 18 | "devDependencies": { 19 | "firebase-functions-test": "^0.1.6" 20 | }, 21 | "private": true 22 | } 23 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/model/user.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | 3 | class User1 { 4 | final String id; 5 | final String username; 6 | final String email; 7 | final String photoUrl; 8 | final String displayName; 9 | final String bio; 10 | 11 | User1({ 12 | this.id, 13 | this.username, 14 | this.email, 15 | this.photoUrl, 16 | this.displayName, 17 | this.bio, 18 | }); 19 | 20 | factory User1.fromDocument(DocumentSnapshot doc) { 21 | return User1( 22 | id: doc.documentID, 23 | email: doc['email'], 24 | username: doc['username'], 25 | photoUrl: doc['photoUrl'], 26 | displayName: doc['displayName'], 27 | bio: doc['bio'], 28 | ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/widgets/post_tile.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:socialmedia/pages/post_screen.dart'; 3 | import 'package:socialmedia/widgets/custome_image.dart'; 4 | import 'package:socialmedia/widgets/post.dart'; 5 | 6 | class PostTile extends StatelessWidget { 7 | final Post post; 8 | PostTile(this.post); 9 | showPost(context) { 10 | Navigator.push( 11 | context, 12 | MaterialPageRoute( 13 | builder: (context) => PostScreen(postId: post.postId, userId: post.ownerId))); 14 | } 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return GestureDetector( 19 | onTap: ()=>showPost(context), 20 | child: cachedNetworkImage(post.mediaUrl), 21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | /build/ 32 | 33 | # Web related 34 | lib/generated_plugin_registrant.dart 35 | 36 | # Exceptions to above rules. 37 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 38 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.5.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | classpath 'com.google.gms:google-services:4.3.3' 12 | //classpath 'com.google.gms:google-services:4.0.1' 13 | } 14 | } 15 | 16 | allprojects { 17 | repositories { 18 | google() 19 | jcenter() 20 | } 21 | } 22 | 23 | rootProject.buildDir = '../build' 24 | subprojects { 25 | project.buildDir = "${rootProject.buildDir}/${project.name}" 26 | } 27 | subprojects { 28 | project.evaluationDependsOn(':app') 29 | } 30 | 31 | task clean(type: Delete) { 32 | delete rootProject.buildDir 33 | } 34 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:socialmedia/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /android/app/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "337910188392", 4 | "firebase_url": "https://socialmediafirestore.firebaseio.com", 5 | "project_id": "socialmediafirestore", 6 | "storage_bucket": "socialmediafirestore.appspot.com" 7 | }, 8 | "client": [ 9 | { 10 | "client_info": { 11 | "mobilesdk_app_id": "1:337910188392:android:0a5dcd1740f2bb6b59eedd", 12 | "android_client_info": { 13 | "package_name": "com.example.socialmedia" 14 | } 15 | }, 16 | "oauth_client": [ 17 | { 18 | "client_id": "337910188392-iotf08dlnmst6ano1fqt800ggu9fnevs.apps.googleusercontent.com", 19 | "client_type": 3 20 | } 21 | ], 22 | "api_key": [ 23 | { 24 | "current_key": "AIzaSyD3E648F6Y3ghEm0YlpjC7dAnuk4GzxXGY" 25 | } 26 | ], 27 | "services": { 28 | "appinvite_service": { 29 | "other_platform_oauth_client": [ 30 | { 31 | "client_id": "337910188392-iotf08dlnmst6ano1fqt800ggu9fnevs.apps.googleusercontent.com", 32 | "client_type": 3 33 | } 34 | ] 35 | } 36 | } 37 | } 38 | ], 39 | "configuration_version": "1" 40 | } -------------------------------------------------------------------------------- /lib/pages/post_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:socialmedia/pages/home.dart'; 3 | import 'package:socialmedia/widgets/header.dart'; 4 | import 'package:socialmedia/widgets/post.dart'; 5 | import 'package:socialmedia/widgets/progress.dart'; 6 | 7 | class PostScreen extends StatelessWidget { 8 | final String userId; 9 | final String postId; 10 | 11 | PostScreen({this.userId, this.postId}); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return FutureBuilder( 16 | future: postsRef 17 | .document(userId) 18 | .collection('userPosts') 19 | .document(postId) 20 | .get(), 21 | builder: (context, snapshot) { 22 | if (!snapshot.hasData) { 23 | return circularProgress(); 24 | } 25 | Post post = Post.fromDocument(snapshot.data); 26 | return Center( 27 | child: Scaffold( 28 | appBar: header(titleText: post.description), 29 | body: ListView( 30 | children: [ 31 | Container( 32 | child: post, 33 | ) 34 | ], 35 | ), 36 | ), 37 | ); 38 | }, 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /lib/widgets/header.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:google_fonts/google_fonts.dart'; 3 | 4 | AppBar header( 5 | {bool isAppTitle = false, 6 | bool leadIcon = false, 7 | bool actIcon: false, 8 | String titleText, 9 | removeBackButton = false 10 | }) { 11 | return AppBar( 12 | leading: leadIcon 13 | ? IconButton( 14 | icon: Icon( 15 | Icons.camera_alt, 16 | size: 32.0, 17 | color: Colors.black, 18 | ), 19 | onPressed: () => Text(""), 20 | ) 21 | : Text(""), 22 | automaticallyImplyLeading: removeBackButton ? false : true, 23 | title: Text( 24 | isAppTitle ? "Instagram" : titleText, 25 | style: GoogleFonts.grandHotel( 26 | color: Colors.black, fontSize: isAppTitle ? 30.0 : 22.0), 27 | overflow: TextOverflow.ellipsis, 28 | ), 29 | actions: [ 30 | Transform.rotate( 31 | angle: 5.5, 32 | child: actIcon?IconButton( 33 | icon: Icon( 34 | Icons.send, 35 | color: Colors.black, 36 | size: 25.0, 37 | ), 38 | onPressed: null):Text(""), 39 | ) 40 | ], 41 | centerTitle: true, 42 | backgroundColor: Colors.white, 43 | ); 44 | } 45 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 12 | 19 | 20 | 21 | 22 | 23 | 24 | 26 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /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 | socialmedia 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 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.example.socialmedia" 42 | minSdkVersion 16 43 | multiDexEnabled true 44 | targetSdkVersion 28 45 | versionCode flutterVersionCode.toInteger() 46 | versionName flutterVersionName 47 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 48 | } 49 | 50 | buildTypes { 51 | release { 52 | // TODO: Add your own signing config for the release build. 53 | // Signing with the debug keys for now, so `flutter run --release` works. 54 | signingConfig signingConfigs.debug 55 | } 56 | } 57 | } 58 | 59 | flutter { 60 | source '../..' 61 | } 62 | 63 | dependencies { 64 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 65 | testImplementation 'junit:junit:4.12' 66 | androidTestImplementation 'androidx.test:runner:1.1.1' 67 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 68 | implementation 'com.android.support:multidex:1.0.3' 69 | } 70 | //apply plugin: 'com.android.application' 71 | apply plugin: 'com.google.gms.google-services' -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Instagram Flutter Firebase 2 | 3 | Instagram clone application in flutter amazing realtime social network, backend with firebase. 4 | 5 | 6 | # Screenshots: 7 | 8 | 9 | 10 | # Getting started 11 | ``` 12 | git https://github.com/OsamaxD1/Instagram-clone-flutter.git InstagramFlutter 13 | cd InstagramFlutter 14 | ``` 15 | 16 | # Setup the firebase app 17 | 1. You'll need to create a Firebase instance. Follow the instructions at https://console.firebase.google.com. 18 | 2. Once your Firebase instance is created, you'll need to enable Google authentication. 19 | * Go to the Firebase Console for your new instance. 20 | * Click "Authentication" in the left-hand menu 21 | * Click the "sign-in method" tab 22 | * Click "Google" and enable it 23 | 3. Enable the Firebase Database 24 | * Go to the Firebase Console 25 | * Click "Database" in the left-hand menu 26 | * Click the Realtime "Create Database" button 27 | * Select "Start in test mode" and "Enable" 28 | * Create an app within your Firebase instance for Android. 29 | * Run the following command to get your SHA-1 key: 30 | 31 | 32 | 33 | * In the Firebase console, in the settings of your Android app, add your SHA-1 key by clicking "Add Fingerprint". 34 | * Follow instructions to download ```google-services.json``` 35 | place ```google-services.json``` into ```/android/app/```. 36 | 37 | * [Youtube- Full Video with working functionality](https://youtu.be/3EDbg7q-o3M) - Instagram Flutter Firebase 38 | 39 | 40 | [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/OsamaxD1/SocialMediaFlutter/issues) 41 | 42 | 43 | ## Created and Maintain by 44 | * [Hassan Osama](https://github.com/OsamaxD1) - Follow me on [Twitter](https://twitter.com/sudoosama) 45 | 46 | -------------------------------------------------------------------------------- /lib/pages/create_account.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:socialmedia/widgets/header.dart'; 4 | 5 | class CreateAccount extends StatefulWidget { 6 | @override 7 | _CreateAccountState createState() => _CreateAccountState(); 8 | } 9 | 10 | class _CreateAccountState extends State { 11 | final _scaffoldKey = GlobalKey(); 12 | final _formKey=GlobalKey(); 13 | String username; 14 | 15 | submit(){ 16 | final form=_formKey.currentState; 17 | if(form.validate()){ 18 | form.save(); 19 | //_formKey.currentState.save(); 20 | SnackBar snackBar=SnackBar(content: Text("Welcome $username!")); 21 | _scaffoldKey.currentState.showSnackBar(snackBar); 22 | Timer(Duration(seconds: 2),(){ 23 | Navigator.pop(context,username); 24 | 25 | }); 26 | } 27 | } 28 | 29 | @override 30 | Widget build(BuildContext context) { 31 | return Scaffold( 32 | key: _scaffoldKey, 33 | appBar: header(titleText: "Set up your Profile",removeBackButton: true), 34 | body: ListView(children: [ 35 | Container( 36 | child: Column( 37 | children: [ 38 | Padding(padding: EdgeInsets.only(top: 25.0), 39 | child: Center( 40 | child: Text("Create a Username",style: TextStyle( 41 | fontSize: 25.0 42 | ),), 43 | ),), 44 | Padding(padding: EdgeInsets.all(16.0), 45 | child: Container( 46 | child: Form( 47 | key: _formKey, 48 | autovalidate: true, 49 | child: TextFormField( 50 | validator: (val){ 51 | if(val.trim().length<3||val.isEmpty) { 52 | return 'Username too short'; 53 | } 54 | else if(val.trim().length>12){ 55 | return "Username too long"; 56 | } 57 | else{ 58 | return null; 59 | } 60 | }, 61 | onSaved: (val)=>username=val, 62 | decoration: InputDecoration( 63 | border: OutlineInputBorder(), 64 | labelText: "Username", 65 | labelStyle: TextStyle(fontSize: 15.0), 66 | hintText: "Must be at least 3 characters", 67 | ), 68 | )), 69 | ),), 70 | GestureDetector( 71 | onTap: submit, 72 | child: Container( 73 | height: 50.0, 74 | width: 350.0, 75 | decoration: BoxDecoration( 76 | color: Colors.blue, 77 | borderRadius: BorderRadius.circular(7.0) 78 | ), 79 | child: Center(child: Text("Submit",style: TextStyle( 80 | color: Colors.white, 81 | fontSize: 15.0, 82 | fontWeight: FontWeight.bold 83 | , ),),), 84 | )), 85 | 86 | ], 87 | ), 88 | ) 89 | ],), 90 | ); 91 | } 92 | } -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: socialmedia 2 | description: A new Flutter project. 3 | 4 | # The following defines the version and build number for your application. 5 | # A version number is three numbers separated by dots, like 1.2.43 6 | # followed by an optional build number separated by a +. 7 | # Both the version and the builder number may be overridden in flutter 8 | # build by specifying --build-name and --build-number, respectively. 9 | # In Android, build-name is used as versionName while build-number used as versionCode. 10 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 11 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 12 | # Read more about iOS versioning at 13 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 14 | version: 1.0.0+1 15 | 16 | environment: 17 | sdk: ">=2.1.0 <3.0.0" 18 | 19 | dependencies: 20 | flutter: 21 | sdk: flutter 22 | 23 | # The following adds the Cupertino Icons font to your application. 24 | # Use with the CupertinoIcons class for iOS style icons. 25 | cupertino_icons: ^0.1.2 26 | cloud_firestore: ^0.13.4+2 27 | image_picker: ^0.6.3+4 28 | firebase_storage: ^3.1.3 29 | firebase_auth: ^0.15.5+3 30 | google_sign_in: ^4.2.0 31 | geolocator: ^5.3.0 32 | uuid: ^2.0.4 33 | image: ^2.1.4 34 | animator: ^1.0.0+5 35 | path_provider: ^1.6.1 36 | firebase_messaging: ^6.0.13 37 | timeago: ^2.0.26 38 | cached_network_image: ^2.0.0 39 | flutter_svg: ^0.17.3+1 40 | google_fonts: ^0.4.0 41 | 42 | 43 | dev_dependencies: 44 | flutter_test: 45 | sdk: flutter 46 | 47 | 48 | # For information on the generic Dart part of this file, see the 49 | # following page: https://dart.dev/tools/pub/pubspec 50 | 51 | # The following section is specific to Flutter. 52 | flutter: 53 | 54 | # The following line ensures that the Material Icons font is 55 | # included with your application, so that you can use the icons in 56 | # the material Icons class. 57 | uses-material-design: true 58 | 59 | # To add assets to your application, add an assets section, like this: 60 | # assets: 61 | # - images/a_dot_burr.jpeg 62 | # - images/a_dot_ham.jpeg 63 | assets: 64 | - assets/images/activity_feed.png 65 | - assets/images/google_signin_button.png 66 | - assets/images/no_content.svg 67 | - assets/images/search.svg 68 | - assets/images/upload.svg 69 | 70 | # An image asset can refer to one or more resolution-specific "variants", see 71 | # https://flutter.dev/assets-and-images/#resolution-aware. 72 | 73 | # For details regarding adding assets from package dependencies, see 74 | # https://flutter.dev/assets-and-images/#from-packages 75 | 76 | # To add custom fonts to your application, add a fonts section here, 77 | # in this "flutter" section. Each entry in this list should have a 78 | # "family" key with the font family name, and a "fonts" key with a 79 | # list giving the asset and other descriptors for the font. For 80 | # example: 81 | # fonts: 82 | # - family: Schyler 83 | # fonts: 84 | # - asset: fonts/Schyler-Regular.ttf 85 | # - asset: fonts/Schyler-Italic.ttf 86 | # style: italic 87 | # - family: Trajan Pro 88 | # fonts: 89 | # - asset: fonts/TrajanPro.ttf 90 | # - asset: fonts/TrajanPro_Bold.ttf 91 | # weight: 700 92 | # 93 | # For details regarding fonts from package dependencies, 94 | # see https://flutter.dev/custom-fonts/#from-packages 95 | -------------------------------------------------------------------------------- /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/pages/timeline.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:socialmedia/pages/home.dart'; 4 | import 'package:socialmedia/pages/profile.dart'; 5 | import 'package:socialmedia/pages/search.dart'; 6 | import 'package:socialmedia/widgets/header.dart'; 7 | import 'package:socialmedia/widgets/post.dart'; 8 | import 'package:socialmedia/widgets/progress.dart'; 9 | 10 | class Timeline extends StatefulWidget { 11 | final User currentUser; 12 | Timeline({this.currentUser}); 13 | @override 14 | _TimelineState createState() => _TimelineState(); 15 | } 16 | 17 | class _TimelineState extends State { 18 | List posts; 19 | List followingList=[]; 20 | 21 | @override 22 | void initState() { 23 | super.initState(); 24 | getTimeline(); 25 | getFollowing(); 26 | } 27 | getTimeline()async{ 28 | QuerySnapshot snapshot = await timelineRef 29 | .document(widget.currentUser.id) 30 | .collection('timelinePosts') 31 | .orderBy('timestamp',descending: true) 32 | .getDocuments(); 33 | List posts = snapshot.documents.map((doc)=>Post.fromDocument(doc)).toList(); 34 | setState(() { 35 | this.posts=posts; 36 | }); 37 | } 38 | 39 | getFollowing()async{ 40 | QuerySnapshot snapshot= await followingRef 41 | .document(currentUser.id) 42 | .collection('userFollowing') 43 | .getDocuments(); 44 | setState(() { 45 | followingList=snapshot.documents.map((doc)=>doc.documentID).toList(); 46 | }); 47 | } 48 | 49 | buildTimeline(){ 50 | if(posts==null){ 51 | return circularProgress(); 52 | } 53 | else if (posts.isEmpty) { 54 | return buildUsersToFollow(); 55 | } else{ 56 | return ListView(children: posts); 57 | } 58 | } 59 | 60 | buildUsersToFollow() { 61 | return StreamBuilder( 62 | stream: 63 | usersRef.orderBy('timestamp', descending: true).limit(30).snapshots(), 64 | builder: (context, snapshot) { 65 | if (!snapshot.hasData) { 66 | return circularProgress(); 67 | } 68 | List userResults = []; 69 | snapshot.data.documents.forEach((doc) { 70 | User user = User.fromDocument(doc); 71 | final bool isAuthUser = currentUser.id == user.id; 72 | final bool isFollowingUser = followingList.contains(user.id); 73 | // remove auth user from recommended list 74 | if (isAuthUser) { 75 | return; 76 | } else if (isFollowingUser) { 77 | return; 78 | } else { 79 | UserResult userResult = UserResult(user); 80 | userResults.add(userResult); 81 | } 82 | }); 83 | return Container( 84 | color: Colors.white, 85 | child: Column( 86 | children: [ 87 | Container( 88 | padding: EdgeInsets.all(12.0), 89 | child: Row( 90 | mainAxisAlignment: MainAxisAlignment.center, 91 | children: [ 92 | Icon( 93 | Icons.person_add, 94 | color: Theme.of(context).primaryColor, 95 | size: 30.0, 96 | ), 97 | SizedBox( 98 | width: 8.0, 99 | ), 100 | Text( 101 | "Users to Follow", 102 | style: TextStyle( 103 | color: Theme.of(context).primaryColor, 104 | fontSize: 30.0, 105 | ), 106 | ), 107 | ], 108 | ), 109 | ), 110 | Column(children: userResults), 111 | ], 112 | ), 113 | ); 114 | }, 115 | ); 116 | } 117 | 118 | 119 | @override 120 | Widget build(BuildContext context) { 121 | return Scaffold( 122 | appBar: header(isAppTitle: true,leadIcon: true,actIcon: true), 123 | 124 | body: 125 | RefreshIndicator( 126 | onRefresh: ()=> getTimeline(), 127 | child: buildTimeline(), 128 | ), 129 | ); 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /lib/pages/comment.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:cloud_firestore/cloud_firestore.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:socialmedia/pages/home.dart'; 5 | import 'package:socialmedia/widgets/header.dart'; 6 | import 'package:socialmedia/widgets/progress.dart'; 7 | import 'package:timeago/timeago.dart' as timeago; 8 | 9 | class Comments extends StatefulWidget { 10 | final String postId; 11 | final String postOwnerId; 12 | final String postMediaUrl; 13 | 14 | Comments({ 15 | this.postId, 16 | this.postOwnerId, 17 | this.postMediaUrl, 18 | }); 19 | 20 | @override 21 | CommentsState createState() => CommentsState( 22 | postId: this.postId, 23 | postOwnerId: this.postOwnerId, 24 | postMediaUrl: this.postMediaUrl, 25 | ); 26 | } 27 | 28 | class CommentsState extends State { 29 | TextEditingController commentController = TextEditingController(); 30 | final String postId; 31 | final String postOwnerId; 32 | final String postMediaUrl; 33 | 34 | CommentsState({ 35 | this.postId, 36 | this.postOwnerId, 37 | this.postMediaUrl, 38 | }); 39 | 40 | buildComments() { 41 | return StreamBuilder( 42 | stream: commentsRef 43 | .document(postId) 44 | .collection('comments') 45 | .orderBy("timestamp", descending: false) 46 | .snapshots(), 47 | builder: (context, snapshot) { 48 | if (!snapshot.hasData) { 49 | return circularProgress(); 50 | } 51 | List comments = []; 52 | snapshot.data.documents.forEach((doc) { 53 | comments.add(Comment.fromDocument(doc)); 54 | }); 55 | return ListView( 56 | children: comments, 57 | ); 58 | }); 59 | } 60 | 61 | addComment() { 62 | commentsRef.document(postId).collection("comments").add({ 63 | "username": currentUser.username, 64 | "comment": commentController.text, 65 | "timestamp": timestamp, 66 | "avatarUrl": currentUser.photoUrl, 67 | "userId": currentUser.id, 68 | }); 69 | // bool isNotPostOwner = postOwnerId != currentUser.id; 70 | // if (isNotPostOwner) { 71 | activityFeedRef.document(postOwnerId).collection('feedItems').add({ 72 | "type": "comment", 73 | "commentData": commentController.text, 74 | "timestamp": timestamp, 75 | "postId": postId, 76 | "userId": currentUser.id, 77 | "username": currentUser.username, 78 | "userProfileImg": currentUser.photoUrl, 79 | "mediaUrl": postMediaUrl, 80 | }); 81 | //} 82 | commentController.clear(); 83 | } 84 | 85 | @override 86 | Widget build(BuildContext context) { 87 | return Scaffold( 88 | appBar: header( titleText: "Comments"), 89 | body: Column( 90 | children: [ 91 | Expanded(child: buildComments()), 92 | Divider(), 93 | ListTile( 94 | title: TextFormField( 95 | controller: commentController, 96 | decoration: InputDecoration(labelText: "Write a comment..."), 97 | ), 98 | trailing: OutlineButton( 99 | onPressed: addComment, 100 | borderSide: BorderSide.none, 101 | child: Text("Post"), 102 | ), 103 | ), 104 | ], 105 | ), 106 | ); 107 | } 108 | } 109 | 110 | class Comment extends StatelessWidget { 111 | final String username; 112 | final String userId; 113 | final String avatarUrl; 114 | final String comment; 115 | final Timestamp timestamp; 116 | 117 | Comment({ 118 | this.username, 119 | this.userId, 120 | this.avatarUrl, 121 | this.comment, 122 | this.timestamp, 123 | }); 124 | 125 | factory Comment.fromDocument(DocumentSnapshot doc) { 126 | return Comment( 127 | username: doc['username'], 128 | userId: doc['userId'], 129 | comment: doc['comment'], 130 | timestamp: doc['timestamp'], 131 | avatarUrl: doc['avatarUrl'], 132 | ); 133 | } 134 | 135 | @override 136 | Widget build(BuildContext context) { 137 | return Column( 138 | children: [ 139 | ListTile( 140 | title: Text(comment), 141 | leading: CircleAvatar( 142 | backgroundImage: CachedNetworkImageProvider(avatarUrl), 143 | ), 144 | subtitle: Text(timeago.format(timestamp.toDate())), 145 | ), 146 | Divider(), 147 | ], 148 | ); 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /assets/fonts/OFL.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010, Kimberly Geswein (kimberlygeswein.com) 2 | 3 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 4 | This license is copied below, and is also available with a FAQ at: 5 | http://scripts.sil.org/OFL 6 | 7 | 8 | ----------------------------------------------------------- 9 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 10 | ----------------------------------------------------------- 11 | 12 | PREAMBLE 13 | The goals of the Open Font License (OFL) are to stimulate worldwide 14 | development of collaborative font projects, to support the font creation 15 | efforts of academic and linguistic communities, and to provide a free and 16 | open framework in which fonts may be shared and improved in partnership 17 | with others. 18 | 19 | The OFL allows the licensed fonts to be used, studied, modified and 20 | redistributed freely as long as they are not sold by themselves. The 21 | fonts, including any derivative works, can be bundled, embedded, 22 | redistributed and/or sold with any software provided that any reserved 23 | names are not used by derivative works. The fonts and derivatives, 24 | however, cannot be released under any other type of license. The 25 | requirement for fonts to remain under this license does not apply 26 | to any document created using the fonts or their derivatives. 27 | 28 | DEFINITIONS 29 | "Font Software" refers to the set of files released by the Copyright 30 | Holder(s) under this license and clearly marked as such. This may 31 | include source files, build scripts and documentation. 32 | 33 | "Reserved Font Name" refers to any names specified as such after the 34 | copyright statement(s). 35 | 36 | "Original Version" refers to the collection of Font Software components as 37 | distributed by the Copyright Holder(s). 38 | 39 | "Modified Version" refers to any derivative made by adding to, deleting, 40 | or substituting -- in part or in whole -- any of the components of the 41 | Original Version, by changing formats or by porting the Font Software to a 42 | new environment. 43 | 44 | "Author" refers to any designer, engineer, programmer, technical 45 | writer or other person who contributed to the Font Software. 46 | 47 | PERMISSION & CONDITIONS 48 | Permission is hereby granted, free of charge, to any person obtaining 49 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 50 | redistribute, and sell modified and unmodified copies of the Font 51 | Software, subject to the following conditions: 52 | 53 | 1) Neither the Font Software nor any of its individual components, 54 | in Original or Modified Versions, may be sold by itself. 55 | 56 | 2) Original or Modified Versions of the Font Software may be bundled, 57 | redistributed and/or sold with any software, provided that each copy 58 | contains the above copyright notice and this license. These can be 59 | included either as stand-alone text files, human-readable headers or 60 | in the appropriate machine-readable metadata fields within text or 61 | binary files as long as those fields can be easily viewed by the user. 62 | 63 | 3) No Modified Version of the Font Software may use the Reserved Font 64 | Name(s) unless explicit written permission is granted by the corresponding 65 | Copyright Holder. This restriction only applies to the primary font name as 66 | presented to the users. 67 | 68 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 69 | Software shall not be used to promote, endorse or advertise any 70 | Modified Version, except to acknowledge the contribution(s) of the 71 | Copyright Holder(s) and the Author(s) or with their explicit written 72 | permission. 73 | 74 | 5) The Font Software, modified or unmodified, in part or in whole, 75 | must be distributed entirely under this license, and must not be 76 | distributed under any other license. The requirement for fonts to 77 | remain under this license does not apply to any document created 78 | using the Font Software. 79 | 80 | TERMINATION 81 | This license becomes null and void if any of the above conditions are 82 | not met. 83 | 84 | DISCLAIMER 85 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 86 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 87 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 88 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 89 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 90 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 91 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 92 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 93 | OTHER DEALINGS IN THE FONT SOFTWARE. 94 | -------------------------------------------------------------------------------- /lib/pages/search.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:cloud_firestore/cloud_firestore.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_svg/svg.dart'; 5 | import 'package:socialmedia/pages/activity_feed.dart'; 6 | import 'package:socialmedia/pages/home.dart'; 7 | import 'package:socialmedia/pages/profile.dart'; 8 | import 'package:socialmedia/widgets/progress.dart'; 9 | //import 'package:socialmedia/model/user.dart'; 10 | 11 | class Search extends StatefulWidget { 12 | @override 13 | _SearchState createState() => _SearchState(); 14 | } 15 | 16 | class _SearchState extends State 17 | with AutomaticKeepAliveClientMixin { 18 | TextEditingController searchController = TextEditingController(); 19 | Future searchResultsFuture; 20 | 21 | handleSearch(String query) { 22 | Future users = usersRef 23 | .where("displayName", isGreaterThanOrEqualTo: query) 24 | .getDocuments(); 25 | setState(() { 26 | searchResultsFuture = users; 27 | }); 28 | } 29 | 30 | clearSearch() { 31 | searchController.clear(); 32 | } 33 | 34 | AppBar buildSearchField() { 35 | return AppBar( 36 | backgroundColor: Colors.white, 37 | title: TextFormField( 38 | controller: searchController, 39 | decoration: InputDecoration( 40 | hintText: "Search", 41 | filled: true, 42 | prefixIcon: Icon( 43 | Icons.search, 44 | size: 28.0, 45 | ), 46 | suffixIcon: IconButton( 47 | icon: Icon(Icons.clear), 48 | onPressed: clearSearch, 49 | ), 50 | ), 51 | onFieldSubmitted: handleSearch, 52 | ), 53 | ); 54 | } 55 | 56 | Container buildNoContent() { 57 | final Orientation orientation = MediaQuery.of(context).orientation; 58 | return Container( 59 | child: Center( 60 | child: ListView( 61 | shrinkWrap: true, 62 | children: [ 63 | 64 | // SvgPicture.asset( 65 | // 'assets/images/search.svg', 66 | // height: orientation == Orientation.portrait ? 300.0 : 200.0, 67 | // ), 68 | // Text( 69 | // "Find Users", 70 | // textAlign: TextAlign.center, 71 | // style: TextStyle( 72 | // color: Colors.white, 73 | // fontStyle: FontStyle.italic, 74 | // fontWeight: FontWeight.w600, 75 | // fontSize: 60.0, 76 | // ), 77 | // ), 78 | 79 | ], 80 | ), 81 | ), 82 | ); 83 | } 84 | 85 | buildSearchResults() { 86 | return FutureBuilder( 87 | future: searchResultsFuture, 88 | builder: (context, snapshot) { 89 | if (!snapshot.hasData) { 90 | return circularProgress(); 91 | } 92 | List searchResults = []; 93 | snapshot.data.documents.forEach((doc) { 94 | User user = User.fromDocument(doc); 95 | UserResult searchResult = UserResult(user); 96 | searchResults.add(searchResult); 97 | }); 98 | return ListView( 99 | children: searchResults, 100 | ); 101 | }, 102 | ); 103 | } 104 | 105 | bool get wantKeepAlive => true; 106 | 107 | @override 108 | Widget build(BuildContext context) { 109 | super.build(context); 110 | 111 | return Scaffold( 112 | backgroundColor:Colors.white, 113 | appBar: buildSearchField(), 114 | body: 115 | searchResultsFuture == null ? buildNoContent() : buildSearchResults(), 116 | ); 117 | } 118 | } 119 | 120 | class UserResult extends StatelessWidget { 121 | final User user; 122 | 123 | UserResult(this.user); 124 | 125 | @override 126 | Widget build(BuildContext context) { 127 | return Container( 128 | color: Theme.of(context).primaryColor.withOpacity(0.7), 129 | child: Column( 130 | children: [ 131 | GestureDetector( 132 | onTap: () => showProfile(context, profileId: user.id), 133 | child: ListTile( 134 | leading: CircleAvatar( 135 | backgroundColor: Colors.grey, 136 | backgroundImage: CachedNetworkImageProvider(user.photoUrl), 137 | ), 138 | title: Text( 139 | user.displayName, 140 | style: 141 | TextStyle(color: Colors.white, fontWeight: FontWeight.bold), 142 | ), 143 | subtitle: Text( 144 | user.username, 145 | style: TextStyle(color: Colors.white), 146 | ), 147 | ), 148 | ), 149 | Divider( 150 | height: 2.0, 151 | color: Colors.white54, 152 | ), 153 | ], 154 | ), 155 | ); 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /lib/pages/activity_feed.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:cloud_firestore/cloud_firestore.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:socialmedia/pages/home.dart'; 5 | import 'package:socialmedia/pages/post_screen.dart'; 6 | import 'package:socialmedia/pages/profile.dart'; 7 | import 'package:socialmedia/widgets/header.dart'; 8 | import 'package:socialmedia/widgets/progress.dart'; 9 | import 'package:timeago/timeago.dart' as timeago; 10 | 11 | class ActivityFeed extends StatefulWidget { 12 | @override 13 | _ActivityFeedState createState() => _ActivityFeedState(); 14 | } 15 | 16 | class _ActivityFeedState extends State { 17 | getActivityFeed() async { 18 | QuerySnapshot snapshot = await activityFeedRef 19 | .document(currentUser.id) 20 | .collection('feedItems') 21 | .orderBy('timestamp', descending: true) 22 | .limit(50) 23 | .getDocuments(); 24 | List feedItems = []; 25 | snapshot.documents.forEach((doc) { 26 | feedItems.add(ActivityFeedItem.fromDocument(doc)); 27 | // print('Activity Feed Item: ${doc.data}'); 28 | }); 29 | return feedItems; 30 | } 31 | 32 | @override 33 | Widget build(BuildContext context) { 34 | return Scaffold( 35 | backgroundColor: Colors.white, 36 | appBar: header(titleText: "Activity",leadIcon: false,actIcon: false), 37 | body: Container( 38 | child: FutureBuilder( 39 | 40 | future: getActivityFeed(), 41 | builder: (context, snapshot) { 42 | 43 | if (!snapshot.hasData) { 44 | return circularProgress(); 45 | } 46 | return ListView( 47 | 48 | children: snapshot.data, 49 | ); 50 | }, 51 | )), 52 | ); 53 | } 54 | } 55 | 56 | Widget mediaPreview; 57 | String activityItemText; 58 | 59 | class ActivityFeedItem extends StatelessWidget { 60 | final String username; 61 | final String userId; 62 | final String type; // 'like', 'follow', 'comment' 63 | final String mediaUrl; 64 | final String postId; 65 | final String userProfileImg; 66 | final String commentData; 67 | final Timestamp timestamp; 68 | 69 | ActivityFeedItem({ 70 | this.username, 71 | this.userId, 72 | this.type, 73 | this.mediaUrl, 74 | this.postId, 75 | this.userProfileImg, 76 | this.commentData, 77 | this.timestamp, 78 | }); 79 | 80 | factory ActivityFeedItem.fromDocument(DocumentSnapshot doc) { 81 | return ActivityFeedItem( 82 | username: doc['username'], 83 | userId: doc['userId'], 84 | type: doc['type'], 85 | postId: doc['postId'], 86 | userProfileImg: doc['userProfileImg'], 87 | commentData: doc['commentData'], 88 | timestamp: doc['timestamp'], 89 | mediaUrl: doc['mediaUrl'], 90 | ); 91 | } 92 | 93 | showPost(context) { 94 | Navigator.push( 95 | context, 96 | MaterialPageRoute( 97 | builder: (context) => PostScreen( 98 | postId: postId, 99 | userId: userId, 100 | ), 101 | ), 102 | ); 103 | } 104 | 105 | configureMediaPreview(context) { 106 | if (type == "like" || type == 'comment') { 107 | mediaPreview = GestureDetector( 108 | onTap: () => showPost(context), 109 | child: Container( 110 | height: 50.0, 111 | width: 50.0, 112 | child: AspectRatio( 113 | aspectRatio: 16 / 9, 114 | child: Container( 115 | decoration: BoxDecoration( 116 | image: DecorationImage( 117 | fit: BoxFit.cover, 118 | image: CachedNetworkImageProvider(mediaUrl), 119 | ), 120 | ), 121 | )), 122 | ), 123 | ); 124 | } else { 125 | mediaPreview = Text(''); 126 | } 127 | 128 | if (type == 'like') { 129 | activityItemText = "liked your post"; 130 | } else if (type == 'follow') { 131 | activityItemText = "is following you"; 132 | } else if (type == 'comment') { 133 | activityItemText = 'replied: $commentData'; 134 | } else { 135 | activityItemText = "Error: Unknown type '$type'"; 136 | } 137 | } 138 | 139 | @override 140 | Widget build(BuildContext context) { 141 | configureMediaPreview(context); 142 | 143 | return Padding( 144 | padding: EdgeInsets.only(bottom: 2.0), 145 | child: Container( 146 | color: Colors.white30, 147 | child: ListTile( 148 | title: GestureDetector( 149 | onTap: () => showProfile(context, profileId: userId), 150 | child: RichText( 151 | overflow: TextOverflow.ellipsis, 152 | text: TextSpan( 153 | style: TextStyle( 154 | fontSize: 14.0, 155 | color: Colors.black, 156 | ), 157 | children: [ 158 | TextSpan( 159 | text: username, 160 | style: TextStyle(fontWeight: FontWeight.bold), 161 | ), 162 | TextSpan( 163 | text: ' $activityItemText', 164 | ), 165 | ]), 166 | ), 167 | ), 168 | leading: CircleAvatar( 169 | backgroundImage: CachedNetworkImageProvider(userProfileImg), 170 | ), 171 | subtitle: Text( 172 | timeago.format(timestamp.toDate()), 173 | overflow: TextOverflow.ellipsis, 174 | ), 175 | trailing: mediaPreview, 176 | ), 177 | ), 178 | ); 179 | } 180 | } 181 | 182 | showProfile(BuildContext context, {String profileId}) { 183 | Navigator.push( 184 | context, 185 | MaterialPageRoute( 186 | builder: (context) => Profile( 187 | profileId: profileId, 188 | ), 189 | ), 190 | ); 191 | } 192 | -------------------------------------------------------------------------------- /lib/pages/edit_profile.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:socialmedia/pages/home.dart'; 4 | import 'package:socialmedia/widgets/progress.dart'; 5 | import 'package:cached_network_image/cached_network_image.dart'; 6 | import 'package:socialmedia/model/user.dart'; 7 | 8 | class EditProfile extends StatefulWidget { 9 | final String currentUserId; 10 | 11 | EditProfile({this.currentUserId}); 12 | 13 | @override 14 | _EditProfileState createState() => _EditProfileState(); 15 | } 16 | 17 | class _EditProfileState extends State { 18 | final _scaffoldKey = GlobalKey(); 19 | TextEditingController displayNameController = TextEditingController(); 20 | TextEditingController bioController = TextEditingController(); 21 | bool isLoading = false; 22 | User1 user; 23 | bool _displayNameValid = true; 24 | bool _bioValid = true; 25 | 26 | @override 27 | void initState() { 28 | // TODO: implement initState 29 | super.initState(); 30 | getUser(); 31 | } 32 | 33 | getUser() async { 34 | setState(() { 35 | isLoading = true; 36 | }); 37 | DocumentSnapshot doc = await usersRef.document(widget.currentUserId).get(); 38 | user = User1.fromDocument(doc); 39 | displayNameController.text = user.displayName; 40 | bioController.text = user.bio; 41 | setState(() { 42 | isLoading = false; 43 | }); 44 | } 45 | 46 | Column buildDisplayNameField() { 47 | return Column( 48 | crossAxisAlignment: CrossAxisAlignment.start, 49 | children: [ 50 | Padding( 51 | padding: EdgeInsets.only(top: 12.0), 52 | child: Text( 53 | "Display Name", 54 | style: TextStyle(color: Colors.grey), 55 | ), 56 | ), 57 | TextField( 58 | controller: displayNameController, 59 | decoration: InputDecoration( 60 | hintText: "Update Display Name", 61 | errorText: _displayNameValid ? null : "Name is too short"), 62 | ) 63 | ], 64 | ); 65 | } 66 | 67 | Column buildBioField() { 68 | return Column( 69 | crossAxisAlignment: CrossAxisAlignment.start, 70 | children: [ 71 | Padding( 72 | padding: EdgeInsets.only(top: 12.0), 73 | child: Text( 74 | "Display Bio", 75 | style: TextStyle(color: Colors.grey), 76 | ), 77 | ), 78 | TextField( 79 | controller: bioController, 80 | decoration: InputDecoration( 81 | hintText: "Update Bio", 82 | errorText: _bioValid ? null : "Bio is too long"), 83 | ) 84 | ], 85 | ); 86 | } 87 | 88 | updateProfileData() { 89 | setState(() { 90 | displayNameController.text.trim().length < 3 || 91 | displayNameController.text.isEmpty 92 | ? _displayNameValid = false 93 | : _displayNameValid = true; 94 | bioController.text.trim().length > 50 95 | ? _bioValid = false 96 | : _bioValid = true; 97 | }); 98 | if (_displayNameValid && _bioValid) { 99 | usersRef.document(widget.currentUserId).updateData({ 100 | "displayName": displayNameController.text, 101 | "bio": bioController.text 102 | }); 103 | SnackBar snackbar = SnackBar(content: Text("Profile updated")); 104 | _scaffoldKey.currentState.showSnackBar(snackbar); 105 | } 106 | } 107 | 108 | logout() async { 109 | await googleSignIn.signOut(); 110 | Navigator.push(context, MaterialPageRoute(builder: (context) => Home())); 111 | } 112 | 113 | @override 114 | Widget build(BuildContext context) { 115 | return Scaffold( 116 | key: _scaffoldKey, 117 | appBar: AppBar( 118 | backgroundColor: Colors.white, 119 | title: Text( 120 | "Edit Profile", 121 | style: TextStyle(color: Colors.black), 122 | ), 123 | actions: [ 124 | IconButton( 125 | onPressed: () => Navigator.pop(context), 126 | icon: Icon( 127 | Icons.done, 128 | size: 30.0, 129 | color: Colors.green, 130 | ), 131 | ) 132 | ], 133 | ), 134 | body: isLoading 135 | ? circularProgress() 136 | : ListView( 137 | children: [ 138 | Container( 139 | child: Column( 140 | children: [ 141 | Padding( 142 | padding: EdgeInsets.only(top: 16.0, bottom: 8.0), 143 | child: CircleAvatar( 144 | radius: 50.0, 145 | backgroundImage: 146 | CachedNetworkImageProvider(user.photoUrl), 147 | ), 148 | ), 149 | Padding( 150 | padding: EdgeInsets.all(16.0), 151 | child: Column( 152 | children: [ 153 | buildDisplayNameField(), 154 | buildBioField(), 155 | ], 156 | ), 157 | ), 158 | RaisedButton( 159 | onPressed: updateProfileData, 160 | child: Text( 161 | "Update Profile", 162 | style: TextStyle( 163 | color: Colors.purple, 164 | fontSize: 20.0, 165 | fontWeight: FontWeight.bold), 166 | ), 167 | ), 168 | Padding( 169 | padding: EdgeInsets.all(16.0), 170 | child: FlatButton.icon( 171 | onPressed: logout, 172 | icon: Icon( 173 | Icons.cancel, 174 | color: Colors.red, 175 | ), 176 | label: Text( 177 | "Logout", 178 | style: 179 | TextStyle(color: Colors.red, fontSize: 20.0), 180 | )), 181 | ) 182 | ], 183 | ), 184 | ) 185 | ], 186 | ), 187 | ); 188 | } 189 | } 190 | -------------------------------------------------------------------------------- /lib/pages/home.dart: -------------------------------------------------------------------------------- 1 | import 'package:google_fonts/google_fonts.dart'; 2 | import 'package:cloud_firestore/cloud_firestore.dart'; 3 | import 'package:firebase_storage/firebase_storage.dart'; 4 | import 'package:flutter/cupertino.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:socialmedia/pages/activity_feed.dart'; 7 | import 'package:socialmedia/pages/create_account.dart'; 8 | import 'package:socialmedia/pages/profile.dart'; 9 | import 'package:socialmedia/pages/search.dart'; 10 | import 'package:socialmedia/pages/timeline.dart'; 11 | import 'package:socialmedia/pages/upload.dart'; 12 | import 'package:google_sign_in/google_sign_in.dart'; 13 | 14 | final GoogleSignIn googleSignIn = GoogleSignIn(); 15 | final StorageReference storageRef = FirebaseStorage.instance.ref(); 16 | final usersRef = Firestore.instance.collection('users'); 17 | final postsRef = Firestore.instance.collection('posts'); 18 | final commentsRef = Firestore.instance.collection('comments'); 19 | final activityFeedRef = Firestore.instance.collection('feed'); 20 | final followersRef = Firestore.instance.collection('followers'); 21 | final followingRef = Firestore.instance.collection('following'); 22 | final timelineRef = Firestore.instance.collection('timeline'); 23 | final DateTime timestamp = DateTime.now(); 24 | User currentUser; 25 | 26 | class Home extends StatefulWidget { 27 | @override 28 | _HomeState createState() => _HomeState(); 29 | } 30 | 31 | class _HomeState extends State { 32 | final _scaffoldKey = GlobalKey(); 33 | bool isAuth = false; 34 | PageController pageController; 35 | int pageIndex = 0; 36 | 37 | get currentUser1 => User; 38 | 39 | @override 40 | void initState() { 41 | super.initState(); 42 | pageController = PageController(); 43 | // Detects when user signed in 44 | googleSignIn.onCurrentUserChanged.listen((account) { 45 | handleSignIn(account); 46 | }, onError: (err) { 47 | print('Error signing in: $err'); 48 | }); 49 | // Reauthenticate user when app is opened 50 | googleSignIn.signInSilently(suppressErrors: false).then((account) { 51 | handleSignIn(account); 52 | }).catchError((err) { 53 | print('Error signing in: $err'); 54 | }); 55 | } 56 | 57 | handleSignIn(GoogleSignInAccount account) async { 58 | if (account != null) { 59 | await createUserInFirestore(); 60 | setState(() { 61 | isAuth = true; 62 | }); 63 | } else { 64 | setState(() { 65 | isAuth = false; 66 | }); 67 | } 68 | } 69 | 70 | createUserInFirestore() async { 71 | // 1) check if user exists in users collection in database (according to their id) 72 | final GoogleSignInAccount user = googleSignIn.currentUser; 73 | DocumentSnapshot doc = await usersRef.document(user.id).get(); 74 | 75 | if (!doc.exists) { 76 | // 2) if the user doesn't exist, then we want to take them to the create account page 77 | final username = await Navigator.push( 78 | context, MaterialPageRoute(builder: (context) => CreateAccount())); 79 | 80 | // 3) get username from create account, use it to make new user document in users collection 81 | usersRef.document(user.id).setData({ 82 | "id": user.id, 83 | "username": username, 84 | "photoUrl": user.photoUrl, 85 | "email": user.email, 86 | "displayName": user.displayName, 87 | "bio": "", 88 | "timestamp": timestamp 89 | }); 90 | // make new user their own follower (to include their posts in their timeline) 91 | await followersRef 92 | .document(user.id) 93 | .collection('userFollowers') 94 | .document(user.id) 95 | .setData({}); 96 | 97 | doc = await usersRef.document(user.id).get(); 98 | } 99 | 100 | currentUser = User.fromDocument(doc); 101 | } 102 | 103 | @override 104 | void dispose() { 105 | pageController.dispose(); 106 | super.dispose(); 107 | } 108 | 109 | login() { 110 | googleSignIn.signIn(); 111 | } 112 | 113 | logout() { 114 | googleSignIn.signOut(); 115 | } 116 | 117 | onPageChanged(int pageIndex) { 118 | setState(() { 119 | this.pageIndex = pageIndex; 120 | }); 121 | } 122 | 123 | onTap(int pageIndex) { 124 | pageController.animateToPage( 125 | pageIndex, 126 | duration: Duration(milliseconds: 300), 127 | curve: Curves.easeInOut, 128 | ); 129 | } 130 | 131 | Scaffold buildAuthScreen() { 132 | return Scaffold( 133 | key: _scaffoldKey, 134 | body: PageView( 135 | children: [ 136 | //Timeline(currentUser1: currentUser1), 137 | //timeline.User(currentUser: currentUser), 138 | //timeline(currentUser: currentUser,), 139 | Timeline(currentUser: currentUser), 140 | Search(), 141 | Upload(currentUser: currentUser), 142 | ActivityFeed(), 143 | Profile(profileId: currentUser?.id), 144 | ], 145 | controller: pageController, 146 | onPageChanged: onPageChanged, 147 | physics: NeverScrollableScrollPhysics(), 148 | ), 149 | bottomNavigationBar: CupertinoTabBar( 150 | currentIndex: pageIndex, 151 | onTap: onTap, 152 | activeColor: Theme.of(context).primaryColor, 153 | items: [ 154 | BottomNavigationBarItem(icon: Icon(Icons.home, 155 | color: Colors.black,)), 156 | BottomNavigationBarItem(icon: Icon(Icons.search, 157 | color: Colors.black,)), 158 | BottomNavigationBarItem( 159 | icon: Icon( 160 | Icons.add_circle_outline, 161 | size: 35.0, 162 | color: Colors.black, 163 | ), 164 | ), 165 | BottomNavigationBarItem(icon: Icon(Icons.favorite, 166 | color: Colors.black,)), 167 | BottomNavigationBarItem(icon: Icon(Icons.person, 168 | color: Colors.black,)), 169 | ]), 170 | ); 171 | } 172 | 173 | Scaffold buildUnAuthScreen() { 174 | return Scaffold( 175 | body: Container( 176 | decoration: BoxDecoration( 177 | gradient: LinearGradient( 178 | begin: Alignment.topRight, 179 | end: Alignment.bottomLeft, 180 | colors: [ 181 | Colors.red, 182 | Colors.blue, 183 | // Theme.of(context).accentColor, 184 | // Theme.of(context).primaryColor, 185 | ], 186 | ), 187 | ), 188 | alignment: Alignment.topCenter, 189 | child: Column( 190 | mainAxisAlignment: MainAxisAlignment.center, 191 | crossAxisAlignment: CrossAxisAlignment.center, 192 | children: [ 193 | Text( 194 | 'Instagram', 195 | style: GoogleFonts.grandHotel( 196 | fontSize: 48, 197 | fontWeight: FontWeight.w700, 198 | color: Colors.white 199 | ), 200 | ), 201 | GestureDetector( 202 | onTap: login, 203 | child: Container( 204 | width: 260.0, 205 | height: 60.0, 206 | decoration: BoxDecoration( 207 | image: DecorationImage( 208 | image: AssetImage( 209 | 'assets/images/google_signin_button.png', 210 | ), 211 | fit: BoxFit.cover, 212 | ), 213 | ), 214 | ), 215 | ) 216 | ], 217 | ), 218 | ), 219 | ); 220 | } 221 | 222 | @override 223 | Widget build(BuildContext context) { 224 | return isAuth ? buildAuthScreen() : buildUnAuthScreen(); 225 | } 226 | } 227 | -------------------------------------------------------------------------------- /functions/index.js: -------------------------------------------------------------------------------- 1 | const functions = require("firebase-functions"); 2 | const admin = require("firebase-admin"); 3 | admin.initializeApp(); 4 | 5 | // // Create and Deploy Your First Cloud Functions 6 | // // https://firebase.google.com/docs/functions/write-firebase-functions 7 | // 8 | // exports.helloWorld = functions.https.onRequest((request, response) => { 9 | // response.send("Hello from Firebase!"); 10 | // }); 11 | exports.onCreateFollower = functions.firestore 12 | .document("/followers/{userId}/userFollowers/{followerId}") 13 | .onCreate(async (snapshot, context) => { 14 | console.log("Follower Created", snapshot.id); 15 | const userId = context.params.userId; 16 | const followerId = context.params.followerId; 17 | 18 | // 1) Create followed users posts ref 19 | const followedUserPostsRef = admin 20 | .firestore() 21 | .collection("posts") 22 | .doc(userId) 23 | .collection("userPosts"); 24 | 25 | // 2) Create following user's timeline ref 26 | const timelinePostsRef = admin 27 | .firestore() 28 | .collection("timeline") 29 | .doc(followerId) 30 | .collection("timelinePosts"); 31 | 32 | // 3) Get followed users posts 33 | const querySnapshot = await followedUserPostsRef.get(); 34 | 35 | // 4) Add each user post to following user's timeline 36 | querySnapshot.forEach(doc => { 37 | if (doc.exists) { 38 | const postId = doc.id; 39 | const postData = doc.data(); 40 | timelinePostsRef.doc(postId).set(postData); 41 | } 42 | }); 43 | }); 44 | 45 | exports.onDeleteFollower = functions.firestore 46 | .document("/followers/{userId}/userFollowers/{followerId}") 47 | .onDelete(async (snapshot, context) => { 48 | console.log("Follower Deleted", snapshot.id); 49 | 50 | const userId = context.params.userId; 51 | const followerId = context.params.followerId; 52 | 53 | const timelinePostsRef = admin 54 | .firestore() 55 | .collection("timeline") 56 | .doc(followerId) 57 | .collection("timelinePosts") 58 | .where("ownerId", "==", userId); 59 | 60 | const querySnapshot = await timelinePostsRef.get(); 61 | querySnapshot.forEach(doc => { 62 | if (doc.exists) { 63 | doc.ref.delete(); 64 | } 65 | }); 66 | }); 67 | 68 | // when a post is created, add post to timeline of each follower (of post owner) 69 | exports.onCreatePost = functions.firestore 70 | .document("/posts/{userId}/userPosts/{postId}") 71 | .onCreate(async (snapshot, context) => { 72 | const postCreated = snapshot.data(); 73 | const userId = context.params.userId; 74 | const postId = context.params.postId; 75 | 76 | // 1) Get all the followers of the user who made the post 77 | const userFollowersRef = admin 78 | .firestore() 79 | .collection("followers") 80 | .doc(userId) 81 | .collection("userFollowers"); 82 | 83 | const querySnapshot = await userFollowersRef.get(); 84 | // 2) Add new post to each follower's timeline 85 | querySnapshot.forEach(doc => { 86 | const followerId = doc.id; 87 | 88 | admin 89 | .firestore() 90 | .collection("timeline") 91 | .doc(followerId) 92 | .collection("timelinePosts") 93 | .doc(postId) 94 | .set(postCreated); 95 | }); 96 | }); 97 | 98 | exports.onUpdatePost = functions.firestore 99 | .document("/posts/{userId}/userPosts/{postId}") 100 | .onUpdate(async (change, context) => { 101 | const postUpdated = change.after.data(); 102 | const userId = context.params.userId; 103 | const postId = context.params.postId; 104 | 105 | // 1) Get all the followers of the user who made the post 106 | const userFollowersRef = admin 107 | .firestore() 108 | .collection("followers") 109 | .doc(userId) 110 | .collection("userFollowers"); 111 | 112 | const querySnapshot = await userFollowersRef.get(); 113 | // 2) Update each post in each follower's timeline 114 | querySnapshot.forEach(doc => { 115 | const followerId = doc.id; 116 | 117 | admin 118 | .firestore() 119 | .collection("timeline") 120 | .doc(followerId) 121 | .collection("timelinePosts") 122 | .doc(postId) 123 | .get() 124 | .then(doc => { 125 | if (doc.exists) { 126 | doc.ref.update(postUpdated); 127 | } 128 | }); 129 | }); 130 | }); 131 | 132 | exports.onDeletePost = functions.firestore 133 | .document("/posts/{userId}/userPosts/{postId}") 134 | .onDelete(async (snapshot, context) => { 135 | const userId = context.params.userId; 136 | const postId = context.params.postId; 137 | 138 | // 1) Get all the followers of the user who made the post 139 | const userFollowersRef = admin 140 | .firestore() 141 | .collection("followers") 142 | .doc(userId) 143 | .collection("userFollowers"); 144 | 145 | const querySnapshot = await userFollowersRef.get(); 146 | // 2) Delete each post in each follower's timeline 147 | querySnapshot.forEach(doc => { 148 | const followerId = doc.id; 149 | 150 | admin 151 | .firestore() 152 | .collection("timeline") 153 | .doc(followerId) 154 | .collection("timelinePosts") 155 | .doc(postId) 156 | .get() 157 | .then(doc => { 158 | if (doc.exists) { 159 | doc.ref.delete(); 160 | } 161 | }); 162 | }); 163 | }); 164 | 165 | exports.onCreateActivityFeedItem=functions.firestore 166 | .document("/feed/{userId}/feedItems/{activityFeedItem}") 167 | .onCreate(async(snapshot,context)=>{ 168 | console.log('Activity Feed Item Created',snapshot.data()); 169 | // 1) Get user connected to the feed 170 | const userId=context.params.userId; 171 | 172 | const userRef=admin.firestore().doc(`users/${userId}`); 173 | const doc=await userRef.get(); 174 | 175 | //2) once we have user check if they have a notification token then send 176 | const androidNotificationToken=doc.data() 177 | .androidNotificationToken 178 | const createdActivityFeedItem=snapshot.data(); 179 | if(androidNotificationToken){ 180 | sendNotification(androidNotificationToken,createdActivityFeedItem); 181 | } 182 | else { 183 | console.log("No token for user, cannot send notification"); 184 | 185 | } 186 | function sendNotification(androidNotificationToken,activityFeedItem){ 187 | let body; 188 | 189 | //3) switch body value based of notification type 190 | switch(activityFeedItem.type){ 191 | case "comment": 192 | body=`${activityFeedItem.username} replied: ${activityFeedItem.commentData}`; 193 | break; 194 | case "like": 195 | body=`${activityFeedItem.username} like your post`; 196 | break; 197 | case "follow": 198 | body=`${activityFeedItem.username} start following you`; 199 | break; 200 | default: 201 | break; 202 | } 203 | //4) Create message for push notification 204 | const message={ 205 | notification:{body}, 206 | token: androidNotificationToken, 207 | data: {recipient: userId} 208 | }; 209 | //5) Send message with admin.message() 210 | admin 211 | .messaging() 212 | .send(message) 213 | .then(response=> { 214 | //respone is a message ID string 215 | console.log("Successfully send message",response); 216 | }) 217 | .catch(error=>{ 218 | console.log("Error sending message",error); 219 | }); 220 | } 221 | 222 | }); -------------------------------------------------------------------------------- /lib/pages/upload.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:cached_network_image/cached_network_image.dart'; 4 | import 'package:firebase_storage/firebase_storage.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter_svg/svg.dart'; 7 | import 'package:socialmedia/pages/home.dart'; 8 | import 'package:socialmedia/pages/profile.dart'; 9 | import 'package:socialmedia/widgets/progress.dart'; 10 | import 'package:geolocator/geolocator.dart'; 11 | import 'package:image_picker/image_picker.dart'; 12 | import 'package:path_provider/path_provider.dart'; 13 | import 'package:image/image.dart' as Im; 14 | import 'package:uuid/uuid.dart'; 15 | 16 | class Upload extends StatefulWidget { 17 | final User currentUser; 18 | 19 | Upload({this.currentUser}); 20 | 21 | @override 22 | _UploadState createState() => _UploadState(); 23 | } 24 | 25 | class _UploadState extends State 26 | with AutomaticKeepAliveClientMixin { 27 | TextEditingController captionController = TextEditingController(); 28 | TextEditingController locationController = TextEditingController(); 29 | File file; 30 | bool isUploading = false; 31 | String postId = Uuid().v4(); 32 | 33 | handleTakePhoto() async { 34 | Navigator.pop(context); 35 | File file = await ImagePicker.pickImage( 36 | source: ImageSource.camera, 37 | maxHeight: 675, 38 | maxWidth: 960, 39 | ); 40 | setState(() { 41 | this.file = file; 42 | }); 43 | } 44 | 45 | handleChooseFromGallery() async { 46 | Navigator.pop(context); 47 | File file = await ImagePicker.pickImage(source: ImageSource.gallery); 48 | setState(() { 49 | this.file = file; 50 | }); 51 | } 52 | 53 | selectImage(parentContext) { 54 | return showDialog( 55 | context: parentContext, 56 | builder: (context) { 57 | return SimpleDialog( 58 | title: Text("Create Post"), 59 | children: [ 60 | SimpleDialogOption( 61 | child: Text("Photo with Camera"), onPressed: handleTakePhoto), 62 | SimpleDialogOption( 63 | child: Text("Image from Gallery"), 64 | onPressed: handleChooseFromGallery), 65 | SimpleDialogOption( 66 | child: Text("Cancel"), 67 | onPressed: () => Navigator.pop(context), 68 | ) 69 | ], 70 | ); 71 | }, 72 | ); 73 | } 74 | 75 | Container buildSplashScreen() { 76 | return Container( 77 | color: Theme.of(context).accentColor.withOpacity(0.6), 78 | child: Column( 79 | mainAxisAlignment: MainAxisAlignment.center, 80 | children: [ 81 | SvgPicture.asset('assets/images/upload.svg', height: 260.0), 82 | Padding( 83 | padding: EdgeInsets.only(top: 20.0), 84 | child: RaisedButton( 85 | shape: RoundedRectangleBorder( 86 | borderRadius: BorderRadius.circular(8.0), 87 | ), 88 | child: Text( 89 | "Upload Image", 90 | style: TextStyle( 91 | color: Colors.white, 92 | fontSize: 22.0, 93 | ), 94 | ), 95 | color: Colors.deepOrange, 96 | onPressed: () => selectImage(context)), 97 | ), 98 | ], 99 | ), 100 | ); 101 | } 102 | 103 | clearImage() { 104 | setState(() { 105 | file = null; 106 | }); 107 | } 108 | 109 | compressImage() async { 110 | final tempDir = await getTemporaryDirectory(); 111 | final path = tempDir.path; 112 | Im.Image imageFile = Im.decodeImage(file.readAsBytesSync()); 113 | final compressedImageFile = File('$path/img_$postId.jpg') 114 | ..writeAsBytesSync(Im.encodeJpg(imageFile, quality: 85)); 115 | setState(() { 116 | file = compressedImageFile; 117 | }); 118 | } 119 | 120 | Future uploadImage(imageFile) async { 121 | StorageUploadTask uploadTask = 122 | storageRef.child("post_$postId.jpg").putFile(imageFile); 123 | StorageTaskSnapshot storageSnap = await uploadTask.onComplete; 124 | String downloadUrl = await storageSnap.ref.getDownloadURL(); 125 | return downloadUrl; 126 | } 127 | 128 | createPostInFirestore( 129 | {String mediaUrl, String location, String description}) { 130 | postsRef 131 | .document(widget.currentUser.id) 132 | .collection("userPosts") 133 | .document(postId) 134 | .setData({ 135 | "postId": postId, 136 | "ownerId": widget.currentUser.id, 137 | "username": widget.currentUser.username, 138 | "mediaUrl": mediaUrl, 139 | "description": description, 140 | "location": location, 141 | "timestamp": timestamp, 142 | "likes": {}, 143 | }); 144 | } 145 | 146 | handleSubmit() async { 147 | setState(() { 148 | isUploading = true; 149 | }); 150 | await compressImage(); 151 | String mediaUrl = await uploadImage(file); 152 | createPostInFirestore( 153 | mediaUrl: mediaUrl, 154 | location: locationController.text, 155 | description: captionController.text, 156 | ); 157 | captionController.clear(); 158 | locationController.clear(); 159 | setState(() { 160 | file = null; 161 | isUploading = false; 162 | postId = Uuid().v4(); 163 | }); 164 | } 165 | 166 | Scaffold buildUploadForm() { 167 | return Scaffold( 168 | appBar: AppBar( 169 | backgroundColor: Colors.white70, 170 | leading: IconButton( 171 | icon: Icon(Icons.arrow_back, color: Colors.black), 172 | onPressed: clearImage), 173 | title: Text( 174 | "Caption Post", 175 | style: TextStyle(color: Colors.black), 176 | ), 177 | actions: [ 178 | FlatButton( 179 | onPressed: isUploading ? null : () => handleSubmit(), 180 | child: Text( 181 | "Post", 182 | style: TextStyle( 183 | color: Colors.blueAccent, 184 | fontWeight: FontWeight.bold, 185 | fontSize: 20.0, 186 | ), 187 | ), 188 | ), 189 | ], 190 | ), 191 | body: ListView( 192 | children: [ 193 | isUploading ? linearProgress() : Text(""), 194 | Container( 195 | height: 220.0, 196 | width: MediaQuery.of(context).size.width * 0.8, 197 | child: Center( 198 | child: AspectRatio( 199 | aspectRatio: 16 / 9, 200 | child: Container( 201 | decoration: BoxDecoration( 202 | image: DecorationImage( 203 | fit: BoxFit.cover, 204 | image: FileImage(file), 205 | ), 206 | ), 207 | ), 208 | ), 209 | ), 210 | ), 211 | Padding( 212 | padding: EdgeInsets.only(top: 10.0), 213 | ), 214 | ListTile( 215 | leading: CircleAvatar( 216 | backgroundImage: 217 | CachedNetworkImageProvider(widget.currentUser.photoUrl), 218 | ), 219 | title: Container( 220 | width: 250.0, 221 | child: TextField( 222 | controller: captionController, 223 | decoration: InputDecoration( 224 | hintText: "Write a caption...", 225 | border: InputBorder.none, 226 | ), 227 | ), 228 | ), 229 | ), 230 | Divider(), 231 | ListTile( 232 | leading: Icon( 233 | Icons.pin_drop, 234 | color: Colors.orange, 235 | size: 35.0, 236 | ), 237 | title: Container( 238 | width: 250.0, 239 | child: TextField( 240 | controller: locationController, 241 | decoration: InputDecoration( 242 | hintText: "Where was this photo taken?", 243 | border: InputBorder.none, 244 | ), 245 | ), 246 | ), 247 | ), 248 | Container( 249 | width: 200.0, 250 | height: 100.0, 251 | alignment: Alignment.center, 252 | child: RaisedButton.icon( 253 | label: Text( 254 | "Use Current Location", 255 | style: TextStyle(color: Colors.white), 256 | ), 257 | shape: RoundedRectangleBorder( 258 | borderRadius: BorderRadius.circular(30.0), 259 | ), 260 | color: Colors.blue, 261 | onPressed: getUserLocation, 262 | icon: Icon( 263 | Icons.my_location, 264 | color: Colors.white, 265 | ), 266 | ), 267 | ), 268 | ], 269 | ), 270 | ); 271 | } 272 | 273 | getUserLocation() async { 274 | Position position = await Geolocator() 275 | .getCurrentPosition(desiredAccuracy: LocationAccuracy.high); 276 | List placemarks = await Geolocator() 277 | .placemarkFromCoordinates(position.latitude, position.longitude); 278 | Placemark placemark = placemarks[0]; 279 | String completeAddress = 280 | '${placemark.subThoroughfare} ${placemark.thoroughfare}, ${placemark.subLocality} ${placemark.locality}, ${placemark.subAdministrativeArea}, ${placemark.administrativeArea} ${placemark.postalCode}, ${placemark.country}'; 281 | print(completeAddress); 282 | String formattedAddress = "${placemark.locality}, ${placemark.country}"; 283 | locationController.text = formattedAddress; 284 | } 285 | 286 | bool get wantKeepAlive => true; 287 | 288 | @override 289 | Widget build(BuildContext context) { 290 | super.build(context); 291 | 292 | return file == null ? buildSplashScreen() : buildUploadForm(); 293 | } 294 | } 295 | -------------------------------------------------------------------------------- /lib/widgets/post.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:animator/animator.dart'; 3 | import 'package:cached_network_image/cached_network_image.dart'; 4 | import 'package:cloud_firestore/cloud_firestore.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:socialmedia/pages/activity_feed.dart'; 7 | import 'package:socialmedia/pages/comment.dart'; 8 | import 'package:socialmedia/pages/home.dart'; 9 | import 'package:socialmedia/widgets/custome_image.dart'; 10 | import 'package:socialmedia/widgets/progress.dart'; 11 | 12 | class Post extends StatefulWidget { 13 | final String postId; 14 | final String ownerId; 15 | final String username; 16 | final String location; 17 | final String description; 18 | final String mediaUrl; 19 | final dynamic likes; 20 | 21 | Post({ 22 | this.postId, 23 | this.ownerId, 24 | this.username, 25 | this.location, 26 | this.description, 27 | this.mediaUrl, 28 | this.likes, 29 | }); 30 | 31 | factory Post.fromDocument(DocumentSnapshot doc) { 32 | return Post( 33 | postId: doc['postId'], 34 | ownerId: doc['ownerId'], 35 | username: doc['username'], 36 | location: doc['location'], 37 | description: doc['description'], 38 | mediaUrl: doc['mediaUrl'], 39 | likes: doc['likes'], 40 | ); 41 | } 42 | 43 | int getLikeCount(likes) { 44 | // if no likes, return 0 45 | if (likes == null) { 46 | return 0; 47 | } 48 | int count = 0; 49 | // if the key is explicitly set to true, add a like 50 | likes.values.forEach((val) { 51 | if (val == true) { 52 | count += 1; 53 | } 54 | }); 55 | return count; 56 | } 57 | 58 | @override 59 | _PostState createState() => _PostState( 60 | postId: this.postId, 61 | ownerId: this.ownerId, 62 | username: this.username, 63 | location: this.location, 64 | description: this.description, 65 | mediaUrl: this.mediaUrl, 66 | likes: this.likes, 67 | likeCount: getLikeCount(this.likes), 68 | ); 69 | } 70 | 71 | class _PostState extends State { 72 | final String currentUserId = currentUser?.id; 73 | final String postId; 74 | final String ownerId; 75 | final String username; 76 | final String location; 77 | final String description; 78 | final String mediaUrl; 79 | bool showHeart = false; 80 | bool isLiked; 81 | int likeCount; 82 | Map likes; 83 | 84 | _PostState({ 85 | this.postId, 86 | this.ownerId, 87 | this.username, 88 | this.location, 89 | this.description, 90 | this.mediaUrl, 91 | this.likes, 92 | this.likeCount, 93 | }); 94 | 95 | buildPostHeader() { 96 | return FutureBuilder( 97 | future: usersRef.document(ownerId).get(), 98 | builder: (context, snapshot) { 99 | if (!snapshot.hasData) { 100 | return circularProgress(); 101 | } 102 | User1 user = User1.fromDocument(snapshot.data); 103 | bool isPostOwner=currentUserId==ownerId; 104 | return ListTile( 105 | leading: CircleAvatar( 106 | backgroundImage: CachedNetworkImageProvider(user.photoUrl), 107 | backgroundColor: Colors.grey, 108 | ), 109 | title: GestureDetector( 110 | onTap: () => showProfile(context, profileId: user.id), 111 | child: Text( 112 | user.username, 113 | style: TextStyle( 114 | color: Colors.black, 115 | fontWeight: FontWeight.bold, 116 | ), 117 | ), 118 | ), 119 | subtitle: Text(location), 120 | trailing: isPostOwner ? IconButton( 121 | onPressed: () => handleDeletePost(context), 122 | icon: Icon(Icons.more_vert), 123 | ):Text(''), 124 | ); 125 | }, 126 | ); 127 | } 128 | handleDeletePost(BuildContext parentContext ){ 129 | return showDialog( 130 | context: parentContext, 131 | builder: (context){ 132 | return SimpleDialog( 133 | title: Text("Remove this post?"), 134 | children: [ 135 | SimpleDialogOption( 136 | onPressed: (){ 137 | Navigator.pop(context); 138 | deletePost(); 139 | }, 140 | child: Text('Delete', 141 | style: TextStyle( 142 | 143 | ),), 144 | ), 145 | SimpleDialogOption( 146 | onPressed: ()=> Navigator.pop(context), 147 | child: Text('Cancel', 148 | ), 149 | ) 150 | ], 151 | ); 152 | } 153 | ); 154 | } 155 | deletePost()async{ 156 | postsRef 157 | .document(ownerId) 158 | .collection('userPosts') 159 | .document(postId) 160 | .get().then((doc){ 161 | if(doc.exists){ 162 | doc.reference.delete(); 163 | } 164 | }); 165 | //delete upload image for the post 166 | storageRef.child("post_$postId.jpg").delete(); 167 | //then delete all activity feed notifications 168 | QuerySnapshot activityFeedSnapshot=await activityFeedRef 169 | .document(ownerId) 170 | .collection("feeditems") 171 | .where('postId',isEqualTo: postId) 172 | .getDocuments(); 173 | activityFeedSnapshot.documents.forEach((doc){ 174 | if(doc.exists){ 175 | doc.reference.delete(); 176 | } 177 | }); 178 | //then also delete all comments 179 | QuerySnapshot commentsSnapshot=await commentsRef 180 | .document(postId) 181 | .collection('comments') 182 | .getDocuments(); 183 | commentsSnapshot.documents.forEach((doc){ 184 | if(doc.exists){ 185 | doc.reference.delete(); 186 | } 187 | }); 188 | } 189 | handleLikePost() { 190 | bool _isLiked = likes[currentUserId] == true; 191 | 192 | if (_isLiked) { 193 | postsRef 194 | .document(ownerId) 195 | .collection('userPosts') 196 | .document(postId) 197 | .updateData({'likes.$currentUserId': false}); 198 | removeLikeFromActivityFeed(); 199 | setState(() { 200 | likeCount -= 1; 201 | isLiked = false; 202 | likes[currentUserId] = false; 203 | }); 204 | } else if (!_isLiked) { 205 | postsRef 206 | .document(ownerId) 207 | .collection('userPosts') 208 | .document(postId) 209 | .updateData({'likes.$currentUserId': true}); 210 | addLikeToActivityFeed(); 211 | setState(() { 212 | likeCount += 1; 213 | isLiked = true; 214 | likes[currentUserId] = true; 215 | showHeart = true; 216 | }); 217 | Timer(Duration(milliseconds: 500), () { 218 | setState(() { 219 | showHeart = false; 220 | }); 221 | }); 222 | } 223 | } 224 | 225 | addLikeToActivityFeed() { 226 | // add a notification to the postOwner's activity feed only if comment made by OTHER user (to avoid getting notification for our own like) 227 | bool isNotPostOwner = currentUserId != ownerId; 228 | if (isNotPostOwner) { 229 | activityFeedRef 230 | .document(ownerId) 231 | .collection("feedItems") 232 | .document(postId) 233 | .setData({ 234 | "type": "like", 235 | "username": currentUser.username, 236 | "userId": currentUser.id, 237 | "userProfileImg": currentUser.photoUrl, 238 | "postId": postId, 239 | "mediaUrl": mediaUrl, 240 | "timestamp": timestamp, 241 | }); 242 | } 243 | } 244 | 245 | removeLikeFromActivityFeed() { 246 | bool isNotPostOwner = currentUserId != ownerId; 247 | if (isNotPostOwner) { 248 | activityFeedRef 249 | .document(ownerId) 250 | .collection("feedItems") 251 | .document(postId) 252 | .get() 253 | .then((doc) { 254 | if (doc.exists) { 255 | doc.reference.delete(); 256 | } 257 | }); 258 | } 259 | } 260 | 261 | buildPostImage() { 262 | return GestureDetector( 263 | onDoubleTap: handleLikePost, 264 | child: Stack( 265 | alignment: Alignment.center, 266 | children: [ 267 | cachedNetworkImage(mediaUrl), 268 | showHeart 269 | ? Animator( 270 | duration: Duration(milliseconds: 400), 271 | tween: Tween(begin: 0.8, end: 1.4), 272 | curve: Curves.elasticOut, 273 | cycles: 0, 274 | builder: (anim) => Transform.scale( 275 | scale: anim.value, 276 | child: Icon( 277 | Icons.favorite, 278 | size: 80.0, 279 | color: Colors.white, 280 | ), 281 | ), 282 | ) 283 | : Text(""), 284 | ], 285 | ), 286 | ); 287 | } 288 | 289 | buildPostFooter() { 290 | return Column( 291 | children: [ 292 | Row( 293 | mainAxisAlignment: MainAxisAlignment.start, 294 | children: [ 295 | Padding(padding: EdgeInsets.only(top: 40.0, left: 20.0)), 296 | GestureDetector( 297 | onTap: handleLikePost, 298 | child: Icon( 299 | isLiked ? Icons.favorite : Icons.favorite_border, 300 | size: 28.0, 301 | color: Colors.pink, 302 | ), 303 | ), 304 | Padding(padding: EdgeInsets.only(right: 20.0)), 305 | GestureDetector( 306 | onTap: () => showComments( 307 | context, 308 | postId: postId, 309 | ownerId: ownerId, 310 | mediaUrl: mediaUrl, 311 | ), 312 | child: Icon( 313 | Icons.chat, 314 | size: 28.0, 315 | color: Colors.blue[900], 316 | ), 317 | ), 318 | ], 319 | ), 320 | Row( 321 | children: [ 322 | Container( 323 | margin: EdgeInsets.only(left: 20.0), 324 | child: Text( 325 | "$likeCount likes", 326 | style: TextStyle( 327 | color: Colors.black, 328 | fontWeight: FontWeight.bold, 329 | ), 330 | ), 331 | ), 332 | ], 333 | ), 334 | Row( 335 | crossAxisAlignment: CrossAxisAlignment.start, 336 | children: [ 337 | Container( 338 | margin: EdgeInsets.only(left: 20.0), 339 | child: Text( 340 | "$username ", 341 | style: TextStyle( 342 | color: Colors.black, 343 | fontWeight: FontWeight.bold, 344 | ), 345 | ), 346 | ), 347 | Expanded(child: Text(description)) 348 | ], 349 | ), 350 | ], 351 | ); 352 | } 353 | 354 | @override 355 | Widget build(BuildContext context) { 356 | isLiked = (likes[currentUserId] == true); 357 | 358 | return Column( 359 | mainAxisSize: MainAxisSize.min, 360 | children: [ 361 | buildPostHeader(), 362 | buildPostImage(), 363 | buildPostFooter() 364 | ], 365 | ); 366 | } 367 | } 368 | 369 | showComments(BuildContext context, 370 | {String postId, String ownerId, String mediaUrl}) { 371 | Navigator.push(context, MaterialPageRoute(builder: (context) { 372 | return Comments( 373 | postId: postId, 374 | postOwnerId: ownerId, 375 | postMediaUrl: mediaUrl, 376 | ); 377 | })); 378 | } 379 | 380 | 381 | class User1{ 382 | final String id; 383 | final String username; 384 | final String email; 385 | final String photoUrl; 386 | final String displayName; 387 | final String bio; 388 | 389 | User1({ 390 | this.id, 391 | this.username, 392 | this.email, 393 | this.photoUrl, 394 | this.displayName, 395 | this.bio, 396 | }); 397 | factory User1.fromDocument(DocumentSnapshot doc){ 398 | return User1( 399 | id: doc['id'], 400 | email: doc['email'], 401 | username: doc['username'], 402 | photoUrl: doc['photoUrl'], 403 | displayName: doc['displayName'], 404 | bio: doc['bio'], 405 | ); 406 | } 407 | } 408 | 409 | 410 | -------------------------------------------------------------------------------- /lib/pages/profile.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:cloud_firestore/cloud_firestore.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_svg/svg.dart'; 5 | import 'package:socialmedia/pages/edit_profile.dart'; 6 | import 'package:socialmedia/pages/home.dart'; 7 | import 'package:socialmedia/widgets/header.dart'; 8 | import 'package:socialmedia/widgets/post.dart'; 9 | import 'package:socialmedia/widgets/post_tile.dart'; 10 | import 'package:socialmedia/widgets/progress.dart'; 11 | 12 | class Profile extends StatefulWidget { 13 | final String profileId; 14 | 15 | Profile({this.profileId}); 16 | 17 | @override 18 | _ProfileState createState() => _ProfileState(); 19 | } 20 | 21 | class _ProfileState extends State { 22 | final String currentUserId = currentUser?.id; 23 | String postOrientation = "grid"; 24 | bool isLoading = false; 25 | bool isFollowing = false; 26 | int followerCount = 0; 27 | int followingCount = 0; 28 | int postCount = 0; 29 | List posts = []; 30 | 31 | @override 32 | void initState() { 33 | super.initState(); 34 | getProfilePosts(); 35 | getFollowers(); 36 | getFollowing(); 37 | checkIfFollowing(); 38 | } 39 | 40 | checkIfFollowing() async { 41 | DocumentSnapshot doc = await followersRef 42 | .document(widget.profileId) 43 | .collection('userFollowers') 44 | .document(currentUserId) 45 | .get(); 46 | setState(() { 47 | isFollowing = doc.exists; 48 | }); 49 | } 50 | 51 | getFollowers() async { 52 | QuerySnapshot snapshot = await followersRef 53 | .document(widget.profileId) 54 | .collection('userFollowers') 55 | .getDocuments(); 56 | setState(() { 57 | followerCount = snapshot.documents.length; 58 | }); 59 | } 60 | 61 | getFollowing() async { 62 | QuerySnapshot snapshot = await followingRef 63 | .document(widget.profileId) 64 | .collection('userFollowing') 65 | .getDocuments(); 66 | setState(() { 67 | followingCount = snapshot.documents.length; 68 | }); 69 | } 70 | 71 | getProfilePosts() async { 72 | setState(() { 73 | isLoading = true; 74 | }); 75 | QuerySnapshot snapshot = await postsRef 76 | .document(widget.profileId) 77 | .collection('userPosts') 78 | .orderBy('timestamp', descending: true) 79 | .getDocuments(); 80 | setState(() { 81 | isLoading = false; 82 | postCount = snapshot.documents.length; 83 | posts = snapshot.documents.map((doc) => Post.fromDocument(doc)).toList(); 84 | }); 85 | } 86 | 87 | Column buildCountColumn(String label, int count) { 88 | return Column( 89 | mainAxisSize: MainAxisSize.min, 90 | mainAxisAlignment: MainAxisAlignment.center, 91 | children: [ 92 | Text( 93 | count.toString(), 94 | style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.bold), 95 | ), 96 | Container( 97 | margin: EdgeInsets.only(top: 4.0), 98 | child: Text( 99 | label, 100 | style: TextStyle( 101 | color: Colors.grey, 102 | fontSize: 15.0, 103 | fontWeight: FontWeight.w400, 104 | ), 105 | ), 106 | ), 107 | ], 108 | ); 109 | } 110 | 111 | editProfile() { 112 | Navigator.push( 113 | context, 114 | MaterialPageRoute( 115 | builder: (context) => EditProfile(currentUserId: currentUserId))); 116 | } 117 | 118 | Container buildButton({String text, Function function}) { 119 | return Container( 120 | padding: EdgeInsets.only(top: 2.0), 121 | child: FlatButton( 122 | onPressed: function, 123 | child: Container( 124 | width: 230.0, 125 | height: 27.0, 126 | child: Text( 127 | text, 128 | style: TextStyle( 129 | color: isFollowing ? Colors.black : Colors.white, 130 | fontWeight: FontWeight.bold, 131 | ), 132 | ), 133 | alignment: Alignment.center, 134 | decoration: BoxDecoration( 135 | color: isFollowing ? Colors.white : Colors.blue, 136 | border: Border.all( 137 | color: isFollowing ? Colors.grey : Colors.blue, 138 | ), 139 | borderRadius: BorderRadius.circular(5.0), 140 | ), 141 | ), 142 | ), 143 | ); 144 | } 145 | 146 | buildProfileButton() { 147 | // viewing your own profile - should show edit profile button 148 | bool isProfileOwner = currentUserId == widget.profileId; 149 | if (isProfileOwner) { 150 | return buildButton(text: "Edit Profile", function: editProfile); 151 | } else if (isFollowing) { 152 | return buildButton(text: "Unfollow", function: handleUnfollowUser); 153 | } else if (!isFollowing) { 154 | return buildButton(text: "Follow", function: handleFollowUser); 155 | } 156 | } 157 | 158 | handleUnfollowUser() { 159 | setState(() { 160 | isFollowing = false; 161 | }); 162 | //remove follower 163 | followersRef 164 | .document(widget.profileId) 165 | .collection('userFollowers') 166 | .document(currentUserId) 167 | .get() 168 | .then((doc) { 169 | if (doc.exists) { 170 | doc.reference.delete(); 171 | } 172 | }); 173 | followingRef 174 | .document(currentUserId) 175 | .collection('userFollowing') 176 | .document(widget.profileId) 177 | .get() 178 | .then((doc) { 179 | if (doc.exists) { 180 | doc.reference.delete(); 181 | } 182 | }); 183 | //delete activity feed item 184 | activityFeedRef 185 | .document(widget.profileId) 186 | .collection('feedItems') 187 | .document(currentUserId) 188 | .get() 189 | .then((doc) { 190 | if (doc.exists) { 191 | doc.reference.delete(); 192 | } 193 | }); 194 | } 195 | 196 | handleFollowUser() { 197 | setState(() { 198 | isFollowing = true; 199 | }); 200 | //Make auth user follower of THAT user (update their followers 201 | //collection 202 | followersRef 203 | .document(widget.profileId) 204 | .collection('userFollowers') 205 | .document(currentUserId) 206 | .setData({}); 207 | followingRef 208 | .document(currentUserId) 209 | .collection('userFollowing') 210 | .document(widget.profileId) 211 | .setData({}); 212 | //add activity feed item for that user to notify about new follower 213 | activityFeedRef 214 | .document(widget.profileId) 215 | .collection('feedItems') 216 | .document(currentUserId) 217 | .setData({ 218 | "type": "follow", 219 | "ownerId": widget.profileId, 220 | "username": currentUser.username, 221 | "userId": currentUserId, 222 | "userProfileImg": currentUser.photoUrl, 223 | "timestamp": timestamp, 224 | }); 225 | } 226 | 227 | buildProfileHeader() { 228 | return FutureBuilder( 229 | future: usersRef.document(widget.profileId).get(), 230 | builder: (context, snapshot) { 231 | if (!snapshot.hasData) { 232 | return circularProgress(); 233 | } 234 | User user = User.fromDocument(snapshot.data); 235 | return Padding( 236 | padding: EdgeInsets.all(16.0), 237 | child: Column( 238 | children: [ 239 | Row( 240 | children: [ 241 | CircleAvatar( 242 | radius: 40.0, 243 | backgroundColor: Colors.grey, 244 | backgroundImage: 245 | CachedNetworkImageProvider(user.photoUrl), 246 | ), 247 | Expanded( 248 | flex: 1, 249 | child: Column( 250 | children: [ 251 | Row( 252 | mainAxisSize: MainAxisSize.max, 253 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 254 | children: [ 255 | buildCountColumn("posts", postCount), 256 | buildCountColumn("followers", followerCount), 257 | buildCountColumn("following", followingCount), 258 | ], 259 | ), 260 | Row( 261 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 262 | children: [ 263 | buildProfileButton(), 264 | ], 265 | ), 266 | ], 267 | ), 268 | ), 269 | ], 270 | ), 271 | Container( 272 | alignment: Alignment.centerLeft, 273 | padding: EdgeInsets.only(top: 12.0), 274 | child: Text( 275 | user.username, 276 | style: TextStyle( 277 | fontWeight: FontWeight.bold, 278 | fontSize: 16.0, 279 | ), 280 | ), 281 | ), 282 | Container( 283 | alignment: Alignment.centerLeft, 284 | padding: EdgeInsets.only(top: 4.0), 285 | child: Text( 286 | user.displayName, 287 | style: TextStyle( 288 | fontWeight: FontWeight.bold, 289 | ), 290 | ), 291 | ), 292 | Container( 293 | alignment: Alignment.centerLeft, 294 | padding: EdgeInsets.only(top: 2.0), 295 | child: Text( 296 | user.bio, 297 | ), 298 | ), 299 | ], 300 | ), 301 | ); 302 | }); 303 | } 304 | 305 | buildProfilePosts() { 306 | if (isLoading) { 307 | return circularProgress(); 308 | } else if (posts.isEmpty) { 309 | return Container( 310 | child: Column( 311 | mainAxisAlignment: MainAxisAlignment.center, 312 | children: [ 313 | SvgPicture.asset('assets/images/no_content.svg', height: 260.0), 314 | Padding( 315 | padding: EdgeInsets.only(top: 20.0), 316 | child: Text( 317 | "No Posts", 318 | style: TextStyle( 319 | color: Colors.redAccent, 320 | fontSize: 40.0, 321 | fontWeight: FontWeight.bold, 322 | ), 323 | ), 324 | ), 325 | ], 326 | ), 327 | ); 328 | } else if (postOrientation == "grid") { 329 | List gridTiles = []; 330 | posts.forEach((post) { 331 | gridTiles.add(GridTile(child: PostTile(post))); 332 | }); 333 | return GridView.count( 334 | crossAxisCount: 3, 335 | childAspectRatio: 1.0, 336 | mainAxisSpacing: 1.5, 337 | crossAxisSpacing: 1.5, 338 | shrinkWrap: true, 339 | physics: NeverScrollableScrollPhysics(), 340 | children: gridTiles, 341 | ); 342 | } else if (postOrientation == "list") { 343 | return Column( 344 | children: posts, 345 | ); 346 | } 347 | } 348 | 349 | setPostOrientation(String postOrientation) { 350 | setState(() { 351 | this.postOrientation = postOrientation; 352 | }); 353 | } 354 | 355 | buildTogglePostOrientation() { 356 | return Row( 357 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 358 | children: [ 359 | IconButton( 360 | onPressed: () => setPostOrientation("grid"), 361 | icon: Icon(Icons.grid_on), 362 | color: postOrientation == 'grid' 363 | ? Theme.of(context).primaryColor 364 | : Colors.grey, 365 | ), 366 | IconButton( 367 | onPressed: () => setPostOrientation("list"), 368 | icon: Icon(Icons.list), 369 | color: postOrientation == 'list' 370 | ? Theme.of(context).primaryColor 371 | : Colors.grey, 372 | ), 373 | ], 374 | ); 375 | } 376 | 377 | @override 378 | Widget build(BuildContext context) { 379 | return Scaffold( 380 | appBar: header(titleText: "Profile",removeBackButton: true), 381 | body: ListView( 382 | children: [ 383 | buildProfileHeader(), 384 | Divider(), 385 | buildTogglePostOrientation(), 386 | Divider( 387 | height: 0.0, 388 | ), 389 | buildProfilePosts(), 390 | ], 391 | ), 392 | ); 393 | } 394 | } 395 | 396 | class User { 397 | final String id; 398 | final String username; 399 | final String email; 400 | final String photoUrl; 401 | final String displayName; 402 | final String bio; 403 | 404 | User({ 405 | this.id, 406 | this.username, 407 | this.email, 408 | this.photoUrl, 409 | this.displayName, 410 | this.bio, 411 | }); 412 | 413 | factory User.fromDocument(DocumentSnapshot doc) { 414 | return User( 415 | id: doc['id'], 416 | email: doc['email'], 417 | username: doc['username'], 418 | photoUrl: doc['photoUrl'], 419 | displayName: doc['displayName'], 420 | bio: doc['bio'], 421 | ); 422 | } 423 | } 424 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | animator: 5 | dependency: "direct main" 6 | description: 7 | name: animator 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "1.0.0+5" 11 | archive: 12 | dependency: transitive 13 | description: 14 | name: archive 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.0.11" 18 | args: 19 | dependency: transitive 20 | description: 21 | name: args 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.5.2" 25 | async: 26 | dependency: transitive 27 | description: 28 | name: async 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "2.4.0" 32 | boolean_selector: 33 | dependency: transitive 34 | description: 35 | name: boolean_selector 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.0.5" 39 | cached_network_image: 40 | dependency: "direct main" 41 | description: 42 | name: cached_network_image 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "2.0.0" 46 | charcode: 47 | dependency: transitive 48 | description: 49 | name: charcode 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.1.2" 53 | cloud_firestore: 54 | dependency: "direct main" 55 | description: 56 | name: cloud_firestore 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "0.13.4+2" 60 | cloud_firestore_platform_interface: 61 | dependency: transitive 62 | description: 63 | name: cloud_firestore_platform_interface 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "1.1.0" 67 | cloud_firestore_web: 68 | dependency: transitive 69 | description: 70 | name: cloud_firestore_web 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "0.1.1+2" 74 | collection: 75 | dependency: transitive 76 | description: 77 | name: collection 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "1.14.11" 81 | convert: 82 | dependency: transitive 83 | description: 84 | name: convert 85 | url: "https://pub.dartlang.org" 86 | source: hosted 87 | version: "2.1.1" 88 | crypto: 89 | dependency: transitive 90 | description: 91 | name: crypto 92 | url: "https://pub.dartlang.org" 93 | source: hosted 94 | version: "2.1.3" 95 | cupertino_icons: 96 | dependency: "direct main" 97 | description: 98 | name: cupertino_icons 99 | url: "https://pub.dartlang.org" 100 | source: hosted 101 | version: "0.1.3" 102 | equatable: 103 | dependency: transitive 104 | description: 105 | name: equatable 106 | url: "https://pub.dartlang.org" 107 | source: hosted 108 | version: "1.1.1" 109 | firebase: 110 | dependency: transitive 111 | description: 112 | name: firebase 113 | url: "https://pub.dartlang.org" 114 | source: hosted 115 | version: "7.2.1" 116 | firebase_auth: 117 | dependency: "direct main" 118 | description: 119 | name: firebase_auth 120 | url: "https://pub.dartlang.org" 121 | source: hosted 122 | version: "0.15.5+3" 123 | firebase_auth_platform_interface: 124 | dependency: transitive 125 | description: 126 | name: firebase_auth_platform_interface 127 | url: "https://pub.dartlang.org" 128 | source: hosted 129 | version: "1.1.7" 130 | firebase_auth_web: 131 | dependency: transitive 132 | description: 133 | name: firebase_auth_web 134 | url: "https://pub.dartlang.org" 135 | source: hosted 136 | version: "0.1.2" 137 | firebase_core: 138 | dependency: transitive 139 | description: 140 | name: firebase_core 141 | url: "https://pub.dartlang.org" 142 | source: hosted 143 | version: "0.4.4+3" 144 | firebase_core_platform_interface: 145 | dependency: transitive 146 | description: 147 | name: firebase_core_platform_interface 148 | url: "https://pub.dartlang.org" 149 | source: hosted 150 | version: "1.0.4" 151 | firebase_core_web: 152 | dependency: transitive 153 | description: 154 | name: firebase_core_web 155 | url: "https://pub.dartlang.org" 156 | source: hosted 157 | version: "0.1.1+2" 158 | firebase_messaging: 159 | dependency: "direct main" 160 | description: 161 | name: firebase_messaging 162 | url: "https://pub.dartlang.org" 163 | source: hosted 164 | version: "6.0.13" 165 | firebase_storage: 166 | dependency: "direct main" 167 | description: 168 | name: firebase_storage 169 | url: "https://pub.dartlang.org" 170 | source: hosted 171 | version: "3.1.5" 172 | flutter: 173 | dependency: "direct main" 174 | description: flutter 175 | source: sdk 176 | version: "0.0.0" 177 | flutter_cache_manager: 178 | dependency: transitive 179 | description: 180 | name: flutter_cache_manager 181 | url: "https://pub.dartlang.org" 182 | source: hosted 183 | version: "1.1.3" 184 | flutter_plugin_android_lifecycle: 185 | dependency: transitive 186 | description: 187 | name: flutter_plugin_android_lifecycle 188 | url: "https://pub.dartlang.org" 189 | source: hosted 190 | version: "1.0.6" 191 | flutter_svg: 192 | dependency: "direct main" 193 | description: 194 | name: flutter_svg 195 | url: "https://pub.dartlang.org" 196 | source: hosted 197 | version: "0.17.3+1" 198 | flutter_test: 199 | dependency: "direct dev" 200 | description: flutter 201 | source: sdk 202 | version: "0.0.0" 203 | flutter_web_plugins: 204 | dependency: transitive 205 | description: flutter 206 | source: sdk 207 | version: "0.0.0" 208 | geolocator: 209 | dependency: "direct main" 210 | description: 211 | name: geolocator 212 | url: "https://pub.dartlang.org" 213 | source: hosted 214 | version: "5.3.0" 215 | google_api_availability: 216 | dependency: transitive 217 | description: 218 | name: google_api_availability 219 | url: "https://pub.dartlang.org" 220 | source: hosted 221 | version: "2.0.3" 222 | google_fonts: 223 | dependency: "direct main" 224 | description: 225 | name: google_fonts 226 | url: "https://pub.dartlang.org" 227 | source: hosted 228 | version: "0.4.0" 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.3.0" 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.0" 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.8.4" 250 | http: 251 | dependency: transitive 252 | description: 253 | name: http 254 | url: "https://pub.dartlang.org" 255 | source: hosted 256 | version: "0.12.0+4" 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: 265 | dependency: "direct main" 266 | description: 267 | name: image 268 | url: "https://pub.dartlang.org" 269 | source: hosted 270 | version: "2.1.4" 271 | image_picker: 272 | dependency: "direct main" 273 | description: 274 | name: image_picker 275 | url: "https://pub.dartlang.org" 276 | source: hosted 277 | version: "0.6.4" 278 | js: 279 | dependency: transitive 280 | description: 281 | name: js 282 | url: "https://pub.dartlang.org" 283 | source: hosted 284 | version: "0.6.1+1" 285 | location_permissions: 286 | dependency: transitive 287 | description: 288 | name: location_permissions 289 | url: "https://pub.dartlang.org" 290 | source: hosted 291 | version: "2.0.5" 292 | matcher: 293 | dependency: transitive 294 | description: 295 | name: matcher 296 | url: "https://pub.dartlang.org" 297 | source: hosted 298 | version: "0.12.6" 299 | meta: 300 | dependency: transitive 301 | description: 302 | name: meta 303 | url: "https://pub.dartlang.org" 304 | source: hosted 305 | version: "1.1.8" 306 | path: 307 | dependency: transitive 308 | description: 309 | name: path 310 | url: "https://pub.dartlang.org" 311 | source: hosted 312 | version: "1.6.4" 313 | path_drawing: 314 | dependency: transitive 315 | description: 316 | name: path_drawing 317 | url: "https://pub.dartlang.org" 318 | source: hosted 319 | version: "0.4.1" 320 | path_parsing: 321 | dependency: transitive 322 | description: 323 | name: path_parsing 324 | url: "https://pub.dartlang.org" 325 | source: hosted 326 | version: "0.1.4" 327 | path_provider: 328 | dependency: "direct main" 329 | description: 330 | name: path_provider 331 | url: "https://pub.dartlang.org" 332 | source: hosted 333 | version: "1.6.5" 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" 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.1" 348 | pedantic: 349 | dependency: transitive 350 | description: 351 | name: pedantic 352 | url: "https://pub.dartlang.org" 353 | source: hosted 354 | version: "1.8.0+1" 355 | petitparser: 356 | dependency: transitive 357 | description: 358 | name: petitparser 359 | url: "https://pub.dartlang.org" 360 | source: hosted 361 | version: "2.4.0" 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.2" 376 | quiver: 377 | dependency: transitive 378 | description: 379 | name: quiver 380 | url: "https://pub.dartlang.org" 381 | source: hosted 382 | version: "2.0.5" 383 | sky_engine: 384 | dependency: transitive 385 | description: flutter 386 | source: sdk 387 | version: "0.0.99" 388 | source_span: 389 | dependency: transitive 390 | description: 391 | name: source_span 392 | url: "https://pub.dartlang.org" 393 | source: hosted 394 | version: "1.5.5" 395 | sqflite: 396 | dependency: transitive 397 | description: 398 | name: sqflite 399 | url: "https://pub.dartlang.org" 400 | source: hosted 401 | version: "1.3.0" 402 | sqflite_common: 403 | dependency: transitive 404 | description: 405 | name: sqflite_common 406 | url: "https://pub.dartlang.org" 407 | source: hosted 408 | version: "1.0.0+1" 409 | stack_trace: 410 | dependency: transitive 411 | description: 412 | name: stack_trace 413 | url: "https://pub.dartlang.org" 414 | source: hosted 415 | version: "1.9.3" 416 | states_rebuilder: 417 | dependency: transitive 418 | description: 419 | name: states_rebuilder 420 | url: "https://pub.dartlang.org" 421 | source: hosted 422 | version: "1.14.3" 423 | stream_channel: 424 | dependency: transitive 425 | description: 426 | name: stream_channel 427 | url: "https://pub.dartlang.org" 428 | source: hosted 429 | version: "2.0.0" 430 | string_scanner: 431 | dependency: transitive 432 | description: 433 | name: string_scanner 434 | url: "https://pub.dartlang.org" 435 | source: hosted 436 | version: "1.0.5" 437 | synchronized: 438 | dependency: transitive 439 | description: 440 | name: synchronized 441 | url: "https://pub.dartlang.org" 442 | source: hosted 443 | version: "2.2.0" 444 | term_glyph: 445 | dependency: transitive 446 | description: 447 | name: term_glyph 448 | url: "https://pub.dartlang.org" 449 | source: hosted 450 | version: "1.1.0" 451 | test_api: 452 | dependency: transitive 453 | description: 454 | name: test_api 455 | url: "https://pub.dartlang.org" 456 | source: hosted 457 | version: "0.2.11" 458 | timeago: 459 | dependency: "direct main" 460 | description: 461 | name: timeago 462 | url: "https://pub.dartlang.org" 463 | source: hosted 464 | version: "2.0.26" 465 | typed_data: 466 | dependency: transitive 467 | description: 468 | name: typed_data 469 | url: "https://pub.dartlang.org" 470 | source: hosted 471 | version: "1.1.6" 472 | uuid: 473 | dependency: "direct main" 474 | description: 475 | name: uuid 476 | url: "https://pub.dartlang.org" 477 | source: hosted 478 | version: "2.0.4" 479 | vector_math: 480 | dependency: transitive 481 | description: 482 | name: vector_math 483 | url: "https://pub.dartlang.org" 484 | source: hosted 485 | version: "2.0.8" 486 | xml: 487 | dependency: transitive 488 | description: 489 | name: xml 490 | url: "https://pub.dartlang.org" 491 | source: hosted 492 | version: "3.5.0" 493 | sdks: 494 | dart: ">=2.7.0 <3.0.0" 495 | flutter: ">=1.12.13+hotfix.4 <2.0.0" 496 | -------------------------------------------------------------------------------- /assets/images/upload.svg: -------------------------------------------------------------------------------- 1 | uploading -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 15 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 16 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 17 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 18 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 19 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXCopyFilesBuildPhase section */ 23 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 24 | isa = PBXCopyFilesBuildPhase; 25 | buildActionMask = 2147483647; 26 | dstPath = ""; 27 | dstSubfolderSpec = 10; 28 | files = ( 29 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 30 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 31 | ); 32 | name = "Embed Frameworks"; 33 | runOnlyForDeploymentPostprocessing = 0; 34 | }; 35 | /* End PBXCopyFilesBuildPhase section */ 36 | 37 | /* Begin PBXFileReference section */ 38 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 39 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 40 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 41 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 42 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 43 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 44 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 45 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 46 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 47 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 48 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 50 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 51 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 52 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 53 | /* End PBXFileReference section */ 54 | 55 | /* Begin PBXFrameworksBuildPhase section */ 56 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 61 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | /* End PBXFrameworksBuildPhase section */ 66 | 67 | /* Begin PBXGroup section */ 68 | 9740EEB11CF90186004384FC /* Flutter */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | 3B80C3931E831B6300D905FE /* App.framework */, 72 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 73 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 74 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 75 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 76 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 77 | ); 78 | name = Flutter; 79 | sourceTree = ""; 80 | }; 81 | 97C146E51CF9000F007C117D = { 82 | isa = PBXGroup; 83 | children = ( 84 | 9740EEB11CF90186004384FC /* Flutter */, 85 | 97C146F01CF9000F007C117D /* Runner */, 86 | 97C146EF1CF9000F007C117D /* Products */, 87 | ); 88 | sourceTree = ""; 89 | }; 90 | 97C146EF1CF9000F007C117D /* Products */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | 97C146EE1CF9000F007C117D /* Runner.app */, 94 | ); 95 | name = Products; 96 | sourceTree = ""; 97 | }; 98 | 97C146F01CF9000F007C117D /* Runner */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 102 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 103 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 104 | 97C147021CF9000F007C117D /* Info.plist */, 105 | 97C146F11CF9000F007C117D /* Supporting Files */, 106 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 107 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 108 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 109 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 110 | ); 111 | path = Runner; 112 | sourceTree = ""; 113 | }; 114 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | ); 118 | name = "Supporting Files"; 119 | sourceTree = ""; 120 | }; 121 | /* End PBXGroup section */ 122 | 123 | /* Begin PBXNativeTarget section */ 124 | 97C146ED1CF9000F007C117D /* Runner */ = { 125 | isa = PBXNativeTarget; 126 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 127 | buildPhases = ( 128 | 9740EEB61CF901F6004384FC /* Run Script */, 129 | 97C146EA1CF9000F007C117D /* Sources */, 130 | 97C146EB1CF9000F007C117D /* Frameworks */, 131 | 97C146EC1CF9000F007C117D /* Resources */, 132 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 133 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 134 | ); 135 | buildRules = ( 136 | ); 137 | dependencies = ( 138 | ); 139 | name = Runner; 140 | productName = Runner; 141 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 142 | productType = "com.apple.product-type.application"; 143 | }; 144 | /* End PBXNativeTarget section */ 145 | 146 | /* Begin PBXProject section */ 147 | 97C146E61CF9000F007C117D /* Project object */ = { 148 | isa = PBXProject; 149 | attributes = { 150 | LastUpgradeCheck = 1020; 151 | ORGANIZATIONNAME = "The Chromium Authors"; 152 | TargetAttributes = { 153 | 97C146ED1CF9000F007C117D = { 154 | CreatedOnToolsVersion = 7.3.1; 155 | LastSwiftMigration = 1100; 156 | }; 157 | }; 158 | }; 159 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 160 | compatibilityVersion = "Xcode 3.2"; 161 | developmentRegion = en; 162 | hasScannedForEncodings = 0; 163 | knownRegions = ( 164 | en, 165 | Base, 166 | ); 167 | mainGroup = 97C146E51CF9000F007C117D; 168 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 169 | projectDirPath = ""; 170 | projectRoot = ""; 171 | targets = ( 172 | 97C146ED1CF9000F007C117D /* Runner */, 173 | ); 174 | }; 175 | /* End PBXProject section */ 176 | 177 | /* Begin PBXResourcesBuildPhase section */ 178 | 97C146EC1CF9000F007C117D /* Resources */ = { 179 | isa = PBXResourcesBuildPhase; 180 | buildActionMask = 2147483647; 181 | files = ( 182 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 183 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 184 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 185 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 186 | ); 187 | runOnlyForDeploymentPostprocessing = 0; 188 | }; 189 | /* End PBXResourcesBuildPhase section */ 190 | 191 | /* Begin PBXShellScriptBuildPhase section */ 192 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 193 | isa = PBXShellScriptBuildPhase; 194 | buildActionMask = 2147483647; 195 | files = ( 196 | ); 197 | inputPaths = ( 198 | ); 199 | name = "Thin Binary"; 200 | outputPaths = ( 201 | ); 202 | runOnlyForDeploymentPostprocessing = 0; 203 | shellPath = /bin/sh; 204 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 205 | }; 206 | 9740EEB61CF901F6004384FC /* Run Script */ = { 207 | isa = PBXShellScriptBuildPhase; 208 | buildActionMask = 2147483647; 209 | files = ( 210 | ); 211 | inputPaths = ( 212 | ); 213 | name = "Run Script"; 214 | outputPaths = ( 215 | ); 216 | runOnlyForDeploymentPostprocessing = 0; 217 | shellPath = /bin/sh; 218 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 219 | }; 220 | /* End PBXShellScriptBuildPhase section */ 221 | 222 | /* Begin PBXSourcesBuildPhase section */ 223 | 97C146EA1CF9000F007C117D /* Sources */ = { 224 | isa = PBXSourcesBuildPhase; 225 | buildActionMask = 2147483647; 226 | files = ( 227 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 228 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 229 | ); 230 | runOnlyForDeploymentPostprocessing = 0; 231 | }; 232 | /* End PBXSourcesBuildPhase section */ 233 | 234 | /* Begin PBXVariantGroup section */ 235 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 236 | isa = PBXVariantGroup; 237 | children = ( 238 | 97C146FB1CF9000F007C117D /* Base */, 239 | ); 240 | name = Main.storyboard; 241 | sourceTree = ""; 242 | }; 243 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 244 | isa = PBXVariantGroup; 245 | children = ( 246 | 97C147001CF9000F007C117D /* Base */, 247 | ); 248 | name = LaunchScreen.storyboard; 249 | sourceTree = ""; 250 | }; 251 | /* End PBXVariantGroup section */ 252 | 253 | /* Begin XCBuildConfiguration section */ 254 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 255 | isa = XCBuildConfiguration; 256 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 257 | buildSettings = { 258 | ALWAYS_SEARCH_USER_PATHS = NO; 259 | CLANG_ANALYZER_NONNULL = YES; 260 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 261 | CLANG_CXX_LIBRARY = "libc++"; 262 | CLANG_ENABLE_MODULES = YES; 263 | CLANG_ENABLE_OBJC_ARC = YES; 264 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 265 | CLANG_WARN_BOOL_CONVERSION = YES; 266 | CLANG_WARN_COMMA = YES; 267 | CLANG_WARN_CONSTANT_CONVERSION = YES; 268 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 269 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 270 | CLANG_WARN_EMPTY_BODY = YES; 271 | CLANG_WARN_ENUM_CONVERSION = YES; 272 | CLANG_WARN_INFINITE_RECURSION = YES; 273 | CLANG_WARN_INT_CONVERSION = YES; 274 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 275 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 276 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 277 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 278 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 279 | CLANG_WARN_STRICT_PROTOTYPES = YES; 280 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 281 | CLANG_WARN_UNREACHABLE_CODE = YES; 282 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 283 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 284 | COPY_PHASE_STRIP = NO; 285 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 286 | ENABLE_NS_ASSERTIONS = NO; 287 | ENABLE_STRICT_OBJC_MSGSEND = YES; 288 | GCC_C_LANGUAGE_STANDARD = gnu99; 289 | GCC_NO_COMMON_BLOCKS = YES; 290 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 291 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 292 | GCC_WARN_UNDECLARED_SELECTOR = YES; 293 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 294 | GCC_WARN_UNUSED_FUNCTION = YES; 295 | GCC_WARN_UNUSED_VARIABLE = YES; 296 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 297 | MTL_ENABLE_DEBUG_INFO = NO; 298 | SDKROOT = iphoneos; 299 | SUPPORTED_PLATFORMS = iphoneos; 300 | TARGETED_DEVICE_FAMILY = "1,2"; 301 | VALIDATE_PRODUCT = YES; 302 | }; 303 | name = Profile; 304 | }; 305 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 306 | isa = XCBuildConfiguration; 307 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 308 | buildSettings = { 309 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 310 | CLANG_ENABLE_MODULES = YES; 311 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 312 | ENABLE_BITCODE = NO; 313 | FRAMEWORK_SEARCH_PATHS = ( 314 | "$(inherited)", 315 | "$(PROJECT_DIR)/Flutter", 316 | ); 317 | INFOPLIST_FILE = Runner/Info.plist; 318 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 319 | LIBRARY_SEARCH_PATHS = ( 320 | "$(inherited)", 321 | "$(PROJECT_DIR)/Flutter", 322 | ); 323 | PRODUCT_BUNDLE_IDENTIFIER = com.example.socialmedia; 324 | PRODUCT_NAME = "$(TARGET_NAME)"; 325 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 326 | SWIFT_VERSION = 5.0; 327 | VERSIONING_SYSTEM = "apple-generic"; 328 | }; 329 | name = Profile; 330 | }; 331 | 97C147031CF9000F007C117D /* Debug */ = { 332 | isa = XCBuildConfiguration; 333 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 334 | buildSettings = { 335 | ALWAYS_SEARCH_USER_PATHS = NO; 336 | CLANG_ANALYZER_NONNULL = YES; 337 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 338 | CLANG_CXX_LIBRARY = "libc++"; 339 | CLANG_ENABLE_MODULES = YES; 340 | CLANG_ENABLE_OBJC_ARC = YES; 341 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 342 | CLANG_WARN_BOOL_CONVERSION = YES; 343 | CLANG_WARN_COMMA = YES; 344 | CLANG_WARN_CONSTANT_CONVERSION = YES; 345 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 346 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 347 | CLANG_WARN_EMPTY_BODY = YES; 348 | CLANG_WARN_ENUM_CONVERSION = YES; 349 | CLANG_WARN_INFINITE_RECURSION = YES; 350 | CLANG_WARN_INT_CONVERSION = YES; 351 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 352 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 353 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 354 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 355 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 356 | CLANG_WARN_STRICT_PROTOTYPES = YES; 357 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 358 | CLANG_WARN_UNREACHABLE_CODE = YES; 359 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 360 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 361 | COPY_PHASE_STRIP = NO; 362 | DEBUG_INFORMATION_FORMAT = dwarf; 363 | ENABLE_STRICT_OBJC_MSGSEND = YES; 364 | ENABLE_TESTABILITY = YES; 365 | GCC_C_LANGUAGE_STANDARD = gnu99; 366 | GCC_DYNAMIC_NO_PIC = NO; 367 | GCC_NO_COMMON_BLOCKS = YES; 368 | GCC_OPTIMIZATION_LEVEL = 0; 369 | GCC_PREPROCESSOR_DEFINITIONS = ( 370 | "DEBUG=1", 371 | "$(inherited)", 372 | ); 373 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 374 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 375 | GCC_WARN_UNDECLARED_SELECTOR = YES; 376 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 377 | GCC_WARN_UNUSED_FUNCTION = YES; 378 | GCC_WARN_UNUSED_VARIABLE = YES; 379 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 380 | MTL_ENABLE_DEBUG_INFO = YES; 381 | ONLY_ACTIVE_ARCH = YES; 382 | SDKROOT = iphoneos; 383 | TARGETED_DEVICE_FAMILY = "1,2"; 384 | }; 385 | name = Debug; 386 | }; 387 | 97C147041CF9000F007C117D /* Release */ = { 388 | isa = XCBuildConfiguration; 389 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 390 | buildSettings = { 391 | ALWAYS_SEARCH_USER_PATHS = NO; 392 | CLANG_ANALYZER_NONNULL = YES; 393 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 394 | CLANG_CXX_LIBRARY = "libc++"; 395 | CLANG_ENABLE_MODULES = YES; 396 | CLANG_ENABLE_OBJC_ARC = YES; 397 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 398 | CLANG_WARN_BOOL_CONVERSION = YES; 399 | CLANG_WARN_COMMA = YES; 400 | CLANG_WARN_CONSTANT_CONVERSION = YES; 401 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 402 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 403 | CLANG_WARN_EMPTY_BODY = YES; 404 | CLANG_WARN_ENUM_CONVERSION = YES; 405 | CLANG_WARN_INFINITE_RECURSION = YES; 406 | CLANG_WARN_INT_CONVERSION = YES; 407 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 408 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 409 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 410 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 411 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 412 | CLANG_WARN_STRICT_PROTOTYPES = YES; 413 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 414 | CLANG_WARN_UNREACHABLE_CODE = YES; 415 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 416 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 417 | COPY_PHASE_STRIP = NO; 418 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 419 | ENABLE_NS_ASSERTIONS = NO; 420 | ENABLE_STRICT_OBJC_MSGSEND = YES; 421 | GCC_C_LANGUAGE_STANDARD = gnu99; 422 | GCC_NO_COMMON_BLOCKS = YES; 423 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 424 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 425 | GCC_WARN_UNDECLARED_SELECTOR = YES; 426 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 427 | GCC_WARN_UNUSED_FUNCTION = YES; 428 | GCC_WARN_UNUSED_VARIABLE = YES; 429 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 430 | MTL_ENABLE_DEBUG_INFO = NO; 431 | SDKROOT = iphoneos; 432 | SUPPORTED_PLATFORMS = iphoneos; 433 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 434 | TARGETED_DEVICE_FAMILY = "1,2"; 435 | VALIDATE_PRODUCT = YES; 436 | }; 437 | name = Release; 438 | }; 439 | 97C147061CF9000F007C117D /* Debug */ = { 440 | isa = XCBuildConfiguration; 441 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 442 | buildSettings = { 443 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 444 | CLANG_ENABLE_MODULES = YES; 445 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 446 | ENABLE_BITCODE = NO; 447 | FRAMEWORK_SEARCH_PATHS = ( 448 | "$(inherited)", 449 | "$(PROJECT_DIR)/Flutter", 450 | ); 451 | INFOPLIST_FILE = Runner/Info.plist; 452 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 453 | LIBRARY_SEARCH_PATHS = ( 454 | "$(inherited)", 455 | "$(PROJECT_DIR)/Flutter", 456 | ); 457 | PRODUCT_BUNDLE_IDENTIFIER = com.example.socialmedia; 458 | PRODUCT_NAME = "$(TARGET_NAME)"; 459 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 460 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 461 | SWIFT_VERSION = 5.0; 462 | VERSIONING_SYSTEM = "apple-generic"; 463 | }; 464 | name = Debug; 465 | }; 466 | 97C147071CF9000F007C117D /* Release */ = { 467 | isa = XCBuildConfiguration; 468 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 469 | buildSettings = { 470 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 471 | CLANG_ENABLE_MODULES = YES; 472 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 473 | ENABLE_BITCODE = NO; 474 | FRAMEWORK_SEARCH_PATHS = ( 475 | "$(inherited)", 476 | "$(PROJECT_DIR)/Flutter", 477 | ); 478 | INFOPLIST_FILE = Runner/Info.plist; 479 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 480 | LIBRARY_SEARCH_PATHS = ( 481 | "$(inherited)", 482 | "$(PROJECT_DIR)/Flutter", 483 | ); 484 | PRODUCT_BUNDLE_IDENTIFIER = com.example.socialmedia; 485 | PRODUCT_NAME = "$(TARGET_NAME)"; 486 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 487 | SWIFT_VERSION = 5.0; 488 | VERSIONING_SYSTEM = "apple-generic"; 489 | }; 490 | name = Release; 491 | }; 492 | /* End XCBuildConfiguration section */ 493 | 494 | /* Begin XCConfigurationList section */ 495 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 496 | isa = XCConfigurationList; 497 | buildConfigurations = ( 498 | 97C147031CF9000F007C117D /* Debug */, 499 | 97C147041CF9000F007C117D /* Release */, 500 | 249021D3217E4FDB00AE95B9 /* Profile */, 501 | ); 502 | defaultConfigurationIsVisible = 0; 503 | defaultConfigurationName = Release; 504 | }; 505 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 506 | isa = XCConfigurationList; 507 | buildConfigurations = ( 508 | 97C147061CF9000F007C117D /* Debug */, 509 | 97C147071CF9000F007C117D /* Release */, 510 | 249021D4217E4FDB00AE95B9 /* Profile */, 511 | ); 512 | defaultConfigurationIsVisible = 0; 513 | defaultConfigurationName = Release; 514 | }; 515 | /* End XCConfigurationList section */ 516 | }; 517 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 518 | } 519 | --------------------------------------------------------------------------------