diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 6f16c7b..30e77ca 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"firebase_auth","path":"D:\\\\Code\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_auth-0.15.2\\\\","dependencies":["firebase_core"]},{"name":"firebase_core","path":"D:\\\\Code\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_core-0.4.2+1\\\\","dependencies":[]},{"name":"firebase_database","path":"D:\\\\Code\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_database-3.1.1\\\\","dependencies":["firebase_core"]},{"name":"google_maps_flutter","path":"D:\\\\Code\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_maps_flutter-0.5.21+15\\\\","dependencies":[]},{"name":"google_sign_in","path":"D:\\\\Code\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_sign_in-4.0.14\\\\","dependencies":[]},{"name":"location","path":"D:\\\\Code\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\location-2.3.5\\\\","dependencies":[]}],"android":[{"name":"firebase_auth","path":"D:\\\\Code\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_auth-0.15.2\\\\","dependencies":["firebase_core"]},{"name":"firebase_core","path":"D:\\\\Code\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_core-0.4.2+1\\\\","dependencies":[]},{"name":"firebase_database","path":"D:\\\\Code\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_database-3.1.1\\\\","dependencies":["firebase_core"]},{"name":"google_maps_flutter","path":"D:\\\\Code\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_maps_flutter-0.5.21+15\\\\","dependencies":[]},{"name":"google_sign_in","path":"D:\\\\Code\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_sign_in-4.0.14\\\\","dependencies":[]},{"name":"location","path":"D:\\\\Code\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\location-2.3.5\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[{"name":"firebase_auth_web","path":"D:\\\\Code\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_auth_web-0.1.1\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"firebase_auth","dependencies":["firebase_core","firebase_auth_web"]},{"name":"firebase_auth_web","dependencies":[]},{"name":"firebase_core","dependencies":[]},{"name":"firebase_database","dependencies":["firebase_core"]},{"name":"google_maps_flutter","dependencies":[]},{"name":"google_sign_in","dependencies":[]},{"name":"location","dependencies":[]}],"date_created":"2021-02-10 23:47:26.991742","version":"1.26.0-8.0.pre"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"firebase_auth","path":"/Users/manoj/Code/flutter_installation/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.15.2/","dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/manoj/Code/flutter_installation/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.4.2+1/","dependencies":[]},{"name":"firebase_database","path":"/Users/manoj/Code/flutter_installation/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_database-3.1.1/","dependencies":["firebase_core"]},{"name":"google_maps_flutter","path":"/Users/manoj/Code/flutter_installation/flutter/.pub-cache/hosted/pub.dartlang.org/google_maps_flutter-0.5.21+15/","dependencies":[]},{"name":"google_sign_in","path":"/Users/manoj/Code/flutter_installation/flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in-4.0.14/","dependencies":[]},{"name":"location","path":"/Users/manoj/Code/flutter_installation/flutter/.pub-cache/hosted/pub.dartlang.org/location-2.3.5/","dependencies":[]}],"android":[{"name":"firebase_auth","path":"/Users/manoj/Code/flutter_installation/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.15.2/","dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/manoj/Code/flutter_installation/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.4.2+1/","dependencies":[]},{"name":"firebase_database","path":"/Users/manoj/Code/flutter_installation/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_database-3.1.1/","dependencies":["firebase_core"]},{"name":"google_maps_flutter","path":"/Users/manoj/Code/flutter_installation/flutter/.pub-cache/hosted/pub.dartlang.org/google_maps_flutter-0.5.21+15/","dependencies":[]},{"name":"google_sign_in","path":"/Users/manoj/Code/flutter_installation/flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in-4.0.14/","dependencies":[]},{"name":"location","path":"/Users/manoj/Code/flutter_installation/flutter/.pub-cache/hosted/pub.dartlang.org/location-2.3.5/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[{"name":"firebase_auth_web","path":"/Users/manoj/Code/flutter_installation/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_web-0.1.1/","dependencies":[]}]},"dependencyGraph":[{"name":"firebase_auth","dependencies":["firebase_core","firebase_auth_web"]},{"name":"firebase_auth_web","dependencies":[]},{"name":"firebase_core","dependencies":[]},{"name":"firebase_database","dependencies":["firebase_core"]},{"name":"google_maps_flutter","dependencies":[]},{"name":"google_sign_in","dependencies":[]},{"name":"location","dependencies":[]}],"date_created":"2021-02-20 13:14:23.962724","version":"1.26.0-17.5.pre"} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..0c504bf --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,14 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + + { + "name": "Trovami", + "request": "launch", + "type": "dart" + } + ] +} \ No newline at end of file diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig index e8efba1..b2f5fae 100644 --- a/ios/Flutter/Debug.xcconfig +++ b/ios/Flutter/Debug.xcconfig @@ -1,2 +1,3 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Generated.xcconfig" diff --git a/ios/Flutter/Flutter.podspec b/ios/Flutter/Flutter.podspec new file mode 100644 index 0000000..2c4421c --- /dev/null +++ b/ios/Flutter/Flutter.podspec @@ -0,0 +1,18 @@ +# +# NOTE: This podspec is NOT to be published. It is only used as a local source! +# This is a generated file; do not edit or check into version control. +# + +Pod::Spec.new do |s| + s.name = 'Flutter' + s.version = '1.0.0' + s.summary = 'High-performance, high-fidelity mobile apps.' + s.homepage = 'https://flutter.io' + s.license = { :type => 'MIT' } + s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' } + s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s } + s.ios.deployment_target = '8.0' + # Framework linking is handled by Flutter tooling, not CocoaPods. + # Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs. + s.vendored_frameworks = 'path/to/nothing' +end diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig index 399e934..88c2914 100644 --- a/ios/Flutter/Release.xcconfig +++ b/ios/Flutter/Release.xcconfig @@ -1,2 +1,3 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Generated.xcconfig" diff --git a/ios/Podfile.lock b/ios/Podfile.lock new file mode 100644 index 0000000..8c3936c --- /dev/null +++ b/ios/Podfile.lock @@ -0,0 +1,195 @@ +PODS: + - AppAuth (1.4.0): + - AppAuth/Core (= 1.4.0) + - AppAuth/ExternalUserAgent (= 1.4.0) + - AppAuth/Core (1.4.0) + - AppAuth/ExternalUserAgent (1.4.0) + - Firebase/Auth (6.34.0): + - Firebase/CoreOnly + - FirebaseAuth (~> 6.9.2) + - Firebase/Core (6.34.0): + - Firebase/CoreOnly + - FirebaseAnalytics (= 6.9.0) + - Firebase/CoreOnly (6.34.0): + - FirebaseCore (= 6.10.4) + - Firebase/Database (6.34.0): + - Firebase/CoreOnly + - FirebaseDatabase (~> 6.6.0) + - firebase_auth (0.0.1): + - Firebase/Auth (~> 6.0) + - Firebase/Core + - Flutter + - firebase_core (0.0.1): + - Firebase/Core + - Flutter + - firebase_database (0.0.1): + - Firebase/Database + - Flutter + - FirebaseAnalytics (6.9.0): + - FirebaseCore (~> 6.10) + - FirebaseInstallations (~> 1.7) + - GoogleAppMeasurement (= 6.9.0) + - GoogleUtilities/AppDelegateSwizzler (~> 6.7) + - GoogleUtilities/MethodSwizzler (~> 6.7) + - GoogleUtilities/Network (~> 6.7) + - "GoogleUtilities/NSData+zlib (~> 6.7)" + - nanopb (~> 1.30906.0) + - FirebaseAuth (6.9.2): + - FirebaseCore (~> 6.10) + - GoogleUtilities/AppDelegateSwizzler (~> 6.7) + - GoogleUtilities/Environment (~> 6.7) + - GTMSessionFetcher/Core (~> 1.1) + - FirebaseCore (6.10.4): + - FirebaseCoreDiagnostics (~> 1.6) + - GoogleUtilities/Environment (~> 6.7) + - GoogleUtilities/Logger (~> 6.7) + - FirebaseCoreDiagnostics (1.7.0): + - GoogleDataTransport (~> 7.4) + - GoogleUtilities/Environment (~> 6.7) + - GoogleUtilities/Logger (~> 6.7) + - nanopb (~> 1.30906.0) + - FirebaseDatabase (6.6.0): + - FirebaseCore (~> 6.10) + - leveldb-library (~> 1.22) + - FirebaseInstallations (1.7.0): + - FirebaseCore (~> 6.10) + - GoogleUtilities/Environment (~> 6.7) + - GoogleUtilities/UserDefaults (~> 6.7) + - PromisesObjC (~> 1.2) + - Flutter (1.0.0) + - google_maps_flutter (0.0.1): + - Flutter + - GoogleMaps + - google_sign_in (0.0.1): + - Flutter + - GoogleSignIn (~> 5.0) + - GoogleAppMeasurement (6.9.0): + - GoogleUtilities/AppDelegateSwizzler (~> 6.7) + - GoogleUtilities/MethodSwizzler (~> 6.7) + - GoogleUtilities/Network (~> 6.7) + - "GoogleUtilities/NSData+zlib (~> 6.7)" + - nanopb (~> 1.30906.0) + - GoogleDataTransport (7.5.1): + - nanopb (~> 1.30906.0) + - GoogleMaps (2.7.0): + - GoogleMaps/Maps (= 2.7.0) + - GoogleMaps/Base (2.7.0) + - GoogleMaps/Maps (2.7.0): + - GoogleMaps/Base + - GoogleSignIn (5.0.2): + - AppAuth (~> 1.2) + - GTMAppAuth (~> 1.0) + - GTMSessionFetcher/Core (~> 1.1) + - GoogleUtilities/AppDelegateSwizzler (6.7.2): + - GoogleUtilities/Environment + - GoogleUtilities/Logger + - GoogleUtilities/Network + - GoogleUtilities/Environment (6.7.2): + - PromisesObjC (~> 1.2) + - GoogleUtilities/Logger (6.7.2): + - GoogleUtilities/Environment + - GoogleUtilities/MethodSwizzler (6.7.2): + - GoogleUtilities/Logger + - GoogleUtilities/Network (6.7.2): + - GoogleUtilities/Logger + - "GoogleUtilities/NSData+zlib" + - GoogleUtilities/Reachability + - "GoogleUtilities/NSData+zlib (6.7.2)" + - GoogleUtilities/Reachability (6.7.2): + - GoogleUtilities/Logger + - GoogleUtilities/UserDefaults (6.7.2): + - GoogleUtilities/Logger + - GTMAppAuth (1.1.0): + - AppAuth/Core (~> 1.4) + - GTMSessionFetcher (~> 1.4) + - GTMSessionFetcher (1.4.0): + - GTMSessionFetcher/Full (= 1.4.0) + - GTMSessionFetcher/Core (1.4.0) + - GTMSessionFetcher/Full (1.4.0): + - GTMSessionFetcher/Core (= 1.4.0) + - leveldb-library (1.22) + - location (0.0.1): + - Flutter + - nanopb (1.30906.0): + - nanopb/decode (= 1.30906.0) + - nanopb/encode (= 1.30906.0) + - nanopb/decode (1.30906.0) + - nanopb/encode (1.30906.0) + - PromisesObjC (1.2.10) + +DEPENDENCIES: + - firebase_auth (from `.symlinks/plugins/firebase_auth/ios`) + - firebase_core (from `.symlinks/plugins/firebase_core/ios`) + - firebase_database (from `.symlinks/plugins/firebase_database/ios`) + - Flutter (from `Flutter`) + - google_maps_flutter (from `.symlinks/plugins/google_maps_flutter/ios`) + - google_sign_in (from `.symlinks/plugins/google_sign_in/ios`) + - location (from `.symlinks/plugins/location/ios`) + +SPEC REPOS: + trunk: + - AppAuth + - Firebase + - FirebaseAnalytics + - FirebaseAuth + - FirebaseCore + - FirebaseCoreDiagnostics + - FirebaseDatabase + - FirebaseInstallations + - GoogleAppMeasurement + - GoogleDataTransport + - GoogleMaps + - GoogleSignIn + - GoogleUtilities + - GTMAppAuth + - GTMSessionFetcher + - leveldb-library + - nanopb + - PromisesObjC + +EXTERNAL SOURCES: + firebase_auth: + :path: ".symlinks/plugins/firebase_auth/ios" + firebase_core: + :path: ".symlinks/plugins/firebase_core/ios" + firebase_database: + :path: ".symlinks/plugins/firebase_database/ios" + Flutter: + :path: Flutter + google_maps_flutter: + :path: ".symlinks/plugins/google_maps_flutter/ios" + google_sign_in: + :path: ".symlinks/plugins/google_sign_in/ios" + location: + :path: ".symlinks/plugins/location/ios" + +SPEC CHECKSUMS: + AppAuth: 31bcec809a638d7bd2f86ea8a52bd45f6e81e7c7 + Firebase: c23a36d9e4cdf7877dfcba8dd0c58add66358999 + firebase_auth: 48dca46d6a22ab8522633c6257715c4ee5afb0f9 + firebase_core: 15d27cd74b2e40f8c29540707c0486bb561a92e8 + firebase_database: 25e756b41e85a2d9c07502b78f28fc5ae5973e0d + FirebaseAnalytics: 3bb096873ee0d7fa4b6c70f5e9166b6da413cc7f + FirebaseAuth: c92d49ada7948d1a23466e3db17bc4c2039dddc3 + FirebaseCore: d3a978a3cfa3240bf7e4ba7d137fdf5b22b628ec + FirebaseCoreDiagnostics: 770ac5958e1372ce67959ae4b4f31d8e127c3ac1 + FirebaseDatabase: 13a865a4b85897462b930eb683bda8f52583713f + FirebaseInstallations: 466c7b4d1f58fe16707693091da253726a731ed2 + Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c + google_maps_flutter: d0dd62f5a7d39bae61057eb9f52dd778d99c7c6c + google_sign_in: decaf71f56e22fb1dc179de062177ae6df415716 + GoogleAppMeasurement: a6a3a066369828db64eda428cb2856dc1cdc7c4e + GoogleDataTransport: f56af7caa4ed338dc8e138a5d7c5973e66440833 + GoogleMaps: f79af95cb24d869457b1f961c93d3ce8b2f3b848 + GoogleSignIn: 7137d297ddc022a7e0aa4619c86d72c909fa7213 + GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3 + GTMAppAuth: 197a8dabfea5d665224aa00d17f164fc2248dab9 + GTMSessionFetcher: 6f5c8abbab8a9bce4bb3f057e317728ec6182b10 + leveldb-library: 55d93ee664b4007aac644a782d11da33fba316f7 + location: 3a2eed4dd2fab25e7b7baf2a9efefe82b512d740 + nanopb: 59317e09cf1f1a0af72f12af412d54edf52603fc + PromisesObjC: b14b1c6b68e306650688599de8a45e49fae81151 + +PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c + +COCOAPODS: 1.10.1 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 33bce68..3dd21ef 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -9,15 +9,12 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + 9A2F4246C16A5EDEDFEC1B83 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 53E3B5B528E13E97C5770B07 /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -27,8 +24,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -39,18 +34,20 @@ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; + 53E3B5B528E13E97C5770B07 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 6448BD11C82F1DAE81DB9B3E /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 6B62592805C8A51D0B2FDC15 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; - 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + B83DDF0BDFAE9BB709ED2B78 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -58,8 +55,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, + 9A2F4246C16A5EDEDFEC1B83 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -69,9 +65,7 @@ 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( - 3B80C3931E831B6300D905FE /* App.framework */, 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, - 9740EEBA1CF902C7004384FC /* Flutter.framework */, 9740EEB21CF90195004384FC /* Debug.xcconfig */, 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 9740EEB31CF90195004384FC /* Generated.xcconfig */, @@ -85,6 +79,8 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, + C952E0B03EE30C9D4054812B /* Pods */, + D0C44750BE5B87F10562D05A /* Frameworks */, ); sourceTree = ""; }; @@ -119,6 +115,25 @@ name = "Supporting Files"; sourceTree = ""; }; + C952E0B03EE30C9D4054812B /* Pods */ = { + isa = PBXGroup; + children = ( + 6B62592805C8A51D0B2FDC15 /* Pods-Runner.debug.xcconfig */, + B83DDF0BDFAE9BB709ED2B78 /* Pods-Runner.release.xcconfig */, + 6448BD11C82F1DAE81DB9B3E /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + D0C44750BE5B87F10562D05A /* Frameworks */ = { + isa = PBXGroup; + children = ( + 53E3B5B528E13E97C5770B07 /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -126,12 +141,15 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + B9F563B78A05191E9B80E9FC /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 797E9F83DC8F335290E30ACC /* [CP] Embed Pods Frameworks */, + 3FB7EE7757CD6F2C07AC3D22 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -203,7 +221,59 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 3FB7EE7757CD6F2C07AC3D22 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh", + "${PODS_ROOT}/GoogleMaps/Maps/Frameworks/GoogleMaps.framework/Resources/GoogleMaps.bundle", + "${PODS_ROOT}/GoogleSignIn/Resources/GoogleSignIn.bundle", + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleMaps.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleSignIn.bundle", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 797E9F83DC8F335290E30ACC /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/AppAuth/AppAuth.framework", + "${BUILT_PRODUCTS_DIR}/GTMAppAuth/GTMAppAuth.framework", + "${BUILT_PRODUCTS_DIR}/GTMSessionFetcher/GTMSessionFetcher.framework", + "${BUILT_PRODUCTS_DIR}/GoogleUtilities/GoogleUtilities.framework", + "${BUILT_PRODUCTS_DIR}/PromisesObjC/FBLPromises.framework", + "${BUILT_PRODUCTS_DIR}/leveldb-library/leveldb.framework", + "${BUILT_PRODUCTS_DIR}/location/location.framework", + "${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AppAuth.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GTMAppAuth.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GTMSessionFetcher.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleUtilities.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBLPromises.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/leveldb.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/location.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; @@ -219,6 +289,28 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + B9F563B78A05191E9B80E9FC /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -255,7 +347,6 @@ /* Begin XCBuildConfiguration section */ 249021D3217E4FDB00AE95B9 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -331,7 +422,6 @@ }; 97C147031CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -387,7 +477,6 @@ }; 97C147041CF9000F007C117D /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -513,7 +602,6 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ - }; rootObject = 97C146E61CF9000F007C117D /* Project object */; } diff --git a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 1d526a1..919434a 100644 --- a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/ios/Runner.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcworkspace/contents.xcworkspacedata index 1d526a1..21a3cc1 100644 --- a/ios/Runner.xcworkspace/contents.xcworkspacedata +++ b/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + diff --git a/lib/core/Group.dart b/lib/core/Group.dart deleted file mode 100644 index cd5ff37..0000000 --- a/lib/core/Group.dart +++ /dev/null @@ -1,19 +0,0 @@ - -import 'package:trovami/core/User.dart'; - -class Group { - Group({this.groupname,this.groupmembers}); - String groupname = ""; - List groupmembers=[]; - - Group.fromJson(Map value){ - groupname=value["groupname"]; -// print("value of members:${value["members"]}"); - groupmembers=value["members"]; - - } - Map toJson(){ - return {"groupname": groupname,"members":groupmembers}; - } - -} diff --git a/lib/groupdetails.dart b/lib/groupdetails.dart deleted file mode 100644 index fb8dbe8..0000000 --- a/lib/groupdetails.dart +++ /dev/null @@ -1,323 +0,0 @@ -import 'dart:convert'; - -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter/rendering.dart'; -import 'package:trovami/homepage.dart'; -import 'package:trovami/httpClient/httpClient.dart'; - -import 'InputTextField.dart'; -import 'managers/GroupsManager.dart'; -import 'core/Group.dart'; -import 'core/User.dart'; -import 'signinpage.dart'; -import 'functionsForFirebaseApiCalls.dart'; - - -//var httpClient = createHttpClient(); -// String _selectedChoice=""; -var Json = const JsonCodec(); -var groupName=""; -Color textFieldColor = const Color.fromRGBO(0, 0, 0, 0.2); -const jsonCodec=const JsonCodec(reviver: _reviver); -const jsonCodec1=const JsonCodec(reviver: _reviver1); - -TextStyle textStyle = new TextStyle( - color:const Color.fromRGBO(0, 0, 0, 0.9), - fontSize: 16.0, - fontWeight: FontWeight.normal); - -ThemeData appTheme = new ThemeData( - hintColor: Colors.white, -); - - - _reviver(key,value) { - - if(key!=null&& value is Map && key.contains('-')){ - return new User.fromJson(value); - } - return value; - } - - _reviver1(key,value) { - - if(key!=null&& value is Map && key.contains('-')){ - return new Group.fromJson(value); - } - return value; - } - - class AddGroup extends StatefulWidget { - dynamic users; - AddGroup({this.users}); - @override - AddGroupstate createState() => new AddGroupstate(users:users); - } - - class AddGroupstate extends State{ - dynamic users; - AddGroupstate({this.users}); - final GlobalKey _scaffoldKeySecondary1 = new GlobalKey(); - final GlobalKey _groupformKey = new GlobalKey(); - - bool _autovalidate1 = false; - List userstoShowGrpDetailsPage=new List(); - List children1=new List(); - List members=[]; - int count=0; - - void showInSnackBar(String value) { - _scaffoldKeySecondary1.currentState.showSnackBar( - new SnackBar( - content: new Text(value) - ) - ); - } - - String checkifnotnull(String value){ - if(value.isEmpty) { - return 'Groupname must not be empty'; - } - return null; - } - - _handleSubmitted() async { - var httpClient = HttpClientFireBase(); - final FormState form = _groupformKey.currentState; - form.save(); - User loggedInMember = new User(); - loggedInMember.EmailId = loggedinUser; - loggedInMember.locationShare = false; - for (var i = 0; i < members.length; i++) { - GroupsManager().currentGroup().groupmembers.add(members[i]); - } - loggedInMember.name=loggedInUsername; - GroupsManager().currentGroup().groupmembers.add(loggedInMember); - for (var i = 0; i < GroupsManager().currentGroup().groupmembers.length; i++) { - - -// final Map resstring = await getUsers(); - - - users.value.forEach((k, v) async { - if (v["emailid"] == GroupsManager().currentGroup().groupmembers[i].EmailId) { - - print("v['groupsIamin'] : ${v["groupsIamin"]}"); - if (v["groupsIamin"] == null) { - List groupsIamin = []; - groupsIamin.add(GroupsManager().currentGroup().groupname); - var groupsIaminjson = jsonCodec.encode(groupsIamin); - await httpClient.put( - url: 'https://trovami-bcd81.firebaseio.com/users/${k}/groupsIamin.json?', - body: groupsIaminjson); - } else { - - var response2 = await getUserById(k); - - List resmap=[]; - resmap.addAll(response2.value["groupsIamin"]); - print("resmap: ${resmap}"); - - resmap.add(GroupsManager().currentGroup().groupname); - var groupsIaminjson = jsonCodec.encode(resmap); - var response1 = await httpClient.put( url: - 'https://trovami-bcd81.firebaseio.com/users/${k}/groupsIamin.json?', - body: groupsIaminjson); - } - } - }); - } - var groupjson = jsonCodec1.encode(GroupsManager().currentGroup()); - var url = "https://trovami-bcd81.firebaseio.com/groups.json"; - await httpClient.post(url:url, body: groupjson); -// Navigator.of(context).pushReplacement( -// MaterialPageRoute( -// builder: (context) => Homepagelayout(users: users), -// ),); - Navigator.of(context).pop(); -// await Navigator.of(context).pushReplacementNamed('/b'); - } - - void _select(User user) { - members.add(user); - for(var i=0;i getusers(); - - - @override - Widget build(BuildContext context) { - - - if(members.isNotEmpty) { - children1 = - new List.generate(count, (int i) => new memberlist(members[i].name)); - } - - return new Scaffold( - key: _scaffoldKeySecondary1, - body: new Form( - autovalidate: true, - key: _groupformKey, - child: new ListView( - padding: const EdgeInsets.symmetric(horizontal: 16.0), - children: [ - new Container( - child: new Container( - child: new Text("Add a Group", - style: new TextStyle(fontSize: 20.0,fontWeight: FontWeight.bold), - textAlign: TextAlign.center, - ), - padding: const EdgeInsets.only(bottom:20.0), - ), - padding: const EdgeInsets.only(top:50.0), - decoration: new BoxDecoration( - border: new Border( - bottom: new BorderSide(width: 0.0, color: Colors.brown[200]), - ), - ), - ), - new Container( - child: new Container( - child: new InputField( - hintText: "Groupname", - obscureText: false, - textInputType: TextInputType.text, - textStyle: textStyle, - textFieldColor: textFieldColor, - icon: Icons.group, - validateFunction: checkifnotnull, - iconColor: Colors.grey, - bottomMargin: 20.0, - onSaved: (String value) { - GroupsManager().currentGroup().groupname=value; - GroupsManager().currentGroup().groupmembers=new List(); - } - ), - padding: const EdgeInsets.only( bottom:15.0, top:0.0,right: 20.0), - ), - padding: const EdgeInsets.only( top:30.0) - ), - new Row(children: [ - new Container(child: - new Text("Add a member:",style: new TextStyle(fontSize: 16.0, - fontWeight: FontWeight.bold), - ), - padding: new EdgeInsets.only( left:13.0) - ), - new Container(child: - new CircleAvatar(child: - new PopupMenuButton( - icon: new Icon(Icons.add), - onSelected: _select, - itemBuilder: (BuildContext context) => userstoShowGrpDetailsPage.map((User usertoshow) => - new PopupMenuItem( - value: usertoshow, - child: new Text(usertoshow.name), - ) - ).toList() - ), - backgroundColor: const Color.fromRGBO(0, 0, 0, 0.2), - ), - padding: const EdgeInsets.only( left:50.0) - ), - ], - ), - new Column( - children:children1, - ), - new Row(children: [ - - new Container( - alignment: Alignment.bottomCenter, - child: new FloatingActionButton( - onPressed: _handleSubmitted, - child: new Icon(Icons.check), - ), - padding: const EdgeInsets.only( top:50.0,left: 100.0) , - ), - new Container( - child:new FloatingActionButton( - onPressed: (){ Navigator.of(context).pushReplacement(MaterialPageRoute( - builder: (context) => Homepage(users: users), - ),); - }, - child: new Icon(Icons.clear), - heroTag: null, - ), - padding: const EdgeInsets.only( top:50.0,left: 50.0) , - ), - ], - ), - ], - ), - ), - ); - } - } - - - class memberlist extends StatelessWidget { - final String mem; - memberlist(this.mem); - - @override - Widget build(BuildContext context) => - new Container( - child: new Column( - children: [ - new Row( - children: [ - new CircleAvatar( - child:new Icon(Icons.person), - backgroundColor: const Color.fromRGBO(0, 0, 0, 0.2), - ), - new Container(child: - new Text( - "${mem}", - style: new TextStyle(fontSize: 20.0), - ), - padding: new EdgeInsets.only( left:20.0) - - ), - ], - ), - ], - ), - padding: new EdgeInsets.only( left:10.0,top: 5.0,bottom: 5.0), - decoration: new BoxDecoration( - border: new Border( - bottom: new BorderSide(width: 0.0, color: const Color.fromRGBO(0, 0, 0, 0.2),), - ), - ), - ); - - } diff --git a/lib/groupstatus.dart b/lib/groupstatus.dart deleted file mode 100644 index 00ab42a..0000000 --- a/lib/groupstatus.dart +++ /dev/null @@ -1,425 +0,0 @@ -import 'dart:async'; -import 'dart:convert'; -import 'dart:core'; - -import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; -import 'package:flutter/services.dart'; -import 'package:firebase_database/firebase_database.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; -import 'functionsForFirebaseApiCalls.dart'; -import 'package:http/http.dart' as http; -import 'package:location/location.dart'; - -import 'helpers/RoutesHelper.dart'; -import 'homepage.dart'; -import 'httpClient/httpClient.dart'; -import 'map.dart'; -import 'main.dart'; -import 'core/Group.dart'; -import 'core/User.dart'; -import 'core/UserLocation.dart'; -import 'signinpage.dart'; - - -final userref = FirebaseDatabase.instance.reference().child('users'); // new -final groupref = FirebaseDatabase.instance.reference().child('groups'); // new -//var httpClient = createHttpClient(); -const jsonCodec1=const JsonCodec(reviver: _reviver1); -const jsonCodec=const JsonCodec(reviver: _reviver); -const locationJsonCodec=const JsonCodec(reviver: _locationReviver); -List currentLocations=new List(); -bool locationShare; -Timer t1; -bool mapflag; -var temp1=[]; -var length; -bool togglestate=false; - -_reviver(key,value) { - - if(key!=null&& value is Map) { - return new User.fromJson(value); - } - else return value; -} - -_locationReviver(key,value) { - if(key!=null) { - return new UserLocation.fromJson(value); - } - else return value; -} - -_reviver1(key,value) { - - if(key!=null&& value is Map){ - return new Group.fromJson(value); - } - else return value; -} - -toggleMemberLocation(bool newValue) async{ - HttpClientFireBase httpClient = HttpClientFireBase(); - - final DataSnapshot groupresmap=await getGroups(); - Map grps = groupresmap.value as Map; - var location = new Location(); - Stream locationStream = location.onLocationChanged(); - StreamSubscription locationSub; - grps.forEach((k,v) async{ - - if(v["groupname"]==groupStatusGroupname) { - for(var i=0;i${response1}"); - Map result1=jsonCodec.decode(response1.body); - if(result1["emailid"]==loggedinUser){ - if(result1["locationShare"]==true||result1["location"]==null) { - await httpClient.put( - url: "https://trovami-bcd81.firebaseio.com/groups/${k}/members/${i}/location.json",body: locUpdated); - } - - } - } - } - }); -} - - -class GroupStatusLayout extends StatefulWidget { - @override - GroupStatusLayoutState createState() => new GroupStatusLayoutState(); -} - -class GroupStatusLayoutState extends State{ - - @override - Widget build(BuildContext context)=> - new Scaffold( - body: new Container( - child:new GroupStatus(), - ), - ); -} - - -class GroupStatus extends StatefulWidget { - @override - GroupStatusState createState() => new GroupStatusState(); -} - -class GroupStatusState extends State{ - - var getMemFlag=0; - final GlobalKey _refreshIndicatorKey = new GlobalKey(); - final GlobalKey _scaffoldKeySecondary2 = new GlobalKey(); - List children=new List(); - List memberstoShowHomepage1=new List(); - - getgrpmembers(String grpkey,int i) async{ - var response1 = await getAGroupAndAMember(grpkey,i); -// Map result1 = jsonCodec.decode(response1.body); - print("response1 : ${i}"); - - memberstoShowHomepage1.add(response1.value[i]["name"]); - print("memberstoShowHomepage1 : ${memberstoShowHomepage1}"); - - if (response1.value[i]["emailid"] == loggedinUser) { - setState(() { - togglestate = response1.value[i]["locationShare"]; - locationShare=response1.value[i]["locationShare"]; - }); - } - - - - } - - Future getmembers1() async { -// if(nouserflag==1){ -// showInSnackBar("No users online"); -// } - String grpkey; - var grpmemcount; - - _refreshIndicatorKey.currentState?.show(); - - final dynamic groupresmap = await getGroups(); - -// print("grrrppr: ${groupresmap.value}"); - groupresmap.value.forEach((k, v){ - if (v["groupname"] == groupStatusGroupname) { - print("v: ${v["groupname"]}"); - grpkey=k; - grpmemcount=v["members"].length; - - } - }); - print("grpmemcount : ${grpmemcount}"); - for(var i = 0;i dedup(List list) { - List list1=new List(); - Set seen = new Set(); - int unique = 0; - for (int i = 0; i < list.length; i++) { - String element = list[i]; - if (!seen.contains(element)) { - seen.add(element); - list1.insert(unique++,element); - } - }return list1; - } - - - - void showInSnackBar(String value) { - _scaffoldKeySecondary2.currentState.showSnackBar( - new SnackBar( - content: new Text(value) - ) - ); - } - - @override - void initState() { - super.initState(); - getmembers1(); - } - - @override - Widget build(BuildContext context) { - children= new List.generate(memberstoShowHomepage1.length, (int i) => new memberlist(memberstoShowHomepage1[i])); - return new RefreshIndicator( - key: _refreshIndicatorKey, - onRefresh: getmembers1, - child: new Scaffold( - key: _scaffoldKeySecondary2, - appBar: new AppBar( - leading: defaultTargetPlatform == TargetPlatform.iOS - ? new CupertinoButton(child: new Icon(Icons.keyboard_backspace), onPressed: (){ - Navigator.of(context).pop(); - }, - ) : new FlatButton(onPressed: (){ - Navigator.of(context).pop(); - }, - child:new Icon(Icons.keyboard_backspace) - ), - actions: [ - new FlatButton(onPressed:()async { - await Navigator.of(context).pushNamed(ROUTE_MAP); - }, - child: new Text("Show Map") - ), - ], - flexibleSpace: new FlexibleSpaceBar( - title: new Text('Group Status'), - ), - ), - body :new Container( - child: new ListView( - children : [ - Container( - margin: const EdgeInsets.all(10.0), - color: Colors.red, - height: 100, - child: Center( - child: Text("DO NOT USE REAL LOCATION",style: TextStyle(fontWeight: FontWeight.bold,fontSize: 20),), - ), - ), - new Row(children :[ - new Container(child: new Text("Share Live Location:",style: new TextStyle(fontSize: 20.0)), - padding: const EdgeInsets.only( left:10.0), - ), - new Container( - child: defaultTargetPlatform == TargetPlatform.iOS - ? new CupertinoSwitch(value: togglestate, onChanged: (bool newValue) { - toggleMemberLocation(newValue); - setState(() { - togglestate = newValue; - }); - },) - : new Switch(value: togglestate, onChanged: (bool newValue) { - toggleMemberLocation(newValue); - setState(() { - togglestate = newValue; - }); - }, - ), - ), - ], - ), - new Container( - child: new Column( - children: [ - new Row( - children: [ - new CircleAvatar( - child:new Icon(Icons.group), - backgroundColor: const Color.fromRGBO(0, 0, 0, 0.2), - ), - new Expanded(child:new Container( - child: new Text( - "Group Name: ${groupStatusGroupname}", - style: new TextStyle(fontSize: 20.0,fontWeight: FontWeight.bold), - ), - padding: const EdgeInsets.only( left:20.0) - ), - ), - ], - ), - ], - ), - padding: const EdgeInsets.only( left:10.0,top: 5.0,bottom: 5.0), - decoration: new BoxDecoration( - border: new Border( - bottom: new BorderSide(width: 1.0, color: const Color.fromRGBO(0, 0, 0, 0.2),style: BorderStyle.solid), - ), - ), - ), - new Container( - child:new Text("Members :", - style: new TextStyle(fontSize: 20.0), - ), - padding: const EdgeInsets.only( left:10.0,top: 10.0,bottom: 10.0), - decoration: new BoxDecoration( - border: new Border( - bottom: new BorderSide(width: 0.0, color: const Color.fromRGBO(0, 0, 0, 0.2),style: BorderStyle.solid), - ), - ), - ), - new Column( children: children), - ], - ), - padding: const EdgeInsets.only(top:10.0), - ), - ), - ); - } -} - - -class memberlist extends StatelessWidget { - final String mem; - memberlist(this.mem); - - @override - Widget build(BuildContext context) => - new Container( - child: new Column( - children: [ - new Row( - children: [ - new CircleAvatar( - child:new Icon(Icons.person), - backgroundColor: const Color.fromRGBO(0, 0, 0, 0.2), - ), - new Container(child: - new Text( - "${mem}", - style: new TextStyle(fontSize: 20.0), - ), - padding: new EdgeInsets.only( left:20.0) - - ), - ], - ), - ], - ), - padding: new EdgeInsets.only( left:10.0,top: 5.0,bottom: 5.0), - decoration: new BoxDecoration( - border: new Border( - bottom: new BorderSide(width: 0.0, color: const Color.fromRGBO(0, 0, 0, 0.2),), - ), - ), - ); -} - - - - - - - diff --git a/lib/helpers/RoutesHelper.dart b/lib/helpers/RoutesHelper.dart index 784a207..8f6b39b 100644 --- a/lib/helpers/RoutesHelper.dart +++ b/lib/helpers/RoutesHelper.dart @@ -1,67 +1,99 @@ - import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:trovami/views/screens/signinpage.dart'; +import 'package:trovami/views/screens/splash_screen.dart'; -import '../groupdetails.dart'; -import '../groupstatus.dart'; -import '../homepage.dart'; +import '../views/screens/groupdetails.dart'; +import '../views/screens/groupstatus.dart'; +import '../views/screens/homepage.dart'; import '../main.dart'; -import '../map.dart'; -import '../signuppage.dart'; +import '../views/screens/map.dart'; +import '../views/screens/signuppage.dart'; -const String ROUTE_ADD_GROUP = '/addgroup'; -const String ROUTE_GROUP = '/group'; -const String ROUTE_HOME = '/'; -const String ROUTE_MAP = '/map'; -const String ROUTE_SIGNUP = '/signup'; +const String ROUTE_ADD_GROUP = '/addgroup'; +const String ROUTE_GROUP = '/group'; +const String ROUTE_HOME = '/'; +const String ROUTE_MAP = '/map'; +const String ROUTE_SIGNUP = '/signup'; +const String ROUTE_LOGIN = '/login'; class RoutesHelper { static Route provideRoute(RouteSettings settings) { switch (settings.name) { case ROUTE_HOME: return defaultTargetPlatform == TargetPlatform.iOS - ? new CupertinoPageRoute(builder: (_) => new Homepagelayout(),settings: settings,) + ? new CupertinoPageRoute( + builder: (_) => new Homepagelayout(), + settings: settings, + ) : new MyCustomRoute( - builder: (_) => new Homepagelayout(), - settings: settings, - ); + builder: (_) => new Homepagelayout(), + settings: settings, + ); - case ROUTE_SIGNUP: return defaultTargetPlatform == TargetPlatform.iOS - ? new CupertinoPageRoute(builder: (_) => new SignupLayout(),settings: settings,) - : new MyCustomRoute( - builder: (_) => new SignupLayout(), - settings: settings, - ); + case ROUTE_SIGNUP: + return defaultTargetPlatform == TargetPlatform.iOS + ? new CupertinoPageRoute( + builder: (_) => new SignupLayout(), + settings: settings, + ) + : new MyCustomRoute( + builder: (_) => new SignupLayout(), + settings: settings, + ); - case ROUTE_ADD_GROUP: return defaultTargetPlatform == TargetPlatform.iOS - ? new CupertinoPageRoute(builder: (_) => new AddGroup(),settings: settings,) - :new MyCustomRoute1( - builder: (_) => new AddGroup(), - settings: settings, - ); - case ROUTE_GROUP: return defaultTargetPlatform == TargetPlatform.iOS - ? new CupertinoPageRoute(builder: (_) => new GroupStatusLayout(),settings: settings,) - :new MyCustomRoute1( - builder: (_) => new GroupStatusLayout(), - settings: settings, - ); - case ROUTE_MAP: return defaultTargetPlatform == TargetPlatform.iOS - ? new CupertinoPageRoute(builder: (_) => new MapSample(),settings: settings,) - :new MyCustomRoute1( - builder: (_) => new MapSample(), - settings: settings, - ); + case ROUTE_ADD_GROUP: + return defaultTargetPlatform == TargetPlatform.iOS + ? new CupertinoPageRoute( + builder: (_) => new AddGroup(), + settings: settings, + ) + : new MyCustomRoute1( + builder: (_) => new AddGroup(), + settings: settings, + ); + case ROUTE_GROUP: + return defaultTargetPlatform == TargetPlatform.iOS + ? new CupertinoPageRoute( + builder: (_) => new GroupStatusLayout(), + settings: settings, + ) + : new MyCustomRoute1( + builder: (_) => new GroupStatusLayout(), + settings: settings, + ); + case ROUTE_MAP: + return defaultTargetPlatform == TargetPlatform.iOS + ? new CupertinoPageRoute( + builder: (_) => new MapSample(), + settings: settings, + ) + : new MyCustomRoute1( + builder: (_) => new MapSample(), + settings: settings, + ); + + case ROUTE_LOGIN: + return defaultTargetPlatform == TargetPlatform.iOS + ? new CupertinoPageRoute( + builder: (_) => new SignInForm(), + settings: settings, + ) + : new MyCustomRoute( + builder: (_) => new SignInForm(), + settings: settings, + ); default: return MaterialPageRoute( builder: (_) => Scaffold( - body: Center( child: Text('No route defined for ${settings.name}')), - ) - ); + body: Center( + child: Text('No route defined for ${settings.name}')), + )); } } static pushRoute(BuildContext context, String name) { Navigator.pushNamed(context, name); } -} \ No newline at end of file +} diff --git a/lib/Strings.dart b/lib/helpers/Strings.dart similarity index 100% rename from lib/Strings.dart rename to lib/helpers/Strings.dart diff --git a/lib/authentication.dart b/lib/helpers/authentication.dart similarity index 100% rename from lib/authentication.dart rename to lib/helpers/authentication.dart diff --git a/lib/functionsForFirebaseApiCalls.dart b/lib/helpers/functionsForFirebaseApiCalls.dart similarity index 100% rename from lib/functionsForFirebaseApiCalls.dart rename to lib/helpers/functionsForFirebaseApiCalls.dart diff --git a/lib/httpClient/httpClient.dart b/lib/helpers/httpClient/httpClient.dart similarity index 100% rename from lib/httpClient/httpClient.dart rename to lib/helpers/httpClient/httpClient.dart diff --git a/lib/homepage.dart b/lib/homepage.dart deleted file mode 100644 index c114b60..0000000 --- a/lib/homepage.dart +++ /dev/null @@ -1,230 +0,0 @@ -import 'dart:async'; -import 'dart:convert'; - -import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; -import 'package:firebase_database/firebase_database.dart'; -import 'package:firebase_database/ui/firebase_animated_list.dart'; -import 'package:flutter/services.dart'; - - - - - -import 'groupdetails.dart'; -import 'helpers/RoutesHelper.dart'; -import 'main.dart'; -import 'core/Group.dart'; -import 'core/User.dart'; -import 'signinpage.dart'; -import 'functionsForFirebaseApiCalls.dart'; - -var temp=[]; -String pageName=''; -var groupStatusGroupname=''; -double animValue=0.0; -List membersToShow=new List(); -List groupNamesToShow=new List(); -List groupsToShow=new List(); -Group grps=new Group(); -const jsonCodec2=const JsonCodec(); -List membersToShowHomepage=new List(); -final groupref = FirebaseDatabase.instance.reference().child('groups'); -final usrref = FirebaseDatabase.instance.reference().child('users'); -//var _httpClient = createHttpClient(); -const _jsonCodec=const JsonCodec(reviver: _reviver); -var reference; - - - -bool _first=true; - -_reviver( key, value) { - if(key!=null&& value is Map && key.contains('-')){ - return new User.fromJson(value); - } - return value; -} - - - - - class Homepagelayout extends StatelessWidget { - dynamic users; - Homepagelayout({this.users}); - @override - Widget build(BuildContext context) { - - final Size screenSize = MediaQuery - .of(context) - .size; - - return - new Container( - child: new Homepage(users:users), - width: screenSize.width, - height: screenSize.height, - ); - } - - - } - -class groupBox extends StatelessWidget { - groupBox({ - this.snapshot, this.animation,this.index - }); - final DataSnapshot snapshot; - final Animation animation; - final int index; - - - - @override - Widget build(BuildContext context) { -// print(snapshot.value); - return new SizeTransition( - sizeFactor: new CurvedAnimation( - parent: animation, curve: Curves.easeOut), - axisAlignment: 0.0, - child: new Container( - margin: const EdgeInsets.symmetric(vertical: 10.0), - child: new Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - new Container( - margin: const EdgeInsets.only(right: 16.0,bottom: 16.0), - child: new CircleAvatar(child: new IconButton( - icon: new Icon(Icons.group), onPressed: null), - backgroundColor: const Color.fromRGBO(0, 0, 0, 0.2), - ), - ), - new FlatButton(onPressed: () { - groupStatusGroupname = snapshot.value; - RoutesHelper.pushRoute(context, ROUTE_GROUP); - }, child: new Text( - snapshot.value,)) - ], - ), - decoration: new BoxDecoration( - border: new Border( - bottom: new BorderSide(width: 1.0, color: const Color.fromRGBO(0, 0, 0, 0.2)), - ), - ), - ), - - ); - } -} - - - - - - class Homepage extends StatefulWidget{ - dynamic users; - Homepage({this.users}); - @override - HomePageState createState() => new HomePageState(users:users); - } - - class HomePageState extends State with TickerProviderStateMixin { - dynamic users; - var userkey; - - HomePageState({this.users}); - - - - getgroups() { - //loggedinuser="m@g.com"; - //loggedinusername="man"; - -// print("init"); - groupsToShow=new List(); - - -// _refreshIndicatorKey.currentState?.show(); - users.value.forEach((k,v){ - if(v["emailid"]==loggedinUser) { - userkey=k; - } - }); - - setState(() { - reference= usrref.child(userkey).child("groupsIamin"); -// groupsToShow = groupsToShow; - _first=true; - }); - } - - @override - void initState() => getgroups(); - - @override - Widget build(BuildContext context) { - return new Scaffold( - appBar: new AppBar( - leading: new Container(), - actions: [ - new IconButton( - icon: new Icon(Icons.group_add), onPressed: ()async{ - - Navigator.of(context).push(MaterialPageRoute( - builder: (context) => AddGroup(users: users), - ),); - } - ,iconSize: 42.0, - ), - new IconButton( - icon: new Icon(Icons.person), onPressed: - (){ - //TODO - Animation alpha; - - final AnimationController controller = new AnimationController( - duration: const Duration(milliseconds: 500), vsync: this); - alpha = new Tween(begin: 0.0, end: 255.0).animate(controller) - ..addListener(() { -// _scaffoldkeyhomepage.currentState.setState(() { -// _first=false; -// -// }); -// _scaffoldkeyhomepage.currentState.setState(() { -// animValue=alpha.value; -// -// }); - }); - controller.forward(); - }, - iconSize: 35.0,), - ], - title: new Text('Groups'), - ), - body: new Column(children: [ - new Flexible( - child: - ((reference!=null)? - new FirebaseAnimatedList( //new - query: reference, //new - sort: (a, b) => b.key.compareTo(a.key), //new - padding: new EdgeInsets.all(8.0), //new - reverse: false, //new - itemBuilder: (_, DataSnapshot snapshot, Animation animation,index) { - return new groupBox( - snapshot: snapshot, - animation: animation, - index: index, - ); - }, - - ): - new Container()), //new - ), - ]) - ); - } - } - - - diff --git a/lib/main.dart b/lib/main.dart index a7da120..76ddc06 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -3,11 +3,11 @@ import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:provider/provider.dart'; -import 'package:trovami/model/userModel.dart'; +import 'package:trovami/managers/userModel.dart'; +import 'package:trovami/views/screens/splash_screen.dart'; -import 'Strings.dart'; +import 'helpers/Strings.dart'; import 'helpers/RoutesHelper.dart'; -import 'signinpage.dart'; // TODO: Deprecate. Unsure what it is needed for //var popflag=0; @@ -25,7 +25,6 @@ final ThemeData kDefaultTheme = new ThemeData( accentColor: Colors.blueGrey, ); - void main() { // defaultTargetPlatform == TargetPlatform.iOS // ? MapView.setApiKey("AIzaSyCLw1SjRi8TLDu_Nzcdo2Ufu68H1UXl9BU") @@ -34,50 +33,43 @@ void main() { runApp( ChangeNotifierProvider( create: (context) => UserModel(), - child: new MaterialApp( - title: Strings.appName, - debugShowCheckedModeBanner: false, - home: new SignInForm(), - theme: defaultTargetPlatform == TargetPlatform.iOS - ? kIOSTheme - : kDefaultTheme, + title: Strings.appName, + debugShowCheckedModeBanner: false, + home: SplashScreen(), + theme: defaultTargetPlatform == TargetPlatform.iOS + ? kIOSTheme + : kDefaultTheme, // ignore: missing_return onGenerateRoute: RoutesHelper.provideRoute, initialRoute: ROUTE_HOME, - ), + ), ), ); } class MyCustomRoute extends MaterialPageRoute { - MyCustomRoute({ WidgetBuilder builder, RouteSettings settings }) + MyCustomRoute({WidgetBuilder builder, RouteSettings settings}) : super(builder: builder, settings: settings); @override - Widget buildTransitions(BuildContext context, - Animation animation, - Animation secondaryAnimation, - Widget child) { + Widget buildTransitions(BuildContext context, Animation animation, + Animation secondaryAnimation, Widget child) { // if (settings.isInitialRoute) // return child; - return new FadeTransition( opacity: animation, child: child); + return new FadeTransition(opacity: animation, child: child); } } class MyCustomRoute1 extends MaterialPageRoute { - MyCustomRoute1({ WidgetBuilder builder, RouteSettings settings }) + MyCustomRoute1({WidgetBuilder builder, RouteSettings settings}) : super(builder: builder, settings: settings); @override - Widget TransitionBuilder(BuildContext context, - Animation animation, - Animation secondaryAnimation, - Widget child) { + Widget TransitionBuilder(BuildContext context, Animation animation, + Animation secondaryAnimation, Widget child) { // if (settings.isInitialRoute) // return child; - return new SlideTransition( position: animation, child: child); + return new SlideTransition(position: animation, child: child); } } - - diff --git a/lib/managers/GroupsManager.dart b/lib/managers/GroupsManager.dart index 3e29194..0d63624 100644 --- a/lib/managers/GroupsManager.dart +++ b/lib/managers/GroupsManager.dart @@ -1,7 +1,6 @@ - // Singleton to manage Users -import 'package:trovami/core/Group.dart'; -import 'package:trovami/core/User.dart'; +import 'package:trovami/models/Group.dart'; +import 'package:trovami/models/User.dart'; class GroupsManager { // Map _items = new LinkedHashMap(); @@ -16,10 +15,9 @@ class GroupsManager { GroupsManager._internal(); - List users=new List(); + List users = new List(); Group currentGroup() { return _currentGroup; } - } diff --git a/lib/managers/UsersManager.dart b/lib/managers/UsersManager.dart index 6c6812c..7906708 100644 --- a/lib/managers/UsersManager.dart +++ b/lib/managers/UsersManager.dart @@ -1,6 +1,5 @@ - // Singleton to manage Users -import 'package:trovami/core/User.dart'; +import 'package:trovami/models/User.dart'; class UsersManager { // Map _items = new LinkedHashMap(); @@ -13,6 +12,5 @@ class UsersManager { UsersManager._internal(); - List users=new List(); - + List users = new List(); } diff --git a/lib/model/userModel.dart b/lib/managers/userModel.dart similarity index 61% rename from lib/model/userModel.dart rename to lib/managers/userModel.dart index e6d92fc..e85b374 100644 --- a/lib/model/userModel.dart +++ b/lib/managers/userModel.dart @@ -1,13 +1,8 @@ - - import 'package:flutter/cupertino.dart'; -import 'package:trovami/core/User.dart'; +import 'package:trovami/models/User.dart'; class UserModel extends ChangeNotifier { final User _currentUser = User(); - void signUp(User user){ - - } - -} \ No newline at end of file + void signUp(User user) {} +} diff --git a/lib/models/Group.dart b/lib/models/Group.dart new file mode 100644 index 0000000..6b122f6 --- /dev/null +++ b/lib/models/Group.dart @@ -0,0 +1,16 @@ +import 'package:trovami/models/User.dart'; + +class Group { + Group({this.groupname, this.groupmembers}); + String groupname = ""; + List groupmembers = []; + + Group.fromJson(Map value) { + groupname = value["groupname"]; +// print("value of members:${value["members"]}"); + groupmembers = value["members"]; + } + Map toJson() { + return {"groupname": groupname, "members": groupmembers}; + } +} diff --git a/lib/core/Location.dart b/lib/models/Location.dart similarity index 100% rename from lib/core/Location.dart rename to lib/models/Location.dart diff --git a/lib/core/User.dart b/lib/models/User.dart similarity index 100% rename from lib/core/User.dart rename to lib/models/User.dart diff --git a/lib/core/UserLocation.dart b/lib/models/UserLocation.dart similarity index 100% rename from lib/core/UserLocation.dart rename to lib/models/UserLocation.dart diff --git a/lib/views/screens/groupdetails.dart b/lib/views/screens/groupdetails.dart new file mode 100644 index 0000000..842f76d --- /dev/null +++ b/lib/views/screens/groupdetails.dart @@ -0,0 +1,317 @@ +import 'dart:convert'; + +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter/rendering.dart'; +import 'package:trovami/views/screens/homepage.dart'; +import 'package:trovami/helpers/httpClient/httpClient.dart'; + +import 'package:trovami/views/widgets/InputTextField.dart'; +import 'package:trovami/managers/GroupsManager.dart'; +import 'package:trovami/models/Group.dart'; +import 'package:trovami/models/User.dart'; +import 'signinpage.dart'; +import 'package:trovami/helpers/functionsForFirebaseApiCalls.dart'; + +//var httpClient = createHttpClient(); +// String _selectedChoice=""; +var Json = const JsonCodec(); +var groupName = ""; +Color textFieldColor = const Color.fromRGBO(0, 0, 0, 0.2); +const jsonCodec = const JsonCodec(reviver: _reviver); +const jsonCodec1 = const JsonCodec(reviver: _reviver1); + +TextStyle textStyle = new TextStyle( + color: const Color.fromRGBO(0, 0, 0, 0.9), + fontSize: 16.0, + fontWeight: FontWeight.normal); + +ThemeData appTheme = new ThemeData( + hintColor: Colors.white, +); + +_reviver(key, value) { + if (key != null && value is Map && key.contains('-')) { + return new User.fromJson(value); + } + return value; +} + +_reviver1(key, value) { + if (key != null && value is Map && key.contains('-')) { + return new Group.fromJson(value); + } + return value; +} + +class AddGroup extends StatefulWidget { + dynamic users; + AddGroup({this.users}); + @override + AddGroupstate createState() => new AddGroupstate(users: users); +} + +class AddGroupstate extends State { + dynamic users; + AddGroupstate({this.users}); + final GlobalKey _scaffoldKeySecondary1 = + new GlobalKey(); + final GlobalKey _groupformKey = new GlobalKey(); + + bool _autovalidate1 = false; + List userstoShowGrpDetailsPage = new List(); + List children1 = new List(); + List members = []; + int count = 0; + + void showInSnackBar(String value) { + _scaffoldKeySecondary1.currentState + .showSnackBar(new SnackBar(content: new Text(value))); + } + + String checkifnotnull(String value) { + if (value.isEmpty) { + return 'Groupname must not be empty'; + } + return null; + } + + _handleSubmitted() async { + var httpClient = HttpClientFireBase(); + final FormState form = _groupformKey.currentState; + form.save(); + User loggedInMember = new User(); + loggedInMember.EmailId = loggedinUser; + loggedInMember.locationShare = false; + for (var i = 0; i < members.length; i++) { + GroupsManager().currentGroup().groupmembers.add(members[i]); + } + loggedInMember.name = loggedInUsername; + GroupsManager().currentGroup().groupmembers.add(loggedInMember); + for (var i = 0; + i < GroupsManager().currentGroup().groupmembers.length; + i++) { +// final Map resstring = await getUsers(); + + users.value.forEach((k, v) async { + if (v["emailid"] == + GroupsManager().currentGroup().groupmembers[i].EmailId) { + print("v['groupsIamin'] : ${v["groupsIamin"]}"); + if (v["groupsIamin"] == null) { + List groupsIamin = []; + groupsIamin.add(GroupsManager().currentGroup().groupname); + var groupsIaminjson = jsonCodec.encode(groupsIamin); + await httpClient.put( + url: + 'https://trovami-bcd81.firebaseio.com/users/${k}/groupsIamin.json?', + body: groupsIaminjson); + } else { + var response2 = await getUserById(k); + + List resmap = []; + resmap.addAll(response2.value["groupsIamin"]); + print("resmap: ${resmap}"); + + resmap.add(GroupsManager().currentGroup().groupname); + var groupsIaminjson = jsonCodec.encode(resmap); + var response1 = await httpClient.put( + url: + 'https://trovami-bcd81.firebaseio.com/users/${k}/groupsIamin.json?', + body: groupsIaminjson); + } + } + }); + } + var groupjson = jsonCodec1.encode(GroupsManager().currentGroup()); + var url = "https://trovami-bcd81.firebaseio.com/groups.json"; + await httpClient.post(url: url, body: groupjson); +// Navigator.of(context).pushReplacement( +// MaterialPageRoute( +// builder: (context) => Homepagelayout(users: users), +// ),); + Navigator.of(context).pop(); +// await Navigator.of(context).pushReplacementNamed('/b'); + } + + void _select(User user) { + members.add(user); + for (var i = 0; i < userstoShowGrpDetailsPage.length; i++) { + if (userstoShowGrpDetailsPage[i].EmailId == user.EmailId) { + userstoShowGrpDetailsPage.removeAt(i); + } + } + setState(() { +// TODO: Deprecate +// popflag=1; + userstoShowGrpDetailsPage = userstoShowGrpDetailsPage; + count = count + 1; + }); + } + + getusers() { + users.value.forEach((k, v) { + User usertoshow = new User(); + usertoshow.name = v["name"]; + usertoshow.EmailId = v["emailid"]; + usertoshow.locationShare = false; + if (usertoshow.EmailId == loggedinUser) { + } else { + userstoShowGrpDetailsPage.add(usertoshow); + } + }); + } + + @override + void initState() => getusers(); + + @override + Widget build(BuildContext context) { + if (members.isNotEmpty) { + children1 = + new List.generate(count, (int i) => new memberlist(members[i].name)); + } + + return new Scaffold( + key: _scaffoldKeySecondary1, + body: new Form( + autovalidate: true, + key: _groupformKey, + child: new ListView( + padding: const EdgeInsets.symmetric(horizontal: 16.0), + children: [ + new Container( + child: new Container( + child: new Text( + "Add a Group", + style: new TextStyle( + fontSize: 20.0, fontWeight: FontWeight.bold), + textAlign: TextAlign.center, + ), + padding: const EdgeInsets.only(bottom: 20.0), + ), + padding: const EdgeInsets.only(top: 50.0), + decoration: new BoxDecoration( + border: new Border( + bottom: new BorderSide(width: 0.0, color: Colors.brown[200]), + ), + ), + ), + new Container( + child: new Container( + child: new InputField( + hintText: "Groupname", + obscureText: false, + textInputType: TextInputType.text, + textStyle: textStyle, + textFieldColor: textFieldColor, + icon: Icons.group, + validateFunction: checkifnotnull, + iconColor: Colors.grey, + bottomMargin: 20.0, + onSaved: (String value) { + GroupsManager().currentGroup().groupname = value; + GroupsManager().currentGroup().groupmembers = + new List(); + }), + padding: const EdgeInsets.only( + bottom: 15.0, top: 0.0, right: 20.0), + ), + padding: const EdgeInsets.only(top: 30.0)), + new Row( + children: [ + new Container( + child: new Text( + "Add a member:", + style: new TextStyle( + fontSize: 16.0, fontWeight: FontWeight.bold), + ), + padding: new EdgeInsets.only(left: 13.0)), + new Container( + child: new CircleAvatar( + child: new PopupMenuButton( + icon: new Icon(Icons.add), + onSelected: _select, + itemBuilder: (BuildContext context) => + userstoShowGrpDetailsPage + .map((User usertoshow) => + new PopupMenuItem( + value: usertoshow, + child: new Text(usertoshow.name), + )) + .toList()), + backgroundColor: const Color.fromRGBO(0, 0, 0, 0.2), + ), + padding: const EdgeInsets.only(left: 50.0)), + ], + ), + new Column( + children: children1, + ), + new Row( + children: [ + new Container( + alignment: Alignment.bottomCenter, + child: new FloatingActionButton( + onPressed: _handleSubmitted, + child: new Icon(Icons.check), + ), + padding: const EdgeInsets.only(top: 50.0, left: 100.0), + ), + new Container( + child: new FloatingActionButton( + onPressed: () { + Navigator.of(context).pushReplacement( + MaterialPageRoute( + builder: (context) => Homepage(users: users), + ), + ); + }, + child: new Icon(Icons.clear), + heroTag: null, + ), + padding: const EdgeInsets.only(top: 50.0, left: 50.0), + ), + ], + ), + ], + ), + ), + ); + } +} + +class memberlist extends StatelessWidget { + final String mem; + memberlist(this.mem); + + @override + Widget build(BuildContext context) => new Container( + child: new Column( + children: [ + new Row( + children: [ + new CircleAvatar( + child: new Icon(Icons.person), + backgroundColor: const Color.fromRGBO(0, 0, 0, 0.2), + ), + new Container( + child: new Text( + "${mem}", + style: new TextStyle(fontSize: 20.0), + ), + padding: new EdgeInsets.only(left: 20.0)), + ], + ), + ], + ), + padding: new EdgeInsets.only(left: 10.0, top: 5.0, bottom: 5.0), + decoration: new BoxDecoration( + border: new Border( + bottom: new BorderSide( + width: 0.0, + color: const Color.fromRGBO(0, 0, 0, 0.2), + ), + ), + ), + ); +} diff --git a/lib/views/screens/groupstatus.dart b/lib/views/screens/groupstatus.dart new file mode 100644 index 0000000..487e26c --- /dev/null +++ b/lib/views/screens/groupstatus.dart @@ -0,0 +1,424 @@ +import 'dart:async'; +import 'dart:convert'; +import 'dart:core'; + +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'package:flutter/services.dart'; +import 'package:firebase_database/firebase_database.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/foundation.dart'; +import 'package:trovami/helpers/functionsForFirebaseApiCalls.dart'; +import 'package:http/http.dart' as http; +import 'package:location/location.dart'; + +import 'package:trovami/helpers/RoutesHelper.dart'; +import 'homepage.dart'; +import 'package:trovami/helpers/httpClient/httpClient.dart'; +import 'package:trovami/models/Group.dart'; +import 'package:trovami/models/User.dart'; +import 'package:trovami/models/UserLocation.dart'; +import 'signinpage.dart'; + +final userref = FirebaseDatabase.instance.reference().child('users'); // new +final groupref = FirebaseDatabase.instance.reference().child('groups'); // new +//var httpClient = createHttpClient(); +const jsonCodec1 = const JsonCodec(reviver: _reviver1); +const jsonCodec = const JsonCodec(reviver: _reviver); +const locationJsonCodec = const JsonCodec(reviver: _locationReviver); +List currentLocations = new List(); +bool locationShare; +Timer t1; +bool mapflag; +var temp1 = []; +var length; +bool togglestate = false; + +_reviver(key, value) { + if (key != null && value is Map) { + return new User.fromJson(value); + } else + return value; +} + +_locationReviver(key, value) { + if (key != null) { + return new UserLocation.fromJson(value); + } else + return value; +} + +_reviver1(key, value) { + if (key != null && value is Map) { + return new Group.fromJson(value); + } else + return value; +} + +toggleMemberLocation(bool newValue) async { + HttpClientFireBase httpClient = HttpClientFireBase(); + + final DataSnapshot groupresmap = await getGroups(); + Map grps = groupresmap.value as Map; + var location = new Location(); + Stream locationStream = location.onLocationChanged(); + StreamSubscription locationSub; + grps.forEach((k, v) async { + if (v["groupname"] == groupStatusGroupname) { + for (var i = 0; i < v["members"].length; i++) { + var response1 = await http.get( + "https://trovami-bcd81.firebaseio.com/groups/${k}/members/${i}.json"); +// print(response1); + Map result1 = jsonCodec.decode(response1.body); + if (result1["emailid"] == loggedinUser) { + if (result1["locationShare"] == true) { + if (locationSub != null) locationSub.cancel(); + locationShare = false; + } else { + LocationData currLoc; + + try { + currLoc = await location.getLocation(); + await updateDatabaseLocation(currLoc); + locationSub = + locationStream.listen((LocationData currentLocation) async { + await updateDatabaseLocation(currentLocation); + }); + } on PlatformException catch (e) { + if (e.code == 'PERMISSION_DENIED') { + print('Permission denied'); + } + currLoc = null; + } + locationShare = true; + } + String result2 = jsonCodec.encode(locationShare); + await httpClient.put( + url: + "https://trovami-bcd81.firebaseio.com/groups/${k}/members/${i}/locationShare.json", + body: result2); + } + } + } + }); +} + +updateDatabaseLocation(currLoc) async { + HttpClientFireBase httpClient = HttpClientFireBase(); + +// Platform messages may fail, so we use a try/catch PlatformException. + + var loggedInuserKey = ""; + var updatedLocation; + String locUpdated; + DataSnapshot usersDataSnap = await getUsers(); + Map usersMap = usersDataSnap.value as Map; + usersMap.forEach((k, v) { + if (v["emailid"] == loggedinUser) { + loggedInuserKey = k; + updatedLocation = { + "latitude": currLoc.latitude, + "longitude": currLoc.longitude + }; + } + }); + if (loggedInuserKey != "") { + locUpdated = jsonCodec.encode(updatedLocation); + await httpClient.put( + url: + "https://trovami-bcd81.firebaseio.com/users/${loggedInuserKey}/location.json", + body: locUpdated); + } + final DataSnapshot groupresmap = await getGroups(); + Map grps = groupresmap.value as Map; + + grps.forEach((k, v) async { + if (v["groupname"] == groupStatusGroupname) { + for (var i = 0; i < v["members"].length; i++) { + var response1 = await http.get( + "https://trovami-bcd81.firebaseio.com/groups/${k}/members/${i}.json"); + print("response1->${response1}"); + Map result1 = jsonCodec.decode(response1.body); + if (result1["emailid"] == loggedinUser) { + if (result1["locationShare"] == true || result1["location"] == null) { + await httpClient.put( + url: + "https://trovami-bcd81.firebaseio.com/groups/${k}/members/${i}/location.json", + body: locUpdated); + } + } + } + } + }); +} + +class GroupStatusLayout extends StatefulWidget { + @override + GroupStatusLayoutState createState() => new GroupStatusLayoutState(); +} + +class GroupStatusLayoutState extends State { + @override + Widget build(BuildContext context) => new Scaffold( + body: new Container( + child: new GroupStatus(), + ), + ); +} + +class GroupStatus extends StatefulWidget { + @override + GroupStatusState createState() => new GroupStatusState(); +} + +class GroupStatusState extends State { + var getMemFlag = 0; + final GlobalKey _refreshIndicatorKey = + new GlobalKey(); + final GlobalKey _scaffoldKeySecondary2 = + new GlobalKey(); + List children = new List(); + List memberstoShowHomepage1 = new List(); + + getgrpmembers(String grpkey, int i) async { + var response1 = await getAGroupAndAMember(grpkey, i); +// Map result1 = jsonCodec.decode(response1.body); + print("response1 : ${i}"); + + memberstoShowHomepage1.add(response1.value[i]["name"]); + print("memberstoShowHomepage1 : ${memberstoShowHomepage1}"); + + if (response1.value[i]["emailid"] == loggedinUser) { + setState(() { + togglestate = response1.value[i]["locationShare"]; + locationShare = response1.value[i]["locationShare"]; + }); + } + } + + Future getmembers1() async { +// if(nouserflag==1){ +// showInSnackBar("No users online"); +// } + String grpkey; + var grpmemcount; + + _refreshIndicatorKey.currentState?.show(); + + final dynamic groupresmap = await getGroups(); + +// print("grrrppr: ${groupresmap.value}"); + groupresmap.value.forEach((k, v) { + if (v["groupname"] == groupStatusGroupname) { + print("v: ${v["groupname"]}"); + grpkey = k; + grpmemcount = v["members"].length; + } + }); + print("grpmemcount : ${grpmemcount}"); + for (var i = 0; i < grpmemcount; i++) { + getgrpmembers(grpkey, i); + } + setState(() { + memberstoShowHomepage1 = memberstoShowHomepage1; +// memberstoShowHomepage1=dedup(memberstoShowHomepage1); + }); + } + + List dedup(List list) { + List list1 = new List(); + Set seen = new Set(); + int unique = 0; + for (int i = 0; i < list.length; i++) { + String element = list[i]; + if (!seen.contains(element)) { + seen.add(element); + list1.insert(unique++, element); + } + } + return list1; + } + + void showInSnackBar(String value) { + _scaffoldKeySecondary2.currentState + .showSnackBar(new SnackBar(content: new Text(value))); + } + + @override + void initState() { + super.initState(); + getmembers1(); + } + + @override + Widget build(BuildContext context) { + children = new List.generate(memberstoShowHomepage1.length, + (int i) => new memberlist(memberstoShowHomepage1[i])); + return new RefreshIndicator( + key: _refreshIndicatorKey, + onRefresh: getmembers1, + child: new Scaffold( + key: _scaffoldKeySecondary2, + appBar: new AppBar( + leading: defaultTargetPlatform == TargetPlatform.iOS + ? new CupertinoButton( + child: new Icon(Icons.keyboard_backspace), + onPressed: () { + Navigator.of(context).pop(); + }, + ) + : new FlatButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: new Icon(Icons.keyboard_backspace)), + actions: [ + new FlatButton( + onPressed: () async { + await Navigator.of(context).pushNamed(ROUTE_MAP); + }, + child: new Text("Show Map")), + ], + flexibleSpace: new FlexibleSpaceBar( + title: new Text('Group Status'), + ), + ), + body: new Container( + child: new ListView( + children: [ + Container( + margin: const EdgeInsets.all(10.0), + color: Colors.red, + height: 100, + child: Center( + child: Text( + "DO NOT USE REAL LOCATION", + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + ), + ), + ), + new Row( + children: [ + new Container( + child: new Text("Share Live Location:", + style: new TextStyle(fontSize: 20.0)), + padding: const EdgeInsets.only(left: 10.0), + ), + new Container( + child: defaultTargetPlatform == TargetPlatform.iOS + ? new CupertinoSwitch( + value: togglestate, + onChanged: (bool newValue) { + toggleMemberLocation(newValue); + setState(() { + togglestate = newValue; + }); + }, + ) + : new Switch( + value: togglestate, + onChanged: (bool newValue) { + toggleMemberLocation(newValue); + setState(() { + togglestate = newValue; + }); + }, + ), + ), + ], + ), + new Container( + child: new Column( + children: [ + new Row( + children: [ + new CircleAvatar( + child: new Icon(Icons.group), + backgroundColor: const Color.fromRGBO(0, 0, 0, 0.2), + ), + new Expanded( + child: new Container( + child: new Text( + "Group Name: ${groupStatusGroupname}", + style: new TextStyle( + fontSize: 20.0, + fontWeight: FontWeight.bold), + ), + padding: const EdgeInsets.only(left: 20.0)), + ), + ], + ), + ], + ), + padding: + const EdgeInsets.only(left: 10.0, top: 5.0, bottom: 5.0), + decoration: new BoxDecoration( + border: new Border( + bottom: new BorderSide( + width: 1.0, + color: const Color.fromRGBO(0, 0, 0, 0.2), + style: BorderStyle.solid), + ), + ), + ), + new Container( + child: new Text( + "Members :", + style: new TextStyle(fontSize: 20.0), + ), + padding: + const EdgeInsets.only(left: 10.0, top: 10.0, bottom: 10.0), + decoration: new BoxDecoration( + border: new Border( + bottom: new BorderSide( + width: 0.0, + color: const Color.fromRGBO(0, 0, 0, 0.2), + style: BorderStyle.solid), + ), + ), + ), + new Column(children: children), + ], + ), + padding: const EdgeInsets.only(top: 10.0), + ), + ), + ); + } +} + +class memberlist extends StatelessWidget { + final String mem; + memberlist(this.mem); + + @override + Widget build(BuildContext context) => new Container( + child: new Column( + children: [ + new Row( + children: [ + new CircleAvatar( + child: new Icon(Icons.person), + backgroundColor: const Color.fromRGBO(0, 0, 0, 0.2), + ), + new Container( + child: new Text( + "${mem}", + style: new TextStyle(fontSize: 20.0), + ), + padding: new EdgeInsets.only(left: 20.0)), + ], + ), + ], + ), + padding: new EdgeInsets.only(left: 10.0, top: 5.0, bottom: 5.0), + decoration: new BoxDecoration( + border: new Border( + bottom: new BorderSide( + width: 0.0, + color: const Color.fromRGBO(0, 0, 0, 0.2), + ), + ), + ), + ); +} diff --git a/lib/views/screens/homepage.dart b/lib/views/screens/homepage.dart new file mode 100644 index 0000000..2e6da78 --- /dev/null +++ b/lib/views/screens/homepage.dart @@ -0,0 +1,202 @@ +import 'dart:convert'; + +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'package:firebase_database/firebase_database.dart'; +import 'package:firebase_database/ui/firebase_animated_list.dart'; + +import 'groupdetails.dart'; +import 'package:trovami/helpers/RoutesHelper.dart'; +import 'package:trovami/models/Group.dart'; +import 'package:trovami/models/User.dart'; +import 'signinpage.dart'; + +var temp = []; +String pageName = ''; +var groupStatusGroupname = ''; +double animValue = 0.0; +List membersToShow = new List(); +List groupNamesToShow = new List(); +List groupsToShow = new List(); +Group grps = new Group(); +const jsonCodec2 = const JsonCodec(); +List membersToShowHomepage = new List(); +final groupref = FirebaseDatabase.instance.reference().child('groups'); +final usrref = FirebaseDatabase.instance.reference().child('users'); +//var _httpClient = createHttpClient(); +const _jsonCodec = const JsonCodec(reviver: _reviver); +var reference; + +bool _first = true; + +_reviver(key, value) { + if (key != null && value is Map && key.contains('-')) { + return new User.fromJson(value); + } + return value; +} + +class Homepagelayout extends StatelessWidget { + dynamic users; + Homepagelayout({this.users}); + @override + Widget build(BuildContext context) { + final Size screenSize = MediaQuery.of(context).size; + + return new Container( + child: new Homepage(users: users), + width: screenSize.width, + height: screenSize.height, + ); + } +} + +class groupBox extends StatelessWidget { + groupBox({this.snapshot, this.animation, this.index}); + final DataSnapshot snapshot; + final Animation animation; + final int index; + + @override + Widget build(BuildContext context) { +// print(snapshot.value); + return new SizeTransition( + sizeFactor: new CurvedAnimation(parent: animation, curve: Curves.easeOut), + axisAlignment: 0.0, + child: new Container( + margin: const EdgeInsets.symmetric(vertical: 10.0), + child: new Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + new Container( + margin: const EdgeInsets.only(right: 16.0, bottom: 16.0), + child: new CircleAvatar( + child: new IconButton( + icon: new Icon(Icons.group), onPressed: null), + backgroundColor: const Color.fromRGBO(0, 0, 0, 0.2), + ), + ), + new FlatButton( + onPressed: () { + groupStatusGroupname = snapshot.value; + RoutesHelper.pushRoute(context, ROUTE_GROUP); + }, + child: new Text( + snapshot.value, + )) + ], + ), + decoration: new BoxDecoration( + border: new Border( + bottom: new BorderSide( + width: 1.0, color: const Color.fromRGBO(0, 0, 0, 0.2)), + ), + ), + ), + ); + } +} + +class Homepage extends StatefulWidget { + dynamic users; + Homepage({this.users}); + @override + HomePageState createState() => new HomePageState(users: users); +} + +class HomePageState extends State with TickerProviderStateMixin { + dynamic users; + var userkey; + + HomePageState({this.users}); + + getgroups() { + //loggedinuser="m@g.com"; + //loggedinusername="man"; + +// print("init"); + groupsToShow = new List(); + +// _refreshIndicatorKey.currentState?.show(); + users.value.forEach((k, v) { + if (v["emailid"] == loggedinUser) { + userkey = k; + } + }); + + setState(() { + reference = usrref.child(userkey).child("groupsIamin"); +// groupsToShow = groupsToShow; + _first = true; + }); + } + + @override + void initState() => getgroups(); + + @override + Widget build(BuildContext context) { + return new Scaffold( + appBar: new AppBar( + leading: new Container(), + actions: [ + new IconButton( + icon: new Icon(Icons.group_add), + onPressed: () async { + Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => AddGroup(users: users), + ), + ); + }, + iconSize: 42.0, + ), + new IconButton( + icon: new Icon(Icons.person), + onPressed: () { + //TODO + Animation alpha; + + final AnimationController controller = new AnimationController( + duration: const Duration(milliseconds: 500), vsync: this); + alpha = new Tween(begin: 0.0, end: 255.0).animate(controller) + ..addListener(() { +// _scaffoldkeyhomepage.currentState.setState(() { +// _first=false; +// +// }); +// _scaffoldkeyhomepage.currentState.setState(() { +// animValue=alpha.value; +// +// }); + }); + controller.forward(); + }, + iconSize: 35.0, + ), + ], + title: new Text('Groups'), + ), + body: new Column(children: [ + new Flexible( + child: ((reference != null) + ? new FirebaseAnimatedList( + //new + query: reference, //new + sort: (a, b) => b.key.compareTo(a.key), //new + padding: new EdgeInsets.all(8.0), //new + reverse: false, //new + itemBuilder: (_, DataSnapshot snapshot, + Animation animation, index) { + return new groupBox( + snapshot: snapshot, + animation: animation, + index: index, + ); + }, + ) + : new Container()), //new + ), + ])); + } +} diff --git a/lib/map.dart b/lib/views/screens/map.dart similarity index 91% rename from lib/map.dart rename to lib/views/screens/map.dart index 3570bb9..4363232 100644 --- a/lib/map.dart +++ b/lib/views/screens/map.dart @@ -1,10 +1,7 @@ import 'dart:convert'; -import 'dart:math'; import 'dart:async'; import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; -import 'package:flutter/services.dart'; //import 'package:map_view/camera_position.dart'; //import 'package:map_view/location.dart'; //import 'package:map_view/map_options.dart'; @@ -14,14 +11,10 @@ import 'package:flutter/services.dart'; import 'package:firebase_database/firebase_database.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:http/http.dart' as http; -import 'package:trovami/groupdetails.dart'; -import 'groupstatus.dart'; import 'homepage.dart'; -import 'httpClient/httpClient.dart'; -import 'main.dart'; -import 'signinpage.dart'; -import 'functionsForFirebaseApiCalls.dart'; +import 'package:trovami/helpers/httpClient/httpClient.dart'; +import 'package:trovami/helpers/functionsForFirebaseApiCalls.dart'; final userref = FirebaseDatabase.instance.reference().child('users'); // new final groupref = FirebaseDatabase.instance.reference().child('groups'); @@ -40,7 +33,8 @@ class MapSample extends StatefulWidget { class MapSampleState extends State { Completer _controller = Completer(); - Map markers = {}; // CLASS MEMBER, MAP OF MARKS + Map markers = + {}; // CLASS MEMBER, MAP OF MARKS Map _add(locData) { var markerIdVal = locData["emailid"]; @@ -59,31 +53,34 @@ class MapSampleState extends State { }, ); - // adding a new marker to map - markers[markerId] = marker; - return markers; + // adding a new marker to map + markers[markerId] = marker; + return markers; } + StreamSubscription _getChangesSubscription; @override void initState() { listenTochanges(); } + @override void dispose() { _getChangesSubscription?.cancel(); print("Groups listener disposed"); super.dispose(); } - void listenTochanges(){ + + void listenTochanges() { print("Groups lister inistialised"); - _getChangesSubscription = groupref.onChildChanged.listen((event) async{ - if(groupStatusGroupname == event.snapshot.value["groupname"]){ + _getChangesSubscription = groupref.onChildChanged.listen((event) async { + if (groupStatusGroupname == event.snapshot.value["groupname"]) { List groupMems = event.snapshot.value["members"]; print("groupMems -> ${groupMems}"); - for(var grpmem in groupMems){ + for (var grpmem in groupMems) { print("mem -> ${grpmem["locationShare"]}"); - if(grpmem["locationShare"]==true) { + if (grpmem["locationShare"] == true) { for (var i = 0; i < widget.currentLocations.length; i++) { if (widget.currentLocations[i]["emailid"] == grpmem["emailid"]) { widget.currentLocations[i] = { @@ -95,10 +92,7 @@ class MapSampleState extends State { } } } - setState(() { - - }); - + setState(() {}); } }); } @@ -117,15 +111,15 @@ class MapSampleState extends State { "No Live location sharing users, Go back and try again"), ); } else { - widget.currentLocations.forEach((curr){ - markers = _add(curr); - }); + widget.currentLocations.forEach((curr) { + markers = _add(curr); + }); return GoogleMap( mapType: MapType.normal, initialCameraPosition: CameraPosition( - target: LatLng(snapshot.data[0]["latitude"], snapshot.data[0]["longitude"]), + target: LatLng(snapshot.data[0]["latitude"], + snapshot.data[0]["longitude"]), zoom: 14.4746, - ), onMapCreated: (GoogleMapController controller) { _controller.complete(controller); @@ -157,31 +151,37 @@ class MapSampleState extends State { print(result1["emailid"]); print(result1["locationShare"]); if (result1["locationShare"] == true) { - - if(widget.currentLocations.length == 0) { - widget.currentLocations.add({"latitude":result1["location"]["latitude"],"longitude":result1["location"]["longitude"],"emailid":result1["emailid"]}); + if (widget.currentLocations.length == 0) { + widget.currentLocations.add({ + "latitude": result1["location"]["latitude"], + "longitude": result1["location"]["longitude"], + "emailid": result1["emailid"] + }); print("here 1 ${widget.currentLocations}"); - - }else{ + } else { var flag = 0; for (var i = 0; i < widget.currentLocations.length; i++) { print("check hereee ${result1["emailid"]}"); if (widget.currentLocations[i]["emailid"] == result1["emailid"]) { - flag=1; + flag = 1; print("curr loc ${widget.currentLocations}"); print("${result1["emailid"]}"); widget.currentLocations.removeAt(i); - widget.currentLocations.add({"latitude":result1["location"]["latitude"],"longitude":result1["location"]["longitude"],"emailid":result1["emailid"]}); - + widget.currentLocations.add({ + "latitude": result1["location"]["latitude"], + "longitude": result1["location"]["longitude"], + "emailid": result1["emailid"] + }); } } - if(flag==0){ - widget.currentLocations.add({"latitude":result1["location"]["latitude"],"longitude":result1["location"]["longitude"],"emailid":result1["emailid"]}); + if (flag == 0) { + widget.currentLocations.add({ + "latitude": result1["location"]["latitude"], + "longitude": result1["location"]["longitude"], + "emailid": result1["emailid"] + }); } - } - - } else { print("works till here"); @@ -197,7 +197,6 @@ class MapSampleState extends State { return widget.currentLocations; } - // Future _goToTheLake() async { // final GoogleMapController controller = await _controller.future; // controller.animateCamera(CameraUpdate.newCameraPosition(_kLake)); diff --git a/lib/signinpage.dart b/lib/views/screens/signinpage.dart similarity index 95% rename from lib/signinpage.dart rename to lib/views/screens/signinpage.dart index 6e2b162..7f2fb4c 100644 --- a/lib/signinpage.dart +++ b/lib/views/screens/signinpage.dart @@ -1,23 +1,20 @@ -import 'dart:convert'; - import 'package:firebase_database/firebase_database.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; import 'package:google_sign_in/google_sign_in.dart'; import 'package:trovami/helpers/RoutesHelper.dart'; -import 'package:trovami/httpClient/httpClient.dart'; +import 'package:trovami/helpers/httpClient/httpClient.dart'; //import 'package:flutter_test/flutter_test.dart'; import 'package:firebase_auth/firebase_auth.dart'; -import 'InputTextField.dart'; -import 'Roundedbutton.dart'; -import 'Strings.dart'; -import 'main.dart'; -import 'core/User.dart'; +import 'package:trovami/views/widgets/InputTextField.dart'; +import 'package:trovami/views/widgets/Roundedbutton.dart'; +import 'package:trovami/helpers/Strings.dart'; +import 'package:trovami/models/User.dart'; import 'signuppage.dart'; import 'homepage.dart'; -import 'functionsForFirebaseApiCalls.dart'; +import 'package:trovami/helpers/functionsForFirebaseApiCalls.dart'; final googleSignIn = new GoogleSignIn(); String loggedinUser; @@ -47,6 +44,8 @@ ScrollController scrollController = new ScrollController(); //} class SignInForm extends StatefulWidget { + SignInForm({Key key}) : super(key: Key('sign_in_form')); + @override SigninFormState createState() => new SigninFormState(); } @@ -168,9 +167,7 @@ class SigninFormState extends State _isgooglesigincomplete = true; }); } - } - } _handleSubmitted() async { @@ -209,8 +206,7 @@ class SigninFormState extends State setGoogleSigninListener() { _googleSignIn.onCurrentUserChanged - .listen((GoogleSignInAccount account) async { - }); + .listen((GoogleSignInAccount account) async {}); _googleSignIn.signInSilently(); } @@ -331,7 +327,7 @@ class SigninFormState extends State buttonColor: const Color.fromRGBO(100, 100, 100, 1.0), ), -/// UNCOMMENT IF YOU WANT TO SIGNIN THROUGH GOOGLE + /// UNCOMMENT IF YOU WANT TO SIGNIN THROUGH GOOGLE // (_isgooglesigincomplete // ? new FloatingActionButton( // child: diff --git a/lib/signuppage.dart b/lib/views/screens/signuppage.dart similarity index 74% rename from lib/signuppage.dart rename to lib/views/screens/signuppage.dart index ba52ea2..866562e 100644 --- a/lib/signuppage.dart +++ b/lib/views/screens/signuppage.dart @@ -6,13 +6,13 @@ import 'package:flutter/rendering.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:provider/provider.dart'; -import 'package:trovami/httpClient/httpClient.dart'; -import 'package:trovami/model/userModel.dart'; +import 'package:trovami/helpers/httpClient/httpClient.dart'; +import 'package:trovami/managers/userModel.dart'; -import 'Roundedbutton.dart'; -import 'functionsForFirebaseApiCalls.dart'; -import 'managers/UsersManager.dart'; -import 'core/User.dart'; +import 'package:trovami/views/widgets/Roundedbutton.dart'; +import 'package:trovami/helpers/functionsForFirebaseApiCalls.dart'; +import 'package:trovami/managers/UsersManager.dart'; +import 'package:trovami/models/User.dart'; bool userexists = false; User user1 = new User(); @@ -25,7 +25,10 @@ _reviver(key, value) { return value; } -TextStyle textStyle = new TextStyle(color: const Color.fromRGBO(255, 255, 255, 0.4), fontSize: 16.0, fontWeight: FontWeight.bold); +TextStyle textStyle = new TextStyle( + color: const Color.fromRGBO(255, 255, 255, 0.4), + fontSize: 16.0, + fontWeight: FontWeight.bold); class SignupLayout extends StatefulWidget { @override @@ -34,15 +37,16 @@ class SignupLayout extends StatefulWidget { class SignupLayoutState extends State { @override - Widget build(BuildContext context) => defaultTargetPlatform == TargetPlatform.iOS - ? new CupertinoPageScaffold(child: new Signup() + Widget build(BuildContext context) => + defaultTargetPlatform == TargetPlatform.iOS + ? new CupertinoPageScaffold(child: new Signup() // ,navigationBar: new CupertinoNavigationBar(middle: new Text("Sign-up"),backgroundColor:const Color.fromRGBO(0, 0, 0, 0.7),), - ) - : new Scaffold( - body: new Container( - child: new Signup(), - ), - ); + ) + : new Scaffold( + body: new Container( + child: new Signup(), + ), + ); } class Signup extends StatefulWidget { @@ -51,19 +55,24 @@ class Signup extends StatefulWidget { } class signupstate extends State { - final GlobalKey _scaffoldKeySecondary = new GlobalKey(); + final GlobalKey _scaffoldKeySecondary = + new GlobalKey(); final GlobalKey _formKeySeondary = new GlobalKey(); - final GlobalKey> _passwordFieldKeySecondary = new GlobalKey>(); + final GlobalKey> _passwordFieldKeySecondary = + new GlobalKey>(); bool _autovalidate1 = false; bool _formWasEdited = false; final IconData mail = const IconData(0xe158, fontFamily: 'MaterialIcons'); - final IconData lock_outline = const IconData(0xe899, fontFamily: 'MaterialIcons'); - final IconData signupicon = const IconData(0xe316, fontFamily: 'MaterialIcons'); + final IconData lock_outline = + const IconData(0xe899, fontFamily: 'MaterialIcons'); + final IconData signupicon = + const IconData(0xe316, fontFamily: 'MaterialIcons'); void showInSnackBar(String value) { - _scaffoldKeySecondary.currentState.showSnackBar(new SnackBar(content: new Text(value))); + _scaffoldKeySecondary.currentState + .showSnackBar(new SnackBar(content: new Text(value))); } _handleSubmitted1() async { @@ -92,7 +101,9 @@ class signupstate extends State { if (userexists == false) { HttpClientFireBase httpClient = HttpClientFireBase(); - await httpClient.post(url: 'https://trovami-bcd81.firebaseio.com/users.json', body: userjson); + await httpClient.post( + url: 'https://trovami-bcd81.firebaseio.com/users.json', + body: userjson); } else { showInSnackBar('User already exits'); } @@ -110,8 +121,10 @@ class signupstate extends State { String _validatePassword(String value) { _formWasEdited = true; - final FormFieldState passwordField1 = _passwordFieldKeySecondary.currentState; - if (passwordField1.value == null || passwordField1.value.isEmpty) return 'Please choose a password.'; + final FormFieldState passwordField1 = + _passwordFieldKeySecondary.currentState; + if (passwordField1.value == null || passwordField1.value.isEmpty) + return 'Please choose a password.'; if (passwordField1.value != value) return 'Passwords don\'t match'; return null; } @@ -130,12 +143,17 @@ class signupstate extends State { children: [ new Container( child: new TextFormField( - decoration: new InputDecoration(hintText: 'Name', labelText: 'Name', icon: new Icon(Icons.person), labelStyle: textStyle), + decoration: new InputDecoration( + hintText: 'Name', + labelText: 'Name', + icon: new Icon(Icons.person), + labelStyle: textStyle), onSaved: (String value) { user1.name = value; }, ), - padding: const EdgeInsets.only(bottom: 15.0, top: 0.0, right: 20.0), + padding: + const EdgeInsets.only(bottom: 15.0, top: 0.0, right: 20.0), ), Container( padding: const EdgeInsets.only(top: 10.0, left: 30), @@ -172,7 +190,8 @@ class signupstate extends State { user1.password = value; }, ), - padding: const EdgeInsets.only(bottom: 15.0, top: 0.0, right: 20.0), + padding: const EdgeInsets.only( + bottom: 15.0, top: 0.0, right: 20.0), ), padding: const EdgeInsets.only(top: 10.0), ), @@ -187,14 +206,15 @@ class signupstate extends State { obscureText: true, validator: _validatePassword, ), - padding: const EdgeInsets.only(bottom: 15.0, top: 0.0, right: 20.0), + padding: const EdgeInsets.only( + bottom: 15.0, top: 0.0, right: 20.0), ), padding: const EdgeInsets.only(top: 10.0), ), Consumer(builder: (context, user, child) { return RoundedButton( buttonName: 'Sign-up', - onTap: (){ + onTap: () { user.signUp(user1); }, width: screenSize.width, @@ -206,7 +226,8 @@ class signupstate extends State { }), new Container( padding: const EdgeInsets.only(top: 20.0), - child: new Text('* indicates required field', style: Theme.of(context).textTheme.caption), + child: new Text('* indicates required field', + style: Theme.of(context).textTheme.caption), ), ], ), diff --git a/lib/views/screens/splash_screen.dart b/lib/views/screens/splash_screen.dart new file mode 100644 index 0000000..b417b8a --- /dev/null +++ b/lib/views/screens/splash_screen.dart @@ -0,0 +1,45 @@ +import 'package:flutter/material.dart'; +import 'package:trovami/helpers/Strings.dart'; +import 'package:trovami/helpers/RoutesHelper.dart'; + +class SplashScreen extends StatefulWidget { + SplashScreen({Key key}) : super(key: Key('splash_screen')); + @override + _SplashScreenState createState() => _SplashScreenState(); +} + +class _SplashScreenState extends State { + @override + void initState() { + super.initState(); + Future.delayed(Duration(seconds: 5), () { + RoutesHelper.pushRoute(context, '/login'); + }); + } + + @override + Widget build(BuildContext context) { + return Material( + child: Stack( + children: [ + Container( + height: MediaQuery.of(context).size.height, + child: Image.asset( + "assets/back.jpg", + fit: BoxFit.fitHeight, + ), + ), + Positioned( + top: MediaQuery.of(context).size.height * 0.25, + left: MediaQuery.of(context).size.width * 0.25, + child: Text( + Strings.appName, + textAlign: TextAlign.center, + style: new TextStyle(fontSize: 64.0, color: Colors.white), + ), + ), + ], + ), + ); + } +} diff --git a/lib/InputTextField.dart b/lib/views/widgets/InputTextField.dart similarity index 100% rename from lib/InputTextField.dart rename to lib/views/widgets/InputTextField.dart diff --git a/lib/Roundedbutton.dart b/lib/views/widgets/Roundedbutton.dart similarity index 100% rename from lib/Roundedbutton.dart rename to lib/views/widgets/Roundedbutton.dart diff --git a/pubspec.lock b/pubspec.lock index a42587d..57a9bb5 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,42 +7,42 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0-nullsafety.3" + version: "2.5.0" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.3" + version: "2.1.0" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.5" + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.3" + version: "1.2.0" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.3" + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0-nullsafety.5" + version: "1.15.0" cupertino_icons: dependency: "direct main" description: @@ -56,7 +56,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.3" + version: "1.2.0" firebase: dependency: transitive description: @@ -162,7 +162,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.3-nullsafety.3" + version: "0.6.3" location: dependency: "direct main" description: @@ -176,14 +176,14 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10-nullsafety.3" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.6" + version: "1.3.0" nested: dependency: transitive description: @@ -197,7 +197,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.3" + version: "1.8.0" pedantic: dependency: transitive description: @@ -237,56 +237,56 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.4" + version: "1.8.0" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.6" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.3" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.3" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.3" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19-nullsafety.6" + version: "0.2.19" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.5" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.5" + version: "2.1.0" sdks: dart: ">=2.12.0-0.0 <3.0.0" - flutter: ">=1.16.0 <2.0.0" + flutter: ">=1.16.0" diff --git a/test/widget_test.dart b/test/widget_test.dart deleted file mode 100644 index 989140c..0000000 --- a/test/widget_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility that Flutter provides. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:trovami/main.dart'; - -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. -// await tester.pumpWidget(MyApp()); - - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); - - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); - }); -} diff --git a/test/widget_tests/splash_screen_test.dart b/test/widget_tests/splash_screen_test.dart new file mode 100644 index 0000000..4c00f03 --- /dev/null +++ b/test/widget_tests/splash_screen_test.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:trovami/helpers/Strings.dart'; +import 'package:trovami/helpers/RoutesHelper.dart'; +import 'package:trovami/views/screens/splash_screen.dart'; + +void main() { + testWidgets( + 'Shows splash screen for a few seconds and Navigates to Log in page', + (WidgetTester tester) async { + await tester.pumpWidget( + new MaterialApp( + title: Strings.appName, + debugShowCheckedModeBanner: false, + home: SplashScreen(), + onGenerateRoute: RoutesHelper.provideRoute, + initialRoute: ROUTE_HOME, + ), + ); + expect(find.byKey(Key('splash_screen')), findsOneWidget); + await tester.pumpAndSettle(Duration(seconds: 4)); + expect(find.byKey(Key('sign_in_form')), findsOneWidget); + }); +}