#8 Merge logInSetUp with the main project

Fusionné
iwa-13 a fusionné 8 commits à partir de iwa-13/logInSignUp vers iwa-13/main il y a 3 ans

BIN
app/assets/communicate.png


BIN
app/assets/hello.png


BIN
app/assets/id-card.png


BIN
app/assets/teamlogo.png


BIN
app/assets/user.png


+ 1 - 0
app/ios/Flutter/Debug.xcconfig

@@ -1 +1,2 @@
+#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
 #include "Generated.xcconfig"

+ 1 - 0
app/ios/Flutter/Release.xcconfig

@@ -1 +1,2 @@
+#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
 #include "Generated.xcconfig"

+ 46 - 0
app/ios/Podfile

@@ -0,0 +1,46 @@
+# Uncomment this line to define a global platform for your project
+platform :ios, '10.0'
+
+# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
+ENV['COCOAPODS_DISABLE_STATS'] = 'true'
+
+project 'Runner', {
+  'Debug' => :debug,
+  'Profile' => :release,
+  'Release' => :release,
+}
+
+
+def flutter_root
+  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
+  unless File.exist?(generated_xcode_build_settings_path)
+    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
+  end
+
+  File.foreach(generated_xcode_build_settings_path) do |line|
+    matches = line.match(/FLUTTER_ROOT\=(.*)/)
+    return matches[1].strip if matches
+  end
+  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
+end
+
+require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
+
+flutter_ios_podfile_setup
+
+target 'Runner' do
+  use_frameworks!
+  use_modular_headers!
+
+  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
+  pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '8.15.0'
+
+end
+
+
+post_install do |installer|
+  installer.pods_project.targets.each do |target|
+    flutter_additional_ios_build_settings(target)
+  end
+end
+

+ 138 - 0
app/ios/Podfile.lock

