├── android ├── settings_aar.gradle ├── app │ ├── src │ │ └── main │ │ │ ├── res │ │ │ ├── drawable │ │ │ │ ├── splash.png │ │ │ │ └── notification.png │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── launcher_icon.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── launcher_icon.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── launcher_icon.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── launcher_icon.png │ │ │ └── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── launcher_icon.png │ │ │ └── kotlin │ │ │ └── com │ │ │ └── example │ │ │ └── morsey_gaming_social_hub │ │ │ └── MainActivity.kt │ ├── google-services.json │ └── build.gradle ├── gradle.properties ├── .gitignore ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── settings.gradle └── build.gradle ├── lib ├── Globals │ └── Globals.dart ├── Config │ └── size.dart ├── Methods │ ├── FirebaseAdd.dart │ ├── notification.dart │ └── GoogleSignIn.dart ├── Models │ ├── GameSearchData.dart │ ├── user.dart │ └── post.dart ├── UI │ ├── Widgets │ │ ├── progress.dart │ │ ├── UserProfilePic.dart │ │ ├── gamePost.dart │ │ ├── profilePost.dart │ │ ├── stat.dart │ │ ├── gameStat.dart │ │ ├── profHead.dart │ │ ├── gameHead.dart │ │ └── feedPost.dart │ └── Screens │ │ ├── profilePage.dart │ │ ├── GamePage.dart │ │ ├── Login.dart │ │ ├── Hompage.dart │ │ ├── followingList.dart │ │ ├── SinglePost.dart │ │ ├── feed.dart │ │ ├── News.dart │ │ ├── searchPage.dart │ │ ├── Comments.dart │ │ ├── UploadPage.dart │ │ └── setScreen.dart └── main.dart ├── ios ├── Flutter │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── AppFrameworkInfo.plist ├── Runner │ ├── Runner-Bridging-Header.h │ ├── Assets.xcassets │ │ ├── LaunchImage.imageset │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ ├── README.md │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-50x50@1x.png │ │ │ ├── Icon-App-50x50@2x.png │ │ │ ├── Icon-App-57x57@1x.png │ │ │ ├── Icon-App-57x57@2x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-72x72@1x.png │ │ │ ├── Icon-App-72x72@2x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ └── Contents.json │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── Main.storyboard │ │ └── LaunchScreen.storyboard │ └── Info.plist ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── WorkspaceSettings.xcsettings │ │ └── IDEWorkspaceChecks.plist ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme └── .gitignore ├── assets ├── 1.jpg ├── f.png ├── gg.png ├── rip.png ├── icon.png ├── impress.mp3 ├── humilation.mp3 ├── multikill.mp3 ├── pro-gamer.png ├── empty_feed.json ├── upload.svg └── loginAnim.json ├── .metadata ├── .vscode └── launch.json ├── .gitignore ├── README.md └── pubspec.yaml /android/settings_aar.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /lib/Globals/Globals.dart: -------------------------------------------------------------------------------- 1 | List gamesSelected=[]; -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /assets/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/assets/1.jpg -------------------------------------------------------------------------------- /assets/f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/assets/f.png -------------------------------------------------------------------------------- /assets/gg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/assets/gg.png -------------------------------------------------------------------------------- /assets/rip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/assets/rip.png -------------------------------------------------------------------------------- /assets/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/assets/icon.png -------------------------------------------------------------------------------- /assets/impress.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/assets/impress.mp3 -------------------------------------------------------------------------------- /assets/humilation.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/assets/humilation.mp3 -------------------------------------------------------------------------------- /assets/multikill.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/assets/multikill.mp3 -------------------------------------------------------------------------------- /assets/pro-gamer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/assets/pro-gamer.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/android/app/src/main/res/drawable/splash.png -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /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/drawable/notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/android/app/src/main/res/drawable/notification.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/android/app/src/main/res/mipmap-hdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/android/app/src/main/res/mipmap-mdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/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/AniketSindhu/Gamiac/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/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/AniketSindhu/Gamiac/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/AniketSindhu/Gamiac/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/AniketSindhu/Gamiac/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/AniketSindhu/Gamiac/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/AniketSindhu/Gamiac/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/AniketSindhu/Gamiac/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/AniketSindhu/Gamiac/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/AniketSindhu/Gamiac/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/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/AniketSindhu/Gamiac/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/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/AniketSindhu/Gamiac/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AniketSindhu/Gamiac/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/AniketSindhu/Gamiac/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 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/morsey_gaming_social_hub/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.morsey_gaming_social_hub 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /lib/Config/size.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/widgets.dart'; 3 | 4 | class SizeConfig { 5 | static getHeight(context) { 6 | return MediaQuery.of(context).size.height; 7 | } 8 | 9 | static getWidth(context) { 10 | return MediaQuery.of(context).size.width; 11 | } 12 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib/Methods/FirebaseAdd.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | class FirebaseAdd{ 3 | 4 | addUser(String name,String email, String phoneNumber,String uid) async{ 5 | Firestore.instance.collection('users').document(email) 6 | .setData({ 'name': name, 'email': email,'uid':uid,}); 7 | } 8 | } -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 1ad9baa8b99a2897c20f9e6e54d3b9b359ade314 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Flutter", 9 | "request": "launch", 10 | "type": "dart" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /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/Models/GameSearchData.dart: -------------------------------------------------------------------------------- 1 | class GameSearch { 2 | final String name; 3 | final String image; 4 | final String slug; 5 | final String metacritic; 6 | GameSearch._({this.name, this.image,this.slug,this.metacritic}); 7 | factory GameSearch.fromJson(Map json) { 8 | return new GameSearch._( 9 | name: json['name'].toString(), 10 | image: json['background_image'].toString(), 11 | slug:json['slug'].toString(), 12 | metacritic:json['metacritic'].toString() 13 | ); 14 | } 15 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/UI/Widgets/progress.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | Container circularProgress() { 4 | return Container( 5 | child: CircularProgressIndicator( 6 | valueColor: AlwaysStoppedAnimation(Color(0xff67FD9A)), 7 | ), 8 | alignment: Alignment.center, 9 | padding: EdgeInsets.only(top: 10.0), 10 | ); 11 | } 12 | 13 | Container linearProgress() { 14 | return Container( 15 | padding: EdgeInsets.only(bottom: 10.0), 16 | child: LinearProgressIndicator( 17 | valueColor: AlwaysStoppedAnimation(Color(0xff67FD9A)), 18 | ), 19 | ); 20 | } -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | include ':app' 6 | 7 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 8 | def properties = new Properties() 9 | 10 | assert localPropertiesFile.exists() 11 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 12 | 13 | def flutterSdkPath = properties.getProperty("flutter.sdk") 14 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 15 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 16 | -------------------------------------------------------------------------------- /lib/Models/user.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | 3 | class User { 4 | final String gamer_tag; 5 | final String uid; 6 | final String email; 7 | final String name; 8 | final String photoUrl; 9 | final String bio; 10 | 11 | User( 12 | {this.gamer_tag, 13 | this.uid, 14 | this.photoUrl, 15 | this.email, 16 | this.name, 17 | this.bio}); 18 | 19 | factory User.fromDocument(DocumentSnapshot doc) { 20 | return User( 21 | gamer_tag: doc['gamer_Tag'], 22 | uid: doc['uid'], 23 | email: doc['email'], 24 | name: doc['name'], 25 | photoUrl: doc['profile_pic'], 26 | bio: doc['bio']); 27 | } 28 | } -------------------------------------------------------------------------------- /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.3' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | classpath 'com.google.gms:google-services:4.3.3' 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | google() 18 | jcenter() 19 | } 20 | } 21 | 22 | rootProject.buildDir = '../build' 23 | subprojects { 24 | project.buildDir = "${rootProject.buildDir}/${project.name}" 25 | } 26 | subprojects { 27 | project.evaluationDependsOn(':app') 28 | } 29 | 30 | task clean(type: Delete) { 31 | delete rootProject.buildDir 32 | } 33 | -------------------------------------------------------------------------------- /lib/Methods/notification.dart: -------------------------------------------------------------------------------- 1 | import 'package:firebase_messaging/firebase_messaging.dart'; 2 | 3 | class PushNotificationsManager { 4 | 5 | PushNotificationsManager._(); 6 | 7 | factory PushNotificationsManager() => _instance; 8 | 9 | static final PushNotificationsManager _instance = PushNotificationsManager._(); 10 | 11 | final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); 12 | bool _initialized = false; 13 | 14 | Future init() async { 15 | if (!_initialized) { 16 | // For iOS request permission first. 17 | _firebaseMessaging.requestNotificationPermissions(); 18 | _firebaseMessaging.configure(); 19 | 20 | // For testing purposes print the Firebase Messaging token 21 | String token = await _firebaseMessaging.getToken(); 22 | print("FirebaseMessaging token: $token"); 23 | 24 | _initialized = true; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | /build/ 32 | android/**/*.xml 33 | android/key.properties 34 | android/app/Randomize.jks 35 | 36 | # Web related 37 | lib/generated_plugin_registrant.dart 38 | 39 | # Symbolication related 40 | app.*.symbols 41 | 42 | # Obfuscation related 43 | app.*.map.json 44 | 45 | # Exceptions to above rules. 46 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 47 | -------------------------------------------------------------------------------- /lib/UI/Widgets/UserProfilePic.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:cloud_firestore/cloud_firestore.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:morsey_gaming_social_hub/Models/user.dart'; 5 | import 'package:morsey_gaming_social_hub/UI/Screens/profilePage.dart'; 6 | 7 | class UserProfilePicture extends StatelessWidget { 8 | final String profilePicture; 9 | final String userId; 10 | const UserProfilePicture({Key key,@required this.profilePicture,@required this.userId}) : super(key: key); 11 | @override 12 | Widget build(BuildContext context) { 13 | return GestureDetector( 14 | child: Container( 15 | alignment: Alignment.center, 16 | decoration: BoxDecoration( 17 | shape: BoxShape.circle, 18 | border: Border.all(color:Color(0xff67FD9A), width: 3), 19 | ), 20 | child: CircleAvatar( 21 | backgroundImage: profilePicture!=null?NetworkImage(profilePicture):AssetImage('assets/pro-gamer.png'), 22 | backgroundColor: Colors.white, 23 | ), 24 | ), 25 | onTap: () async{ 26 | final x= await Firestore.instance.collection("users").document(userId).get(); 27 | Navigator.of(context).push(MaterialPageRoute(builder:(context){return ProfilePage(User.fromDocument(x),false);})); 28 | }, 29 | ); 30 | } 31 | } -------------------------------------------------------------------------------- /lib/UI/Screens/profilePage.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:google_fonts/google_fonts.dart'; 3 | import 'package:morsey_gaming_social_hub/Methods/GoogleSignIn.dart'; 4 | import 'package:morsey_gaming_social_hub/Models/user.dart'; 5 | import 'package:morsey_gaming_social_hub/UI/Widgets/profHead.dart'; 6 | import 'package:morsey_gaming_social_hub/UI/Widgets/profilePost.dart'; 7 | import 'package:morsey_gaming_social_hub/UI/Widgets/stat.dart'; 8 | import 'package:shared_preferences/shared_preferences.dart'; 9 | 10 | import 'Login.dart'; 11 | 12 | class ProfilePage extends StatefulWidget { 13 | final User user; 14 | final bool isOwn; 15 | ProfilePage(this.user,this.isOwn); 16 | @override 17 | _ProfilePageState createState() => _ProfilePageState(); 18 | } 19 | 20 | class _ProfilePageState extends State { 21 | @override 22 | Widget build(BuildContext context) { 23 | return Scaffold( 24 | body: SingleChildScrollView( 25 | child: Container( 26 | padding: EdgeInsets.only(bottom:30), 27 | constraints: BoxConstraints( 28 | minHeight: MediaQuery.of(context).size.height, 29 | ), 30 | color: Color(0xff21252A), 31 | child: Column( 32 | children:[ 33 | ProfileHeader(user: widget.user,isOwn:widget.isOwn), 34 | StatsWidget(widget.user.email), 35 | ProfilePostsWidget(user: widget.user,), 36 | ] 37 | ), 38 | ) 39 | ), 40 | ); 41 | } 42 | } -------------------------------------------------------------------------------- /android/app/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "1002655823160", 4 | "firebase_url": "https://morsey-gaming-social-hub.firebaseio.com", 5 | "project_id": "morsey-gaming-social-hub", 6 | "storage_bucket": "morsey-gaming-social-hub.appspot.com" 7 | }, 8 | "client": [ 9 | { 10 | "client_info": { 11 | "mobilesdk_app_id": "1:1002655823160:android:4921c4f42f2a990ef8fdcd", 12 | "android_client_info": { 13 | "package_name": "com.aniket.gamiac" 14 | } 15 | }, 16 | "oauth_client": [ 17 | { 18 | "client_id": "1002655823160-nuu0ol56l2bccrmje7fd39uhd9mkvrac.apps.googleusercontent.com", 19 | "client_type": 1, 20 | "android_info": { 21 | "package_name": "com.aniket.gamiac", 22 | "certificate_hash": "3e757356bc630beb82922b8f55eca683efbdc53c" 23 | } 24 | }, 25 | { 26 | "client_id": "1002655823160-347iofm9is5av4kpvg5d1a9tej4pcj8n.apps.googleusercontent.com", 27 | "client_type": 3 28 | } 29 | ], 30 | "api_key": [ 31 | { 32 | "current_key": "AIzaSyDitIT0iwrTKToRh_iIf09YD3wt3x6sxx8" 33 | } 34 | ], 35 | "services": { 36 | "appinvite_service": { 37 | "other_platform_oauth_client": [ 38 | { 39 | "client_id": "1002655823160-347iofm9is5av4kpvg5d1a9tej4pcj8n.apps.googleusercontent.com", 40 | "client_type": 3 41 | } 42 | ] 43 | } 44 | } 45 | } 46 | ], 47 | "configuration_version": "1" 48 | } -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'ui/Screens/Hompage.dart'; 3 | import 'package:shared_preferences/shared_preferences.dart'; 4 | import 'ui/Screens/Login.dart'; 5 | void main() async{ 6 | WidgetsFlutterBinding.ensureInitialized(); 7 | SharedPreferences prefs = await SharedPreferences.getInstance(); 8 | bool login=prefs.getBool('login'); 9 | runApp(login==null?MyApp1():login?MyApp2():MyApp1()); 10 | } 11 | 12 | class MyApp1 extends StatelessWidget { 13 | // This widget is the root of your application. 14 | @override 15 | Widget build(BuildContext context) { 16 | return MaterialApp( 17 | debugShowCheckedModeBanner: false, 18 | title: 'Morsey', 19 | theme: ThemeData( 20 | primarySwatch: Colors.teal, 21 | brightness: Brightness.dark, 22 | visualDensity: VisualDensity.adaptivePlatformDensity, 23 | ), 24 | home:Login(), 25 | routes: { 26 | 'login':(context)=>Login(), 27 | 'homepage':(context)=>HomePage() 28 | }, 29 | ); 30 | } 31 | } 32 | 33 | class MyApp2 extends StatelessWidget { 34 | // This widget is the root of your application. 35 | @override 36 | Widget build(BuildContext context) { 37 | return MaterialApp( 38 | debugShowCheckedModeBanner: false, 39 | title: 'Morsey', 40 | theme: ThemeData( 41 | primarySwatch: Colors.teal, 42 | brightness: Brightness.dark, 43 | visualDensity: VisualDensity.adaptivePlatformDensity, 44 | ), 45 | home:HomePage(), 46 | routes: { 47 | 'login':(context)=>Login(), 48 | 'homepage':(context)=>HomePage() 49 | }, 50 | ); 51 | } 52 | } -------------------------------------------------------------------------------- /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 | morsey_gaming_social_hub 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /lib/UI/Screens/GamePage.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:google_fonts/google_fonts.dart'; 3 | import 'package:morsey_gaming_social_hub/Methods/GoogleSignIn.dart'; 4 | import 'package:morsey_gaming_social_hub/Models/GameSearchData.dart'; 5 | import 'package:morsey_gaming_social_hub/Models/user.dart'; 6 | import 'package:morsey_gaming_social_hub/UI/Widgets/gameHead.dart'; 7 | import 'package:morsey_gaming_social_hub/UI/Widgets/gamePost.dart'; 8 | import 'package:morsey_gaming_social_hub/UI/Widgets/gameStat.dart'; 9 | import 'package:morsey_gaming_social_hub/UI/Widgets/profHead.dart'; 10 | import 'package:morsey_gaming_social_hub/UI/Widgets/profilePost.dart'; 11 | import 'package:morsey_gaming_social_hub/UI/Widgets/stat.dart'; 12 | import 'package:shared_preferences/shared_preferences.dart'; 13 | import 'Login.dart'; 14 | 15 | class GamePage extends StatefulWidget { 16 | final GameSearch game; 17 | final User user; 18 | GamePage(this.game,this.user); 19 | @override 20 | _GamePageState createState() => _GamePageState(); 21 | } 22 | 23 | class _GamePageState extends State { 24 | @override 25 | Widget build(BuildContext context) { 26 | return Scaffold( 27 | body: SingleChildScrollView( 28 | child: Container( 29 | padding: EdgeInsets.only(bottom:30), 30 | constraints: BoxConstraints( 31 | minHeight: MediaQuery.of(context).size.height, 32 | ), 33 | color: Color(0xff21252A), 34 | child: Column( 35 | children:[ 36 | GameHeader(user: widget.user,game:widget.game), 37 | GameStatsWidget(widget.game), 38 | GamePostsWidget(game: widget.game,), 39 | ] 40 | ), 41 | ) 42 | ), 43 | ); 44 | } 45 | } -------------------------------------------------------------------------------- /lib/Models/post.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | 3 | class Post { 4 | final String postId; 5 | final String ownerEmail; 6 | final String gamer_tag; 7 | final String description; 8 | final String mediaUrl; 9 | List rip,f,gg; 10 | String profilePic; 11 | int fCount,ripCount,ggCount; 12 | DateTime timestamp; 13 | String slug; 14 | Post( 15 | {this.postId, 16 | this.ownerEmail, 17 | this.gamer_tag, 18 | this.description, 19 | this.mediaUrl, 20 | this.f, 21 | this.gg, 22 | this.rip, 23 | this.fCount, 24 | this.ripCount, 25 | this.profilePic, 26 | this.ggCount, 27 | this.timestamp, 28 | this.slug 29 | }); 30 | 31 | factory Post.fromDocument(DocumentSnapshot doc) { 32 | return Post( 33 | postId: doc['postId'], 34 | ownerEmail: doc['ownerEmail'], 35 | gamer_tag: doc['gamer_Tag'], 36 | description: doc['description'], 37 | mediaUrl: doc['mediaUrl'], 38 | f: doc['f'], 39 | rip: doc['rip'], 40 | gg: doc['gg'], 41 | profilePic:doc['owner_pic'], 42 | timestamp:doc['timestamp'].toDate(), 43 | slug:doc['slug'] 44 | ); 45 | } 46 | 47 | int getFCount(f) { 48 | if (f ==[]) { 49 | return 0; 50 | } 51 | 52 | int count = 0; 53 | f.forEach((val) { 54 | count += 1; 55 | 56 | }); 57 | return count; 58 | } 59 | int geripCount(rip) { 60 | if (rip == []) { 61 | return 0; 62 | } 63 | 64 | int count = 0; 65 | rip.forEach((val) { 66 | count += 1; 67 | }); 68 | return count; 69 | } 70 | int getGGCount(gg) { 71 | if (gg == []) { 72 | return 0; 73 | } 74 | 75 | int count = 0; 76 | gg.forEach((val) { 77 | count += 1; 78 | }); 79 | return count; 80 | } 81 | } -------------------------------------------------------------------------------- /lib/Methods/GoogleSignIn.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | import 'package:firebase_auth/firebase_auth.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:google_sign_in/google_sign_in.dart'; 5 | import 'package:morsey_gaming_social_hub/Methods/FirebaseAdd.dart'; 6 | import 'package:morsey_gaming_social_hub/UI/Screens/Hompage.dart'; 7 | import 'package:morsey_gaming_social_hub/UI/Screens/setScreen.dart'; 8 | import 'package:shared_preferences/shared_preferences.dart'; 9 | 10 | final FirebaseAuth _auth = FirebaseAuth.instance; 11 | final GoogleSignIn googleSignIn = GoogleSignIn(); 12 | String name; 13 | String email; 14 | String phoneNumber; 15 | 16 | Future signInWithGoogle(BuildContext context) async { 17 | final GoogleSignInAccount googleSignInAccount = await googleSignIn.signIn(); 18 | final GoogleSignInAuthentication googleSignInAuthentication = 19 | await googleSignInAccount.authentication; 20 | 21 | final AuthCredential credential = GoogleAuthProvider.getCredential( 22 | accessToken: googleSignInAuthentication.accessToken, 23 | idToken: googleSignInAuthentication.idToken, 24 | ); 25 | 26 | final AuthResult authResult = await _auth.signInWithCredential(credential); 27 | final FirebaseUser user = authResult.user; 28 | 29 | assert(!user.isAnonymous); 30 | assert(await user.getIdToken() != null); 31 | 32 | final FirebaseUser currentUser = await _auth.currentUser(); 33 | assert(user.uid == currentUser.uid); 34 | assert(user.email != null); 35 | assert(user.displayName != null); 36 | SharedPreferences prefs = await SharedPreferences.getInstance(); 37 | prefs.setBool('login', true); 38 | name = user.displayName; 39 | email = user.email; 40 | final x= await Firestore.instance.collection('users').document(user.email).get(); 41 | if(x.exists) 42 | { 43 | Navigator.pop(context); 44 | Navigator.push(context, MaterialPageRoute(builder: (context)=>HomePage())); 45 | } 46 | else{ 47 | FirebaseAdd().addUser(name, email, phoneNumber, user.uid); 48 | Navigator.pushReplacement(context, MaterialPageRoute(builder: (context)=>setProfile(user.email))); 49 | } 50 | return 'signInWithGoogle succeeded: $user'; 51 | } 52 | 53 | void signOutGoogle() async{ 54 | await googleSignIn.signOut(); 55 | print("User Sign Out"); 56 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Gamiac 2 | A gaming social media app. 3 | 4 | **Play, Post & Interact .** 5 | 6 | [Download Gamiac](https://play.google.com/store/apps/details?id=com.aniket.gamiac) 7 | 8 | Are you a Gamer 🎮? 9 | 10 | If yes then GAMIAC is especially for YOU 😀. 11 | 12 | ## What is Gamiac 😕? 13 | Gamiac is a gaming social media platform specially made for gamers where you can post anything related to gaming and others gamers can react to the picture with GG, RIP, and F stickers instead of the old fashioned like upvotes, etc. 14 | Gamiac also provides an interactive Newsfeed 📰 i.e. Gamers can also see the latest and trending news in the world of gaming. 15 | 16 | *Gamiac bring friends and people together through gaming! Your favourite games, friends, memes, and gaming news…all in one single place!🕹️.* 17 | 18 | ## What Gamiac bring to the table? 19 | - 🎮Game themed User Interface 🤩 20 | - 🎮RIP, F, GG stickers with cool & nostalgic CS 1.6 sounds 👾. 21 | - 🎮Post anything related to games, Yeah its gaming social media for gamers 📱. 22 | - 🎮All trending gaming news on one page with in app browser for full article reading 🕹️. 23 | - 🎮Access to share content about any game. 24 | - 🎮Almost every game is available to follow (database source: RAWG). 25 | - 🎮Get custom feed based on the games you follow. 26 | - 🎮Interact with gamers using the comment section. 27 | - 🎮Easy one-tap authentication using Google auth (no hassles) 28 | - 🎮You can also check followed games by other gamers 😄. 29 | - 🎮Get all the content of a particular game in one place. 30 | - 🎮Represent yourself to the community using your Gaming tag. 31 | - 🎮Gaming community at your palm. 32 | - 🎮And many more... 33 | 34 | 35 | ### Almost any game can be followed, some of them are : 36 | - League of Legends 37 | - Dota 38 | - Counterstrike Global Offensive 39 | - PUBG Mobile 40 | - PlayerUnknown’s Battleground 41 | - Apex Legends 42 | - Minecraft 43 | - Overwatch 44 | - Clash Royale 45 | - Destiny 46 | - Grand Theft Auto V 47 | - Call of Duty Mobile 48 | - Valorant 49 | - and many many many many many many many more....... 50 | 51 | *The newsfeed is powered by RSS (source: pcgamer), and the gaming database is provided by RAWG.* 52 | 53 | Many more things are yet to be added into this app like video posts, notifications, chat platform where gamers can chat, personalized gaming preferences section etc which will be added in the upcoming updates so stay tuned and happy gaming. 54 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | apply plugin: 'com.google.gms.google-services' 28 | 29 | def keystoreProperties = new Properties() 30 | def keystorePropertiesFile = rootProject.file('key.properties') 31 | if (keystorePropertiesFile.exists()) { 32 | keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) 33 | } 34 | 35 | 36 | android { 37 | compileSdkVersion 28 38 | 39 | sourceSets { 40 | main.java.srcDirs += 'src/main/kotlin' 41 | } 42 | 43 | lintOptions { 44 | disable 'InvalidPackage' 45 | } 46 | 47 | defaultConfig { 48 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 49 | applicationId "com.aniket.gamiac" 50 | minSdkVersion 16 51 | targetSdkVersion 28 52 | versionCode flutterVersionCode.toInteger() 53 | versionName flutterVersionName 54 | multiDexEnabled true 55 | } 56 | 57 | signingConfigs { 58 | release { 59 | keyAlias keystoreProperties['keyAlias'] 60 | keyPassword keystoreProperties['keyPassword'] 61 | storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null 62 | storePassword keystoreProperties['storePassword'] 63 | } 64 | } 65 | 66 | buildTypes { 67 | release { 68 | // TODO: Add your own signing config for the release build. 69 | // Signing with the debug keys for now, so `flutter run --release` works. 70 | signingConfig signingConfigs.release 71 | } 72 | } 73 | } 74 | 75 | flutter { 76 | source '../..' 77 | } 78 | 79 | dependencies { 80 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 81 | implementation 'com.google.firebase:firebase-analytics:17.2.2' 82 | implementation 'com.google.firebase:firebase-messaging:20.2.3' 83 | } 84 | -------------------------------------------------------------------------------- /lib/UI/Screens/Login.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/gestures.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:lottie/lottie.dart'; 4 | import 'package:morsey_gaming_social_hub/Methods/GoogleSignIn.dart'; 5 | import 'package:google_fonts/google_fonts.dart'; 6 | import 'package:flutter_signin_button/flutter_signin_button.dart'; 7 | import 'package:morsey_gaming_social_hub/Config/size.dart'; 8 | import 'package:url_launcher/url_launcher.dart'; 9 | import 'package:fluttertoast/fluttertoast.dart'; 10 | 11 | class Login extends StatefulWidget { 12 | @override 13 | _LoginState createState() => _LoginState(); 14 | } 15 | 16 | class _LoginState extends State { 17 | @override 18 | bool checked=false; 19 | Widget build(BuildContext context) { 20 | double height=SizeConfig.getHeight(context); 21 | double width=SizeConfig.getWidth(context); 22 | return Scaffold( 23 | backgroundColor:Color(0xff21252A), 24 | body: Column( 25 | mainAxisAlignment: MainAxisAlignment.center, 26 | children:[ 27 | Align( 28 | alignment: Alignment.topCenter, 29 | child: Text('GAMIAC',style: GoogleFonts.orbitron(textStyle:TextStyle(color:Color(0xff67FD9A),fontSize:40,fontWeight: FontWeight.bold)),)), 30 | Text('Social Hub For Gamers',style: TextStyle(color: Colors.tealAccent),), 31 | SizedBox(height:30), 32 | Container( 33 | child: Center(child: Lottie.asset('assets/loginAnim.json')), 34 | height:height/2.5, 35 | width: width*0.95, 36 | ), 37 | SizedBox(height:10), 38 | SignInButton(Buttons.GoogleDark, 39 | onPressed: (){ 40 | if(checked==true) 41 | signInWithGoogle(context); 42 | else 43 | FlutterToast.showToast( 44 | msg: "Please review privacy policy first", 45 | backgroundColor: Colors.redAccent, 46 | textColor: Colors.white 47 | ); 48 | }, 49 | text: 'Continue With Google',), 50 | SizedBox(height:10), 51 | CheckboxListTile( 52 | title: Text.rich(TextSpan( 53 | children:[ 54 | TextSpan(text:"You accept the"), 55 | TextSpan(text:" Privacy policy ",recognizer: TapGestureRecognizer()..onTap=(){ 56 | launch("https://gamiac.flycricket.io/privacy.html"); 57 | },style: TextStyle(color:Colors.blue,fontStyle: FontStyle.italic)), 58 | TextSpan(text:"of morsey") 59 | ] )), 60 | value: checked, 61 | onChanged: (newValue) { 62 | setState(() { 63 | checked = newValue; 64 | }); 65 | }, 66 | controlAffinity: ListTileControlAffinity.leading, // <-- leading Checkbox 67 | ) 68 | ] 69 | ), 70 | ); 71 | } 72 | } -------------------------------------------------------------------------------- /lib/UI/Widgets/gamePost.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:lottie/lottie.dart'; 4 | import 'package:morsey_gaming_social_hub/Models/GameSearchData.dart'; 5 | import 'package:morsey_gaming_social_hub/Models/post.dart'; 6 | import 'package:morsey_gaming_social_hub/UI/Screens/SinglePost.dart'; 7 | 8 | class GamePostsWidget extends StatefulWidget { 9 | final GameSearch game; 10 | const GamePostsWidget({ 11 | Key key, 12 | @required this.game, 13 | }) : super(key: key); 14 | 15 | @override 16 | _GamePostsWidgetState createState() => _GamePostsWidgetState(); 17 | } 18 | 19 | class _GamePostsWidgetState extends State { 20 | @override 21 | Future getPosts()async{ 22 | final x =await Firestore.instance.collection("games").document(widget.game.slug).collection("posts").orderBy("timestamp",descending: true).getDocuments(); 23 | return x.documents; 24 | } 25 | Widget build(BuildContext context) { 26 | return FutureBuilder( 27 | future: getPosts(), 28 | builder: (context, snapshot) { 29 | if(!snapshot.hasData) 30 | { 31 | return Center(child: Lottie.asset("assets/loading.json")); 32 | } 33 | else if(snapshot.data.length==0) 34 | { 35 | return Center( 36 | child:Column( 37 | mainAxisAlignment: MainAxisAlignment.center, 38 | children: [ 39 | SizedBox(height:45), 40 | Padding( 41 | padding: const EdgeInsets.all(8.0), 42 | child: Text("No post related to the game",style: TextStyle(color:Colors.white,fontSize: 18,fontWeight: FontWeight.bold),textAlign: TextAlign.center,), 43 | ), 44 | ], 45 | )); 46 | } 47 | return Container( 48 | padding: EdgeInsets.fromLTRB(10, 0, 10, 0), 49 | child: Column( 50 | children: [ 51 | Divider(), 52 | GridView.builder( 53 | itemCount: snapshot.data.length, 54 | shrinkWrap: true, 55 | physics: NeverScrollableScrollPhysics(), 56 | gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( 57 | crossAxisCount: 3, 58 | crossAxisSpacing: 11.0, 59 | mainAxisSpacing: 11.0), 60 | itemBuilder: (ctx, i) { 61 | return GestureDetector( 62 | onTap: () { 63 | Navigator.of(context).push(MaterialPageRoute(builder: (context){return SinglePost(Post.fromDocument(snapshot.data[i]));})); 64 | }, 65 | child: Image.network( 66 | "${snapshot.data[i].data["mediaUrl"]}", 67 | fit: BoxFit.cover, 68 | ), 69 | ); 70 | }, 71 | ) 72 | ], 73 | ), 74 | ); 75 | } 76 | ); 77 | } 78 | } -------------------------------------------------------------------------------- /lib/UI/Widgets/profilePost.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:lottie/lottie.dart'; 4 | import 'package:morsey_gaming_social_hub/Models/post.dart'; 5 | import 'package:morsey_gaming_social_hub/Models/user.dart'; 6 | import 'package:morsey_gaming_social_hub/UI/Screens/SinglePost.dart'; 7 | import 'package:uuid/uuid.dart'; 8 | 9 | class ProfilePostsWidget extends StatefulWidget { 10 | final User user; 11 | const ProfilePostsWidget({ 12 | Key key, 13 | @required this.user, 14 | }) : super(key: key); 15 | 16 | @override 17 | _ProfilePostsWidgetState createState() => _ProfilePostsWidgetState(); 18 | } 19 | 20 | class _ProfilePostsWidgetState extends State { 21 | @override 22 | Future getPosts()async{ 23 | final x =await Firestore.instance.collection("users").document(widget.user.email).collection("userPosts").orderBy("timestamp",descending: true).getDocuments(); 24 | return x.documents; 25 | } 26 | Widget build(BuildContext context) { 27 | return FutureBuilder( 28 | future: getPosts(), 29 | builder: (context, snapshot) { 30 | if(!snapshot.hasData) 31 | { 32 | return Center(child: Lottie.asset("assets/loading.json")); 33 | } 34 | else if(snapshot.data.length==0) 35 | { 36 | return Center( 37 | child:Column( 38 | mainAxisAlignment: MainAxisAlignment.center, 39 | children: [ 40 | SizedBox(height:45), 41 | Padding( 42 | padding: const EdgeInsets.all(8.0), 43 | child: Text("No post yet , start by posting a meme about your favourite game",style: TextStyle(color:Colors.white,fontSize: 18,fontWeight: FontWeight.bold),textAlign: TextAlign.center,), 44 | ), 45 | ], 46 | )); 47 | } 48 | return Container( 49 | padding: EdgeInsets.fromLTRB(10, 0, 10, 0), 50 | child: Column( 51 | children: [ 52 | Divider(), 53 | GridView.builder( 54 | itemCount: snapshot.data.length, 55 | shrinkWrap: true, 56 | physics: NeverScrollableScrollPhysics(), 57 | gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( 58 | crossAxisCount: 3, 59 | crossAxisSpacing: 11.0, 60 | mainAxisSpacing: 11.0), 61 | itemBuilder: (ctx, i) { 62 | return GestureDetector( 63 | onTap: () { 64 | Navigator.of(context).push(MaterialPageRoute(builder: (context){return SinglePost(Post.fromDocument(snapshot.data[i]));})); 65 | }, 66 | child: Image.network( 67 | "${snapshot.data[i].data["mediaUrl"]}", 68 | fit: BoxFit.cover, 69 | ), 70 | ); 71 | }, 72 | ) 73 | ], 74 | ), 75 | ); 76 | } 77 | ); 78 | } 79 | } -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /lib/UI/Screens/Hompage.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | import 'package:firebase_auth/firebase_auth.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:google_fonts/google_fonts.dart'; 5 | import 'package:morsey_gaming_social_hub/Methods/GoogleSignIn.dart'; 6 | import 'package:morsey_gaming_social_hub/Models/user.dart'; 7 | import 'package:morsey_gaming_social_hub/UI/Screens/News.dart'; 8 | import 'package:morsey_gaming_social_hub/UI/Screens/UploadPage.dart'; 9 | import 'package:morsey_gaming_social_hub/UI/Screens/profilePage.dart'; 10 | import 'package:morsey_gaming_social_hub/UI/Screens/searchPage.dart'; 11 | import 'package:morsey_gaming_social_hub/UI/Widgets/profHead.dart'; 12 | import 'package:shared_preferences/shared_preferences.dart'; 13 | import 'package:convex_bottom_bar/convex_bottom_bar.dart'; 14 | import 'Login.dart'; 15 | import 'feed.dart'; 16 | 17 | class HomePage extends StatefulWidget { 18 | @override 19 | _HomePageState createState() => _HomePageState(); 20 | } 21 | 22 | class _HomePageState extends State { 23 | String email; 24 | int page; 25 | int bottomSelectedIndex; 26 | User user1; 27 | PageController pageController = PageController( 28 | initialPage: 0, 29 | keepPage: true, 30 | ); 31 | 32 | getEmail()async{ 33 | FirebaseAuth auth=FirebaseAuth.instance; 34 | final FirebaseUser user = await auth.currentUser(); 35 | email = user.email; 36 | final x=await Firestore.instance.collection('users').document(email).get(); 37 | user1 = User.fromDocument(x); 38 | setState(() { 39 | 40 | }); 41 | } 42 | 43 | void bottomTapped(int index) { 44 | setState(() { 45 | bottomSelectedIndex = index; 46 | pageController.animateToPage(index, duration: Duration(milliseconds: 500), curve: Curves.ease); 47 | }); 48 | } 49 | void pageChanged(int index) { 50 | setState(() { 51 | bottomSelectedIndex = index; 52 | }); 53 | } 54 | @override 55 | void initState(){ 56 | super.initState(); 57 | getEmail(); 58 | } 59 | @override 60 | Widget build(BuildContext context) { 61 | return Scaffold( 62 | bottomNavigationBar: ConvexAppBar( 63 | style: TabStyle.fixedCircle, 64 | items: [ 65 | TabItem(icon: Icons.home, title: 'Home'), 66 | TabItem(icon: Icons.search, title: 'Search'), 67 | TabItem(icon: Icons.add, title: 'Add'), 68 | TabItem(icon: Icons.featured_play_list, title: 'News'), 69 | TabItem(icon: Icons.people, title: 'Profile'), 70 | ], 71 | initialActiveIndex: 0,//optional, default as 0 72 | onTap: (int index){ 73 | bottomTapped(index); 74 | }, 75 | color: Color(0xff67FD9A), 76 | backgroundColor: Colors.black, 77 | activeColor: Colors.redAccent, 78 | ), 79 | body:PageView( 80 | controller: pageController, 81 | physics: new NeverScrollableScrollPhysics(), 82 | onPageChanged: (index) { 83 | pageChanged(index); 84 | }, 85 | children:[ 86 | Feed(), 87 | SearchPage(user1), 88 | Upload(currentUser: user1), 89 | NewsPage(), 90 | ProfilePage(user1,true) 91 | ], 92 | ), 93 | ); 94 | } 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/UI/Widgets/stat.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:morsey_gaming_social_hub/UI/Screens/followingList.dart'; 4 | 5 | class StatsWidget extends StatefulWidget { 6 | final String email; 7 | StatsWidget(this.email); 8 | @override 9 | _StatsWidgetState createState() => _StatsWidgetState(); 10 | } 11 | 12 | class _StatsWidgetState extends State { 13 | @override 14 | int count =0; 15 | Future getPosts()async{ 16 | final x =await Firestore.instance.collection("users").document(widget.email).get(); 17 | return x; 18 | } 19 | Future postCount() async{ 20 | final x =await Firestore.instance.collection("users").document(widget.email).collection("userPosts").getDocuments(); 21 | return x.documents.length.toString(); 22 | } 23 | String followingCount(AsyncSnapshot data){ 24 | List following= data.data["games_followed"]; 25 | return following.length.toString(); 26 | } 27 | Widget build(BuildContext context) { 28 | return FutureBuilder( 29 | future: getPosts(), 30 | builder: (context, snapshot) { 31 | if(!snapshot.hasData) 32 | {return Center(child:CircularProgressIndicator());} 33 | else 34 | return Container( 35 | height: 80, 36 | width: MediaQuery.of(context).size.width, 37 | padding: EdgeInsets.all(15.0), 38 | color: Colors.black, 39 | child: Row( 40 | children: [ 41 | Expanded( 42 | child: Column( 43 | children: [ 44 | GestureDetector( 45 | onTap: (){ 46 | Navigator.of(context).push(MaterialPageRoute(builder: (context){return FollowingList(widget.email);})); 47 | }, 48 | child: Text( 49 | '${followingCount(snapshot)}', 50 | style: Theme.of(context) 51 | .textTheme 52 | .headline6 53 | .copyWith( 54 | color: Colors.white, 55 | fontWeight: FontWeight.bold, 56 | ), 57 | ), 58 | ), 59 | GestureDetector( 60 | onTap: (){ 61 | Navigator.of(context).push(MaterialPageRoute(builder: (context){return FollowingList(widget.email);})); 62 | }, 63 | child: Text( 64 | "Following", 65 | style: Theme.of(context) 66 | .textTheme 67 | .subtitle1 68 | .copyWith( 69 | color: Color(0xff67FD9A), 70 | fontWeight: FontWeight.bold, 71 | ), 72 | ), 73 | ) 74 | ], 75 | ), 76 | ), 77 | Expanded( 78 | child: Column( 79 | children: [ 80 | FutureBuilder( 81 | future: postCount(), 82 | builder: (context, snapshot) { 83 | if(snapshot.hasData) 84 | return Text( 85 | '${snapshot.data}', 86 | style: Theme.of(context) 87 | .textTheme 88 | .headline6 89 | .copyWith( 90 | color: Colors.white, 91 | fontWeight: FontWeight.bold, 92 | ), 93 | ); 94 | else 95 | return Text(''); 96 | } 97 | ), 98 | Text( 99 | "Posts", 100 | style: Theme.of(context) 101 | .textTheme 102 | .subtitle1 103 | .copyWith( 104 | color: Color(0xff67FD9A), 105 | fontWeight: FontWeight.bold, 106 | ), 107 | ) 108 | ], 109 | ), 110 | ), 111 | ], 112 | ) 113 | ); 114 | } 115 | ); 116 | } 117 | } -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: morsey_gaming_social_hub 2 | description: A new Flutter project. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | version: 1.0.3+4 19 | 20 | environment: 21 | sdk: ">=2.7.0 <3.0.0" 22 | 23 | dependencies: 24 | flutter: 25 | sdk: flutter 26 | 27 | 28 | # The following adds the Cupertino Icons font to your application. 29 | # Use with the CupertinoIcons class for iOS style icons. 30 | cupertino_icons: ^0.1.3 31 | shared_preferences: ^0.5.8 32 | cloud_firestore: ^0.13.7 33 | google_fonts: ^1.1.0 34 | firebase_auth: ^0.16.1 35 | google_sign_in: ^4.5.1 36 | flutter_signin_button: ^1.0.0 37 | lottie: ^0.4.0+1 38 | bottom_navy_bar: ^5.4.0 39 | fluttertoast: ^5.0.1 40 | morse: ^0.1.4+1 41 | flutter_shake_plugin: ^0.0.2 42 | vibration: ^1.4.0 43 | image_picker: ^0.6.7+4 44 | firebase_storage: ^3.1.6 45 | http: ^0.12.1 46 | convex_bottom_bar: ^2.3.0 47 | path_provider: ^1.6.11 48 | uuid: ^2.2.0 49 | cached_network_image: ^2.2.0+1 50 | image: ^2.1.13 51 | timeago: ^2.0.26 52 | webfeed: ^0.4.2 53 | url_launcher: ^5.5.0 54 | flutter_webview_plugin: ^0.3.11 55 | assets_audio_player: ^2.0.7+9 56 | auto_size_text: ^2.1.0 57 | firebase_messaging: ^6.0.16 58 | flutter_svg: ^0.17.4 59 | 60 | dev_dependencies: 61 | flutter_test: 62 | sdk: flutter 63 | flutter_launcher_icons: ^0.7.5 64 | 65 | dependency_overrides: 66 | flutter_chips_input: ^1.9.0-dev.1 67 | 68 | 69 | 70 | flutter_icons: 71 | android: "launcher_icon" 72 | ios: true 73 | image_path: "assets/icon.png" 74 | # For information on the generic Dart part of this file, see the 75 | # following page: https://dart.dev/tools/pub/pubspec 76 | 77 | # The following section is specific to Flutter. 78 | flutter: 79 | assets: 80 | - assets/ 81 | 82 | # The following line ensures that the Material Icons font is 83 | # included with your application, so that you can use the icons in 84 | # the material Icons class. 85 | uses-material-design: true 86 | 87 | # To add assets to your application, add an assets section, like this: 88 | # assets: 89 | # - images/a_dot_burr.jpeg 90 | # - images/a_dot_ham.jpeg 91 | 92 | # An image asset can refer to one or more resolution-specific "variants", see 93 | # https://flutter.dev/assets-and-images/#resolution-aware. 94 | 95 | # For details regarding adding assets from package dependencies, see 96 | # https://flutter.dev/assets-and-images/#from-packages 97 | 98 | # To add custom fonts to your application, add a fonts section here, 99 | # in this "flutter" section. Each entry in this list should have a 100 | # "family" key with the font family name, and a "fonts" key with a 101 | # list giving the asset and other descriptors for the font. For 102 | # example: 103 | # fonts: 104 | # - family: Schyler 105 | # fonts: 106 | # - asset: fonts/Schyler-Regular.ttf 107 | # - asset: fonts/Schyler-Italic.ttf 108 | # style: italic 109 | # - family: Trajan Pro 110 | # fonts: 111 | # - asset: fonts/TrajanPro.ttf 112 | # - asset: fonts/TrajanPro_Bold.ttf 113 | # weight: 700 114 | # 115 | # For details regarding fonts from package dependencies, 116 | # see https://flutter.dev/custom-fonts/#from-packages 117 | -------------------------------------------------------------------------------- /lib/UI/Screens/followingList.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:google_fonts/google_fonts.dart'; 4 | import 'package:lottie/lottie.dart'; 5 | import 'package:morsey_gaming_social_hub/Models/user.dart'; 6 | import 'package:morsey_gaming_social_hub/UI/Screens/profilePage.dart'; 7 | import 'package:morsey_gaming_social_hub/UI/Widgets/UserProfilePic.dart'; 8 | 9 | class FollowingList extends StatefulWidget { 10 | final String email; 11 | FollowingList(this.email); 12 | @override 13 | _FollowingListState createState() => _FollowingListState(); 14 | } 15 | 16 | class _FollowingListState extends State { 17 | Future getGames()async{ 18 | final x= await Firestore.instance.collection("users").document(widget.email).get(); 19 | List a= x.data['games_followed']; 20 | return a; 21 | } 22 | @override 23 | Widget build(BuildContext context) { 24 | return Scaffold( 25 | backgroundColor:Color(0xff21252A), 26 | appBar:AppBar( 27 | title:Text("Followed games",style:GoogleFonts.bangers(textStyle:TextStyle(color:Color(0xff67FD9A),fontSize:30,fontWeight:FontWeight.w400,letterSpacing: 2)),), 28 | centerTitle: true, 29 | backgroundColor: Colors.black, 30 | ), 31 | body:Container( 32 | margin: EdgeInsets.only(top:20), 33 | child: FutureBuilder( 34 | future: getGames(), 35 | builder:(_,snapshots){ 36 | if(snapshots.connectionState==ConnectionState.waiting){ 37 | return Center(child:Lottie.asset("assets/loading.json")); 38 | } 39 | else 40 | return ListView.builder( 41 | itemCount: snapshots.data.length, 42 | itemBuilder:(context,i){ 43 | return Column( 44 | children: [ 45 | ListTile( 46 | enabled: true, 47 | title: Text(snapshots.data[i].toString().replaceAll("-", " "),style: TextStyle(fontWeight:FontWeight.w500,fontSize:17),), 48 | ), 49 | Divider(color:Colors.grey) 50 | ], 51 | ); 52 | } 53 | ); 54 | } 55 | ), 56 | ) 57 | ); 58 | } 59 | } 60 | 61 | class GameFollowersList extends StatefulWidget { 62 | final List followers; 63 | GameFollowersList(this.followers); 64 | @override 65 | _GameFollowersListState createState() => _GameFollowersListState(); 66 | } 67 | 68 | class _GameFollowersListState extends State { 69 | @override 70 | List users=[]; 71 | void getUsers() async{ 72 | widget.followers.forEach((element) async { 73 | final x= await Firestore.instance.collection("users").document(element.toString()).get(); 74 | users.add(User.fromDocument(x)); 75 | setState(() { 76 | }); 77 | }); 78 | } 79 | void initState(){ 80 | super.initState(); 81 | getUsers(); 82 | } 83 | Widget build(BuildContext context) { 84 | return Scaffold( 85 | backgroundColor:Color(0xff21252A), 86 | appBar:AppBar( 87 | title:Text("Followed games",style:GoogleFonts.bangers(textStyle:TextStyle(color:Color(0xff67FD9A),fontSize:30,fontWeight:FontWeight.w400,letterSpacing: 2)),), 88 | centerTitle: true, 89 | backgroundColor: Colors.black, 90 | ), 91 | body:Container( 92 | margin: EdgeInsets.only(top:20), 93 | child: users!=null?ListView.builder( 94 | itemCount: users.length, 95 | itemBuilder:(context,i) { 96 | return Column( 97 | children: [ 98 | ListTile( 99 | onTap: (){ 100 | Navigator.of(context).push(MaterialPageRoute(builder:(context){return ProfilePage(users[i],false);})); 101 | }, 102 | enabled: true, 103 | leading: Container( 104 | height: 50, 105 | width: 50, 106 | child: UserProfilePicture(userId: users[i].email,profilePicture: users[i].photoUrl,)), 107 | title: Text(users[i].gamer_tag,style: TextStyle(fontWeight:FontWeight.w500,fontSize:17),), 108 | ), 109 | Divider(color:Colors.grey) 110 | ], 111 | ); 112 | } 113 | ):Container() 114 | ) 115 | ); 116 | } 117 | } -------------------------------------------------------------------------------- /lib/UI/Widgets/gameStat.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:morsey_gaming_social_hub/Models/GameSearchData.dart'; 4 | import 'package:morsey_gaming_social_hub/UI/Screens/followingList.dart'; 5 | 6 | class GameStatsWidget extends StatefulWidget { 7 | final GameSearch game; 8 | GameStatsWidget(this.game); 9 | @override 10 | _GameStatsWidgetState createState() => _GameStatsWidgetState(); 11 | } 12 | 13 | class _GameStatsWidgetState extends State { 14 | @override 15 | int count =0; 16 | bool notAvailable=false; 17 | Future getPosts()async{ 18 | final x =await Firestore.instance.collection("games").document(widget.game.slug).get(); 19 | if(!x.exists) 20 | { 21 | setState(() { 22 | notAvailable=true; 23 | }); 24 | } 25 | return x; 26 | } 27 | Future postCount() async{ 28 | final x =await Firestore.instance.collection("games").document(widget.game.slug).collection("posts").getDocuments(); 29 | return x.documents.length.toString(); 30 | } 31 | String followingCount(AsyncSnapshot data){ 32 | List following= data.data["followers"]; 33 | return following.length.toString(); 34 | } 35 | Widget build(BuildContext context) { 36 | return FutureBuilder( 37 | future: getPosts(), 38 | builder: (context, snapshot) { 39 | if(!snapshot.hasData||snapshot.data==null) 40 | {return Center(child:CircularProgressIndicator());} 41 | else 42 | return Container( 43 | height: 80, 44 | width: MediaQuery.of(context).size.width, 45 | padding: EdgeInsets.all(15.0), 46 | color: Colors.black, 47 | child: Row( 48 | children: [ 49 | Expanded( 50 | child: Column( 51 | children: [ 52 | GestureDetector( 53 | onTap: (){ 54 | notAvailable?{}:Navigator.of(context).push(MaterialPageRoute(builder: (context){return GameFollowersList(snapshot.data["followers"]);})); 55 | }, 56 | child: Text( 57 | '${notAvailable?"0":followingCount(snapshot)}', 58 | style: Theme.of(context) 59 | .textTheme 60 | .headline6 61 | .copyWith( 62 | color: Colors.white, 63 | fontWeight: FontWeight.bold, 64 | ), 65 | ), 66 | ), 67 | GestureDetector( 68 | onTap: (){ 69 | notAvailable?{}:Navigator.of(context).push(MaterialPageRoute(builder: (context){return GameFollowersList(snapshot.data["followers"]);})); 70 | }, 71 | child: Text( 72 | "Followers", 73 | style: Theme.of(context) 74 | .textTheme 75 | .subtitle1 76 | .copyWith( 77 | color: Color(0xff67FD9A), 78 | fontWeight: FontWeight.bold, 79 | ), 80 | ), 81 | ) 82 | ], 83 | ), 84 | ), 85 | Expanded( 86 | child: Column( 87 | children: [ 88 | FutureBuilder( 89 | future: postCount(), 90 | builder: (context, snapshot) { 91 | if(snapshot.hasData) 92 | return Text( 93 | '${notAvailable?"0":snapshot.data}', 94 | style: Theme.of(context) 95 | .textTheme 96 | .headline6 97 | .copyWith( 98 | color: Colors.white, 99 | fontWeight: FontWeight.bold, 100 | ), 101 | ); 102 | else 103 | return Text(''); 104 | } 105 | ), 106 | Text( 107 | "Posts", 108 | style: Theme.of(context) 109 | .textTheme 110 | .subtitle1 111 | .copyWith( 112 | color: Color(0xff67FD9A), 113 | fontWeight: FontWeight.bold, 114 | ), 115 | ) 116 | ], 117 | ), 118 | ), 119 | ], 120 | ) 121 | ); 122 | } 123 | ); 124 | } 125 | } -------------------------------------------------------------------------------- /lib/UI/Screens/SinglePost.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:morsey_gaming_social_hub/Models/post.dart'; 4 | import 'package:morsey_gaming_social_hub/Models/user.dart'; 5 | import 'package:morsey_gaming_social_hub/UI/Widgets/UserProfilePic.dart'; 6 | import 'package:timeago/timeago.dart' as timeago; 7 | import 'package:assets_audio_player/assets_audio_player.dart'; 8 | 9 | class SinglePost extends StatefulWidget { 10 | final Post post; 11 | SinglePost(this.post); 12 | @override 13 | _SinglePostState createState() => _SinglePostState(); 14 | } 15 | 16 | class _SinglePostState extends State { 17 | @override 18 | final assetsAudioPlayer = AssetsAudioPlayer(); 19 | bool gg =false; 20 | bool f=false; 21 | bool rip=false; 22 | Widget build(BuildContext context) { 23 | return Scaffold( 24 | backgroundColor: Color(0xff21252A), 25 | body: SingleChildScrollView( 26 | child: GestureDetector( 27 | onTap: () { 28 | }, 29 | child: Container( 30 | margin: EdgeInsets.only(top:100), 31 | decoration: BoxDecoration( 32 | border: Border( 33 | bottom: BorderSide( 34 | color: Colors.grey, 35 | ), 36 | ), 37 | ), 38 | padding: const EdgeInsets.all(15.0), 39 | child: Column( 40 | crossAxisAlignment: CrossAxisAlignment.start, 41 | children: [ 42 | Row( 43 | children: [ 44 | UserProfilePicture( 45 | userId: widget.post.ownerEmail, 46 | profilePicture: widget.post.profilePic 47 | ), 48 | SizedBox(width: 15), 49 | Expanded( 50 | child: Column( 51 | crossAxisAlignment: 52 | CrossAxisAlignment.start, 53 | children: [ 54 | Text( 55 | "${widget.post.gamer_tag}", 56 | style: Theme.of(context) 57 | .textTheme 58 | .headline6 59 | .copyWith( 60 | color: Colors.white, 61 | fontWeight: 62 | FontWeight.bold, 63 | ), 64 | ), 65 | Text( 66 | "${widget.post.ownerEmail}", 67 | style:TextStyle(color:Colors.grey,fontSize:13) 68 | ), 69 | ], 70 | ), 71 | ), 72 | Expanded( 73 | child: Text( 74 | timeago.format( 75 | DateTime.parse( 76 | "${widget.post.timestamp}"), 77 | locale: "en"), 78 | textAlign: TextAlign.end, 79 | style: Theme.of(context) 80 | .textTheme 81 | .subtitle2 82 | .copyWith( 83 | color: Colors.grey, 84 | fontWeight: FontWeight.bold), 85 | ), 86 | ) 87 | ], 88 | ), 89 | Container( 90 | margin: 91 | const EdgeInsets.symmetric(vertical: 15.0), 92 | width: double.infinity, 93 | child: ClipRRect( 94 | borderRadius: BorderRadius.circular(5.0), 95 | child: Image.network( 96 | "${widget.post.mediaUrl}", 97 | fit: BoxFit.cover, 98 | ), 99 | ), 100 | ), 101 | Text( 102 | "${widget.post.description}", 103 | overflow: TextOverflow.ellipsis, 104 | maxLines: 30, 105 | style: Theme.of(context) 106 | .textTheme 107 | .subtitle2 108 | .copyWith( 109 | color: Colors.white, 110 | fontWeight: FontWeight.bold, 111 | ), 112 | ), 113 | ], 114 | ), 115 | ), 116 | ), 117 | ), 118 | ); 119 | } 120 | } -------------------------------------------------------------------------------- /lib/UI/Screens/feed.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | import 'package:firebase_auth/firebase_auth.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:google_fonts/google_fonts.dart'; 5 | import 'package:lottie/lottie.dart'; 6 | import 'package:morsey_gaming_social_hub/Methods/GoogleSignIn.dart'; 7 | import 'package:morsey_gaming_social_hub/Models/post.dart'; 8 | import 'package:morsey_gaming_social_hub/Models/user.dart'; 9 | import 'package:morsey_gaming_social_hub/UI/Widgets/feedPost.dart'; 10 | import 'package:shared_preferences/shared_preferences.dart'; 11 | 12 | import 'Login.dart'; 13 | 14 | class Feed extends StatefulWidget { 15 | @override 16 | _FeedState createState() => _FeedState(); 17 | } 18 | 19 | class _FeedState extends State { 20 | User user1; 21 | getEmail()async{ 22 | FirebaseAuth auth=FirebaseAuth.instance; 23 | final FirebaseUser user = await auth.currentUser(); 24 | email = user.email; 25 | final x=await Firestore.instance.collection('users').document(email).get(); 26 | user1 = User.fromDocument(x); 27 | setState(() { 28 | }); 29 | } 30 | 31 | 32 | @override 33 | void initState(){ 34 | super.initState(); 35 | getEmail(); 36 | } 37 | Widget build(BuildContext context) { 38 | return Scaffold( 39 | backgroundColor: Color(0xff21252A), 40 | body: CustomScrollView( 41 | slivers:[ 42 | SliverAppBar( 43 | elevation: 10, 44 | expandedHeight: 150, 45 | pinned: true, 46 | floating: true, 47 | centerTitle: true, 48 | backgroundColor: Colors.black, 49 | actions: [ 50 | PopupMenuButton( 51 | color:Colors.tealAccent[400], 52 | itemBuilder: (BuildContext context){ 53 | return[ 54 | PopupMenuItem( 55 | child: Center( 56 | child: FlatButton( 57 | onPressed:()async{ 58 | SharedPreferences prefs = await SharedPreferences.getInstance(); 59 | prefs.clear(); 60 | signOutGoogle(); 61 | Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context)=>Login()),ModalRoute.withName('homepage')); 62 | }, 63 | child: Text('Logout',style:GoogleFonts.orbitron(textStyle: TextStyle(color: Colors.black,fontWeight: FontWeight.w500,fontSize:18))), 64 | color: Colors.teal, 65 | splashColor: Colors.tealAccent, 66 | ), 67 | ) 68 | ) 69 | ]; 70 | }, 71 | ) 72 | ], 73 | flexibleSpace: FlexibleSpaceBar( 74 | background:Image.asset('assets/1.jpg',fit: BoxFit.fill,), 75 | centerTitle: true, 76 | title: Text("GAMIAC",style:GoogleFonts.bangers(textStyle:TextStyle(color:Color(0xff67FD9A),fontSize:30,fontWeight:FontWeight.w400,letterSpacing: 2)),), 77 | ), 78 | ), 79 | if(user1!=null) 80 | StreamBuilder( 81 | stream: Firestore.instance.collection("users").document(user1.email).collection("feed").orderBy('timestamp',descending:true).limit(45).snapshots(), 82 | builder: (_,snapshot){ 83 | if(snapshot.connectionState==ConnectionState.waiting||!snapshot.hasData){ 84 | return SliverFillRemaining(child: Center(child: Lottie.asset("assets/loading.json"))); 85 | } 86 | else{ 87 | if(snapshot.data.documents.length==0) 88 | { 89 | return SliverFillRemaining( 90 | child:Center( 91 | child: Column( 92 | mainAxisAlignment: MainAxisAlignment.center, 93 | children: [ 94 | Lottie.asset("assets/empty_feed.json"), 95 | SizedBox(height:20), 96 | Text("Empty feed, fill your feed by following your favourite games",style: TextStyle(color:Colors.redAccent,fontSize:18,fontWeight:FontWeight.bold),textAlign: TextAlign.center,) 97 | ], 98 | ), 99 | ) 100 | ); 101 | } 102 | else 103 | return SliverList( 104 | delegate: 105 | SliverChildBuilderDelegate((_,index){ 106 | return FeedPost(Post.fromDocument(snapshot.data.documents[index]),user1); 107 | },childCount: snapshot.data.documents.length 108 | ) 109 | ); 110 | } 111 | } 112 | ) 113 | ] 114 | ), 115 | 116 | ); 117 | } 118 | } -------------------------------------------------------------------------------- /lib/UI/Screens/News.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:fluttertoast/fluttertoast.dart'; 4 | import 'package:google_fonts/google_fonts.dart'; 5 | import 'package:lottie/lottie.dart'; 6 | import 'package:morsey_gaming_social_hub/Methods/GoogleSignIn.dart'; 7 | import 'package:morsey_gaming_social_hub/UI/Screens/Login.dart'; 8 | import 'package:shared_preferences/shared_preferences.dart'; 9 | import 'package:webfeed/webfeed.dart'; 10 | import 'package:http/http.dart'as http; 11 | import 'package:url_launcher/url_launcher.dart'; 12 | import 'package:flutter_webview_plugin/flutter_webview_plugin.dart'; 13 | import 'package:auto_size_text/auto_size_text.dart'; 14 | 15 | class NewsPage extends StatefulWidget { 16 | @override 17 | _NewsPageState createState() => _NewsPageState(); 18 | } 19 | 20 | class _NewsPageState extends State { 21 | @override 22 | static const String feedUrl='https://www.pcgamer.com/rss/'; 23 | RssFeed _feed; 24 | String _title; 25 | final flutterWebViewPlugin = FlutterWebviewPlugin(); 26 | updateFeed(feed){ 27 | if(mounted) 28 | setState(() { 29 | _feed=feed; 30 | }); 31 | } 32 | load() async{ 33 | loadfeed().then((value){ 34 | if(value==null) 35 | { 36 | FlutterToast.showToast( 37 | msg: "Something went wrong try again", 38 | backgroundColor: Colors.red, 39 | textColor: Colors.white, 40 | fontSize: 16.0 41 | ); 42 | } 43 | updateFeed(value); 44 | }); 45 | } 46 | Future loadfeed()async{ 47 | try{ 48 | final client=http.Client(); 49 | final response= await client.get(feedUrl); 50 | return RssFeed.parse(response.body); 51 | }catch(e){ 52 | 53 | } 54 | return null; 55 | } 56 | void initState(){ 57 | super.initState(); 58 | load(); 59 | } 60 | title(title){ 61 | return AutoSizeText(title,style: GoogleFonts.ptSerif(color:Colors.white,fontSize:22,fontWeight:FontWeight.w500),maxLines: 2,overflow: TextOverflow.ellipsis,); 62 | } 63 | thumbnail(url){ 64 | return Container( 65 | decoration: BoxDecoration( 66 | borderRadius:BorderRadius.only(topLeft:Radius.circular(18), 67 | topRight:Radius.circular(18),), 68 | image: DecorationImage(image: CachedNetworkImageProvider(url 69 | ), ) 70 | ), 71 | ); 72 | } 73 | Widget build(BuildContext context) { 74 | return Scaffold( 75 | backgroundColor: Color(0xff21252A), 76 | appBar:AppBar( 77 | title:Text("GAMIAC",style:GoogleFonts.bangers(textStyle:TextStyle(color:Color(0xff67FD9A),fontSize:30,fontWeight:FontWeight.w400,letterSpacing: 2)),), 78 | centerTitle: true, 79 | backgroundColor: Colors.black, 80 | actions: [ 81 | PopupMenuButton( 82 | color:Colors.tealAccent[400], 83 | itemBuilder: (BuildContext context){ 84 | return[ 85 | PopupMenuItem( 86 | child: Center( 87 | child: FlatButton( 88 | onPressed:()async{ 89 | SharedPreferences prefs = await SharedPreferences.getInstance(); 90 | prefs.clear(); 91 | signOutGoogle(); 92 | Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context)=>Login()),ModalRoute.withName('homepage')); 93 | }, 94 | child: Text('Logout',style:GoogleFonts.orbitron(textStyle: TextStyle(color: Colors.black,fontWeight: FontWeight.w500,fontSize:18))), 95 | color: Colors.teal, 96 | splashColor: Colors.tealAccent, 97 | ), 98 | ) 99 | ) 100 | ]; 101 | }, 102 | ) 103 | ], 104 | ), 105 | body: _feed!=null?ListView.builder( 106 | itemCount: _feed.items.length, 107 | itemBuilder: (BuildContext context,index){ 108 | final item=_feed.items[index]; 109 | return GestureDetector( 110 | onTap: (){ 111 | launch(item.link,forceSafariVC: true,forceWebView: true); 112 | }, 113 | child: Container( 114 | margin: EdgeInsets.only(bottom:7), 115 | height: MediaQuery.of(context).size.height/2.5, 116 | width: MediaQuery.of(context).size.width, 117 | child: Card( 118 | color: Colors.black, 119 | shape: RoundedRectangleBorder( 120 | borderRadius: BorderRadius.circular(18), 121 | ), 122 | child:Column(children: [ 123 | Container( 124 | height:MediaQuery.of(context).size.height/3.5, 125 | child: thumbnail(item.media.contents[0].url), 126 | ), 127 | Expanded( 128 | child: Padding( 129 | padding: EdgeInsets.all(10), 130 | child:title(item.title)) 131 | ) 132 | ],) 133 | ), 134 | ), 135 | ); 136 | } 137 | ):Center(child:Lottie.asset('assets/loading.json')) 138 | ); 139 | } 140 | } -------------------------------------------------------------------------------- /lib/UI/Screens/searchPage.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | import 'package:http/http.dart'as http; 4 | import 'package:flutter/material.dart'; 5 | import 'package:google_fonts/google_fonts.dart'; 6 | import 'package:morsey_gaming_social_hub/Methods/GoogleSignIn.dart'; 7 | import 'package:morsey_gaming_social_hub/Models/GameSearchData.dart'; 8 | import 'package:morsey_gaming_social_hub/Models/user.dart'; 9 | import 'package:morsey_gaming_social_hub/UI/Screens/GamePage.dart'; 10 | import 'package:morsey_gaming_social_hub/UI/Screens/Login.dart'; 11 | import 'package:shared_preferences/shared_preferences.dart'; 12 | 13 | class SearchPage extends StatefulWidget { 14 | final User user; 15 | SearchPage(this.user); 16 | @override 17 | _SearchPageState createState() => _SearchPageState(); 18 | } 19 | 20 | class _SearchPageState extends State { 21 | List searchList; 22 | String query=''; 23 | final _debouncer = Debouncer(milliseconds: 500); 24 | fetchSearchList() async { 25 | final response = await http.get('https://api.rawg.io/api/games?page_size=8&search=${query.replaceAll(' ', '%20')}'); 26 | if (response.statusCode == 200) { 27 | var data = json.decode(response.body); 28 | var rest = data['results'] as List; 29 | setState(() { 30 | searchList = rest.map((json) => GameSearch.fromJson(json)).toList(); 31 | }); 32 | 33 | } else { 34 | throw Exception('Failed to load deck'); 35 | } 36 | } 37 | @override 38 | Widget build(BuildContext context) { 39 | return Scaffold( 40 | appBar:AppBar( 41 | title:Text("GAMIAC",style:GoogleFonts.bangers(textStyle:TextStyle(color:Color(0xff67FD9A),fontSize:30,fontWeight:FontWeight.w400,letterSpacing: 2)),), 42 | centerTitle: true, 43 | backgroundColor: Colors.black, 44 | actions: [ 45 | PopupMenuButton( 46 | color:Colors.tealAccent[400], 47 | itemBuilder: (BuildContext context){ 48 | return[ 49 | PopupMenuItem( 50 | child: Center( 51 | child: FlatButton( 52 | onPressed:()async{ 53 | SharedPreferences prefs = await SharedPreferences.getInstance(); 54 | prefs.clear(); 55 | signOutGoogle(); 56 | Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context)=>Login()),ModalRoute.withName('homepage')); 57 | }, 58 | child: Text('Logout',style:GoogleFonts.orbitron(textStyle: TextStyle(color: Colors.black,fontWeight: FontWeight.w500,fontSize:18))), 59 | color: Colors.teal, 60 | splashColor: Colors.tealAccent, 61 | ), 62 | ) 63 | ) 64 | ]; 65 | }, 66 | ) 67 | ], 68 | ), 69 | body: Column( 70 | children: [ 71 | Padding( 72 | padding: const EdgeInsets.all(8.0), 73 | child: TextField( 74 | onChanged: (value){ 75 | setState(() { 76 | query=value; 77 | }); 78 | _debouncer.run(() { 79 | fetchSearchList(); 80 | }); 81 | }, 82 | decoration:InputDecoration( 83 | enabledBorder:OutlineInputBorder(borderRadius:BorderRadius.all(Radius.circular(12)),borderSide: BorderSide(color:Colors.redAccent)), 84 | hintText:'Search Any Game',hintStyle: TextStyle(color:Colors.red,fontWeight:FontWeight.w600)), 85 | ) 86 | ), 87 | Expanded( 88 | child: GridView.builder( 89 | gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(maxCrossAxisExtent: 300), 90 | itemCount: searchList==null?0:searchList.length, 91 | itemBuilder: (context,index){ 92 | return GestureDetector( 93 | onTap: (){ 94 | Navigator.of(context).push(MaterialPageRoute(builder:(context){return GamePage(searchList[index], widget.user);})); 95 | }, 96 | child: Card( 97 | elevation: 10, 98 | shadowColor: Colors.teal, 99 | color: Colors.grey[900], 100 | child:Stack( 101 | children:[ 102 | Center(child: Image.network(searchList[index].image,fit: BoxFit.fitWidth,)), 103 | Text("${searchList[index].name}",style: TextStyle(fontSize:20),textAlign: TextAlign.center,) 104 | ] 105 | ) 106 | ), 107 | ); 108 | }, 109 | ), 110 | ) 111 | ], 112 | ), 113 | backgroundColor: Color(0xff21252A), 114 | ); 115 | } 116 | } 117 | 118 | class Debouncer { 119 | final int milliseconds; 120 | VoidCallback action; 121 | Timer _timer; 122 | 123 | Debouncer({this.milliseconds}); 124 | 125 | run(VoidCallback action) { 126 | if (null != _timer) { 127 | _timer.cancel(); 128 | } 129 | _timer = Timer(Duration(milliseconds: milliseconds), action); 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /lib/UI/Widgets/profHead.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:cloud_firestore/cloud_firestore.dart'; 4 | import 'package:firebase_storage/firebase_storage.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:fluttertoast/fluttertoast.dart'; 7 | import 'package:image_picker/image_picker.dart'; 8 | import 'package:morsey_gaming_social_hub/Models/user.dart'; 9 | 10 | class ProfileHeader extends StatefulWidget { 11 | final User user; 12 | final bool isOwn; 13 | const ProfileHeader({Key key, @required this.user,this.isOwn}) : super(key: key); 14 | @override 15 | _ProfileHeaderState createState() => _ProfileHeaderState(); 16 | } 17 | 18 | class _ProfileHeaderState extends State { 19 | File _image; 20 | int _currentCoverIndex = 0; 21 | 22 | void ChangePhoto() async{ 23 | final pickedFile = await ImagePicker().getImage(source: ImageSource.gallery); 24 | setState(() { 25 | _image = File(pickedFile.path); 26 | }); 27 | if(_image!=null){ 28 | String _uploadedFileURL; 29 | String fileName = "ProfilePics/${widget.user.email}"; 30 | StorageReference firebaseStorageRef = 31 | FirebaseStorage.instance.ref().child(fileName); 32 | StorageUploadTask uploadTask = firebaseStorageRef.putFile(_image); 33 | StorageTaskSnapshot taskSnapshot = await uploadTask.onComplete; 34 | print(taskSnapshot); 35 | await firebaseStorageRef.getDownloadURL().then((fileURL) async { 36 | _uploadedFileURL = fileURL; 37 | }); 38 | Firestore.instance.collection('users').document(widget.user.email).setData({'profile_pic':_uploadedFileURL},merge: true).whenComplete((){ 39 | FlutterToast.showToast( 40 | msg: "Image uploaded", 41 | backgroundColor: Colors.green, 42 | textColor: Colors.white, 43 | fontSize: 16.0 44 | ); 45 | setState(() { 46 | 47 | }); 48 | }); 49 | } 50 | else 51 | FlutterToast.showToast( 52 | msg: "No image selected", 53 | backgroundColor: Colors.red, 54 | textColor: Colors.white, 55 | fontSize: 16.0 56 | ); 57 | } 58 | 59 | @override 60 | Widget build(BuildContext context) { 61 | return Container( 62 | height: MediaQuery.of(context).size.height / 2, 63 | child: Stack( 64 | children: [ 65 | Positioned.fill( 66 | child: PageView.builder( 67 | onPageChanged: (i) { 68 | setState(() { 69 | _currentCoverIndex = i; 70 | }); 71 | }, 72 | itemCount: 3, 73 | itemBuilder: (ctx, i) { 74 | return _image==null?widget.user.photoUrl==null?Image.asset('assets/pro-gamer.png',fit: BoxFit.fill,):Image.network( 75 | "${widget.user.photoUrl}",fit: BoxFit.fill,):Image.file(_image,fit: BoxFit.fill,); 76 | }, 77 | ), 78 | ), 79 | Positioned( 80 | bottom: 0, 81 | left: 0, 82 | right: 0, 83 | child: Container( 84 | padding: const EdgeInsets.all(15.0), 85 | decoration: BoxDecoration( 86 | gradient: LinearGradient( 87 | colors: [ 88 | Colors.transparent, 89 | Colors.black.withOpacity(.5), 90 | ], 91 | begin: Alignment.topCenter, 92 | end: Alignment.bottomCenter, 93 | ), 94 | ), 95 | child: Row( 96 | children: [ 97 | Expanded( 98 | child: Column( 99 | crossAxisAlignment: 100 | CrossAxisAlignment.start, 101 | children: [ 102 | Text( 103 | "${widget.user.gamer_tag}", 104 | style: Theme.of(context) 105 | .textTheme 106 | .headline4 107 | .copyWith( 108 | color: Colors.white, 109 | fontWeight: FontWeight.bold, 110 | ), 111 | ), 112 | Row( 113 | children: [ 114 | Expanded( 115 | child: widget.isOwn?RaisedButton( 116 | child: Text( 117 | "Change photo", 118 | style: TextStyle(fontWeight:FontWeight.bold,fontSize: 15,color: Colors.redAccent) 119 | ), 120 | onPressed: () { 121 | ChangePhoto(); 122 | }, 123 | color: Color(0xff67FD9A), 124 | shape: RoundedRectangleBorder( 125 | borderRadius: 126 | BorderRadius.circular(25.0), 127 | ), 128 | ):Container(), 129 | ), 130 | Expanded( 131 | child: Row( 132 | crossAxisAlignment: 133 | CrossAxisAlignment.end, 134 | mainAxisAlignment: 135 | MainAxisAlignment.end, 136 | children: List.generate( 137 | 3, 138 | (f) { 139 | return Container( 140 | height: 9, 141 | width: 9, 142 | margin: EdgeInsets.symmetric( 143 | horizontal: 3.0), 144 | decoration: BoxDecoration( 145 | shape: BoxShape.circle, 146 | color: 147 | _currentCoverIndex == f 148 | ? Color(0xff67FD9A) 149 | : Colors.white, 150 | ), 151 | ); 152 | }), 153 | ), 154 | ) 155 | ], 156 | ), 157 | ], 158 | ), 159 | ), 160 | ], 161 | ), 162 | ), 163 | ) 164 | ], 165 | ), 166 | ); 167 | } 168 | } 169 | 170 | -------------------------------------------------------------------------------- /lib/UI/Widgets/gameHead.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:morsey_gaming_social_hub/Models/GameSearchData.dart'; 4 | import 'package:morsey_gaming_social_hub/Models/user.dart'; 5 | 6 | class GameHeader extends StatefulWidget { 7 | final GameSearch game; 8 | final User user; 9 | const GameHeader({Key key, @required this.game,this.user}) : super(key: key); 10 | @override 11 | _GameHeaderState createState() => _GameHeaderState(); 12 | } 13 | 14 | class _GameHeaderState extends State { 15 | int _currentCoverIndex = 0; 16 | bool followed=false; 17 | @override 18 | Future isFollow() async{ 19 | final x= await Firestore.instance.collection("users").document(widget.user.email).get(); 20 | List z=x.data["games_followed"]; 21 | if(z.contains(widget.game.slug)) 22 | { 23 | setState(() { 24 | followed=true; 25 | }); 26 | } 27 | else 28 | setState(() { 29 | followed=false; 30 | }); 31 | } 32 | follow()async{ 33 | final x= await Firestore.instance.collection("games").document(widget.game.slug).get(); 34 | if(x.exists) 35 | { 36 | final z= await Firestore.instance.collection("users").document(widget.user.email).get(); 37 | List l=z.data["games_followed"]; 38 | if(l.contains(widget.game.slug)) 39 | { 40 | followed=false; 41 | await Firestore.instance.collection("users").document(widget.user.email).updateData({"games_followed":FieldValue.arrayRemove([widget.game.slug])}); 42 | final f=await Firestore.instance.collection("users").document(widget.user.email).collection("feed").where("slug",isEqualTo:widget.game.slug).getDocuments(); 43 | f.documents.forEach((element) { 44 | Firestore.instance.collection("users").document(widget.user.email).collection("feed").document(element.documentID).delete(); 45 | }); 46 | await Firestore.instance.collection("games").document(widget.game.slug).updateData({"followers_count":FieldValue.increment(-1),"followers":FieldValue.arrayRemove([widget.user.email])}); 47 | setState(() {}); 48 | } 49 | else{ 50 | followed=true; 51 | await Firestore.instance.collection("users").document(widget.user.email).updateData({"games_followed":FieldValue.arrayUnion([widget.game.slug])}); 52 | await Firestore.instance.collection("games").document(widget.game.slug).updateData({"followers":FieldValue.arrayUnion([widget.user.email]),"followers_count":FieldValue.increment(1)}); 53 | final o=await Firestore.instance.collection("games").document(widget.game.slug).collection("posts").getDocuments(); 54 | o.documents.forEach((element) { 55 | Firestore.instance.collection("users").document(widget.user.email).collection("feed").document(element.documentID).setData(element.data); 56 | }); 57 | setState(() {}); 58 | } 59 | } 60 | else{ 61 | setState(() { 62 | followed=true; 63 | }); 64 | await Firestore.instance.collection('games').document(widget.game.slug).setData({'followers':[widget.user.email],'followers_count':1,'slug':widget.game.slug}); 65 | await Firestore.instance.collection('users').document(widget.user.email).updateData({'games_followed':FieldValue.arrayUnion([widget.game.slug])}); 66 | } 67 | } 68 | @override 69 | void initState(){ 70 | super.initState(); 71 | isFollow(); 72 | } 73 | Widget build(BuildContext context) { 74 | return Container( 75 | height: MediaQuery.of(context).size.height / 2, 76 | child: Stack( 77 | children: [ 78 | Positioned.fill( 79 | child: PageView.builder( 80 | onPageChanged: (i) { 81 | setState(() { 82 | _currentCoverIndex = i; 83 | }); 84 | }, 85 | itemCount: 3, 86 | itemBuilder: (ctx, i) { 87 | return Image.network( 88 | "${widget.game.image}",fit: BoxFit.fill,); 89 | }, 90 | ), 91 | ), 92 | Positioned( 93 | bottom: 0, 94 | left: 0, 95 | right: 0, 96 | child: Container( 97 | padding: const EdgeInsets.all(15.0), 98 | decoration: BoxDecoration( 99 | gradient: LinearGradient( 100 | colors: [ 101 | Colors.transparent, 102 | Colors.black.withOpacity(.5), 103 | ], 104 | begin: Alignment.topCenter, 105 | end: Alignment.bottomCenter, 106 | ), 107 | ), 108 | child: Row( 109 | children: [ 110 | Expanded( 111 | child: Column( 112 | crossAxisAlignment: 113 | CrossAxisAlignment.start, 114 | children: [ 115 | Text( 116 | "${widget.game.name}", 117 | style: Theme.of(context) 118 | .textTheme 119 | .headline4 120 | .copyWith( 121 | color: Colors.white, 122 | fontWeight: FontWeight.bold, 123 | ), 124 | ), 125 | Row( 126 | children: [ 127 | Expanded( 128 | child: RaisedButton( 129 | child: Text( 130 | followed?"Following":"Follow", 131 | style: TextStyle(fontWeight:FontWeight.bold,fontSize: 15,color: Colors.redAccent) 132 | ), 133 | onPressed: () {follow();}, 134 | color: Color(0xff67FD9A), 135 | shape: RoundedRectangleBorder( 136 | borderRadius: 137 | BorderRadius.circular(25.0), 138 | ), 139 | ), 140 | ), 141 | Expanded( 142 | child: Row( 143 | crossAxisAlignment: 144 | CrossAxisAlignment.end, 145 | mainAxisAlignment: 146 | MainAxisAlignment.end, 147 | children: List.generate( 148 | 3, 149 | (f) { 150 | return Container( 151 | height: 9, 152 | width: 9, 153 | margin: EdgeInsets.symmetric( 154 | horizontal: 3.0), 155 | decoration: BoxDecoration( 156 | shape: BoxShape.circle, 157 | color: 158 | _currentCoverIndex == f 159 | ? Color(0xff67FD9A) 160 | : Colors.white, 161 | ), 162 | ); 163 | }), 164 | ), 165 | ) 166 | ], 167 | ), 168 | ], 169 | ), 170 | ), 171 | ], 172 | ), 173 | ), 174 | ) 175 | ], 176 | ), 177 | ); 178 | } 179 | } -------------------------------------------------------------------------------- /lib/UI/Screens/Comments.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:cloud_firestore/cloud_firestore.dart'; 3 | import 'package:firebase_auth/firebase_auth.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:google_fonts/google_fonts.dart'; 6 | import 'package:morsey_gaming_social_hub/Methods/GoogleSignIn.dart'; 7 | import 'package:morsey_gaming_social_hub/Models/post.dart'; 8 | import 'package:morsey_gaming_social_hub/Models/user.dart'; 9 | import 'package:shared_preferences/shared_preferences.dart'; 10 | 11 | import 'Login.dart'; 12 | 13 | class Comments extends StatefulWidget { 14 | final Post post; 15 | final User user; 16 | Comments(this.user,this.post,); 17 | @override 18 | _CommentsState createState() => _CommentsState(); 19 | } 20 | 21 | class _CommentsState extends State { 22 | final Firestore _firestore = Firestore.instance; 23 | bool english=false; 24 | TextEditingController messageController = TextEditingController(); 25 | ScrollController scrollController = ScrollController(); 26 | Future callback() async { 27 | if (messageController.text.length > 0) { 28 | await _firestore.collection('games').document(widget.post.slug).collection('posts').document(widget.post.postId).collection("comments").add({ 29 | 'text': messageController.text, 30 | 'from': widget.user.gamer_tag, 31 | 'date': DateTime.now().toIso8601String().toString(), 32 | }); 33 | messageController.clear(); 34 | scrollController.animateTo( 35 | scrollController.position.maxScrollExtent, 36 | curve: Curves.easeOut, 37 | duration: const Duration(milliseconds: 300), 38 | ); 39 | } 40 | } 41 | void initState(){ 42 | super.initState(); 43 | } 44 | void dispose() { 45 | super.dispose(); 46 | 47 | } 48 | @override 49 | Widget build(BuildContext context) { 50 | return Scaffold( 51 | backgroundColor: Color(0xff21252A), 52 | appBar: AppBar( 53 | title:Text("Comments",style:GoogleFonts.bangers(textStyle:TextStyle(color:Color(0xff67FD9A),fontSize:30,fontWeight:FontWeight.w400,letterSpacing: 2)),), 54 | centerTitle: true, 55 | backgroundColor: Colors.black, 56 | actions: [ 57 | PopupMenuButton( 58 | color:Colors.tealAccent[400], 59 | itemBuilder: (BuildContext context){ 60 | return[ 61 | PopupMenuItem( 62 | child: Center( 63 | child: FlatButton( 64 | onPressed:()async{ 65 | SharedPreferences prefs = await SharedPreferences.getInstance(); 66 | prefs.clear(); 67 | signOutGoogle(); 68 | Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context)=>Login()),ModalRoute.withName('homepage')); 69 | }, 70 | child: Text('Logout',style:GoogleFonts.orbitron(textStyle: TextStyle(color: Colors.black,fontWeight: FontWeight.w500,fontSize:18))), 71 | color: Colors.teal, 72 | splashColor: Colors.tealAccent, 73 | ), 74 | ) 75 | ) 76 | ]; 77 | }, 78 | ) 79 | ], 80 | ), 81 | body: SafeArea( 82 | child: Column( 83 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 84 | children: [ 85 | Expanded( 86 | child: StreamBuilder( 87 | stream: _firestore 88 | .collection('games').document(widget.post.slug).collection('posts').document(widget.post.postId).collection("comments") 89 | .orderBy('date',descending:true) 90 | .snapshots(), 91 | builder: (context, snapshot) { 92 | if (!snapshot.hasData) 93 | return Center( 94 | child: CircularProgressIndicator(), 95 | ); 96 | 97 | List docs = snapshot.data.documents; 98 | 99 | List messages = docs 100 | .map((doc) => Message( 101 | message: doc.data['text'], 102 | gamerTag: doc.data['from'], 103 | )) 104 | .toList(); 105 | 106 | return ListView( 107 | controller: scrollController, 108 | children: [ 109 | ...messages, 110 | ], 111 | ); 112 | }, 113 | ), 114 | ), 115 | Container( 116 | child: Row( 117 | children: [ 118 | Expanded( 119 | child: Padding( 120 | padding: const EdgeInsets.only(bottom:10.0,left: 8), 121 | child: TextField( 122 | onSubmitted: (value) => callback(), 123 | decoration: InputDecoration( 124 | hoverColor: Colors.deepPurpleAccent, 125 | hintText: "Enter a comment", 126 | hintStyle: TextStyle(color:Color(0xffE6BBFC)), 127 | border: const OutlineInputBorder(), 128 | ), 129 | controller: messageController, 130 | ), 131 | ), 132 | ), 133 | SendButton( 134 | text: "Send", 135 | callback: callback, 136 | ) 137 | ], 138 | ), 139 | ), 140 | ], 141 | ), 142 | ), 143 | ); 144 | } 145 | } 146 | class SendButton extends StatelessWidget { 147 | final String text; 148 | final VoidCallback callback; 149 | 150 | const SendButton({Key key, this.text, this.callback}) : super(key: key); 151 | @override 152 | Widget build(BuildContext context) { 153 | return IconButton( 154 | icon: Icon(Icons.send,size: 33,), 155 | color: Color(0xffFF16CD), 156 | onPressed: callback, 157 | ); 158 | } 159 | } 160 | 161 | class Message extends StatefulWidget { 162 | final String message; 163 | final String gamerTag; 164 | Message({@required this.message,@required this.gamerTag}); 165 | 166 | @override 167 | _MessageState createState() => _MessageState(); 168 | } 169 | 170 | class _MessageState extends State { 171 | @override 172 | 173 | Widget build(BuildContext context) { 174 | return Container( 175 | padding: EdgeInsets.only( 176 | top: 8, 177 | bottom: 8, 178 | left: 24, 179 | right: 0), 180 | alignment: Alignment.centerLeft, 181 | child: Container( 182 | margin: EdgeInsets.only(right: 30), 183 | padding: EdgeInsets.only( 184 | top: 17, bottom: 17, left: 20, right: 20), 185 | decoration: BoxDecoration( 186 | borderRadius: BorderRadius.only( 187 | topLeft: Radius.circular(23), 188 | topRight: Radius.circular(23), 189 | bottomRight: Radius.circular(23)), 190 | gradient: LinearGradient( 191 | colors: [ 192 | Colors.greenAccent, 193 | Colors.green[600] 194 | ], 195 | ) 196 | ), 197 | child: Column( 198 | crossAxisAlignment: CrossAxisAlignment.start, 199 | children: [ 200 | Text(widget.gamerTag,style: TextStyle(color:Colors.black),), 201 | SizedBox(height:5), 202 | Text(widget.message, 203 | textAlign: TextAlign.start, 204 | style:TextStyle( 205 | color: Colors.white, 206 | fontSize: 18, 207 | fontFamily: 'OverpassRegular', 208 | fontWeight: FontWeight.w700) 209 | ), 210 | ], 211 | ) 212 | ), 213 | ); 214 | } 215 | } -------------------------------------------------------------------------------- /assets/empty_feed.json: -------------------------------------------------------------------------------- 1 | {"v":"5.1.18","fr":29.9700012207031,"ip":0,"op":60.0000024438501,"w":58,"h":58,"nm":"Comp 1","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"empty Outlines","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[29,29,0],"ix":2},"a":{"a":0,"k":[29,29,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0.55,0],[0,0],[0,0.55],[-0.55,0],[0,0],[0,-0.55]],"o":[[0,0],[-0.55,0],[0,-0.55],[0,0],[0.55,0],[0,0.55]],"v":[[8.5,1],[-8.5,1],[-9.5,0],[-8.5,-1],[8.5,-1],[9.5,0]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.403921568627451,0.9921568627450981,0.6039215686274509,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":0,"s":[28.25,37],"e":[28.25,33],"to":[0,-0.66666668653488],"ti":[0,0.66666668653488]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":10,"s":[28.25,33],"e":[28.25,33],"to":[0,0],"ti":[0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":15,"s":[28.25,33],"e":[28.25,44],"to":[0,1.83333337306976],"ti":[0,-1.83333337306976]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":20,"s":[28.25,44],"e":[28.25,44],"to":[0,0],"ti":[0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":35,"s":[28.25,44],"e":[28.25,33],"to":[0,-1.83333337306976],"ti":[0,1.83333337306976]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":40,"s":[28.25,33],"e":[28.25,33],"to":[0,0],"ti":[0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":45,"s":[28.25,33],"e":[28.25,37],"to":[0,0.66666668653488],"ti":[0,-0.66666668653488]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":50,"s":[28.25,37],"e":[28.25,37],"to":[0,0],"ti":[0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":55,"s":[28.25,37],"e":[28.25,37],"to":[0,0],"ti":[0,0]},{"t":59.0000024031193}],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"n":["0p833_0p833_0p167_0p167","0p833_0p833_0p167_0p167"],"t":0,"s":[100,100],"e":[69,69]},{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"n":["0p833_0p833_0p167_0p167","0p833_0p833_0p167_0p167"],"t":10,"s":[69,69],"e":[69,69]},{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"n":["0p833_0p833_0p167_0p167","0p833_0p833_0p167_0p167"],"t":15,"s":[69,69],"e":[69,69]},{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"n":["0p833_0p833_0p167_0p167","0p833_0p833_0p167_0p167"],"t":35,"s":[69,69],"e":[69,69]},{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"n":["0p833_0p833_0p167_0p167","0p833_0p833_0p167_0p167"],"t":45,"s":[69,69],"e":[69,69]},{"t":55.0000022401959}],"ix":3},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":0,"s":[0],"e":[-12]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":10,"s":[-12],"e":[-12]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":15,"s":[-12],"e":[1]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":20,"s":[1],"e":[1]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":35,"s":[1],"e":[13]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":40,"s":[13],"e":[13]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":45,"s":[13],"e":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":50,"s":[0],"e":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":55,"s":[0],"e":[19]},{"t":59.0000024031193}],"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,-1.381],[1.381,0],[0,1.381],[-1.381,0]],"o":[[0,1.381],[-1.381,0],[0,-1.381],[1.381,0]],"v":[[2.5,0],[0,2.5],[-2.5,0],[0,-2.5]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.403921568627451,0.9921568627450981,0.6039215686274509,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":0,"s":[37.75,24.5],"e":[32.75,18.5],"to":[-0.83333331346512,-1],"ti":[0.83333331346512,-1.33333337306976]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":10,"s":[32.75,18.5],"e":[32.317,19.859],"to":[-0.14039172232151,0.22462674975395],"ti":[0.14257775247097,-0.65421944856644]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":15,"s":[32.317,19.859],"e":[32.75,32.5],"to":[-0.7037313580513,3.22907829284668],"ti":[-1.66305983066559,-1.94023656845093]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":20,"s":[32.75,32.5],"e":[33.762,33.254],"to":[0.25078782439232,0.29258579015732],"ti":[-0.41581165790558,-0.21069806814194]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":25,"s":[33.762,33.254],"e":[44.75,32.5],"to":[2.90023159980774,1.46959137916565],"ti":[-1.74921214580536,1.74921214580536]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":30,"s":[44.75,32.5],"e":[45.34,31.443],"to":[0.2598968744278,-0.2598968744278],"ti":[-0.13797041773796,0.43620339035988]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":35,"s":[45.34,31.443],"e":[44.75,20.5],"to":[0.92376166582108,-2.92053866386414],"ti":[0,1.7401031255722]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":40,"s":[44.75,20.5],"e":[44.75,20.5],"to":[0,-2],"ti":[0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":45,"s":[44.75,20.5],"e":[37.75,24.5],"to":[0,0],"ti":[0,0]},{"t":50.0000020365418}],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":50,"s":[100],"e":[100]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":51,"s":[100],"e":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":53,"s":[0],"e":[100]},{"t":54.0000021994651}],"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 2","np":2,"cix":2,"ix":2,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,-1.381],[1.381,0],[0,1.381],[-1.381,0]],"o":[[0,1.381],[-1.381,0],[0,-1.381],[1.381,0]],"v":[[2.5,0],[0,2.5],[-2.5,0],[0,-2.5]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.403921568627451,0.9921568627450981,0.6039215686274509,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":0,"s":[20,24.5],"e":[15,18.5],"to":[-0.83333331346512,-1],"ti":[0.83333331346512,-1.33333337306976]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":10,"s":[15,18.5],"e":[14.763,19.886],"to":[-0.07927326112986,0.12683720886707],"ti":[0.07540860027075,-0.75201451778412]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":15,"s":[14.763,19.886],"e":[15,32.5],"to":[-0.3389684855938,3.38037323951721],"ti":[-0.780821621418,-0.91095858812332]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":20,"s":[15,32.5],"e":[16.012,33.254],"to":[0.25078782439232,0.29258579015732],"ti":[-0.41581165790558,-0.21069806814194]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":25,"s":[16.012,33.254],"e":[27,32.5],"to":[2.90023159980774,1.46959137916565],"ti":[-1.74921214580536,1.74921214580536]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":30,"s":[27,32.5],"e":[27.59,31.443],"to":[0.2598968744278,-0.2598968744278],"ti":[-0.13797041773796,0.43620339035988]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":35,"s":[27.59,31.443],"e":[27,20.5],"to":[0.92376166582108,-2.92053866386414],"ti":[0,1.7401031255722]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":40,"s":[27,20.5],"e":[27,20.5],"to":[0,-2],"ti":[0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":45,"s":[27,20.5],"e":[20,24.5],"to":[0,0],"ti":[0,0]},{"t":50.0000020365418}],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":50,"s":[100],"e":[100]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":51,"s":[100],"e":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":53,"s":[0],"e":[100]},{"t":54.0000021994651}],"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 3","np":2,"cix":2,"ix":3,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,-12.426],[12.427,0],[0,12.427],[-12.426,0]],"o":[[0,12.427],[-12.426,0],[0,-12.426],[12.427,0]],"v":[[22.5,0],[0,22.5],[-22.5,0],[0,-22.5]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.972999961703,0.842999985639,0.46699999641,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[28.25,29],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 4","np":2,"cix":2,"ix":4,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":60.0000024438501,"st":0,"bm":0}],"markers":[]} -------------------------------------------------------------------------------- /lib/UI/Widgets/feedPost.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:morsey_gaming_social_hub/Models/post.dart'; 4 | import 'package:morsey_gaming_social_hub/Models/user.dart'; 5 | import 'package:morsey_gaming_social_hub/UI/Screens/Comments.dart'; 6 | import 'package:morsey_gaming_social_hub/UI/Widgets/UserProfilePic.dart'; 7 | import 'package:timeago/timeago.dart' as timeago; 8 | import 'package:assets_audio_player/assets_audio_player.dart'; 9 | 10 | class FeedPost extends StatefulWidget { 11 | final Post post; 12 | final User user; 13 | FeedPost(this.post,this.user); 14 | @override 15 | _FeedPostState createState() => _FeedPostState(); 16 | } 17 | 18 | class _FeedPostState extends State { 19 | @override 20 | final assetsAudioPlayer = AssetsAudioPlayer(); 21 | bool gg =false; 22 | bool f=false; 23 | bool rip=false; 24 | Widget build(BuildContext context) { 25 | ggHandler() async{ 26 | final x= await Firestore.instance.collection('games').document(widget.post.slug).get(); 27 | List a= x.data['followers']; 28 | if(widget.post.gg.contains(widget.user.email)||gg==true) 29 | { 30 | setState(() { 31 | gg=false; 32 | }); 33 | await Firestore.instance.collection('games').document(widget.post.slug).collection("posts").document(widget.post.postId).updateData({"gg":FieldValue.arrayRemove([widget.user.email])}); 34 | a.forEach((element) { 35 | Firestore.instance.collection('users').document(element).collection("feed").document(widget.post.postId).updateData({"gg":FieldValue.arrayRemove([widget.user.email])}); 36 | }); 37 | } 38 | else{ 39 | assetsAudioPlayer.open( 40 | Audio("assets/impress.mp3"), 41 | ); 42 | await Firestore.instance.collection('games').document(widget.post.slug).collection("posts").document(widget.post.postId).updateData({"gg":FieldValue.arrayUnion([widget.user.email])}); 43 | a.forEach((element) { 44 | Firestore.instance.collection('users').document(element).collection("feed").document(widget.post.postId).updateData({"gg":FieldValue.arrayUnion([widget.user.email])}); 45 | }); 46 | setState(() { 47 | gg=true; 48 | }); 49 | } 50 | } 51 | fHandler() async{ 52 | final x= await Firestore.instance.collection('games').document(widget.post.slug).get(); 53 | List a= x.data['followers']; 54 | if(widget.post.f.contains(widget.user.email)||f==true) 55 | { 56 | setState(() { 57 | f=false; 58 | }); 59 | await Firestore.instance.collection('games').document(widget.post.slug).collection("posts").document(widget.post.postId).updateData({"f":FieldValue.arrayRemove([widget.user.email])}); 60 | a.forEach((element) { 61 | Firestore.instance.collection('users').document(element).collection("feed").document(widget.post.postId).updateData({"f":FieldValue.arrayRemove([widget.user.email])}); 62 | }); 63 | } 64 | else{ 65 | assetsAudioPlayer.open( 66 | Audio("assets/humilation.mp3")); 67 | await Firestore.instance.collection('games').document(widget.post.slug).collection("posts").document(widget.post.postId).updateData({"f":FieldValue.arrayUnion([widget.user.email])}); 68 | a.forEach((element) { 69 | Firestore.instance.collection('users').document(element).collection("feed").document(widget.post.postId).updateData({"f":FieldValue.arrayUnion([widget.user.email])}); 70 | }); 71 | setState(() { 72 | f=true; 73 | }); 74 | } 75 | } 76 | ripHandler() async{ 77 | final x= await Firestore.instance.collection('games').document(widget.post.slug).get(); 78 | List a= x.data['followers']; 79 | if(widget.post.rip.contains(widget.user.email)||rip==true) 80 | { 81 | setState(() { 82 | rip=false; 83 | }); 84 | await Firestore.instance.collection('games').document(widget.post.slug).collection("posts").document(widget.post.postId).updateData({"rip":FieldValue.arrayRemove([widget.user.email])}); 85 | a.forEach((element) { 86 | Firestore.instance.collection('users').document(element).collection("feed").document(widget.post.postId).updateData({"rip":FieldValue.arrayRemove([widget.user.email])}); 87 | }); 88 | } 89 | else{ 90 | assetsAudioPlayer.open( 91 | Audio("assets/multikill.mp3"), 92 | ); 93 | await Firestore.instance.collection('games').document(widget.post.slug).collection("posts").document(widget.post.postId).updateData({"gg":FieldValue.arrayUnion([widget.user.email])}); 94 | a.forEach((element) { 95 | Firestore.instance.collection('users').document(element).collection("feed").document(widget.post.postId).updateData({"rip":FieldValue.arrayUnion([widget.user.email])}); 96 | }); 97 | setState(() { 98 | rip=true; 99 | }); 100 | } 101 | } 102 | return GestureDetector( 103 | onTap: () { 104 | }, 105 | child: Container( 106 | decoration: BoxDecoration( 107 | border: Border( 108 | bottom: BorderSide( 109 | color: Colors.grey, 110 | ), 111 | ), 112 | ), 113 | padding: const EdgeInsets.all(15.0), 114 | child: Column( 115 | crossAxisAlignment: CrossAxisAlignment.start, 116 | children: [ 117 | Row( 118 | children: [ 119 | UserProfilePicture( 120 | userId: widget.post.ownerEmail, 121 | profilePicture: widget.post.profilePic 122 | ), 123 | SizedBox(width: 15), 124 | Expanded( 125 | child: Column( 126 | crossAxisAlignment: 127 | CrossAxisAlignment.start, 128 | children: [ 129 | Text( 130 | "${widget.post.gamer_tag}", 131 | style: Theme.of(context) 132 | .textTheme 133 | .headline6 134 | .copyWith( 135 | color: Colors.white, 136 | fontWeight: 137 | FontWeight.bold, 138 | ), 139 | ), 140 | Text( 141 | "${widget.post.ownerEmail}", 142 | style:TextStyle(color:Colors.grey,fontSize:13) 143 | ), 144 | ], 145 | ), 146 | ), 147 | Expanded( 148 | child: Text( 149 | timeago.format( 150 | DateTime.parse( 151 | "${widget.post.timestamp}"), 152 | locale: "en"), 153 | textAlign: TextAlign.end, 154 | style: Theme.of(context) 155 | .textTheme 156 | .subtitle2 157 | .copyWith( 158 | color: Colors.grey, 159 | fontWeight: FontWeight.bold), 160 | ), 161 | ) 162 | ], 163 | ), 164 | Container( 165 | margin: 166 | const EdgeInsets.symmetric(vertical: 15.0), 167 | width: double.infinity, 168 | child: ClipRRect( 169 | borderRadius: BorderRadius.circular(5.0), 170 | child: Image.network( 171 | "${widget.post.mediaUrl}", 172 | fit: BoxFit.cover, 173 | ), 174 | ), 175 | ), 176 | Text( 177 | "${widget.post.description}", 178 | overflow: TextOverflow.ellipsis, 179 | maxLines: 30, 180 | style: Theme.of(context) 181 | .textTheme 182 | .subtitle2 183 | .copyWith( 184 | color: Colors.white, 185 | fontWeight: FontWeight.bold, 186 | ), 187 | ), 188 | SizedBox(height: 15), 189 | Row( 190 | children: [ 191 | FlatButton( 192 | onPressed: () {ggHandler();}, 193 | child: Row( 194 | children: [ 195 | Image.asset("assets/gg.png",width: 30,height: 30,), 196 | SizedBox(width:5), 197 | Text( 198 | "${widget.post.getGGCount(widget.post.gg)}", 199 | style: Theme.of(context) 200 | .textTheme 201 | .button 202 | .copyWith( 203 | color: Color(0xff67FD9A), 204 | fontWeight: FontWeight.bold, 205 | fontSize: 18), 206 | ), 207 | ], 208 | ), 209 | ), 210 | FlatButton( 211 | onPressed: () {fHandler();}, 212 | child: Row( 213 | children: [ 214 | Image.asset("assets/f.png",width: 40,height: 30,), 215 | SizedBox(width:5), 216 | Text( 217 | "${widget.post.getFCount(widget.post.f)}", 218 | style: Theme.of(context) 219 | .textTheme 220 | .button 221 | .copyWith( 222 | color: Color(0xff67FD9A), 223 | fontWeight: FontWeight.bold, 224 | fontSize: 18), 225 | ), 226 | ], 227 | ), 228 | ), 229 | FlatButton( 230 | onPressed: () {ripHandler();}, 231 | child: Row( 232 | children: [ 233 | Image.asset("assets/rip.png",width: 30,height: 30,), 234 | SizedBox(width:5), 235 | Text( 236 | "${widget.post.geripCount(widget.post.rip)}", 237 | style: Theme.of(context) 238 | .textTheme 239 | .button 240 | .copyWith( 241 | color: Color(0xff67FD9A), 242 | fontWeight: FontWeight.bold, 243 | fontSize: 18), 244 | ), 245 | ], 246 | ), 247 | ), 248 | FlatButton( 249 | onPressed: () { 250 | Navigator.of(context).push(MaterialPageRoute(builder: (context){return Comments(widget.user,widget.post);})); 251 | }, 252 | child:Icon(Icons.comment,size: 30,color: Colors.white,), 253 | ), 254 | ], 255 | ), 256 | ], 257 | ), 258 | ), 259 | ); 260 | } 261 | } -------------------------------------------------------------------------------- /assets/upload.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/loginAnim.json: -------------------------------------------------------------------------------- 1 | {"v":"5.5.7","fr":60,"ip":0,"op":240,"w":1920,"h":1080,"nm":"Comp 1","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Untitled-1 Outlines","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[960.055,539.07,0],"ix":2},"a":{"a":0,"k":[421,298,0],"ix":1},"s":{"a":0,"k":[188.49,188.49,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,-40.792],[40.792,0],[0,40.792],[-40.793,0]],"o":[[0,40.792],[-40.793,0],[0,-40.792],[40.792,0]],"v":[[73.861,0],[0.001,73.861],[-73.861,0],[0.001,-73.861]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0.914,0.631,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":1,"k":[{"i":{"x":0,"y":1},"o":{"x":0.333,"y":0},"t":0,"s":[648.139,171.692],"to":[0,32.333],"ti":[0,-32.333]},{"i":{"x":0,"y":0},"o":{"x":0.333,"y":0.333},"t":30,"s":[648.139,365.692],"to":[0,0],"ti":[0,0]},{"i":{"x":0,"y":1},"o":{"x":0.333,"y":0},"t":60,"s":[648.139,365.692],"to":[-77,-34.667],"ti":[77,34.667]},{"i":{"x":0.219,"y":0.219},"o":{"x":0.333,"y":0.333},"t":90,"s":[186.139,157.692],"to":[0,0],"ti":[0,0]},{"i":{"x":0.219,"y":1},"o":{"x":0.333,"y":0},"t":120,"s":[186.139,157.692],"to":[0,32.667],"ti":[0,-32.667]},{"i":{"x":0.219,"y":0.219},"o":{"x":0.333,"y":0.333},"t":150,"s":[186.139,353.692],"to":[0,0],"ti":[0,0]},{"i":{"x":0.219,"y":1},"o":{"x":0.333,"y":0},"t":180,"s":[186.139,353.692],"to":[77,-30.333],"ti":[-77,30.333]},{"t":210,"s":[648.139,171.692]}],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":0,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":30,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":60,"s":[100,100]},{"i":{"x":[0.219,0.219],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":90,"s":[66,66]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":120,"s":[66,66]},{"i":{"x":[0.443,0.443],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":135,"s":[120,120]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":195,"s":[120,120]},{"t":210,"s":[100,100]}],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Circle","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[11.488,0],[0,0],[0,11.49],[-11.489,0],[0,0],[0,-11.488]],"o":[[0,0],[-11.489,0],[0,-11.488],[0,0],[11.488,0],[0,11.49]],"v":[[132.445,20.888],[-132.444,20.888],[-153.333,0],[-132.444,-20.888],[132.445,-20.888],[153.333,0]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.039,0.039,0.039,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[420.945,538.889],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 2","np":2,"cix":2,"bm":0,"ix":2,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[7.132,0],[0,0],[0,7.132],[-7.132,0],[0,0],[0,-7.132]],"o":[[0,0],[-7.132,0],[0,-7.132],[0,0],[7.132,0],[0,7.132]],"v":[[83.421,12.968],[-83.422,12.968],[-96.389,0],[-83.422,-12.968],[83.421,-12.968],[96.389,0]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0.914,0.631,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":1,"k":[{"i":{"x":0,"y":0},"o":{"x":0.333,"y":0.333},"t":0,"s":[180.723,409.838],"to":[0,0],"ti":[0,0]},{"i":{"x":0,"y":0},"o":{"x":0.333,"y":0.333},"t":30,"s":[180.723,409.838],"to":[0,0],"ti":[0,0]},{"i":{"x":0,"y":1},"o":{"x":0.333,"y":0},"t":60,"s":[180.723,409.838],"to":[76.5,0],"ti":[-76.5,0]},{"i":{"x":0.219,"y":0.219},"o":{"x":0.333,"y":0.333},"t":90,"s":[639.723,409.838],"to":[0,0],"ti":[0,0]},{"i":{"x":0.219,"y":1},"o":{"x":0.333,"y":0},"t":120,"s":[639.723,409.838],"to":[0,-31.833],"ti":[0,31.833]},{"i":{"x":0.219,"y":0.219},"o":{"x":0.333,"y":0.333},"t":150,"s":[639.723,218.838],"to":[0,0],"ti":[0,0]},{"i":{"x":0.219,"y":1},"o":{"x":0.333,"y":0},"t":180,"s":[639.723,218.838],"to":[-76.5,31.833],"ti":[76.5,-31.833]},{"t":210,"s":[180.723,409.838]}],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":0,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":60,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":75,"s":[120,120]},{"i":{"x":[0.219,0.219],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":90,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":120,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":135,"s":[120,120]},{"i":{"x":[0.219,0.219],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":150,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":180,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":195,"s":[120,120]},{"t":210,"s":[100,100]}],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 3","np":2,"cix":2,"bm":0,"ix":3,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[7.132,0],[0,0],[0,7.132],[0,0],[-7.131,0],[0,0],[0,-7.132],[0,0]],"o":[[0,0],[-7.131,0],[0,0],[0,-7.132],[0,0],[7.132,0],[0,0],[0,7.132]],"v":[[128.811,12.967],[-128.81,12.967],[-141.777,0.001],[-141.777,0],[-128.81,-12.967],[128.811,-12.967],[141.777,0],[141.777,0.001]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0.914,0.631,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":1,"k":[{"i":{"x":0,"y":0},"o":{"x":0.333,"y":0.333},"t":0,"s":[226.111,360.06],"to":[0,0],"ti":[0,0]},{"i":{"x":0,"y":0},"o":{"x":0.333,"y":0.333},"t":30,"s":[226.111,360.06],"to":[0,0],"ti":[0,0]},{"i":{"x":0,"y":1},"o":{"x":0.333,"y":0},"t":60,"s":[226.111,360.06],"to":[60.667,0],"ti":[-60.667,0]},{"i":{"x":0.219,"y":0.219},"o":{"x":0.333,"y":0.333},"t":90,"s":[590.111,360.06],"to":[0,0],"ti":[0,0]},{"i":{"x":0.219,"y":1},"o":{"x":0.333,"y":0},"t":120,"s":[590.111,360.06],"to":[0,-40.667],"ti":[0,40.667]},{"i":{"x":0.219,"y":0.219},"o":{"x":0.333,"y":0.333},"t":150,"s":[590.111,116.06],"to":[0,0],"ti":[0,0]},{"i":{"x":0.219,"y":1},"o":{"x":0.333,"y":0},"t":180,"s":[590.111,116.06],"to":[-60.667,40.667],"ti":[60.667,-40.667]},{"t":210,"s":[226.111,360.06]}],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":0,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":30,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":60,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":75,"s":[120,120]},{"i":{"x":[0.219,0.219],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":90,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":120,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":135,"s":[120,120]},{"i":{"x":[0.219,0.219],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":150,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":180,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":195,"s":[120,120]},{"t":210,"s":[100,100]}],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 4","np":2,"cix":2,"bm":0,"ix":4,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[7.132,0],[0,0],[0,7.132],[-7.131,0],[0,0],[0,-7.133]],"o":[[0,0],[-7.131,0],[0,-7.133],[0,0],[7.132,0],[0,7.132]],"v":[[128.811,12.967],[-128.81,12.967],[-141.777,0.001],[-128.81,-12.967],[128.811,-12.967],[141.777,0.001]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0.914,0.631,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":1,"k":[{"i":{"x":0.077,"y":1},"o":{"x":0.333,"y":0},"t":0,"s":[226.111,215.171],"to":[63.167,0],"ti":[-63.167,0]},{"i":{"x":0.077,"y":0.077},"o":{"x":0.333,"y":0.333},"t":30,"s":[605.111,215.171],"to":[0,0],"ti":[0,0]},{"i":{"x":0.077,"y":1},"o":{"x":0.333,"y":0},"t":60,"s":[605.111,215.171],"to":[0,15.333],"ti":[0,-15.333]},{"i":{"x":0,"y":0},"o":{"x":0.333,"y":0.333},"t":90,"s":[605.111,307.171],"to":[0,0],"ti":[0,0]},{"i":{"x":0,"y":1},"o":{"x":0.333,"y":0},"t":120,"s":[605.111,307.171],"to":[0,-22.667],"ti":[0,22.667]},{"i":{"x":0,"y":0},"o":{"x":0.333,"y":0.333},"t":150,"s":[605.111,171.171],"to":[0,0],"ti":[0,0]},{"i":{"x":0,"y":1},"o":{"x":0.333,"y":0},"t":180,"s":[605.111,171.171],"to":[-63.167,7.333],"ti":[63.167,-7.333]},{"t":210,"s":[226.111,215.171]}],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.077,0.077],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":0,"s":[100,100]},{"i":{"x":[0.077,0.077],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":30,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":60,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":75,"s":[120,120]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":90,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":120,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":135,"s":[120,120]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":150,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":180,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":195,"s":[120,120]},{"t":210,"s":[100,100]}],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 5","np":2,"cix":2,"bm":0,"ix":5,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[7.132,0],[0,0],[0,7.132],[-7.132,0],[0,0],[0,-7.133]],"o":[[0,0],[-7.132,0],[0,-7.133],[0,0],[7.132,0],[0,7.132]],"v":[[62.143,12.967],[-62.144,12.967],[-75.111,0.001],[-62.144,-12.967],[62.143,-12.967],[75.111,0.001]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0.914,0.631,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":0,"s":[159.445,171.692],"to":[0,21.167],"ti":[0,-21.167]},{"i":{"x":0.667,"y":0.667},"o":{"x":0.333,"y":0.333},"t":30,"s":[159.445,298.692],"to":[0,0],"ti":[0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":60,"s":[159.445,298.692],"to":[0,18.5],"ti":[0,-18.5]},{"i":{"x":0,"y":0},"o":{"x":0.333,"y":0.333},"t":90,"s":[159.445,409.692],"to":[0,0],"ti":[0,0]},{"i":{"x":0,"y":1},"o":{"x":0.333,"y":0},"t":120,"s":[159.445,409.692],"to":[81.833,0],"ti":[-81.833,0]},{"i":{"x":0,"y":0},"o":{"x":0.333,"y":0.333},"t":150,"s":[650.445,409.692],"to":[0,0],"ti":[0,0]},{"i":{"x":0,"y":1},"o":{"x":0.333,"y":0},"t":180,"s":[650.445,409.692],"to":[-81.833,-39.667],"ti":[81.833,39.667]},{"t":210,"s":[159.445,171.692]}],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":0,"s":[100,100]},{"i":{"x":[0.667,0.667],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":30,"s":[100,100]},{"i":{"x":[0.667,0.667],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":60,"s":[100,100]},{"i":{"x":[0.667,0.667],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":75,"s":[120,120]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":90,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":120,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":135,"s":[120,120]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":150,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":180,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":195,"s":[120,120]},{"t":210,"s":[100,100]}],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 6","np":2,"cix":2,"bm":0,"ix":6,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[7.132,0],[0,0],[0,7.132],[-7.132,0],[0,0],[0,-7.133]],"o":[[0,0],[-7.132,0],[0,-7.133],[0,0],[7.132,0],[0,7.132]],"v":[[97.7,12.967],[-97.698,12.967],[-110.666,0.001],[-97.698,-12.967],[97.7,-12.967],[110.666,0.001]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0.914,0.631,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":0,"s":[195,128.212],"to":[72,0],"ti":[-72,0]},{"i":{"x":0.667,"y":0.667},"o":{"x":0.333,"y":0.333},"t":30,"s":[627,128.212],"to":[0,0],"ti":[0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":60,"s":[627,128.212],"to":[-73.833,38.167],"ti":[73.833,-38.167]},{"i":{"x":0,"y":0},"o":{"x":0.333,"y":0.333},"t":90,"s":[184,357.212],"to":[0,0],"ti":[0,0]},{"i":{"x":0,"y":1},"o":{"x":0.333,"y":0},"t":120,"s":[184,357.212],"to":[68.833,0],"ti":[-68.833,0]},{"i":{"x":0,"y":0},"o":{"x":0.333,"y":0.333},"t":150,"s":[597,357.212],"to":[0,0],"ti":[0,0]},{"i":{"x":0,"y":1},"o":{"x":0.333,"y":0},"t":180,"s":[597,357.212],"to":[-67,-38.167],"ti":[67,38.167]},{"t":210,"s":[195,128.212]}],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":0,"s":[100,100]},{"i":{"x":[0.667,0.667],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":15,"s":[120,120]},{"i":{"x":[0.667,0.667],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":75,"s":[120,120]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":90,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":120,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":135,"s":[120,120]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":150,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":180,"s":[100,100]},{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":195,"s":[120,120]},{"t":210,"s":[100,100]}],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 7","np":2,"cix":2,"bm":0,"ix":7,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[17.051,0],[0,0],[0,17.05],[0,0],[-17.05,0],[0,0],[0,-17.05],[0,0]],"o":[[0,0],[-17.05,0],[0,0],[0,-17.05],[0,0],[17.051,0],[0,0],[0,17.05]],"v":[[344.111,222.736],[-344.111,222.736],[-375.111,191.737],[-375.111,-191.736],[-344.111,-222.736],[344.111,-222.736],[375.111,-191.736],[375.111,191.737]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.039,0.039,0.039,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":4,"ix":5},"lc":1,"lj":1,"ml":10,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.999999820485,0.999999760646,0.999999820485,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[420.945,260.819],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 8","np":3,"cix":2,"bm":0,"ix":8,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":240,"st":0,"bm":0}],"markers":[]} -------------------------------------------------------------------------------- /lib/UI/Screens/UploadPage.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'package:cloud_firestore/cloud_firestore.dart'; 3 | import 'package:firebase_auth/firebase_auth.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'dart:io'; 6 | import 'package:firebase_storage/firebase_storage.dart'; 7 | import 'package:flutter_svg/svg.dart'; 8 | import 'package:image_picker/image_picker.dart'; 9 | import 'package:morsey_gaming_social_hub/Methods/GoogleSignIn.dart'; 10 | import 'package:morsey_gaming_social_hub/Models/GameSearchData.dart'; 11 | import 'package:morsey_gaming_social_hub/Models/user.dart'; 12 | import 'package:morsey_gaming_social_hub/UI/Screens/setScreen.dart'; 13 | import 'package:morsey_gaming_social_hub/UI/Widgets/progress.dart'; 14 | import 'package:shared_preferences/shared_preferences.dart'; 15 | import 'package:uuid/uuid.dart'; 16 | import 'package:http/http.dart'as http; 17 | import 'package:fluttertoast/fluttertoast.dart'; 18 | import 'package:path_provider/path_provider.dart'; 19 | import 'package:image/image.dart' as Im; 20 | import 'package:cached_network_image/cached_network_image.dart'; 21 | import 'package:google_fonts/google_fonts.dart'; 22 | 23 | import 'Login.dart'; 24 | 25 | class Upload extends StatefulWidget { 26 | final User currentUser; 27 | Upload({@required this.currentUser}); 28 | @override 29 | _UploadState createState() => _UploadState(); 30 | } 31 | 32 | class _UploadState extends State 33 | with AutomaticKeepAliveClientMixin { 34 | PickedFile file; 35 | File _image; 36 | bool isUploading = false; 37 | String selected; 38 | String postId = Uuid().v4(); 39 | TextEditingController searchControler = TextEditingController(); 40 | TextEditingController captionControler = TextEditingController(); 41 | List searchList; 42 | String query=''; 43 | final _debouncer = Debouncer(milliseconds: 500); 44 | 45 | handleTakePhoto() async { 46 | Navigator.pop(context); 47 | PickedFile file = await ImagePicker().getImage( 48 | source: ImageSource.camera, maxWidth: 960, maxHeight: 1280); 49 | setState(() { 50 | this.file = file; 51 | _image=File(file.path); 52 | }); 53 | } 54 | 55 | handleChooseFromGallery() async { 56 | Navigator.pop(context); 57 | PickedFile file = await ImagePicker().getImage( 58 | source: ImageSource.gallery, maxWidth: 960, maxHeight: 1280); 59 | setState(() { 60 | this.file = file; 61 | _image=File(file.path); 62 | }); 63 | } 64 | 65 | selectImage(parentContext) { 66 | return showDialog( 67 | context: parentContext, 68 | builder: (context) { 69 | return SimpleDialog( 70 | title: Center(child: Text('Create Post',style: GoogleFonts.bangers(textStyle:TextStyle(color:Colors.black,fontSize:30,fontWeight:FontWeight.w400,letterSpacing: 2)))), 71 | backgroundColor: Color(0xff67FD9A), 72 | children: [ 73 | SimpleDialogOption( 74 | child: Text('Photo with Camera',style: TextStyle(fontSize: 18,fontWeight: FontWeight.w500),), 75 | onPressed: handleTakePhoto, 76 | ), 77 | SimpleDialogOption( 78 | child: Text('Image from Gallery',style: TextStyle(fontSize: 18,fontWeight: FontWeight.w500),), 79 | onPressed: handleChooseFromGallery, 80 | ), 81 | SimpleDialogOption( 82 | child: Text('Cancel',style: TextStyle(fontSize: 16,fontWeight: FontWeight.w500,color: Colors.redAccent),), 83 | onPressed: () => Navigator.pop(context), 84 | ) 85 | ], 86 | ); 87 | }); 88 | } 89 | 90 | Container buildSplashScreen() { 91 | return Container( 92 | color: Color(0xff21252A), 93 | child: Column( 94 | mainAxisAlignment: MainAxisAlignment.center, 95 | children: [ 96 | Padding( 97 | padding: const EdgeInsets.all(16.0), 98 | child: SvgPicture.asset('assets/upload.svg', height: 260), 99 | ), 100 | Padding( 101 | padding: EdgeInsets.only(top: 20), 102 | child: RaisedButton( 103 | onPressed: () => selectImage(context), 104 | shape: RoundedRectangleBorder( 105 | borderRadius: BorderRadius.circular(8.0), 106 | ), 107 | child: Text( 108 | 'Create post', 109 | style: TextStyle(color: Colors.white, fontSize: 22.0), 110 | ), 111 | color: Colors.redAccent, 112 | ), 113 | ) 114 | ], 115 | ), 116 | ); 117 | } 118 | 119 | clearImage() { 120 | setState(() { 121 | file = null; 122 | }); 123 | } 124 | 125 | 126 | 127 | Future uploadImage(imageFile) async { 128 | StorageUploadTask uploadTask = 129 | FirebaseStorage.instance.ref().child("post_$postId.jpg").putFile(imageFile); 130 | StorageTaskSnapshot storageSnap = await uploadTask.onComplete; 131 | String downloadUrl = await storageSnap.ref.getDownloadURL(); 132 | return downloadUrl; 133 | } 134 | 135 | createPostInFirestore( 136 | {String mediaUrl, String slug, String description})async{ 137 | Firestore.instance.collection("users") 138 | .document(widget.currentUser.email) 139 | .collection('userPosts') 140 | .document(postId) 141 | .setData({ 142 | "postId": postId, 143 | "ownerEmail": widget.currentUser.email, 144 | "gamer_Tag": widget.currentUser.gamer_tag, 145 | "mediaUrl": mediaUrl, 146 | "description": description, 147 | "slug": slug, 148 | "timestamp": DateTime.now(), 149 | "f": [], 150 | "rip":[], 151 | "gg":[] 152 | }); 153 | 154 | final x = await Firestore.instance.collection('games').document(slug).get(); 155 | if(x.exists) 156 | { 157 | Firestore.instance.collection('games').document(slug).collection('posts').document(postId) 158 | .setData({ 159 | "postId": postId, 160 | "ownerEmail": widget.currentUser.email, 161 | "gamer_Tag": widget.currentUser.gamer_tag, 162 | "mediaUrl": mediaUrl, 163 | "description": description, 164 | "slug": slug, 165 | "timestamp": DateTime.now(), 166 | "owner_pic":widget.currentUser.photoUrl, 167 | "f": [], 168 | "rip":[], 169 | "gg":[] 170 | }); 171 | List a =x.data['followers']; 172 | a.forEach((element) { 173 | Firestore.instance.collection('users').document(element).collection('feed').document(postId) 174 | .setData({ 175 | "postId": postId, 176 | "ownerEmail": widget.currentUser.email, 177 | "gamer_Tag": widget.currentUser.gamer_tag, 178 | "mediaUrl": mediaUrl, 179 | "description": description, 180 | "slug": slug, 181 | "timestamp": DateTime.now(), 182 | "owner_pic":widget.currentUser.photoUrl, 183 | "f": [], 184 | "rip":[], 185 | "gg":[] 186 | }); 187 | }); 188 | } 189 | else{ 190 | Firestore.instance.collection('games').document(slug).setData({'followers':[],'followers_count':0,'slug':slug}); 191 | Firestore.instance.collection('games').document(slug).collection('posts').document(postId) 192 | .setData({ 193 | "postId": postId, 194 | "ownerEmail": widget.currentUser.email, 195 | "gamer_Tag": widget.currentUser.gamer_tag, 196 | "mediaUrl": mediaUrl, 197 | "description": description, 198 | "slug": slug, 199 | "timestamp": DateTime.now(), 200 | "owner_pic":widget.currentUser.photoUrl, 201 | "f": [], 202 | "rip":[], 203 | "gg":[] 204 | }); 205 | } 206 | } 207 | compressImage() async { 208 | final tempDir = await getTemporaryDirectory(); 209 | final path = tempDir.path; 210 | Im.Image imageFile = Im.decodeImage(_image.readAsBytesSync()); 211 | final compressedImageFile = File('$path/img_$postId.jpg') 212 | ..writeAsBytesSync(Im.encodeJpg(imageFile, quality: 85)); 213 | setState(() { 214 | _image = compressedImageFile; 215 | }); 216 | } 217 | handleSubmit() async { 218 | if(selected==null||selected=='') 219 | { 220 | FlutterToast.showToast( 221 | msg: "Select a game!", 222 | backgroundColor: Colors.red, 223 | textColor: Colors.white, 224 | fontSize: 16); 225 | } 226 | else{ 227 | setState(() { 228 | isUploading = true; 229 | }); 230 | await compressImage(); 231 | String mediaUrl = await uploadImage(_image); 232 | createPostInFirestore( 233 | mediaUrl: mediaUrl, 234 | slug: selected, 235 | description: captionControler.text, 236 | ); 237 | captionControler.clear(); 238 | searchControler.clear(); 239 | FlutterToast.showToast( 240 | msg: "Post Uploaded", 241 | backgroundColor: Colors.green, 242 | textColor: Colors.white, 243 | fontSize: 16); 244 | setState(() { 245 | file = null; 246 | isUploading = false; 247 | selected=null; 248 | postId = Uuid().v4(); 249 | }); 250 | } 251 | } 252 | 253 | Scaffold buildUploadForm() { 254 | return Scaffold( 255 | appBar: AppBar( 256 | backgroundColor: Colors.black, 257 | leading: IconButton( 258 | icon: Icon(Icons.arrow_back), 259 | color: Color(0xff67FD9A), 260 | onPressed: clearImage, 261 | ), 262 | title: Text( 263 | "Upload Post", 264 | style: TextStyle(color: Colors.white), 265 | ), 266 | actions: [ 267 | FlatButton( 268 | child: Text( 269 | 'Post', 270 | style: TextStyle( 271 | color: Colors.redAccent, 272 | fontWeight: FontWeight.bold, 273 | fontSize: 20.0), 274 | ), 275 | onPressed: isUploading ? null : () => handleSubmit(), 276 | ) 277 | ], 278 | ), 279 | body: ListView( 280 | children: [ 281 | isUploading ? linearProgress() : Text(""), 282 | Container( 283 | width: MediaQuery.of(context).size.width * 0.8, 284 | 285 | child: Image.file((File(file.path))) 286 | ), 287 | Padding( 288 | padding: EdgeInsets.only(top: 10.0), 289 | ), 290 | ListTile( 291 | title: Container( 292 | width: 250.0, 293 | child: TextField( 294 | controller: captionControler, 295 | maxLines: 3, 296 | decoration: InputDecoration( 297 | hintText: 'Write Something', border: InputBorder.none, 298 | hintStyle: TextStyle(color: Colors.teal) 299 | ), 300 | ), 301 | ), 302 | ), 303 | Divider(), 304 | ListTile( 305 | leading: Icon( 306 | Icons.gamepad, 307 | color: Colors.orange, 308 | size: 35, 309 | ), 310 | title: Container( 311 | width: 280, 312 | child: TextField( 313 | onChanged: (value){ 314 | setState(() { 315 | query=value; 316 | }); 317 | _debouncer.run(() { 318 | fetchSearchList(); 319 | }); 320 | }, 321 | controller: searchControler, 322 | decoration: InputDecoration( 323 | hintText: 'Which game is this post related to?',hintStyle: TextStyle(color: Colors.teal)), 324 | ), 325 | ), 326 | ), 327 | Container( 328 | height: 350.0, 329 | alignment: Alignment.center, 330 | child: GridView.builder( 331 | gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(maxCrossAxisExtent: 300), 332 | itemCount: searchList==null?0:searchList.length, 333 | itemBuilder: (context,index){ 334 | return GestureDetector( 335 | onTap: (){ 336 | FlutterToast.showToast( 337 | msg: "${searchList[index].name} is selected", 338 | backgroundColor: Colors.red, 339 | textColor: Colors.white, 340 | fontSize: 16.0 341 | ); 342 | setState(() { 343 | searchControler.text=searchList[index].name; 344 | selected=searchList[index].slug; 345 | }); 346 | }, 347 | child: Card( 348 | elevation: 10, 349 | shadowColor: Colors.teal, 350 | color: Colors.deepPurple, 351 | child:Stack( 352 | children:[ 353 | Center(child: Image.network(searchList[index].image,fit: BoxFit.fitWidth,)), 354 | Container(color:Colors.redAccent.withOpacity(selected==searchList[index].slug?0.45:0)), 355 | Text("${searchList[index].name}",style: TextStyle(fontSize:20),textAlign: TextAlign.center,) 356 | ] 357 | ) 358 | ), 359 | ); 360 | }, 361 | ) 362 | ) 363 | ], 364 | ), 365 | ); 366 | } 367 | 368 | fetchSearchList() async { 369 | final response = await http.get('https://api.rawg.io/api/games?page_size=4&search=${query.replaceAll(' ', '%20')}'); 370 | if (response.statusCode == 200) { 371 | var data = json.decode(response.body); 372 | var rest = data['results'] as List; 373 | setState(() { 374 | searchList = rest.map((json) => GameSearch.fromJson(json)).toList(); 375 | }); 376 | 377 | } else { 378 | throw Exception('Failed to load deck'); 379 | } 380 | } 381 | 382 | 383 | get wantKeepAlive => true; 384 | 385 | @override 386 | Widget build(BuildContext context) { 387 | super.build(context); 388 | return Scaffold( 389 | body:file == null ? buildSplashScreen() : buildUploadForm(), 390 | backgroundColor: Color(0xff21252A), 391 | appBar:AppBar( 392 | title:Text("GAMIAC",style:GoogleFonts.bangers(textStyle:TextStyle(color:Color(0xff67FD9A),fontSize:30,fontWeight:FontWeight.w400,letterSpacing: 2)),), 393 | centerTitle: true, 394 | backgroundColor: Colors.black, 395 | actions: [ 396 | PopupMenuButton( 397 | color:Colors.tealAccent[400], 398 | itemBuilder: (BuildContext context){ 399 | return[ 400 | PopupMenuItem( 401 | child: Center( 402 | child: FlatButton( 403 | onPressed:()async{ 404 | SharedPreferences prefs = await SharedPreferences.getInstance(); 405 | prefs.clear(); 406 | signOutGoogle(); 407 | Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context)=>Login()),ModalRoute.withName('homepage')); 408 | }, 409 | child: Text('Logout',style:GoogleFonts.orbitron(textStyle: TextStyle(color: Colors.black,fontWeight: FontWeight.w500,fontSize:18))), 410 | color: Colors.teal, 411 | splashColor: Colors.tealAccent, 412 | ), 413 | ) 414 | ) 415 | ]; 416 | }, 417 | ) 418 | ], 419 | ), 420 | ); 421 | } 422 | } -------------------------------------------------------------------------------- /lib/UI/Screens/setScreen.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | import 'dart:io'; 4 | import 'package:cloud_firestore/cloud_firestore.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:google_fonts/google_fonts.dart'; 7 | import 'package:fluttertoast/fluttertoast.dart'; 8 | import 'package:image_picker/image_picker.dart'; 9 | import 'package:firebase_storage/firebase_storage.dart'; 10 | import 'package:morsey_gaming_social_hub/Globals/Globals.dart' as globals ; 11 | import 'package:morsey_gaming_social_hub/Models/GameSearchData.dart'; 12 | import 'package:morsey_gaming_social_hub/Models/post.dart'; 13 | import 'package:morsey_gaming_social_hub/UI/Screens/Hompage.dart'; 14 | import 'package:http/http.dart'as http; 15 | 16 | class setProfile extends StatefulWidget { 17 | setProfile(this.email); 18 | final String email; 19 | @override 20 | _setProfileState createState() => _setProfileState(); 21 | } 22 | 23 | class _setProfileState extends State { 24 | File _image; 25 | TextEditingController steamController=TextEditingController(); 26 | TextEditingController gamerTagController=TextEditingController(); 27 | checkAuthenticityAndUpload()async{ 28 | final QuerySnapshot result = await Firestore.instance.collection('users').where('gamer_tag',isEqualTo:gamerTagController.text).limit(1).getDocuments(); 29 | 30 | if(gamerTagController.text.length<2){ 31 | FlutterToast.showToast( 32 | msg: "Gamer Tag must be 2 chracter long", 33 | backgroundColor: Colors.red, 34 | textColor: Colors.white, 35 | fontSize: 16.0 36 | ); 37 | } 38 | else if(result.documents.length==1) 39 | { 40 | FlutterToast.showToast( 41 | msg: "Gamer Tag Already Taken", 42 | backgroundColor: Colors.red, 43 | textColor: Colors.white, 44 | fontSize: 16.0 45 | ); 46 | } 47 | else 48 | { 49 | if(_image!=null){ 50 | String _uploadedFileURL; 51 | String fileName = "ProfilePics/${widget.email}"; 52 | StorageReference firebaseStorageRef = 53 | FirebaseStorage.instance.ref().child(fileName); 54 | StorageUploadTask uploadTask = firebaseStorageRef.putFile(_image); 55 | StorageTaskSnapshot taskSnapshot = await uploadTask.onComplete; 56 | print(taskSnapshot); 57 | await firebaseStorageRef.getDownloadURL().then((fileURL) async { 58 | _uploadedFileURL = fileURL; 59 | }); 60 | Firestore.instance.collection('users').document(widget.email).setData({'gamer_Tag':gamerTagController.text,'steam_link':steamController.text,'profile_pic':_uploadedFileURL},merge: true); 61 | } 62 | else{ 63 | Firestore.instance.collection('users').document(widget.email).setData({'gamer_Tag':gamerTagController.text,'steam_link':steamController.text,'profile_pic':null},merge: true);} 64 | Navigator.pushReplacement(context, MaterialPageRoute(builder: (context){return SelectGames(widget.email);})); 65 | } 66 | } 67 | Widget build(BuildContext context) { 68 | return Scaffold( 69 | backgroundColor: Color(0xff1B0536), 70 | floatingActionButton: FloatingActionButton( 71 | onPressed:(){ 72 | checkAuthenticityAndUpload(); 73 | }, 74 | child: Icon(Icons.navigate_next,color: Colors.white,), 75 | backgroundColor: Colors.teal, 76 | ), 77 | appBar: AppBar( 78 | title:Text("Set Profile",style:GoogleFonts.bangers(textStyle:TextStyle(color:Colors.teal,fontSize:25,fontWeight:FontWeight.bold,letterSpacing: 2)),), 79 | centerTitle: true, 80 | ), 81 | body: new Container( 82 | child: new ListView( 83 | children: [ 84 | Column( 85 | children: [ 86 | new Container( 87 | height: 250.0, 88 | child: new Column( 89 | children: [ 90 | Padding( 91 | padding: EdgeInsets.only(top: 20.0), 92 | child: new Stack(fit: StackFit.loose, children: [ 93 | new Row( 94 | crossAxisAlignment: CrossAxisAlignment.center, 95 | mainAxisAlignment: MainAxisAlignment.center, 96 | children: [ 97 | new Container( 98 | width: 140.0, 99 | height: 140.0, 100 | decoration: new BoxDecoration( 101 | shape: BoxShape.circle, 102 | image: new DecorationImage( 103 | image:_image!=null?FileImage(File(_image.path)):new ExactAssetImage( 104 | 'assets/pro-gamer.png'), 105 | fit: BoxFit.cover, 106 | ), 107 | )), 108 | ], 109 | ), 110 | Padding( 111 | padding: EdgeInsets.only(top: 90.0, right: 100.0), 112 | child: new Row( 113 | mainAxisAlignment: MainAxisAlignment.center, 114 | children: [ 115 | new CircleAvatar( 116 | backgroundColor: Colors.red, 117 | radius: 25.0, 118 | child: new IconButton( 119 | onPressed:()async{ 120 | final pickedFile = await ImagePicker().getImage(source: ImageSource.gallery); 121 | setState(() { 122 | _image = File(pickedFile.path); 123 | }); 124 | }, 125 | icon:Icon(Icons.camera_alt), 126 | color: Colors.white, 127 | ), 128 | ) 129 | ], 130 | )), 131 | ]), 132 | ) 133 | ], 134 | ), 135 | ), 136 | new Container( 137 | child: Padding( 138 | padding: EdgeInsets.only(bottom: 25.0), 139 | child: new Column( 140 | crossAxisAlignment: CrossAxisAlignment.start, 141 | mainAxisAlignment: MainAxisAlignment.start, 142 | children: [ 143 | Padding( 144 | padding: EdgeInsets.only( 145 | left: 25.0, right: 25.0,), 146 | child: new Row( 147 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 148 | mainAxisSize: MainAxisSize.max, 149 | children: [ 150 | new Column( 151 | mainAxisAlignment: MainAxisAlignment.start, 152 | mainAxisSize: MainAxisSize.min, 153 | children: [ 154 | new Text( 155 | 'Personal Information', 156 | style: TextStyle( 157 | fontSize: 18.0, 158 | color: Colors.teal, 159 | fontWeight: FontWeight.bold), 160 | ), 161 | ], 162 | ), 163 | ], 164 | )), 165 | Padding( 166 | padding: EdgeInsets.only( 167 | left: 25.0, right: 25.0, top: 25.0), 168 | child: new Row( 169 | mainAxisSize: MainAxisSize.max, 170 | children: [ 171 | new Column( 172 | mainAxisAlignment: MainAxisAlignment.start, 173 | mainAxisSize: MainAxisSize.min, 174 | children: [ 175 | new Text( 176 | 'Gamer Tag', 177 | style: TextStyle( 178 | fontSize: 16.0, 179 | fontWeight: FontWeight.bold), 180 | ), 181 | ], 182 | ), 183 | ], 184 | )), 185 | Padding( 186 | padding: EdgeInsets.only( 187 | left: 25.0, right: 25.0, top: 2.0), 188 | child: new Row( 189 | mainAxisSize: MainAxisSize.max, 190 | children: [ 191 | new Flexible( 192 | child: new TextField( 193 | controller: gamerTagController, 194 | decoration: const InputDecoration( 195 | hintText: "Enter Your Gamer Tag", 196 | ), 197 | ), 198 | ), 199 | ], 200 | )), 201 | Padding( 202 | padding: EdgeInsets.only( 203 | left: 25.0, right: 25.0, top: 25.0), 204 | child: new Row( 205 | mainAxisSize: MainAxisSize.max, 206 | children: [ 207 | new Column( 208 | mainAxisAlignment: MainAxisAlignment.start, 209 | mainAxisSize: MainAxisSize.min, 210 | children: [ 211 | new Text( 212 | 'Steam Profile link (optional)', 213 | style: TextStyle( 214 | fontSize: 16.0, 215 | fontWeight: FontWeight.bold), 216 | ), 217 | ], 218 | ), 219 | ], 220 | )), 221 | Padding( 222 | padding: EdgeInsets.only( 223 | left: 25.0, right: 25.0, top: 2.0), 224 | child: new Row( 225 | mainAxisSize: MainAxisSize.max, 226 | children: [ 227 | new Flexible( 228 | child: new TextField( 229 | controller: steamController, 230 | decoration: const InputDecoration( 231 | hintText: "Steam link"), 232 | ), 233 | ), 234 | ], 235 | )), 236 | ], 237 | ), 238 | ), 239 | ) 240 | ], 241 | ), 242 | ], 243 | ), 244 | ) 245 | ); 246 | } 247 | } 248 | 249 | 250 | class SelectGames extends StatefulWidget { 251 | SelectGames(this.email); 252 | final String email; 253 | @override 254 | _SelectGamesState createState() => _SelectGamesState(); 255 | } 256 | 257 | class _SelectGamesState extends State { 258 | List searchList; 259 | String query=''; 260 | final _debouncer = Debouncer(milliseconds: 500); 261 | Future> getPopGames()async{ 262 | QuerySnapshot games= await Firestore.instance.collection("popular games").getDocuments(); 263 | return games.documents; 264 | } 265 | fetchSearchList() async { 266 | final response = await http.get('https://api.rawg.io/api/games?page_size=4&search=${query.replaceAll(' ', '%20')}'); 267 | if (response.statusCode == 200) { 268 | var data = json.decode(response.body); 269 | var rest = data['results'] as List; 270 | setState(() { 271 | searchList = rest.map((json) => GameSearch.fromJson(json)).toList(); 272 | }); 273 | 274 | } else { 275 | throw Exception('Failed to load deck'); 276 | } 277 | } 278 | Widget build(BuildContext context) { 279 | return Scaffold( 280 | floatingActionButton: FloatingActionButton( 281 | onPressed:() async { 282 | if(globals.gamesSelected.length<=5) 283 | FlutterToast.showToast( 284 | msg: "Select atleast 5 or more games", 285 | backgroundColor: Colors.red, 286 | textColor: Colors.white, 287 | fontSize: 16.0 288 | ); 289 | else{ 290 | Firestore.instance.collection('users').document(widget.email).setData({'games_followed':globals.gamesSelected},merge: true); 291 | for(int i=0;iHomePage())); 307 | globals.gamesSelected.clear(); 308 | } 309 | }, 310 | child: Icon(Icons.navigate_next,color:Colors.red,size: 40,), 311 | backgroundColor: Colors.teal, 312 | ), 313 | appBar: AppBar( 314 | title:Text("What Games you like?",style:GoogleFonts.bangers(textStyle:TextStyle(color:Color(0xff67FD9A),fontSize:25,fontWeight:FontWeight.bold,letterSpacing: 2)),), 315 | centerTitle: true, 316 | ), 317 | backgroundColor: Color(0xff21252A), 318 | body: Container( 319 | margin: EdgeInsets.symmetric(horizontal:10,vertical:15), 320 | child:Column( 321 | children: [ 322 | Padding( 323 | padding: const EdgeInsets.all(8.0), 324 | child: TextField( 325 | onChanged: (value){ 326 | _debouncer.run(() { 327 | setState(() { 328 | query=value; 329 | fetchSearchList(); 330 | }); 331 | }); 332 | }, 333 | decoration:InputDecoration( 334 | enabledBorder:OutlineInputBorder(borderRadius:BorderRadius.all(Radius.circular(12)),borderSide: BorderSide(color:Colors.redAccent)), 335 | hintText:'Search Any Game',hintStyle: TextStyle(color:Colors.red,fontWeight:FontWeight.w600)), 336 | ) 337 | ), 338 | Expanded( 339 | child: FutureBuilder( 340 | future: getPopGames(), 341 | builder: (_,snapshot){ 342 | if(snapshot.connectionState==ConnectionState.waiting||!snapshot.hasData){ 343 | return Center(child:CircularProgressIndicator()); 344 | } 345 | else 346 | return GridView.builder( 347 | gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(maxCrossAxisExtent: 300), 348 | itemCount: query==''?snapshot.data.length:searchList.length, 349 | itemBuilder: (context,index){ 350 | return query==''?GameCard(snapshot.data[index]):SearchGameCard(searchList[index]); 351 | }, 352 | ); 353 | } 354 | ), 355 | ), 356 | ], 357 | ) 358 | ), 359 | ); 360 | } 361 | } 362 | class GameCard extends StatefulWidget { 363 | GameCard(this.data); 364 | final DocumentSnapshot data; 365 | @override 366 | _GameCardState createState() => _GameCardState(); 367 | } 368 | 369 | class _GameCardState extends State { 370 | bool selected=false; 371 | @override 372 | void initState(){ 373 | super.initState(); 374 | if(globals.gamesSelected.contains(widget.data['slug'])) 375 | selected=true; 376 | } 377 | Widget build(BuildContext context) { 378 | return GestureDetector( 379 | onTap: (){ 380 | setState(() { 381 | selected==true?selected=false:selected=true; 382 | selected==true?globals.gamesSelected.add(widget.data['slug']):globals.gamesSelected.remove(widget.data['slug']); 383 | print (globals.gamesSelected); 384 | }); 385 | }, 386 | child: Card( 387 | elevation: 10, 388 | shadowColor: Colors.teal, 389 | color: Colors.deepPurple, 390 | child:Stack( 391 | children:[ 392 | Center(child: Image.network(widget.data.data['image'],fit: BoxFit.fitWidth,)), 393 | Container( 394 | color:Colors.pink.withOpacity(selected?0.6:0), 395 | child: selected?Center(child:Icon(Icons.thumb_up,color:Color(0xff67FD9A),size: 35,)):Container(), 396 | ) 397 | ] 398 | ) 399 | ), 400 | ); 401 | } 402 | } 403 | 404 | class SearchGameCard extends StatefulWidget { 405 | SearchGameCard(this.data); 406 | final GameSearch data; 407 | @override 408 | _SearchGameCardState createState() => _SearchGameCardState(); 409 | } 410 | 411 | class _SearchGameCardState extends State { 412 | bool selected=false; 413 | @override 414 | void initState(){ 415 | super.initState(); 416 | if(globals.gamesSelected.contains(widget.data.slug)) 417 | selected=true; 418 | } 419 | Widget build(BuildContext context) { 420 | return GestureDetector( 421 | onTap: (){ 422 | setState(() { 423 | selected==true?selected=false:selected=true; 424 | selected==true?globals.gamesSelected.add(widget.data.slug):globals.gamesSelected.remove(widget.data.slug); 425 | print (globals.gamesSelected); 426 | }); 427 | }, 428 | child: Card( 429 | elevation: 10, 430 | shadowColor: Colors.teal, 431 | color: Colors.deepPurple, 432 | child:Stack( 433 | children:[ 434 | Center(child: Image.network(widget.data.image,fit: BoxFit.fitWidth,)), 435 | Align(alignment:Alignment.bottomCenter,child: Text(widget.data.name,style: TextStyle(color:Colors.white,fontSize:18,fontWeight: FontWeight.w500),textAlign: TextAlign.center,)), 436 | Container( 437 | color:Colors.pink.withOpacity(selected?0.6:0), 438 | child: selected?Center(child:Icon(Icons.thumb_up,color:Colors.tealAccent,size: 35,)):Container(), 439 | ) 440 | ] 441 | ) 442 | ), 443 | ); 444 | } 445 | } 446 | 447 | class Debouncer { 448 | final int milliseconds; 449 | VoidCallback action; 450 | Timer _timer; 451 | 452 | Debouncer({this.milliseconds}); 453 | 454 | run(VoidCallback action) { 455 | if (null != _timer) { 456 | _timer.cancel(); 457 | } 458 | _timer = Timer(Duration(milliseconds: milliseconds), action); 459 | } 460 | } --------------------------------------------------------------------------------