@@ -0,0 +1,138 @@
+PODS:
+  - cloud_firestore (3.1.15):
+    - Firebase/Firestore (= 8.15.0)
+    - firebase_core
+    - Flutter
+  - Firebase/Auth (8.15.0):
+    - Firebase/CoreOnly
+    - FirebaseAuth (~> 8.15.0)
+  - Firebase/CoreOnly (8.15.0):
+    - FirebaseCore (= 8.15.0)
+  - Firebase/Firestore (8.15.0):
+    - Firebase/CoreOnly
+    - FirebaseFirestore (~> 8.15.0)
+  - firebase_auth (3.3.18):
+    - Firebase/Auth (= 8.15.0)
+    - firebase_core
+    - Flutter
+  - firebase_core (1.17.0):
+    - Firebase/CoreOnly (= 8.15.0)
+    - Flutter
+  - FirebaseAuth (8.15.0):
+    - FirebaseCore (~> 8.0)
+    - GoogleUtilities/AppDelegateSwizzler (~> 7.7)
+    - GoogleUtilities/Environment (~> 7.7)
+    - GTMSessionFetcher/Core (~> 1.5)
+  - FirebaseCore (8.15.0):
+    - FirebaseCoreDiagnostics (~> 8.0)
+    - GoogleUtilities/Environment (~> 7.7)
+    - GoogleUtilities/Logger (~> 7.7)
+  - FirebaseCoreDiagnostics (8.15.0):
+    - GoogleDataTransport (~> 9.1)
+    - GoogleUtilities/Environment (~> 7.7)
+    - GoogleUtilities/Logger (~> 7.7)
+    - nanopb (~> 2.30908.0)
+  - FirebaseFirestore (8.15.0):
+    - FirebaseFirestore/AutodetectLeveldb (= 8.15.0)
+  - FirebaseFirestore/AutodetectLeveldb (8.15.0):
+    - FirebaseFirestore/Base
+    - FirebaseFirestore/WithLeveldb
+  - FirebaseFirestore/Base (8.15.0)
+  - FirebaseFirestore/WithLeveldb (8.15.0):
+    - FirebaseFirestore/Base
+  - Flutter (1.0.0)
+  - flutter_compass (0.0.1):
+    - Flutter
+  - geolocator_apple (1.2.0):
+    - Flutter
+  - GoogleDataTransport (9.1.4):
+    - GoogleUtilities/Environment (~> 7.7)
+    - nanopb (< 2.30910.0, >= 2.30908.0)
+    - PromisesObjC (< 3.0, >= 1.2)
+  - GoogleUtilities/AppDelegateSwizzler (7.7.0):
+    - GoogleUtilities/Environment
+    - GoogleUtilities/Logger
+    - GoogleUtilities/Network
+  - GoogleUtilities/Environment (7.7.0):
+    - PromisesObjC (< 3.0, >= 1.2)
+  - GoogleUtilities/Logger (7.7.0):
+    - GoogleUtilities/Environment
+  - GoogleUtilities/Network (7.7.0):
+    - GoogleUtilities/Logger
+    - "GoogleUtilities/NSData+zlib"
+    - GoogleUtilities/Reachability
+  - "GoogleUtilities/NSData+zlib (7.7.0)"
+  - GoogleUtilities/Reachability (7.7.0):
+    - GoogleUtilities/Logger
+  - GTMSessionFetcher/Core (1.7.2)
+  - nanopb (2.30908.0):
+    - nanopb/decode (= 2.30908.0)
+    - nanopb/encode (= 2.30908.0)
+  - nanopb/decode (2.30908.0)
+  - nanopb/encode (2.30908.0)
+  - PromisesObjC (2.1.0)
+
+DEPENDENCIES:
+  - cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`)
+  - firebase_auth (from `.symlinks/plugins/firebase_auth/ios`)
+  - firebase_core (from `.symlinks/plugins/firebase_core/ios`)
+  - FirebaseFirestore (from `https://github.com/invertase/firestore-ios-sdk-frameworks.git`, tag `8.15.0`)
+  - Flutter (from `Flutter`)
+  - flutter_compass (from `.symlinks/plugins/flutter_compass/ios`)
+  - geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`)
+
+SPEC REPOS:
+  trunk:
+    - Firebase
+    - FirebaseAuth
+    - FirebaseCore
+    - FirebaseCoreDiagnostics
+    - GoogleDataTransport
+    - GoogleUtilities
+    - GTMSessionFetcher
+    - nanopb
+    - PromisesObjC
+
+EXTERNAL SOURCES:
+  cloud_firestore:
+    :path: ".symlinks/plugins/cloud_firestore/ios"
+  firebase_auth:
+    :path: ".symlinks/plugins/firebase_auth/ios"
+  firebase_core:
+    :path: ".symlinks/plugins/firebase_core/ios"
+  FirebaseFirestore:
+    :git: https://github.com/invertase/firestore-ios-sdk-frameworks.git
+    :tag: 8.15.0
+  Flutter:
+    :path: Flutter
+  flutter_compass:
+    :path: ".symlinks/plugins/flutter_compass/ios"
+  geolocator_apple:
+    :path: ".symlinks/plugins/geolocator_apple/ios"
+
+CHECKOUT OPTIONS:
+  FirebaseFirestore:
+    :git: https://github.com/invertase/firestore-ios-sdk-frameworks.git
+    :tag: 8.15.0
+
+SPEC CHECKSUMS:
+  cloud_firestore: 76e73835a6ac79ac825190eefd876a1e100c7835
+  Firebase: 5f8193dff4b5b7c5d5ef72ae54bb76c08e2b841d
+  firebase_auth: ace975b530600827bd901a9a18584f7cdaf6d160
+  firebase_core: aa1b92020533f5c23955e388c347c58fd64f8627
+  FirebaseAuth: 3e73bf8abf4fbb40f8b421f361f4cc48ee57388c
+  FirebaseCore: 5743c5785c074a794d35f2fff7ecc254a91e08b1
+  FirebaseCoreDiagnostics: 92e07a649aeb66352b319d43bdd2ee3942af84cb
+  FirebaseFirestore: cb361b7f8f225a225c9f11b8d42066baebb1630c
+  Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
+  flutter_compass: cbbd285cea1584c7ac9c4e0c3e1f17cbea55e855
+  geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401
+  GoogleDataTransport: 5fffe35792f8b96ec8d6775f5eccd83c998d5a3b
+  GoogleUtilities: e0913149f6b0625b553d70dae12b49fc62914fd1
+  GTMSessionFetcher: 5595ec75acf5be50814f81e9189490412bad82ba
+  nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96
+  PromisesObjC: 99b6f43f9e1044bd87a95a60beff28c2c44ddb72
+
+PODFILE CHECKSUM: f99a294491bb4a8b0ed5ee7ec97f8c8001a75c19
+
+COCOAPODS: 1.11.3

+ 86 - 0
app/ios/Runner.xcodeproj/project.pbxproj

@@ -13,6 +13,7 @@
 		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 */; };
+		AEC8ADA59409895D03733F7A /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14A3BA377ED9242B31B10B26 /* Pods_Runner.framework */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXCopyFilesBuildPhase section */
@@ -31,6 +32,8 @@
 /* Begin PBXFileReference section */
 		1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
 		1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
+		14A3BA377ED9242B31B10B26 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+		1B1E3B130A92F3A6CC5D4508 /* 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 = "<group>"; };
 		3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
 		74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
 		74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
@@ -42,6 +45,8 @@
 		97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
 		97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
 		97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+		A936D2F453AE9AAA9478C7D6 /* 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 = "<group>"; };
+		E88252A05C17DBF07881EBAB /* 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 = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -49,12 +54,32 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				AEC8ADA59409895D03733F7A /* Pods_Runner.framework in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+		01C38152DAD16C1BC69EF05C /* Frameworks */ = {
+			isa = PBXGroup;
+			children = (
+				14A3BA377ED9242B31B10B26 /* Pods_Runner.framework */,
+			);
+			name = Frameworks;
+			sourceTree = "<group>";
+		};
+		14F2D831B115D42B82C7A7E1 /* Pods */ = {
+			isa = PBXGroup;
+			children = (
+				A936D2F453AE9AAA9478C7D6 /* Pods-Runner.debug.xcconfig */,
+				E88252A05C17DBF07881EBAB /* Pods-Runner.release.xcconfig */,
+				1B1E3B130A92F3A6CC5D4508 /* Pods-Runner.profile.xcconfig */,
+			);
+			name = Pods;
+			path = Pods;
+			sourceTree = "<group>";
+		};
 		9740EEB11CF90186004384FC /* Flutter */ = {
 			isa = PBXGroup;
 			children = (
@@ -72,6 +97,8 @@
 				9740EEB11CF90186004384FC /* Flutter */,
 				97C146F01CF9000F007C117D /* Runner */,
 				97C146EF1CF9000F007C117D /* Products */,
+				14F2D831B115D42B82C7A7E1 /* Pods */,
+				01C38152DAD16C1BC69EF05C /* Frameworks */,
 			);
 			sourceTree = "<group>";
 		};
@@ -105,12 +132,15 @@
 			isa = PBXNativeTarget;
 			buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
 			buildPhases = (
+				921990EA0522D53EB760F73A /* [CP] Check Pods Manifest.lock */,
 				9740EEB61CF901F6004384FC /* Run Script */,
 				97C146EA1CF9000F007C117D /* Sources */,
 				97C146EB1CF9000F007C117D /* Frameworks */,
 				97C146EC1CF9000F007C117D /* Resources */,
 				9705A1C41CF9048500538489 /* Embed Frameworks */,
 				3B06AD1E1E4923F5004D2608 /* Thin Binary */,
+				A39D21FDDD6C92E2BC5C1DF1 /* [CP] Embed Pods Frameworks */,
+				71A126D59B4B2A205423702B /* [CP] Copy Pods Resources */,
 			);
 			buildRules = (
 			);
@@ -183,6 +213,45 @@
 			shellPath = /bin/sh;
 			shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
 		};
+		71A126D59B4B2A205423702B /* [CP] Copy Pods Resources */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputFileListPaths = (
+				"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
+			);
+			name = "[CP] Copy Pods Resources";
+			outputFileListPaths = (
+				"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
+			showEnvVarsInLog = 0;
+		};
+		921990EA0522D53EB760F73A /* [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;
+		};
 		9740EEB61CF901F6004384FC /* Run Script */ = {
 			isa = PBXShellScriptBuildPhase;
 			buildActionMask = 2147483647;
@@ -197,6 +266,23 @@
 			shellPath = /bin/sh;
 			shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
 		};
+		A39D21FDDD6C92E2BC5C1DF1 /* [CP] Embed Pods Frameworks */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputFileListPaths = (
+				"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
+			);
+			name = "[CP] Embed Pods Frameworks";
+			outputFileListPaths = (
+				"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
+			showEnvVarsInLog = 0;
+		};
 /* End PBXShellScriptBuildPhase section */
 
 /* Begin PBXSourcesBuildPhase section */

+ 3 - 0
app/ios/Runner.xcworkspace/contents.xcworkspacedata

@@ -4,4 +4,7 @@
    <FileRef
       location = "group:Runner.xcodeproj">
    </FileRef>
+   <FileRef
+      location = "group:Pods/Pods.xcodeproj">
+   </FileRef>
 </Workspace>

+ 37 - 0
app/lib/Services/AuthService.dart

@@ -0,0 +1,37 @@
+import 'package:firebase_auth/firebase_auth.dart';
+import 'package:physigo/Services/DatabaseManager.dart';
+
+class AuthenticationServices {
+  final FirebaseAuth _auth = FirebaseAuth.instance;
+
+  //Register a user
+  Future createNewUser(String address, bool anonymous, String birth,
+      String name, String email, String password, String phone, String sharedID,
+      String surname) async {
+    try {
+      UserCredential result = await _auth.createUserWithEmailAndPassword(
+          email: email, password: password);
+      User? user = result.user;
+      await DatabaseManager().createUserData(
+          address, anonymous, birth, DateTime.now(), DateTime.now(), email,
+          name, phone, sharedID, surname, 0, DateTime.now(), 'null', user!.uid);
+
+      return user;
+    } catch (e) {
+      print('catch auto');
+      print(e.toString());
+      print('catch auto2');
+    }
+  }
+
+  //LogIn with user
+  Future loginUser(String email, String password) async {
+    try {
+      UserCredential result = await _auth.signInWithEmailAndPassword(
+          email: email, password: password);
+      return result.user;
+    } catch(e) {
+      print(e.toString());
+    }
+  }
+}

+ 47 - 0
app/lib/Services/DatabaseManager.dart

@@ -0,0 +1,47 @@
+//import 'package:cloud_firestore/cloud_firestore.dart';
+import 'package:cloud_firestore/cloud_firestore.dart';
+import 'package:flutter/cupertino.dart';
+
+class DatabaseManager {
+  final CollectionReference profileList =
+  FirebaseFirestore.instance.collection('profileInfo');
+
+  Future<void> createUserData(String address,
+      bool anonymous,
+      String birth_date,
+      DateTime create_date,
+      DateTime lastChallengeDate,
+      String mail,
+      String name,
+      String phoneNumber,
+      String shared_id,
+      String surname,
+      int totalpoints,
+      DateTime updated_date,
+      String weeklyplace,
+      String uid) async {
+    print('----------- ' + uid);
+    return await profileList.doc(uid).set({
+      'address': address,
+      'anonymous': anonymous,
+      'birth_date': birth_date,
+      'created_date': create_date,
+      'last_challenge_date': lastChallengeDate,
+      'mail': mail,
+      'name': name,
+      'phone_number': phoneNumber,
+      'shared_id': shared_id,
+      'surname': surname,
+      'total_points': totalpoints,
+      'updated_date': updated_date,
+      'weekly_place': weeklyplace,
+    });
+  }
+
+  Future getusersList(String id) async {
+  }
+}
+//  FirebaseFirestore.instance.collection('profileInfo').doc(arguments['id'])
+//         .get().then((DocumentSnapshot) =>
+//         print('____'+DocumentSnapshot.data().toString())
+//     );

+ 342 - 0
app/lib/SignupPage.dart

@@ -0,0 +1,342 @@
+import 'package:flutter/material.dart';
+import 'package:physigo/Services/AuthService.dart';
+
+import 'Services/DatabaseManager.dart';
+
+//Fields..
+TextEditingController _name = TextEditingController();
+TextEditingController _surname = TextEditingController();
+TextEditingController _mail = TextEditingController();
+TextEditingController _phoneNumber = TextEditingController();
+TextEditingController _address = TextEditingController();
+TextEditingController _username = TextEditingController();
+TextEditingController _passwd = TextEditingController();
+TextEditingController _passwd2 = TextEditingController();
+
+bool anonymous = false;
+String? _dateString;
+
+final AuthenticationServices _auth = AuthenticationServices();
+
+
+class SignupPage extends StatefulWidget {
+  const SignupPage({Key? key}) : super(key: key);
+
+  @override
+  State<SignupPage> createState() => _SignupPageState();
+}
+
+class _SignupPageState extends State<SignupPage> {
+  int _pageIndex = 0;
+
+  List<Widget> forms = [
+    SignupForm1(
+      title: '',
+    ),
+    SignupForm2(
+      title: '',
+    ),
+    SignupForm3(
+      title: '',
+    )
+  ];
+
+  void _updatePageIndex(int newPageIndex) {
+    if (newPageIndex == -1) {
+      Navigator.pushNamed(context, '/');
+    } else if (newPageIndex == 3) {
+      //autentification
+      //Navigator.pop(context);
+      newPageIndex == 2;
+    } else {
+      setState(() {
+        _pageIndex = newPageIndex;
+      });
+    }
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    return Scaffold(
+      floatingActionButton: Row(
+        mainAxisAlignment: MainAxisAlignment.end,
+        children: [
+          FloatingActionButton(
+              heroTag: "btn1",
+              child: Icon(Icons.navigate_before_outlined),
+              onPressed: () => _updatePageIndex(_pageIndex - 1)),
+          SizedBox(
+            width: 25,
+          ),
+          FloatingActionButton(
+              heroTag: "btn2",
+              child: Icon(Icons.navigate_next_outlined),
+              onPressed: () => _updatePageIndex(_pageIndex + 1))
+        ],
+      ),
+      body: Center(child: forms[_pageIndex]),
+    );
+  }
+}
+
+class SignupForm1 extends StatefulWidget {
+  const SignupForm1({Key? key, required this.title}) : super(key: key);
+  final String title;
+
+  @override
+  //_RegisterScreen createState() => _RegisterScreen();
+  State<SignupForm1> createState() => _SignupForm1();
+}
+
+class _SignupForm1 extends State<SignupForm1> {
+  DateTime? _dateTime;
+
+  @override
+  Widget build(BuildContext context) {
+    return Scaffold(
+      appBar: AppBar(
+        title: const Text('Register Screen'),
+      ),
+      body: Center(
+          child: SizedBox(
+        width: 300,
+        child: Column(children: <Widget>[
+          const SizedBox(height: 30),
+          Text(
+            'Personal Information',
+            style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
+          ),
+          const SizedBox(height: 30),
+          Image.asset(
+            'assets/user.png',
+            width: 150,
+          ),
+          const SizedBox(height: 30),
+          TextFormField(
+            controller: _name,
+            decoration: InputDecoration(
+              hintText: 'Name',
+            ),
+          ),
+          const SizedBox(height: 10),
+          TextFormField(
+            controller: _surname,
+            decoration: InputDecoration(
+              hintText: 'Surname',
+            ),
+          ),
+          const SizedBox(height: 10),
+          Row(children: <Widget>[
+            Text(_dateString == null
+                ? 'Select birthday date :'
+                : _dateString.toString()),
+            const SizedBox(width: 49),
+            ElevatedButton(
+              onPressed: () {
+                showDatePicker(
+                        context: context,
+                        initialDate: DateTime.now(),
+                        firstDate: DateTime(1900),
+                        lastDate: DateTime.now())
+                    .then((date) {
+                  setState(() {
+                    _dateTime = date!;
+                    _dateString = "${date.day}-${date.month}-${date.year}";
+                  });
+                });
+              },
+              child: const Text('Select date'),
+            ),
+          ]),
+          const SizedBox(height: 10),
+        ]),
+      )),
+    );
+  }
+}
+
+class SignupForm2 extends StatefulWidget {
+  const SignupForm2({Key? key, required this.title}) : super(key: key);
+  final String title;
+
+  @override
+  //_RegisterScreen createState() => _RegisterScreen();
+  State<SignupForm2> createState() => _SignupForm2();
+}
+
+class _SignupForm2 extends State<SignupForm2> {
+  @override
+  Widget build(BuildContext context) {
+    return Scaffold(
+      appBar: AppBar(
+        title: const Text('Register Screen'),
+      ),
+      body: Center(
+          child: SizedBox(
+        width: 300,
+        child: Column(children: <Widget>[
+          const SizedBox(height: 30),
+          Text(
+            'Contact Details',
+            style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
+          ),
+          const SizedBox(height: 30),
+          Image.asset(
+            'assets/communicate.png',
+            width: 150,
+          ),
+          const SizedBox(height: 30),
+          TextFormField(
+            controller: _mail,
+            decoration: InputDecoration(
+              hintText: 'Mail',
+            ),
+          ),
+          const SizedBox(height: 10),
+          TextFormField(
+            controller: _phoneNumber,
+            decoration: InputDecoration(
+              hintText: 'Phone Number',
+            ),
+          ),
+          const SizedBox(height: 10),
+          TextFormField(
+            controller: _address,
+            decoration: InputDecoration(
+              hintText: 'Home Adress..',
+            ),
+          ),
+          const SizedBox(height: 10),
+          Row(children: <Widget>[
+            Text('Anonymous'),
+            Checkbox(
+              checkColor: Colors.white,
+              value: anonymous,
+              onChanged: (bool? value) {
+                setState(() {
+                  anonymous = value!;
+                });
+              },
+            ),
+          ]),
+          const SizedBox(height: 10),
+        ]),
+      )),
+    );
+  }
+}
+
+class SignupForm3 extends StatefulWidget {
+  const SignupForm3({Key? key, required this.title}) : super(key: key);
+  final String title;
+
+  @override
+  //_RegisterScreen createState() => _RegisterScreen();
+  State<SignupForm3> createState() => _SignupForm3();
+}
+
+class _SignupForm3 extends State<SignupForm3> {
+  @override
+  Widget build(BuildContext context) {
+    return Scaffold(
+      appBar: AppBar(
+        title: const Text('Register Screen'),
+      ),
+      body: Center(
+          child: SizedBox(
+        width: 300,
+        child: Column(children: <Widget>[
+          const SizedBox(height: 30),
+          Text(
+            'User details',
+            style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
+          ),
+          const SizedBox(height: 30),
+          Image.asset(
+            'assets/id-card.png',
+            width: 150,
+          ),
+          const SizedBox(height: 30),
+          TextFormField(
+            controller: _username,
+            decoration: InputDecoration(
+              hintText: 'Username',
+            ),
+          ),
+          const SizedBox(height: 10),
+          TextFormField(
+            controller: _passwd,
+            obscureText: true,
+            enableSuggestions: false,
+            autocorrect: false,
+            decoration: InputDecoration(
+              hintText: 'Password',
+            ),
+          ),
+          const SizedBox(height: 10),
+          TextFormField(
+            controller: _passwd2,
+            obscureText: true,
+            enableSuggestions: false,
+            autocorrect: false,
+            decoration: InputDecoration(
+              hintText: 'Repeat password',
+            ),
+          ),
+          const SizedBox(height: 15),
+          ElevatedButton(
+              onPressed: () {
+                try {
+                  if (_passwd.text == _passwd2.text) {
+                    createUser();
+                    Navigator.pop(context);
+                  } else {
+                    print("passwd is not the same");
+                  }
+                } catch (e) {
+                  print(e.toString());
+                }
+              },
+              child: const Text('Finish Register')),
+
+        ]),
+      )),
+    );
+  }
+
+  void createUser() async {
+    dynamic result =
+        await _auth.createNewUser(_address.text, anonymous, _dateString.toString(), _name.text, _mail.text, _passwd.text,
+            _phoneNumber.text, _username.text, _surname.text);
+    if (result == null) {
+      print('mail not valid');
+    } else {
+      //print(result.toString());
+      //[51.787378° N, 19.449455° E]
+
+      print('*****  address: ' + _address.text +
+          ' anonymous: ' + anonymous.toString() +
+          ' birthdate: ' + _dateString.toString() +
+          ' createDate: ' + DateTime.now().toString()+
+          ' last_challenge_data: ' + 'null'+
+          ' mail: ' + _mail.text +
+          ' name: ' + _name.text +
+          ' passwd: ' + '??? ' +
+          ' phone_number: ' + _phoneNumber.text+
+          ' shared_id: ' + _username.text +
+          ' surname: ' + _surname.text +
+          ' totalpoints: 0 ' +
+          ' update_date: ' + DateTime.now().toString()+
+          ' weeklyplace: ' + 'null');
+
+      _name.clear();
+      _surname.clear();
+      _mail.clear();
+      _phoneNumber.clear();
+      _address.clear();
+      _username.clear();
+      _passwd.clear();
+      _passwd2.clear();
+    }
+  }
+}

+ 80 - 0
app/lib/logIn.dart

@@ -0,0 +1,80 @@
+import 'package:flutter/material.dart';
+import 'Services/AuthService.dart';
+
+class LogIn extends StatefulWidget {
+  const LogIn({Key? key, required this.title}) : super(key: key);
+  final String title;
+
+  @override
+  //_RegisterScreen createState() => _RegisterScreen();
+  State<LogIn> createState() => _LogIn();
+}
+
+class _LogIn extends State<LogIn> {
+  TextEditingController _email = TextEditingController();
+  TextEditingController _passwd = TextEditingController();
+  final AuthenticationServices _auth = AuthenticationServices();
+
+  @override
+  Widget build(BuildContext context) {
+    return Scaffold(
+      appBar: AppBar(
+        title: const Text('Login Screen'),
+      ),
+      body: Center(
+          child: SizedBox(
+        width: 300,
+        child: Column(children: <Widget>[
+          const SizedBox(height: 30),
+          Text(
+            'Welcome back!',
+            style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
+          ),
+          const SizedBox(height: 30),
+          Image.asset(
+            'assets/hello.png',
+            width: 150,
+          ),
+          const SizedBox(height: 30),
+          TextFormField(
+            controller: _email,
+            decoration: InputDecoration(
+              hintText: 'Mail',
+            ),
+          ),
+          const SizedBox(height: 10),
+          TextFormField(
+            controller: _passwd,
+            obscureText: true,
+            enableSuggestions: false,
+            autocorrect: false,
+            decoration: InputDecoration(
+              hintText: 'Password',
+            ),
+          ),
+          const SizedBox(height: 10),
+          ElevatedButton(
+            onPressed: () {
+              signInUser();
+            },
+            child: const Text('Log In'),
+          ),
+        ]),
+      )),
+    );
+  }
+
+  void signInUser() async {
+    dynamic authResult = await _auth.loginUser(_email.text, _passwd.text);
+    if (authResult == null) {
+      print("log in error");
+    } else {
+      _email.clear();
+      _passwd.clear();
+      print("Succesful login ");
+      Navigator.pushNamed(context, '/mainPage',
+        arguments: {'uid': authResult.uid},
+      );
+    }
+  }
+}

+ 18 - 65
app/lib/main.dart

@@ -1,12 +1,13 @@
 import 'package:firebase_core/firebase_core.dart';
 import 'package:flutter/material.dart';
-import 'package:latlong2/latlong.dart';
-import 'package:physigo/exercises/exercises_page.dart';
-import 'package:physigo/friends/friends_page.dart';
-import 'navigation/navigation_page.dart';
 
 import 'firebase_options.dart';
 import 'push_notifications_initializer.dart';
+import 'package:physigo/logIn.dart';
+import 'package:physigo/profilePage.dart';
+import 'package:physigo/SignupPage.dart';
+import 'package:physigo/mainPage.dart';
+import 'package:physigo/welcomeScreen.dart';
 
 void main() async {
   WidgetsFlutterBinding.ensureInitialized();
@@ -23,69 +24,21 @@ class PhysiGo extends StatelessWidget {
   @override
   Widget build(BuildContext context) {
     return MaterialApp(
-      title: 'PhysiGo',
+      title: 'PhisyGo',
       theme: ThemeData(
-        primarySwatch: Colors.blue,
-      ),
-      home: const HomePage(),
-    );
-  }
-}
-
-class HomePage extends StatelessWidget {
-  const HomePage({Key? key}) : super(key: key);
-
-  @override
-  Widget build(BuildContext context) {
-    return SafeArea(
-      child: Scaffold(
-        body: Column(
-          mainAxisAlignment: MainAxisAlignment.center,
-          children: [
-            Center(
-              child: TextButton(
-                  onPressed: () {
-                    Navigator.push(
-                      context,
-                      MaterialPageRoute(
-                        // Example on how to use NavigationPage
-                        builder: (context) => NavigationPage(
-                          destination: LatLng(51.78036111980833, 19.451262207821234),
-                        ),
-                      ),
-                    );
-                  },
-                  child: const Text('Navigation')),
-            ),
-            Center(
-              child: TextButton(
-                onPressed: () {
-                  Navigator.push(
-                    context,
-                    MaterialPageRoute(
-                      builder: (context) => const ExercisesPage(),
-                    ),
-                  );
-                },
-                child: const Text('Exercises'),
-              ),
-            ),
-            Center(
-              child: TextButton(
-                onPressed: () {
-                  Navigator.push(
-                    context,
-                    MaterialPageRoute(
-                      builder: (context) => const FriendsPage(),
-                    ),
-                  );
-                },
-                child: const Text('Friends'),
-              ),
-            ),
-          ],
-        ),
+        primarySwatch: Colors.blueGrey,
       ),
+      initialRoute: '/',
+      routes: {
+        '/': (context) => MyHomePage(title: '',),
+        '/register': (context) => SignupPage(),
+        //'/register2': (context) => RegisterScreen2(title: ''),
+        //'/register3': (context) => RegisterScreen3(title: ''),
+        '/login': (context) => LogIn(title: ''),
+        '/profilePage': (context) => ProfilePage(title: '',),
+        '/mainPage': (context) => MainPage()
+      },
+      //home: const MyHomePage(title: 'Flutter Demo Home Page'),
     );
   }
 }

+ 40 - 0
app/lib/mainPage.dart

@@ -0,0 +1,40 @@
+import 'package:flutter/material.dart';
+
+class MainPage extends StatefulWidget {
+  const MainPage({Key? key}) : super(key: key);
+  @override
+  State<MainPage> createState() => _MainPage();
+}
+class _MainPage extends State<MainPage> {
+
+
+  @override
+  Widget build(BuildContext context) {
+    final arguments = (ModalRoute.of(context)?.settings.arguments ?? <String, dynamic>{}) as Map;
+    final String id = arguments['uid'];
+    print(id);
+
+    return Scaffold(
+      appBar: AppBar(
+
+        title: const Text('Welcome Back!'),
+        leading: GestureDetector(
+          onTap: () {
+            print('going to profile page');
+            Navigator.pushNamed(context, '/profilePage',
+              arguments: {'id': id},
+            );
+            },
+          child: Icon(
+            Icons.account_circle_rounded,  // add custom icons also
+          ),
+        ),
+      ),
+      body: Center(
+        child: Column(
+        ),
+
+      ),
+    );
+  }
+}

+ 101 - 0
app/lib/profilePage.dart

@@ -0,0 +1,101 @@
+import 'package:cloud_firestore/cloud_firestore.dart';
+import 'package:flutter/material.dart';
+
+class ProfilePage extends StatefulWidget {
+  const ProfilePage({Key? key, required this.title}) : super(key: key);
+  final String title;
+
+  @override
+  //_RegisterScreen createState() => _RegisterScreen();
+  State<ProfilePage> createState() => _ProfilePage();
+}
+
+class _ProfilePage extends State<ProfilePage> {
+  String name = '', surname = '', birth_date = '', mail = '', shared_id = '',
+      phone_number = '', anonymous = '', address = '';
+
+  @override
+  Widget build(BuildContext context) {
+    final arguments = (ModalRoute.of(context)?.settings.arguments ??
+        <String, dynamic>{}) as Map;
+    print('******' + arguments['id']);
+
+    //getting info of the user one by one
+    FirebaseFirestore.instance.collection('profileInfo').doc(arguments['id'])
+        .get().then((DocumentSnapshot) {
+      name = DocumentSnapshot.get('name').toString();
+    });
+    FirebaseFirestore.instance.collection('profileInfo').doc(arguments['id'])
+        .get().then((DocumentSnapshot) {
+      surname = DocumentSnapshot.get('surname').toString();
+    });
+    FirebaseFirestore.instance.collection('profileInfo').doc(arguments['id'])
+        .get().then((DocumentSnapshot) {
+      birth_date = DocumentSnapshot.get('birth_date').toString();
+    });
+    FirebaseFirestore.instance.collection('profileInfo').doc(arguments['id'])
+        .get().then((DocumentSnapshot) {
+      mail = DocumentSnapshot.get('mail').toString();
+    });
+    FirebaseFirestore.instance.collection('profileInfo').doc(arguments['id'])
+        .get().then((DocumentSnapshot) {
+      shared_id = DocumentSnapshot.get('shared_id').toString();
+    });
+    FirebaseFirestore.instance.collection('profileInfo').doc(arguments['id'])
+        .get().then((DocumentSnapshot) {
+      phone_number = DocumentSnapshot.get('phone_number').toString();
+    });
+    FirebaseFirestore.instance.collection('profileInfo').doc(arguments['id'])
+        .get().then((DocumentSnapshot) {
+      anonymous = DocumentSnapshot.get('anonymous').toString();
+    });
+    FirebaseFirestore.instance.collection('profileInfo').doc(arguments['id'])
+        .get().then((DocumentSnapshot) {
+      address = DocumentSnapshot.get('address').toString();
+    });
+
+    return Scaffold(
+      appBar: AppBar(title: const Text('Profile Page')),
+      body: Center(
+        child: SizedBox(
+          width: 300,
+          child: Column(
+            children: [
+              const SizedBox(height: 30),
+              Text(
+                'Personal Information',
+                style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
+              ),
+              const SizedBox(height: 30),
+              Image.asset(
+                'assets/user.png',
+                width: 150,
+              ),
+              const SizedBox(height: 30),
+              Text('Name: ' + name + ' ' + surname),
+              const SizedBox(height: 10),
+              Text('Birth Date: ' + birth_date),
+              const SizedBox(height: 10),
+              Text('Username: ' + shared_id),
+              const SizedBox(height: 10),
+              Text('Mail: ' + mail),
+              const SizedBox(height: 10),
+              Text('Phone: ' + phone_number),
+              const SizedBox(height: 10),
+              Text('Address: ' + address),
+              const SizedBox(height: 10),
+              Text('Anonymous: ' + anonymous),
+              const SizedBox(height: 30),
+              ElevatedButton(
+                onPressed: () {
+                  setState(() {});
+                },
+                child: const Text('Refresh'),
+              ),
+            ],
+          ),
+        ),
+      ),
+    );
+  }
+}

+ 48 - 0
app/lib/welcomeScreen.dart

@@ -0,0 +1,48 @@
+
+import 'package:flutter/material.dart';
+import 'package:flutter/widgets.dart';
+
+class MyHomePage extends StatefulWidget {
+  const MyHomePage({Key? key, required this.title}) : super(key: key);
+  final String title;
+
+  @override
+  State<MyHomePage> createState() => _MyHomePageState();
+}
+
+class _MyHomePageState extends State<MyHomePage> {
+  @override
+  Widget build(BuildContext context) {
+    return Scaffold(
+      appBar: AppBar(
+        title: const Text('Welcome to PhysiGo'),
+      ),
+      body: Center(
+        child: Column(
+          children: <Widget>[
+            const SizedBox(height: 30),
+            Image.asset(
+              'assets/teamlogo.png',
+              width: 260,
+            ),
+            const SizedBox(height: 30),
+            ElevatedButton(
+              // Within the `FirstScreen` widget
+              onPressed: () {
+                // Navigate to the second screen using a named route.
+                Navigator.pushNamed(context, '/register');
+              },
+              child: Text('Register'),
+            ),
+            ElevatedButton(
+              onPressed: () {
+                Navigator.pushNamed(context, '/login');
+              },
+              child: const Text('Log In'),
+            )
+          ],
+        ),
+      ),
+    );
+  }
+}

+ 22 - 1
app/pubspec.lock

@@ -92,13 +92,34 @@ packages:
       url: "https://pub.dartlang.org"
     source: hosted
     version: "1.2.0"
+  firebase_auth:
+    dependency: "direct main"
+    description:
+      name: firebase_auth
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "3.3.18"
+  firebase_auth_platform_interface:
+    dependency: transitive
+    description:
+      name: firebase_auth_platform_interface
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "6.2.6"
+  firebase_auth_web:
+    dependency: transitive
+    description:
+      name: firebase_auth_web
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "3.3.15"
   firebase_core:
     dependency: "direct main"
     description:
       name: firebase_core
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "1.15.0"
+    version: "1.17.0"
   firebase_core_platform_interface:
     dependency: transitive
     description:

+ 8 - 0
app/pubspec.yaml

@@ -31,6 +31,7 @@ dependencies:
     sdk: flutter
 
 
+
   # The following adds the Cupertino Icons font to your application.
   # Use with the CupertinoIcons class for iOS style icons.
   cupertino_icons: ^1.0.2
@@ -44,6 +45,7 @@ dependencies:
   cloud_firestore: ^3.1.15
   firebase_messaging: ^11.4.0
   awesome_notifications: ^0.6.21
+  firebase_auth: ^3.3.17
 
 dev_dependencies:
   flutter_test:
@@ -71,6 +73,12 @@ flutter:
   # assets:
   #   - images/a_dot_burr.jpeg
   #   - images/a_dot_ham.jpeg
+  assets:
+    - assets/teamlogo.png
+    - assets/user.png
+    - assets/communicate.png
+    - assets/id-card.png
+    - assets/hello.png
 
   # An image asset can refer to one or more resolution-specific "variants", see
   # https://flutter.dev/assets-and-images/#resolution-aware.