ManageAccountPage #42

Merged
maze6343 merged 20 commits from ManageAccountPage into master 2022-05-25 22:16:46 +02:00
56 changed files with 3263 additions and 1098 deletions
Showing only changes of commit d4085bf963 - Show all commits

View File

@ -55,6 +55,12 @@
"packageUri": "lib/",
"languageVersion": "2.14"
},
{
"name": "csslib",
"rootUri": "file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/csslib-0.17.1",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "cupertino_icons",
"rootUri": "file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-1.0.4",
@ -231,9 +237,9 @@
},
{
"name": "get",
"rootUri": "file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.6.3",
"rootUri": "file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.6.5",
"packageUri": "lib/",
"languageVersion": "2.16"
"languageVersion": "2.15"
},
{
"name": "google_api_headers",
@ -295,6 +301,12 @@
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "html",
"rootUri": "file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/html-0.15.0",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "http",
"rootUri": "file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.4",
@ -656,7 +668,7 @@
"languageVersion": "2.16"
}
],
"generated": "2022-05-24T12:31:04.427734Z",
"generated": "2022-05-24T12:37:03.789982Z",
"generator": "pub",
"generatorVersion": "2.16.2"
}

View File

@ -38,6 +38,10 @@ crypto
2.14
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/crypto-3.0.2/
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/crypto-3.0.2/lib/
csslib
2.12
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/csslib-0.17.1/
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/csslib-0.17.1/lib/
cupertino_icons
2.12
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-1.0.4/
@ -143,9 +147,9 @@ geolocator_windows
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator_windows-0.1.1/
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator_windows-0.1.1/lib/
get
2.16
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.6.3/
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.6.3/lib/
2.15
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.6.5/
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.6.5/lib/
google_api_headers
2.12
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/google_api_headers-1.3.0/
@ -186,6 +190,10 @@ google_sign_in_web
2.12
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in_web-0.10.1/
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in_web-0.10.1/lib/
html
2.12
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/html-0.15.0/
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/html-0.15.0/lib/
http
2.14
file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.4/

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,7 @@
#
# For more info see: https://dart.dev/go/dot-packages-deprecation
#
# Generated by pub on 2022-05-24 14:31:04.408786.
# Generated by pub on 2022-05-24 14:37:03.770230.
archive:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/archive-3.3.0/lib/
args:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/args-2.3.1/lib/
async:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.8.2/lib/
@ -13,6 +13,7 @@ charcode:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/ch
clock:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/clock-1.1.0/lib/
collection:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.15.0/lib/
crypto:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/crypto-3.0.2/lib/
csslib:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/csslib-0.17.1/lib/
cupertino_icons:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-1.0.4/lib/
dio:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/dio-4.0.6/lib/
fake_async:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/fake_async-1.2.0/lib/
@ -42,7 +43,7 @@ geolocator_apple:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlan
geolocator_platform_interface:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator_platform_interface-4.0.5/lib/
geolocator_web:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator_web-2.1.5/lib/
geolocator_windows:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator_windows-0.1.1/lib/
get:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.6.3/lib/
get:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.6.5/lib/
google_api_headers:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/google_api_headers-1.3.0/lib/
google_fonts:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/google_fonts-2.3.3/lib/
google_maps_flutter:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/google_maps_flutter-2.1.4/lib/
@ -53,6 +54,7 @@ google_sign_in_android:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.d
google_sign_in_ios:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in_ios-5.2.6/lib/
google_sign_in_platform_interface:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in_platform_interface-2.1.3/lib/
google_sign_in_web:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in_web-0.10.1/lib/
html:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/html-0.15.0/lib/
http:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.4/lib/
http_parser:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/http_parser-4.0.1/lib/
image:file:///Users/marahzeibak/flutter/.pub-cache/hosted/pub.dartlang.org/image-3.1.3/lib/

View File

@ -45,7 +45,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.pvt74.sunchaser"
minSdkVersion 21
minSdkVersion 32
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName

View File

@ -18,7 +18,7 @@
</data>
<key>flutter_assets/NOTICES.Z</key>
<data>
RXM4n3glWtHRFjYg8t9yY496tV8=
jWwcVuBiNgVjsZeHMvIvKkgWV7I=
</data>
<key>flutter_assets/assets/fonts/Courgette-Regular.ttf</key>
<data>
@ -50,7 +50,7 @@
</data>
<key>flutter_assets/kernel_blob.bin</key>
<data>
z6HA4R3RmmEmgETKt38kf9Q2pB0=
SHTxJ8fMkVyfUd6I+OY6IBI9xPs=
</data>
<key>flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf</key>
<data>
@ -145,11 +145,11 @@
<dict>
<key>hash</key>
<data>
RXM4n3glWtHRFjYg8t9yY496tV8=
jWwcVuBiNgVjsZeHMvIvKkgWV7I=
</data>
<key>hash2</key>
<data>
ySYMYrdnDxwxQLtQ3PlxG2JP0ovJw8sUhmP9GXqhDpY=
mjjZmUY7Yb9Wu/akBkEvG5Iwb639jTIQLE9bvlflgkc=
</data>
</dict>
<key>flutter_assets/assets/fonts/Courgette-Regular.ttf</key>
@ -233,11 +233,11 @@
<dict>
<key>hash</key>
<data>
z6HA4R3RmmEmgETKt38kf9Q2pB0=
SHTxJ8fMkVyfUd6I+OY6IBI9xPs=
</data>
<key>hash2</key>
<data>
hPNp485pQCJu+T1KogAUSRKfScgh0RDUUDypDrERRP4=
n7iU4LdL05ehp1IEF87FldiFm9DDHYeJ9YYEkfnIG9c=
</data>
</dict>
<key>flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf</key>

View File

@ -1 +0,0 @@
{"assets/fonts/Courgette-Regular.ttf":["assets/fonts/Courgette-Regular.ttf"],"assets/fonts/Sacramento-Regular.ttf":["assets/fonts/Sacramento-Regular.ttf"],"assets/images/bild.png":["assets/images/bild.png"],"assets/images/flutter.png":["assets/images/flutter.png"],"assets/images/outdoor.png":["assets/images/outdoor.png"],"packages/cupertino_icons/assets/CupertinoIcons.ttf":["packages/cupertino_icons/assets/CupertinoIcons.ttf"],"packages/flutter_google_places/assets/google_black.png":["packages/flutter_google_places/assets/google_black.png"],"packages/flutter_google_places/assets/google_white.png":["packages/flutter_google_places/assets/google_white.png"],"packages/flutter_signin_button/assets/logos/2.0x/facebook_new.png":["packages/flutter_signin_button/assets/logos/2.0x/facebook_new.png"],"packages/flutter_signin_button/assets/logos/2.0x/google_dark.png":["packages/flutter_signin_button/assets/logos/2.0x/google_dark.png"],"packages/flutter_signin_button/assets/logos/2.0x/google_light.png":["packages/flutter_signin_button/assets/logos/2.0x/google_light.png"],"packages/flutter_signin_button/assets/logos/3.0x/facebook_new.png":["packages/flutter_signin_button/assets/logos/3.0x/facebook_new.png"],"packages/flutter_signin_button/assets/logos/3.0x/google_dark.png":["packages/flutter_signin_button/assets/logos/3.0x/google_dark.png"],"packages/flutter_signin_button/assets/logos/3.0x/google_light.png":["packages/flutter_signin_button/assets/logos/3.0x/google_light.png"],"packages/flutter_signin_button/assets/logos/facebook_new.png":["packages/flutter_signin_button/assets/logos/facebook_new.png","packages/flutter_signin_button/assets/logos/2.0x/facebook_new.png","packages/flutter_signin_button/assets/logos/3.0x/facebook_new.png"],"packages/flutter_signin_button/assets/logos/google_dark.png":["packages/flutter_signin_button/assets/logos/google_dark.png","packages/flutter_signin_button/assets/logos/2.0x/google_dark.png","packages/flutter_signin_button/assets/logos/3.0x/google_dark.png"],"packages/flutter_signin_button/assets/logos/google_light.png":["packages/flutter_signin_button/assets/logos/google_light.png","packages/flutter_signin_button/assets/logos/2.0x/google_light.png","packages/flutter_signin_button/assets/logos/3.0x/google_light.png"],"packages/font_awesome_flutter/lib/fonts/fa-brands-400.ttf":["packages/font_awesome_flutter/lib/fonts/fa-brands-400.ttf"],"packages/font_awesome_flutter/lib/fonts/fa-regular-400.ttf":["packages/font_awesome_flutter/lib/fonts/fa-regular-400.ttf"],"packages/font_awesome_flutter/lib/fonts/fa-solid-900.ttf":["packages/font_awesome_flutter/lib/fonts/fa-solid-900.ttf"]}

View File

@ -18,7 +18,7 @@
</data>
<key>flutter_assets/NOTICES.Z</key>
<data>
RXM4n3glWtHRFjYg8t9yY496tV8=
jWwcVuBiNgVjsZeHMvIvKkgWV7I=
</data>
<key>flutter_assets/assets/fonts/Courgette-Regular.ttf</key>
<data>
@ -50,7 +50,7 @@
</data>
<key>flutter_assets/kernel_blob.bin</key>
<data>
z6HA4R3RmmEmgETKt38kf9Q2pB0=
SHTxJ8fMkVyfUd6I+OY6IBI9xPs=
</data>
<key>flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf</key>
<data>
@ -145,11 +145,11 @@
<dict>
<key>hash</key>
<data>
RXM4n3glWtHRFjYg8t9yY496tV8=
jWwcVuBiNgVjsZeHMvIvKkgWV7I=
</data>
<key>hash2</key>
<data>
ySYMYrdnDxwxQLtQ3PlxG2JP0ovJw8sUhmP9GXqhDpY=
mjjZmUY7Yb9Wu/akBkEvG5Iwb639jTIQLE9bvlflgkc=
</data>
</dict>
<key>flutter_assets/assets/fonts/Courgette-Regular.ttf</key>
@ -233,11 +233,11 @@
<dict>
<key>hash</key>
<data>
z6HA4R3RmmEmgETKt38kf9Q2pB0=
SHTxJ8fMkVyfUd6I+OY6IBI9xPs=
</data>
<key>hash2</key>
<data>
hPNp485pQCJu+T1KogAUSRKfScgh0RDUUDypDrERRP4=
n7iU4LdL05ehp1IEF87FldiFm9DDHYeJ9YYEkfnIG9c=
</data>
</dict>
<key>flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf</key>

View File

@ -1 +0,0 @@
{"assets/fonts/Courgette-Regular.ttf":["assets/fonts/Courgette-Regular.ttf"],"assets/fonts/Sacramento-Regular.ttf":["assets/fonts/Sacramento-Regular.ttf"],"assets/images/bild.png":["assets/images/bild.png"],"assets/images/flutter.png":["assets/images/flutter.png"],"assets/images/outdoor.png":["assets/images/outdoor.png"],"packages/cupertino_icons/assets/CupertinoIcons.ttf":["packages/cupertino_icons/assets/CupertinoIcons.ttf"],"packages/flutter_google_places/assets/google_black.png":["packages/flutter_google_places/assets/google_black.png"],"packages/flutter_google_places/assets/google_white.png":["packages/flutter_google_places/assets/google_white.png"],"packages/flutter_signin_button/assets/logos/2.0x/facebook_new.png":["packages/flutter_signin_button/assets/logos/2.0x/facebook_new.png"],"packages/flutter_signin_button/assets/logos/2.0x/google_dark.png":["packages/flutter_signin_button/assets/logos/2.0x/google_dark.png"],"packages/flutter_signin_button/assets/logos/2.0x/google_light.png":["packages/flutter_signin_button/assets/logos/2.0x/google_light.png"],"packages/flutter_signin_button/assets/logos/3.0x/facebook_new.png":["packages/flutter_signin_button/assets/logos/3.0x/facebook_new.png"],"packages/flutter_signin_button/assets/logos/3.0x/google_dark.png":["packages/flutter_signin_button/assets/logos/3.0x/google_dark.png"],"packages/flutter_signin_button/assets/logos/3.0x/google_light.png":["packages/flutter_signin_button/assets/logos/3.0x/google_light.png"],"packages/flutter_signin_button/assets/logos/facebook_new.png":["packages/flutter_signin_button/assets/logos/facebook_new.png","packages/flutter_signin_button/assets/logos/2.0x/facebook_new.png","packages/flutter_signin_button/assets/logos/3.0x/facebook_new.png"],"packages/flutter_signin_button/assets/logos/google_dark.png":["packages/flutter_signin_button/assets/logos/google_dark.png","packages/flutter_signin_button/assets/logos/2.0x/google_dark.png","packages/flutter_signin_button/assets/logos/3.0x/google_dark.png"],"packages/flutter_signin_button/assets/logos/google_light.png":["packages/flutter_signin_button/assets/logos/google_light.png","packages/flutter_signin_button/assets/logos/2.0x/google_light.png","packages/flutter_signin_button/assets/logos/3.0x/google_light.png"],"packages/font_awesome_flutter/lib/fonts/fa-brands-400.ttf":["packages/font_awesome_flutter/lib/fonts/fa-brands-400.ttf"],"packages/font_awesome_flutter/lib/fonts/fa-regular-400.ttf":["packages/font_awesome_flutter/lib/fonts/fa-regular-400.ttf"],"packages/font_awesome_flutter/lib/fonts/fa-solid-900.ttf":["packages/font_awesome_flutter/lib/fonts/fa-solid-900.ttf"]}

View File

@ -18,7 +18,7 @@
</data>
<key>flutter_assets/NOTICES.Z</key>
<data>
RXM4n3glWtHRFjYg8t9yY496tV8=
jWwcVuBiNgVjsZeHMvIvKkgWV7I=
</data>
<key>flutter_assets/assets/fonts/Courgette-Regular.ttf</key>
<data>
@ -50,7 +50,7 @@
</data>
<key>flutter_assets/kernel_blob.bin</key>
<data>
z6HA4R3RmmEmgETKt38kf9Q2pB0=
SHTxJ8fMkVyfUd6I+OY6IBI9xPs=
</data>
<key>flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf</key>
<data>
@ -145,11 +145,11 @@
<dict>
<key>hash</key>
<data>
RXM4n3glWtHRFjYg8t9yY496tV8=
jWwcVuBiNgVjsZeHMvIvKkgWV7I=
</data>
<key>hash2</key>
<data>
ySYMYrdnDxwxQLtQ3PlxG2JP0ovJw8sUhmP9GXqhDpY=
mjjZmUY7Yb9Wu/akBkEvG5Iwb639jTIQLE9bvlflgkc=
</data>
</dict>
<key>flutter_assets/assets/fonts/Courgette-Regular.ttf</key>
@ -233,11 +233,11 @@
<dict>
<key>hash</key>
<data>
z6HA4R3RmmEmgETKt38kf9Q2pB0=
SHTxJ8fMkVyfUd6I+OY6IBI9xPs=
</data>
<key>hash2</key>
<data>
hPNp485pQCJu+T1KogAUSRKfScgh0RDUUDypDrERRP4=
n7iU4LdL05ehp1IEF87FldiFm9DDHYeJ9YYEkfnIG9c=
</data>
</dict>
<key>flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf</key>

View File

@ -1 +0,0 @@
{"assets/fonts/Courgette-Regular.ttf":["assets/fonts/Courgette-Regular.ttf"],"assets/fonts/Sacramento-Regular.ttf":["assets/fonts/Sacramento-Regular.ttf"],"assets/images/bild.png":["assets/images/bild.png"],"assets/images/flutter.png":["assets/images/flutter.png"],"assets/images/outdoor.png":["assets/images/outdoor.png"],"packages/cupertino_icons/assets/CupertinoIcons.ttf":["packages/cupertino_icons/assets/CupertinoIcons.ttf"],"packages/flutter_google_places/assets/google_black.png":["packages/flutter_google_places/assets/google_black.png"],"packages/flutter_google_places/assets/google_white.png":["packages/flutter_google_places/assets/google_white.png"],"packages/flutter_signin_button/assets/logos/2.0x/facebook_new.png":["packages/flutter_signin_button/assets/logos/2.0x/facebook_new.png"],"packages/flutter_signin_button/assets/logos/2.0x/google_dark.png":["packages/flutter_signin_button/assets/logos/2.0x/google_dark.png"],"packages/flutter_signin_button/assets/logos/2.0x/google_light.png":["packages/flutter_signin_button/assets/logos/2.0x/google_light.png"],"packages/flutter_signin_button/assets/logos/3.0x/facebook_new.png":["packages/flutter_signin_button/assets/logos/3.0x/facebook_new.png"],"packages/flutter_signin_button/assets/logos/3.0x/google_dark.png":["packages/flutter_signin_button/assets/logos/3.0x/google_dark.png"],"packages/flutter_signin_button/assets/logos/3.0x/google_light.png":["packages/flutter_signin_button/assets/logos/3.0x/google_light.png"],"packages/flutter_signin_button/assets/logos/facebook_new.png":["packages/flutter_signin_button/assets/logos/facebook_new.png","packages/flutter_signin_button/assets/logos/2.0x/facebook_new.png","packages/flutter_signin_button/assets/logos/3.0x/facebook_new.png"],"packages/flutter_signin_button/assets/logos/google_dark.png":["packages/flutter_signin_button/assets/logos/google_dark.png","packages/flutter_signin_button/assets/logos/2.0x/google_dark.png","packages/flutter_signin_button/assets/logos/3.0x/google_dark.png"],"packages/flutter_signin_button/assets/logos/google_light.png":["packages/flutter_signin_button/assets/logos/google_light.png","packages/flutter_signin_button/assets/logos/2.0x/google_light.png","packages/flutter_signin_button/assets/logos/3.0x/google_light.png"],"packages/font_awesome_flutter/lib/fonts/fa-brands-400.ttf":["packages/font_awesome_flutter/lib/fonts/fa-brands-400.ttf"],"packages/font_awesome_flutter/lib/fonts/fa-regular-400.ttf":["packages/font_awesome_flutter/lib/fonts/fa-regular-400.ttf"],"packages/font_awesome_flutter/lib/fonts/fa-solid-900.ttf":["packages/font_awesome_flutter/lib/fonts/fa-solid-900.ttf"]}

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:google_maps_flutter_platform_interface/src/types/camera.dart';
import 'Map.dart';
import 'FavoritePage.dart';
import 'SettingsPage.dart';
@ -6,6 +7,7 @@ import 'globals.dart' as globals;
class BottomNavPage extends StatefulWidget {
@override
State<BottomNavPage> createState() => BottomNavPageState();
}

View File

@ -1,292 +0,0 @@
// ignore_for_file: prefer_const_constructors
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:flutter_applicationdemo/BottomNavPage.dart';
import 'package:flutter_applicationdemo/GoogleSignInProvider.dart';
import 'package:flutter_applicationdemo/mysql.dart';
import 'package:google_sign_in/google_sign_in.dart';
import 'package:flutter_applicationdemo/HomePage.dart';
import 'package:flutter_signin_button/flutter_signin_button.dart';
import 'package:provider/provider.dart';
import 'GoogleSignInProvider.dart';
import 'signInPage.dart';
import 'globals.dart';
import 'user.dart';
class CreateAccountPage extends StatefulWidget {
_CreateAccountPageState createState() => _CreateAccountPageState();
}
class _CreateAccountPageState extends State<CreateAccountPage> {
Color pinkBackgroundColor = const Color.fromARGB(255, 240, 229, 229);
Color textColor = const Color.fromARGB(255, 79, 98, 114);
TextEditingController emailController = TextEditingController();
TextEditingController passwordController = TextEditingController();
TextEditingController userNameController = TextEditingController();
var db = mysql();
late user loggedInUser;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: pinkBackgroundColor,
body: SafeArea(
child: createLoginPageContent(),
),
);
}
// Builds all the components of the page
Column createLoginPageContent() {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
createBackButton(),
createTitleText(),
Text(
"Create Log in:",
style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
),
createUsernameField(),
createEmailField(),
createPasswordField(),
createCreateAccountButton(),
Text("or"),
createGoogleButton(),
Padding(
padding: EdgeInsets.only(top: 100),
child: createContinueWithoutLoggingInButton(),
),
],
);
}
SignInButton createGoogleButton() {
return SignInButton(Buttons.Google, onPressed: () async {
final provider =
Provider.of<GoogleSignInProvider>(context, listen: false);
await provider.logIn();
if (provider.user == null) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
CreateAccountPage()), //Replace Container() with call to Map-page.
);
} else {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
HomePage()), //Replace Container() with call to Map-page.
);
}
});
}
Text createTitleText() {
return Text(
'Sun Chasers',
style: TextStyle(
fontSize: 50,
color: textColor,
fontFamily: 'Sacramento',
shadows: const <Shadow>[
Shadow(
offset: Offset(2, 2),
blurRadius: 10.0,
color: Color.fromARGB(255, 0, 0, 0),
),
],
),
);
}
InputField createUsernameField() {
return InputField(
text: "Username:", isPassword: false, icon: Icon(Icons.person), controller: userNameController);
}
InputField createEmailField() {
return InputField(
text: "Email:", isPassword: false, icon: Icon(Icons.email), controller: emailController);
}
InputField createPasswordField() {
return InputField(
text: "Password:", isPassword: true, icon: Icon(Icons.lock), controller: passwordController);
}
Padding createBackButton() {
return Padding(
padding: EdgeInsets.only(bottom: 20, left: 10),
child: Align(
alignment: Alignment.topLeft,
child: IconButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => HomePage()),
);
},
icon: Icon(Icons.arrow_back),
iconSize: 40,
),
),
);
}
ElevatedButton createCreateAccountButton() {
return ElevatedButton(
onPressed: () async{
UserInput userInput = UserInput(isValid: false, errorMessage: "");
await verifyUserInput(emailController.text, userNameController.text, passwordController.text, userInput);
if(userInput.isValid){
await createUserInSQL(emailController.text, userNameController.text, passwordController.text);
Navigator.push(
context,
MaterialPageRoute(builder: (context) => HomePage()),
);
}else{
createUserError(userInput.errorMessage);
}
},
child: Text(
"Create Account",
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w400),
),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.white),
),
);
}
ElevatedButton createContinueWithoutLoggingInButton() {
return ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => BottomNavPage()),
);
},
child: Text(
"Continue without logging in",
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w400),
),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.white),
),
);
}
Future<void> createUserInSQL(String email, String username, String password) async{
await db.getConnection().then((conn) async{
String sql = "INSERT INTO maen0574.user (id, email, password, username) VALUES (null, '$email', '$password', '$username');";
await conn.query(sql);
sql = "Select id, email, username from maen0574.user where email = '$email'";
await conn.query(sql).then((results){
for(var row in results){
setState(() {
});
loggedInUser = new user(row[0], row[1], row[2]);
LOGGED_IN_USER.userID = loggedInUser.userID;
}
});
});
}
Future<void> verifyUserInput(String email, String username, String password, userInput) async {
userInput.isValid = false;
if(email.contains("'") || !email.contains("@") || email.length < 5){
userInput.errorMessage = "Incorrect email format";
return;
}else if(username.contains("'") || username.length < 6){
userInput.errorMessage = "Incorrect username. \nCharacters limited to a-z, A-Z, 0-9.";
return;
}else if(password.contains("'") || password.length < 6) {
userInput.errorMessage = "Incorrect password. \nPassword can't contain ' and needs to be atleast 6 characters long";
return;
}
await db.getConnection().then((conn) async{
String sql = "SELECT email from maen0574.user where email = '$email';";
var results = await conn.query(sql);
userInput.isValid = true;
for(var row in results){
userInput.isValid = false;
userInput.errorMessage = "email already registererd";
}
});
return;
}
void createUserError(String stringContext) {
showDialog<String>(
context: context,
builder: (BuildContext context) => AlertDialog(
title: Text("Couldn't create user"),
content: Text(stringContext),
actions: <Widget>[
TextButton(
onPressed: () => Navigator.pop(context, 'OK'),
child: const Text('OK'),
),
],
),
);
}
}
class UserInput {
bool isValid;
String errorMessage;
UserInput({
required this.isValid,
required this.errorMessage
});
bool getIsValid(){
return isValid;
}
} // _LoginPageState
class InputField extends StatelessWidget {
final Icon icon;
final String text;
final bool isPassword;
final TextEditingController controller;
const InputField({
Key? key,
required this.text,
required this.isPassword,
required this.icon,
required this.controller
}) : super(key: key);
@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
return Container(
alignment: Alignment.center,
margin: const EdgeInsets.symmetric(vertical: 10, horizontal: 60),
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
width: size.width * 0.7,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.white,
),
child: TextField(
obscureText: isPassword,
controller: controller,
decoration: InputDecoration(
hintText: text,
icon: icon,
border: InputBorder.none,
),
),
);
}
}

View File

@ -1,10 +1,155 @@
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_applicationdemo/BottomNavPage.dart';
import 'package:flutter_applicationdemo/login/GoogleSignInProvider.dart';
import 'package:flutter_applicationdemo/Map.dart';
import 'package:flutter_applicationdemo/venuePage.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:google_sign_in/google_sign_in.dart';
import 'package:settings_ui/settings_ui.dart';
import 'ManageAccountPage.dart';
import 'package:provider/provider.dart';
import 'Venue.dart';
import 'globals.dart' as globals;
import 'Map.dart';
import 'package:flutter_applicationdemo/login/User.dart';
import 'HomePage.dart';
import 'Venue.dart';
import 'mysql.dart';
import 'globals.dart' as globals;
// Standard color of app
Color _backgroundColor = const Color.fromARGB(255, 190, 146, 160);
// Color status of priceRange
Color _colorContainerLow = Colors.yellow;
Color _colorContainerMedium = _backgroundColor;
Color _colorContainerHigh = _backgroundColor;
// Standard
@override
class FavoritePage extends StatefulWidget {
const FavoritePage({Key? key}) : super(key: key);
@override
_FavoritePageState createState() => _FavoritePageState();
}
class _FavoritePageState extends State<FavoritePage> {
List<Venue> likedVenuesList = globals.LOGGED_IN_USER.likedVenuesList;
class FavoritePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(child: Text('FavoritePage',style: TextStyle(fontSize: 60),)),
return DefaultTabController(
length: 2,
child: Scaffold(
appBar: AppBar(
title: Text("Liked"),
backgroundColor: globals.BACKGROUNDCOLOR,
),
body: ListView.builder(
itemCount: likedVenuesList.length,
itemBuilder: (BuildContext context, int index) {
return Dismissible(
key: UniqueKey(),
background: buildDeleteBackground(MainAxisAlignment.start, true),
secondaryBackground: buildDeleteBackground(MainAxisAlignment.end, false),
confirmDismiss: (DismissDirection direction) async{
return await showDialog(
context: context,
builder: (BuildContext context){
return buildUnlikeConfirmation(index, context);
},
);
},
onDismissed: (DismissDirection direction){
removeVenueAsFavorite(likedVenuesList[index]);
setState(() {
likedVenuesList.removeAt(index);
});
},
child: SizedBox(
width: double.infinity,
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
child: InkWell(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Text(likedVenuesList[index].venueName),
),
onTap: (){
Navigator.push(
context,
MaterialPageRoute(builder: (context) => VenuePage(likedVenuesList[index])),
);
},
),
),
),
);
},
)
),
);
}
AlertDialog buildUnlikeConfirmation(int index, BuildContext context) {
return AlertDialog(
title: Text("Delete confirmation"),
content: Text("Are you sure you want to unlike ${likedVenuesList[index].venueName}?"),
actions: <Widget>[
TextButton(
onPressed: () => Navigator.of(context).pop(true),
child: const Text("Delete")
),
TextButton(onPressed: () => Navigator.of(context).pop(false),
child: const Text("Cancel")
),
],
);
}
Container buildDeleteBackground(MainAxisAlignment maa, bool heartAtStart) {
return Container(
color: Colors.red,
child: Padding(
padding: const EdgeInsets.all(15),
child: Row(
mainAxisAlignment: maa,
children: setHeartAtBeginning(heartAtStart),
),
),
);
}
List<Widget> setHeartAtBeginning(bool heartAtStart) {
if(heartAtStart){
return <Widget>[
const Icon(Icons.heart_broken, color: Colors.white),
Text("Remove liked venue", style: TextStyle(color: Colors.white)),
];
}
return <Widget>[
const Text("Remove liked venue", style: TextStyle(color: Colors.white)),
Icon(Icons.heart_broken, color: Colors.white),
];
}
void removeVenueAsFavorite(Venue likedVenue) {
var db = mysql();
db.getConnection().then((conn){
String sql =
"DELETE from maen0574.userFavorites where user_id = '${globals.LOGGED_IN_USER.userID}' and venue_id = '${likedVenue.venueID}'";
conn.query(sql).then((results) {
for (var row in results) {
}
});
});
}
}

View File

@ -12,8 +12,6 @@ Color _colorContainerHappy = _backgroundColor;
Color _colorContainerMediumHappy = _backgroundColor;
Color _colorContainerUpset = _backgroundColor;
var timestamp;
Map<String, bool> _satisfactionBoolean = {
"VeryHappy": false,
@ -54,14 +52,13 @@ class FormForFeedbackState extends State<FormForFeedback> {
var dataBase = mysql();
Future<void> feedbackVerification(String satisfaction, String typeOfFeedback, String writtenFeedback, String timestamp ) async {
Future<void> feedbackVerification(String satisfaction, String typeOfFeedback, String writtenFeedback) async {
await dataBase.getConnection().then((conn) async {
String sql = "INSERT INTO maen0574.User_feedback (id, Satisfaction, Type_of_feedback, Written_feedback, timestamp) VALUES (null, '$satisfaction', '$typeOfFeedback', '$writtenFeedback', '$timestamp);";
String sql = "INSERT INTO maen0574.User_feedback (Satisfaction, Type_of_feedback, Written_feedback) VALUES ('$satisfaction', '$typeOfFeedback', '$writtenFeedback');";
await conn.query(sql).then((results) {
for(var row in results) {
print(row[0].toString());
setState(() {});
form(row[0].toString(), row[1].toString(), row[2].toString(), row[3]);
form(row[0].toString(), row[1].toString(), row[2].toString(), row[3].toString());
}
});
});
@ -339,31 +336,48 @@ class FormForFeedbackState extends State<FormForFeedback> {
InkWell(
onTap: () async {
print(writtenFeedback.text);
if (writtenFeedback.text.contains("'")) {
print('not allowed to use atrophies');
return;
}
timestamp = DateTime.now().millisecondsSinceEpoch.toString();
await feedbackVerification(satisfaction.text, typeOfFeedback.text, writtenFeedback.text, timestamp);
if (_formKey.currentState!.validate()) {
await feedbackVerification(satisfaction.text, typeOfFeedback.text, writtenFeedback.text);
print(satisfaction.text);
print(typeOfFeedback.text);
print(writtenFeedback.text);
print(timestamp);
//pop-up thank you for answering
showDialog<String>(
context: context,
builder: (BuildContext context) =>
AlertDialog(
title: const Text('Thank you'),
content: const Text('Thank you for your feedback, '
'you will now be sent back to the map'),
actions: <Widget>[
TextButton(
child: const Text('Ok'),
onPressed: () =>
Navigator.push(
context,
MaterialPageRoute(builder: (context) =>
BottomNavPage()), //Replace Container() with call to account-page.
BottomNavPage()),
//Replace Container() with call to account-page.
),
),
],
),
);
}
pressedEmojiColor("clear");
pressedTypeOfFeedback("clear");
writtenFeedback.text = '';
},
child: Container(
color: _colorContainerHappy,
color: Colors.purple,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
@ -383,13 +397,9 @@ class FormForFeedbackState extends State<FormForFeedback> {
],
),
),
),
);
}
}
@ -441,6 +451,17 @@ void pressedEmojiColor (String s) {
_satisfactionBoolean["Upset"] == false;
_colorContainerUpset = _backgroundColor;
}
if(s == "clear"){
_satisfactionBoolean["VeryHappy"] = false;
_colorContainerVeryHappy = _backgroundColor;
_satisfactionBoolean["MediumHappy"] == false;
_colorContainerMediumHappy = _backgroundColor;
_satisfactionBoolean["Happy"] == false;
_colorContainerHappy = _backgroundColor;
_satisfactionBoolean["Upset"] == false;
_colorContainerUpset = _backgroundColor;
}
}
void pressedTypeOfFeedback(String s) {
@ -487,4 +508,15 @@ void pressedTypeOfFeedback(String s) {
_typeOfFeedback["Compliment"] == false;
check1 = false;
}
if (s == "clear") {
_typeOfFeedback["Mistake in sun accuracy"] == false;
check4 = false;
_typeOfFeedback["Complaint"] == false;
check2 = false;
_typeOfFeedback["Bug"] == false;
check3 = false;
_typeOfFeedback["Compliment"] == false;
check1 = false;
}
}

View File

@ -2,12 +2,10 @@ class form {
late String satisfaction;
late String typeOfFeedback;
late String writtenFeedback;
late String timestamp;
form(String satisfaction, String typeOfFeedback, String writtenFeedback, String timestamp){
this.satisfaction = satisfaction;
this.typeOfFeedback = typeOfFeedback;
this.writtenFeedback = writtenFeedback;
this.timestamp = timestamp;
}
}

View File

@ -1,10 +1,14 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'BottomNavPage.dart';
import 'package:flutter_applicationdemo/CreateAccountPage.dart';
import 'login/CreateAccountPage.dart';
import 'globals.dart';
import 'signInPage.dart';
import 'user.dart';
import 'login/User.dart';
import 'login/signInPage.dart';
import '../login/User.dart';
import 'mysql.dart';
import 'package:flutter_applicationdemo/login/User.dart' as User;
import 'login/user.dart';
import 'globals.dart' as globals;
@ -45,7 +49,6 @@ class _HomePageState extends State<HomePage> {
color: globals.TEXTCOLOR,
),
),
Container(
padding: EdgeInsets.fromLTRB(80, 40, 80, 80),
child: ElevatedButton(
@ -62,7 +65,8 @@ class _HomePageState extends State<HomePage> {
);
},
child: Text(
'FIND SPOT BY LOCATION',
(globals.LOGGED_IN_USER.userID == 0 ? 'FIND SPOT BY LOCATION \n \n without signing in' : 'FIND SPOT BY LOCATION'),
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18,
@ -155,7 +159,7 @@ class _HomePageState extends State<HomePage> {
elevation: 100,
),
onPressed: () {
globals.LOGGED_IN_USER = user(0, "", "");
globals.LOGGED_IN_USER = User.User(0, "", "");
Navigator.push(
context,
MaterialPageRoute(builder: (context) => HomePage()), //Replace Container() with call to Map-page.

View File

@ -1,15 +1,23 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_applicationdemo/WebScraper.dart';
import 'dart:async';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:flutter_google_places/flutter_google_places.dart';
//import 'package:google_maps_webservice/places.dart';
import 'package:google_api_headers/google_api_headers.dart';
import 'package:http/http.dart' as http;
import 'package:location/location.dart';
import 'package:geolocator/geolocator.dart';
import 'package:flutter_applicationdemo/login/User.dart';
import 'SettingsPage.dart';
import 'Venue.dart';
import 'globals.dart' as globals;
import 'globals.dart' as globals;
class Map extends StatefulWidget {
@override
@ -20,8 +28,6 @@ const kGoogleApiKey = "AIzaSyAUmhd6Xxud8SwgDxJ4LlYlcntm01FGoSk";
final homeSacffoldKey = GlobalKey<ScaffoldState>();
List<_Marker> markers = [];
class MapState extends State<Map> {
@ -33,50 +39,8 @@ class MapState extends State<Map> {
// print('Response body: ${response.body.toString()}');
var jsonData = jsonDecode(response.body);
/* print(jsonData['features'][0]);
print(jsonData['features'][1]['properties']['Plats_1']);
print(jsonData['features'][0]['properties']['Gatunr_1']);
print(jsonData['features'][0]['properties']['Kategorityp']);
/*String data = jsonData['features'][0]['properties']['Kategorityp'];
print(data.contains('Tillfälliga bostäder'));*/
print(jsonData['features'][1]['geometry']['coordinates']);*/
//print(jsonData['features'][0]['properties']['MAIN_ATTRIBUTE_VALUE']);
// List<_Marker> markers = [];
for(var m in jsonData['features']) {
String data = m['properties']['Kategorityp'];
String typ = m['properties']['MAIN_ATTRIBUTE_VALUE'];
if(m['properties']['Kategorityp'] == "1.400I, Uteservering A-läge") {
print(m['properties']['Kategorityp']);
_Marker marker = _Marker(m['properties']['Plats_1'],m['properties']['Gatunr_1'],m['geometry']['coordinates']);
markers.add(marker);
}
print(markers.length);
int count = 0;
for (var mar in markers) {
print(mar.Plats_1);
print(mar.Gatunr_1);
print(mar.coordinates[1]);
print(mar.coordinates[0]);
count++;
print(count);
if (count == 100) {
break;
}
}
//print(m['properties']['Kategorityp']);
}
}
final Completer<GoogleMapController> _controller = Completer();
@ -94,12 +58,14 @@ class MapState extends State<Map> {
@override
void initState() {
intilize();
_getUserLocation();
initialize();
//_getUserLocation();
super.initState();
}
void createBottomSheet() {
void createBottomSheet(String venueName) async {
var webScraper = WebScraper();
await webScraper.getWebsiteData(venueName);
Scaffold.of(context).showBottomSheet<void>(
((context) {
return Container(
@ -109,12 +75,14 @@ class MapState extends State<Map> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: const <Widget>[
children: <Widget>[
/*const Text('BottomSheet'),
ElevatedButton(
child: const Text('Close BottomSheet'),
onPressed: () {Navigator.pop(context);})*/
Image(image: AssetImage('assets/images/bild.png'))
Container(
child: Text(webScraper.openingHoursThisWeek.length.toString()),
),
],
)
@ -124,145 +92,17 @@ class MapState extends State<Map> {
);
}
intilize() {
Marker marker_1;
//for(var marker in markers) {
marker_1 = Marker(
markerId: const MarkerId('id_1'),
onTap: createBottomSheet,
position: const LatLng(59.320671571444514, 18.055854162299937),
infoWindow: const InfoWindow(
title: 'Münchenbryggeriet Beer Garden',
snippet: 'Uteservering',
),
icon: BitmapDescriptor.defaultMarkerWithHue(
BitmapDescriptor.hueGreen,
),
initialize() {
List<Venue> allVenues = globals.VENUES;
for(var venue in allVenues) {
Marker marker = Marker(
markerId: MarkerId(venue.venueID.toString()),
position: venue.position,
onTap: () => createBottomSheet(venue.venueName),
icon: venue.drawIconColor(),
);
Marker marker_2 = Marker(
markerId: const MarkerId('id_2'),
onTap: createBottomSheet,
position: const LatLng(59.33115735285231, 18.074432570090742),
infoWindow: const InfoWindow(
title: 'Le Hibou',
snippet: 'Uteservering',
)
);
Marker marker_3 = Marker(
markerId: const MarkerId('id_3'),
onTap: createBottomSheet,
position: const LatLng(59.3315552932853, 18.092751076985277),
infoWindow: const InfoWindow(
title: 'Strandbryggan',
snippet: 'Uteservering',
)
);
Marker marker_4 = Marker(
markerId: const MarkerId('id_4'),
onTap: createBottomSheet,
position: const LatLng(59.33632582609118, 18.072980646196587),
infoWindow: const InfoWindow(
title: 'Stureplan 1',
snippet: 'Uteservering',
)
);
Marker marker_5 = Marker(
markerId: const MarkerId('id_5'),
onTap: createBottomSheet,
position: const LatLng(59.3240158318325, 18.070690101341437),
infoWindow: const InfoWindow(
title: 'Bågspännaren Bar & Cafe',
snippet: 'Uteservering',
)
);
Marker marker_6 = Marker(
markerId: const MarkerId('id_6'),
onTap: createBottomSheet,
position: const LatLng(59.31905195030728, 18.075349015415547),
infoWindow: const InfoWindow(
title: 'Mosebacketerrassen',
snippet: 'Uteservering',
)
);
Marker marker_7 = Marker(
markerId: const MarkerId('id_7'),
onTap: createBottomSheet,
position: const LatLng(59.31583756143469, 18.072591381467536),
infoWindow: const InfoWindow(
title: 'Snaps Bar & Bistro',
snippet: 'Uteservering',
)
);
Marker marker_8 = Marker(
markerId: const MarkerId('id_8'),
onTap: createBottomSheet,
position: const LatLng(59.315129508641505, 18.074243159987006),
infoWindow: const InfoWindow(
title: 'Kvarnen',
snippet: 'Uteservering',
)
);
Marker marker_9 = Marker(
markerId: const MarkerId('id_9'),
onTap: createBottomSheet,
position: const LatLng(59.31533181094423, 18.070972638518455),
infoWindow: const InfoWindow(
title: 'Neverland Pub & Restaurang',
snippet: 'Uteservering',
)
);
Marker marker_10 = Marker(
markerId: const MarkerId('id_10'),
onTap: createBottomSheet,
position: const LatLng(59.31578389646754, 18.071146819010995),
infoWindow: const InfoWindow(
title: 'Baras Imperium',
snippet: 'Uteservering',
)
);
Marker marker_11 = Marker(
markerId: const MarkerId('id_11'),
onTap: createBottomSheet,
position: const LatLng(59.31549103673382, 18.035425964557245),
infoWindow: const InfoWindow(
title: 'YUC Tanto',
snippet: 'Uteservering',
)
);
Marker marker_12 = Marker(
markerId: const MarkerId('id_12'),
onTap: createBottomSheet,
position: const LatLng(59.314826329005506, 18.03317611771755),
infoWindow: const InfoWindow(
title: 'Loopen',
snippet: 'Uteservering',
)
);
markersList.add(marker_1);
markersList.add(marker_2);
markersList.add(marker_3);
markersList.add(marker_4);
markersList.add(marker_5);
markersList.add(marker_6);
markersList.add(marker_7);
markersList.add(marker_8);
markersList.add(marker_9);
markersList.add(marker_10);
markersList.add(marker_11);
markersList.add(marker_12);
// }
markersList.add(marker);
}
}
@ -338,47 +178,25 @@ class MapState extends State<Map> {
_controller.complete(controller);
},
),
Align(
alignment: Alignment.bottomLeft,
child: Container(
margin: EdgeInsets.symmetric(vertical: 20.0),
height: 250.0,
child: ListView(
scrollDirection: Axis.horizontal,
children: <Widget>[
SizedBox(width: 10.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(59.320671571444514 , 18.055854162299937, 'Münchenbryggeriet Beer Garden') ,
),
SizedBox(width: 10.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(59.33115735285231, 18.074432570090742, 'Le Hibou') ,
),
SizedBox(width: 10.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(59.3315552932853, 18.092751076985277, 'Strandbryggan') ,
),
SizedBox(width: 10.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(59.33632582609118, 18.072980646196587, 'Stureplan 1') ,
),
SizedBox(width: 10.0),
Padding(
padding: const EdgeInsets.all(8.0),
child: _boxes(59.3240158318325, 18.070690101341437, 'Bågspännaren Bar & Cafe') ,
),
],
),
),
)
// ElevatedButton(onPressed: () {} //_handelPressButton
// ,child: const Text("Search Placses"))
],
)
),
floatingActionButton: Padding(
padding: const EdgeInsets.only(top: 100.0),
child: FloatingActionButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const SettingsPage()));
},
backgroundColor: Colors.purple,
child: const Icon(Icons.filter_alt),
),
),
floatingActionButtonLocation: FloatingActionButtonLocation.endTop,
);
}
@ -428,7 +246,7 @@ class MapState extends State<Map> {
Future<void> _goToCurrentPosition(LatLng latlng) async {
final GoogleMapController controller = await _controller.future;
controller.animateCamera(CameraUpdate.newCameraPosition(CameraPosition(
bearing: 192.8334901395799,
bearing: 0,
target: LatLng(latlng.latitude, latlng.longitude),
//tilt: 59.440717697143555,
zoom: 14.4746)));
@ -474,12 +292,3 @@ class MapState extends State<Map> {
}*/
}
class _Marker {
var Plats_1;
var Gatunr_1;
var coordinates;
_Marker(this.Plats_1, this.Gatunr_1, this.coordinates);
}

View File

@ -2,11 +2,11 @@ import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_applicationdemo/BottomNavPage.dart';
import 'package:flutter_applicationdemo/GoogleSignInProvider.dart';
import 'package:flutter_applicationdemo/login/GoogleSignInProvider.dart';
import 'package:google_sign_in/google_sign_in.dart';
import 'package:settings_ui/settings_ui.dart';
import 'ManageAccountPage.dart';
import 'GoogleSignInProvider.dart';
import 'login/GoogleSignInProvider.dart';
import 'package:provider/provider.dart';
import 'FeedbackPage.dart';

View File

@ -1,28 +1,57 @@
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:http/http.dart';
import 'dart:async';
import 'globals.dart' as globals;
import 'Venue.dart';
class ShadowDetector {
bool inShade = false;
List<Venue> venuesInShade = [];
ShadowDetector(double latitude, double longitude) {
evaluateShadowSituation(latitude, longitude);
ShadowDetector() {
}
//Called like "new ShadowDetector.fromShadowDetector(List of venues here);"
ShadowDetector.fromShadowDetector(venues) {
evaluateShadowsForAllVenues(venues);
}
void evaluateShadowSituation (double latitude, double longitude) async {
var lat = latitude.toString();
var lng = longitude.toString();
var dateInMilliseconds = DateTime.now().millisecondsSinceEpoch.toString() + 't';
Future evaluateShadowsForAllVenues (List<Venue> venues) async {
final dateInMilliseconds = DateTime.now().millisecondsSinceEpoch.toString() + 't';
for(var venue in venues) {
LatLng pos = venue.position;
final lat = pos.latitude.toString();
final lng = pos.longitude.toString();
final response = await get(Uri.parse('https://node.sacalerts.com/og-image/loc@$lat,$lng,14.82137z,$dateInMilliseconds'));
var responseAsString = response.body.toString();
print(response);
print(responseAsString);
//print(response);
//print(responseAsString);
//print(responseAsString[responseAsString.length - 2]);
if(responseAsString[responseAsString.length - 2] == 1) {
this.inShade = true;
venue.inShade = true;
}
venuesInShade.add(venue);
}
}
List<Venue> get listWithVenuesInShade => venuesInShade; //Get all venues with their shadow status updated.
void evaluateShadowsForOneVenue (Venue venue) async {
LatLng pos= venue.position;
final lat = pos.latitude.toString();
final lng = pos.longitude.toString();
final dateInMilliseconds = DateTime.now().millisecondsSinceEpoch.toString() + 't';
final response = await get(Uri.parse('https://node.sacalerts.com/og-image/loc@$lat,$lng,14.82137z,$dateInMilliseconds'));
var responseAsString = response.body.toString();
//print(response);
//print(responseAsString);
//print(responseAsString[responseAsString.length - 2]);
if(responseAsString[responseAsString.length - 2] == 1) {
venue.inShade = true;
}
else {
venue.inShade = false;
}
}
bool get isInShade =>inShade;
}

31
lib/Venue.dart Normal file
View File

@ -0,0 +1,31 @@
import 'package:google_maps_flutter/google_maps_flutter.dart';
class Venue {
late String venueName;
late int venueID;
late VenueType typeOfVenue;
late LatLng position;
late InfoWindow infoWindow;
bool inShade = false;
Venue(this.venueName,
this.venueID, this.typeOfVenue, this.position);
BitmapDescriptor drawIconColor() {
if(inShade) {
return BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueAzure);
}
else {
return BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueYellow);
}
}
}
enum VenueType{
cafe, restaurant, bar
}

60
lib/WebScraper.dart Normal file
View File

@ -0,0 +1,60 @@
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:html/dom.dart' as dom;
class WebScraper {
late List<String> openingHoursThisWeek;
late String openingHoursToday;
late String reviewScore;
//late String priceClass;
WebScraper() { //Must provide an URL from bing search engine.
}
Future getWebsiteData(String venueName) async {
final bingURL = Uri.parse('https://www.bing.com/search?q=$venueName');
final bingResponse = await http.get(bingURL);
dom.Document htmlBing = dom.Document.html(bingResponse.body);
openingHoursToday = htmlBing
.getElementsByClassName('opHr_Exp')
.map((e) => e.text)
.toList()[0]
.toString();
openingHoursThisWeek = htmlBing
.getElementsByClassName('hrRange')
.map((e) => e.text)
.toList();
reviewScore = htmlBing.getElementsByClassName('csrc sc_rc1')
.map((e) => e.attributes['aria-label'])
.toList()[0]
.toString();
/* final tripAdvisorURL = htmlBing.querySelectorAll('div.infoModule.b_divsec.topBleed.noSeparator > div > a')
.map((e) => e.attributes['href'])
.toList()[0]
.toString();
final tripAdvisorResponse = await http.get(Uri.parse(tripAdvisorURL));
dom.Document htmlTripAdvisor = dom.Document.html(tripAdvisorResponse.body);
priceClass = htmlTripAdvisor
.getElementsByClassName('drUyy')
.map((e) => e.text)
.toList()[0]
.toString();*/
}
List<String> get getOpeningHoursThisWeek => openingHoursThisWeek; //First item is monday, last item is sunday.
// Output example: "[11:00 - 01:00, 11:00 - 01:00, 11:00 - 01:00, 11:00 - 01:00, 11:00 - 01:00, 11:00 - 01:00, 11:00 - 01:00]"
String get getOpeningHoursToday => openingHoursToday; //Output example: "Open · Closes 01:00" (Gets automatically updated).
String get getReviewScore => reviewScore; // Output example: "Star Rating: 4 out of 5.".
//String get getPriceClass => priceClass; // Output example: "$$ - $$$".
}

View File

@ -1,162 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter_applicationdemo/BottomNavPage.dart';
import 'package:flutter_applicationdemo/HomePage.dart';
class createUserPage extends StatefulWidget {
_createUserPageState createState() => _createUserPageState();
}
class _createUserPageState extends State<createUserPage> {
Color pinkBackgroundColor = const Color.fromARGB(255, 240, 229, 229);
Color textColor = const Color.fromARGB(255, 79, 98, 114);
@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
return Scaffold(
backgroundColor: pinkBackgroundColor,
body: SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
createBackButton(),
createTitleText(),
Text(
"Create Log in:",
style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
),
createUsernameField(),
createEmailField(),
createPasswordField(),
createCreateAccountButton(),
Padding(
padding: EdgeInsets.only(top: 100),
child: createContinueWithoutLoggingInButton(),
),
],
),
),
);
}
Text createTitleText() {
return Text(
'Sun Chasers',
style: TextStyle(
fontSize: 50,
color: textColor,
fontFamily: 'Sacramento',
shadows: const <Shadow>[
Shadow(
offset: Offset(2, 2),
blurRadius: 10.0,
color: Color.fromARGB(255, 0, 0, 0),
),
],
),
);
}
InputField createUsernameField() {
return InputField(
text: "Username:", isPassword: false, icon: Icon(Icons.person));
}
InputField createEmailField() {
return InputField(
text: "Email:", isPassword: false, icon: Icon(Icons.email));
}
InputField createPasswordField() {
return InputField(
text: "Password:", isPassword: true, icon: Icon(Icons.lock));
}
Padding createBackButton() {
return Padding(
padding: EdgeInsets.only(bottom: 20, left: 10),
child: Align(
alignment: Alignment.topLeft,
child: IconButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => HomePage()),
);
},
icon: Icon(Icons.arrow_back),
iconSize: 40,
),
),
);
}
ElevatedButton createCreateAccountButton() {
return ElevatedButton(
onPressed: () {},
child: Text(
"Create Account",
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w400),
),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.white),
),
);
}
ElevatedButton createContinueWithoutLoggingInButton() {
return ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => BottomNavPage()),
);
},
child: Text(
"Continue without logging in",
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w400),
),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.white),
),
);
}
} // _LoginPageState
class InputField extends StatelessWidget {
final Icon icon;
final String text;
final bool isPassword;
const InputField({
Key? key,
required this.text,
required this.isPassword,
required this.icon,
}) : super(key: key);
@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
return Container(
alignment: Alignment.center,
margin: const EdgeInsets.symmetric(vertical: 10, horizontal: 60),
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
width: size.width * 0.7,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.white,
),
child: TextField(
obscureText: isPassword,
decoration: InputDecoration(
hintText: text,
icon: icon,
border: InputBorder.none,
),
),
);
}
}

View File

@ -1,12 +1,16 @@
import 'Venue.dart';
import 'package:flutter_applicationdemo/login/User.dart';
import '../login/User.dart';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'user.dart';
import 'HomePage.dart';
import 'Venue.dart';
import 'Venue.dart';
import 'main.dart';
user LOGGED_IN_USER = user(0, "", "");
User LOGGED_IN_USER = User(0, "", "");
Color BACKGROUNDCOLOR = const Color.fromARGB(255, 190, 146, 160);
Color ITEMCOLOR = const Color.fromARGB(255, 0, 0, 0);
Color BUTTONCOLOR = const Color.fromARGB(204, 172, 123, 132);
@ -14,3 +18,12 @@ Color PINKBACKGROUND = const Color.fromARGB(255, 240, 229, 229);
Color TEXTCOLOR = const Color.fromARGB(255, 79, 98, 114);
Color SHADOWCOLOR = const Color.fromARGB(255, 0, 0, 0);
Color TEXTWHITE = const Color.fromARGB(0, 0, 0, 0);
late List<Venue> VENUES = [];
Venue? getVenueByID(int searchedVenueID){
for(var V in VENUES){
if(V.venueID == searchedVenueID){
return V;
}
}return null;
}

View File

@ -0,0 +1,213 @@
// ignore_for_file: prefer_const_constructors
import 'package:flutter/material.dart';
import 'package:flutter_applicationdemo/BottomNavPage.dart';
import 'package:flutter_applicationdemo/mysql.dart';
import 'package:flutter_applicationdemo/HomePage.dart';
import '../globals.dart' as globals;
import '../reusables/InputField.dart';
import 'User.dart';
import '../reusables/returnButton.dart';
class CreateAccountPage extends StatefulWidget {
_CreateAccountPageState createState() => _CreateAccountPageState();
}
class _CreateAccountPageState extends State<CreateAccountPage> {
Color pinkBackgroundColor = const Color.fromARGB(255, 240, 229, 229);
Color textColor = const Color.fromARGB(255, 79, 98, 114);
TextEditingController emailController = TextEditingController();
TextEditingController passwordController = TextEditingController();
TextEditingController userNameController = TextEditingController();
var db = mysql();
late User loggedInUser;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: globals.PINKBACKGROUND,
leading: ReturnButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => HomePage()),
);
},
),
),
backgroundColor: pinkBackgroundColor,
body: Center(child: SingleChildScrollView(
child: createLoginPageContent(),
))
);
}
// Builds all the components of the page
Column createLoginPageContent() {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
createTitleText(),
Text(
"Create Log in:",
style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
),
createUsernameField(),
createEmailField(),
createPasswordField(),
Padding(
padding: const EdgeInsets.only(top: 20),
child: createCreateAccountButton(),
),
],
);
}
Text createTitleText() {
return Text(
'Sun Chasers',
style: TextStyle(
fontSize: 50,
color: textColor,
fontFamily: 'Sacramento',
shadows: const <Shadow>[
Shadow(
offset: Offset(2, 2),
blurRadius: 10.0,
color: Color.fromARGB(255, 0, 0, 0),
),
],
),
);
}
InputField createUsernameField() {
return InputField(
text: "Username:",
isPassword: false,
icon: Icon(Icons.person),
controller: userNameController);
}
InputField createEmailField() {
return InputField(
text: "Email:",
isPassword: false,
icon: Icon(Icons.email),
controller: emailController);
}
InputField createPasswordField() {
return InputField(
text: "Password:",
isPassword: true,
icon: Icon(Icons.lock),
controller: passwordController);
}
ElevatedButton createCreateAccountButton() {
return ElevatedButton(
onPressed: () async {
UserInput userInput = UserInput(isValid: false, errorMessage: "");
await verifyUserInput(emailController.text, userNameController.text,
passwordController.text, userInput);
if (userInput.isValid) {
await createUserInSQL(emailController.text, userNameController.text,
passwordController.text);
Navigator.push(
context,
MaterialPageRoute(builder: (context) => HomePage()),
);
} else {
createUserError(userInput.errorMessage);
}
},
child: Text(
"Create Account",
style: TextStyle(color: Colors.white, fontWeight: FontWeight.w400),
),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(globals.BUTTONCOLOR),
),
);
}
Future<void> createUserInSQL(
String email, String username, String password) async {
await db.getConnection().then((conn) async {
String sql =
"INSERT INTO maen0574.user (id, email, password, username) VALUES (null, '$email', '$password', '$username');";
await conn.query(sql);
sql =
"Select id, email, username from maen0574.user where email = '$email'";
await conn.query(sql).then((results) {
for (var row in results) {
setState(() {});
loggedInUser = new User(row[0], row[1], row[2]);
globals.LOGGED_IN_USER.userID = loggedInUser.userID;
}
});
});
}
Future<void> verifyUserInput(
String email, String username, String password, userInput) async {
userInput.isValid = false;
if (email.contains("'") || !email.contains("@") || email.length < 5) {
userInput.errorMessage = "Incorrect email format";
return;
} else if (username.contains("'") || username.length < 6) {
userInput.errorMessage =
"Incorrect username. \nCharacters limited to a-z, A-Z, 0-9.";
return;
} else if (password.contains("'") || password.length < 6) {
userInput.errorMessage =
"Incorrect password. \nPassword can't contain ' and needs to be atleast 6 characters long";
return;
}
await db.getConnection().then((conn) async {
String sql = "SELECT email from maen0574.user where email = '$email';";
var results = await conn.query(sql);
userInput.isValid = true;
for (var row in results) {
userInput.isValid = false;
userInput.errorMessage = "email already registererd";
}
});
return;
}
void createUserError(String stringContext) {
showDialog<String>(
context: context,
builder: (BuildContext context) => AlertDialog(
title: Text("Couldn't create user"),
content: Text(stringContext),
actions: <Widget>[
TextButton(
onPressed: () => Navigator.pop(context, 'OK'),
child: const Text('OK'),
),
],
),
);
}
}
class UserInput {
bool isValid;
String errorMessage;
UserInput({required this.isValid, required this.errorMessage});
bool getIsValid() {
return isValid;
}
} // _LoginPageState

42
lib/login/User.dart Normal file
View File

@ -0,0 +1,42 @@
import 'package:flutter_applicationdemo/Venue.dart';
import 'package:flutter_applicationdemo/mysql.dart';
import 'package:flutter_applicationdemo/globals.dart' as globals;
class User{
late int userID;
late String username;
late String email;
late List<Venue> likedVenuesList;
User(this.userID, this.username, this.email){
likedVenuesList = List.empty(growable: true);
getFavoriteVenues();
}
User emptyUser(){
return User(0, "", "");
}
int getID(){
return userID;
}
Future<void> getFavoriteVenues() async{
var db = mysql();
await db.getConnection().then((conn) async {
String sql = "select venue_id from maen0574.userFavorites where user_id = '$userID'";
await conn.query(sql).then((results){
for(var row in results){
Venue? venue = globals.getVenueByID(row[0]);
if(venue != null){
likedVenuesList.add(venue);
}
}
});
for(Venue venue in likedVenuesList){
print(venue.venueName);
}
});
}
}

226
lib/login/signInPage.dart Normal file
View File

@ -0,0 +1,226 @@
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../mysql.dart';
import '../HomePage.dart';
import '../main.dart';
import 'User.dart';
import '../reusables/InputField.dart';
import '../reusables/returnButton.dart';
import 'package:flutter_signin_button/flutter_signin_button.dart';
import 'GoogleSignInProvider.dart';
import 'CreateAccountPage.dart';
import 'package:provider/provider.dart';
import 'package:flutter_applicationdemo/globals.dart' as globals;
class SignInPage extends StatefulWidget {
@override
State<SignInPage> createState() => _SignInPageState();
}
class _SignInPageState extends State<SignInPage> {
var db = mysql();
late User loggedInUser;
TextEditingController emailController = TextEditingController();
TextEditingController passwordController = TextEditingController();
Future<void> loginVerification(String email, String password) async {
await db.getConnection().then((conn) async {
String sql =
"select id, email, password from maen0574.user where email = '$email' and password = '$password'";
await conn.query(sql).then((results) {
for (var row in results) {
setState(() {});
loggedInUser = new User(row[0], row[1], row[2]);
globals.LOGGED_IN_USER = loggedInUser;
}
});
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: globals.PINKBACKGROUND,
resizeToAvoidBottomInset: true,
appBar: AppBar(
backgroundColor: globals.PINKBACKGROUND,
leading: ReturnButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => HomePage()),
);
},
),
),
body: Center(child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
createTitleText(),
const Text(
'Sign in',
style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
),
createEmailField(),
createPasswordField(),
Padding(
padding: const EdgeInsets.only(top: 10.0),
child: createSignInButton(),
),
const Text("or"),
Padding(
padding: const EdgeInsets.only(top: 10.0),
child: createGoogleButton(),
),
],
),
),)
// This trailing comma makes auto-formatting nicer for build methods.
);
}
void loginError() {
showDialog<String>(
context: context,
builder: (BuildContext context) => AlertDialog(
title: const Text('Login failed'),
content: const Text('Email or password incorrect'),
actions: <Widget>[
TextButton(
onPressed: () => Navigator.pop(context, 'OK'),
child: const Text('OK'),
),
],
),
);
}
Text createTitleText() {
return Text(
'Sun Chasers',
style: TextStyle(
fontSize: 50,
color: globals.TEXTCOLOR,
fontFamily: 'Sacramento',
shadows: <Shadow>[
Shadow(
offset: Offset(2, 2),
blurRadius: 10.0,
color: globals.SHADOWCOLOR,
),
],
),
);
}
InputField createEmailField() {
return InputField(
text: "Email:",
isPassword: false,
icon: Icon(Icons.email),
controller: emailController);
}
InputField createPasswordField() {
return InputField(
text: "Password:",
isPassword: true,
icon: Icon(Icons.lock),
controller: passwordController);
}
ElevatedButton createSignInButton() {
return ElevatedButton(
onPressed: () async {
if (emailController.text.contains("'") ||
passwordController.text.contains("'")) {
print("1");
loginError();
return;
}
await loginVerification(emailController.text, passwordController.text);
if (globals.LOGGED_IN_USER.userID != 0) {
globals.LOGGED_IN_USER = loggedInUser;
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
HomePage()), //Replace Container() with call to account-page.
);
} else {
print(globals.LOGGED_IN_USER.userID);
loginError();
}
//print(loggedInUser.email + " " + loggedInUser.userID.toString());
},
child: const Text(
"Sign in",
style: TextStyle(
color: Colors.black, fontWeight: FontWeight.w400, fontSize: 15),
),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.white),
fixedSize: MaterialStateProperty.all(Size.fromHeight(40.0)),
),
);
}
SignInButton createGoogleButton() {
return SignInButton(Buttons.Google, onPressed: () async {
final provider =
Provider.of<GoogleSignInProvider>(context, listen: false);
await provider.logIn();
if (provider.user == null) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
CreateAccountPage()), //Replace Container() with call to Map-page.
);
} else {
var email = provider.user?.email.toString();
await loginVerificationGmail(email!);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
HomePage()), //Replace Container() with call to Map-page.
);
}
});
}
Future<void> loginVerificationGmail(String email) async{
await db.getConnection().then((conn) async {
String sql =
"select id, email, password from maen0574.user where email = '$email'";
await conn.query(sql).then((results) {
for (var row in results) {
setState(() {});
loggedInUser = new User(row[0], row[1], row[2]);
globals.LOGGED_IN_USER = loggedInUser;
}
});
});
if(globals.LOGGED_IN_USER.userID == 0){
await db.getConnection().then((conn) async{
String sql = "INSERT INTO maen0574.user (id, email, password, username) VALUES (null, '$email', '', '');";
await conn.query(sql);
sql = "Select id, email, username from maen0574.user where email = '$email'";
await conn.query(sql).then((results) {
for (var row in results) {
setState(() {});
loggedInUser = new User(row[0], row[1], row[2]);
globals.LOGGED_IN_USER.userID = loggedInUser.userID;
}
});
});
}
}
}

View File

@ -3,17 +3,24 @@ import 'dart:async';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter_applicationdemo/GoogleSignInProvider.dart';
import 'package:flutter_applicationdemo/ShadowDetector.dart';
import 'package:flutter_applicationdemo/login/GoogleSignInProvider.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:flutter_applicationdemo/login/GoogleSignInProvider.dart';
import 'package:provider/provider.dart';
import 'Map.dart';
import 'HomePage.dart';
import 'user.dart';
import 'globals.dart';
import 'Venue.dart';
import 'mysql.dart';
import 'package:flutter_applicationdemo/login/User.dart';
import 'login/User.dart';
import 'globals.dart' as globals;
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// await Firebase.initializeApp();
await Firebase.initializeApp();
await loadAllVenues();
runApp(MyApp());
}
@ -34,26 +41,19 @@ class MyApp extends StatelessWidget {
);
}
}
/*
class HomePage extends StatefulWidget {
@override
State<HomePage> createState() => HomePageState();
Future<void> loadAllVenues() async{
globals.VENUES = [];
var db = mysql();
await db.getConnection().then((conn) async {
String sql = "select venueName, venueID, latitude, longitude from maen0574.venue";
await conn.query(sql).then((results){
for(var row in results){
globals.VENUES.add(Venue(row[0], row[1], VenueType.restaurant, LatLng(row[2], row[3])));
}
});
});
class HomePageState extends State<HomePage> {
var sd = ShadowDetector();
await sd.evaluateShadowsForAllVenues(globals.VENUES);
@override
Widget build(BuildContext context) {
return Scaffold(
floatingActionButton: FloatingActionButton.extended(
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(builder: (context) => Map()));
},
label: const Text('To Karta'),
icon: const Icon(Icons.directions_boat),
),
);
}
}*/

View File

@ -0,0 +1,40 @@
import 'package:flutter/material.dart';
// This class creates an input field for the login- and register-pages
class InputField extends StatelessWidget {
final Icon icon; // The icon
final String text; // The text to be displayed inside the input field
final bool isPassword; // Set to true if you want the input text to be hidden
final TextEditingController controller;
const InputField(
{Key? key,
required this.text,
required this.isPassword,
required this.icon,
required this.controller})
: super(key: key);
@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
return Container(
alignment: Alignment.center,
margin: const EdgeInsets.symmetric(vertical: 10, horizontal: 60),
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
width: size.width * 0.7,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.white,
),
child: TextField(
obscureText: isPassword,
controller: controller,
decoration: InputDecoration(
hintText: text,
icon: icon,
border: InputBorder.none,
),
),
);
}
}

View File

@ -0,0 +1,29 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_applicationdemo/HomePage.dart';
class ReturnButton extends StatelessWidget {
final onPressed;
ReturnButton({
required this.onPressed,
Key? key,})
: super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(left: 10),
child: Align(
alignment: Alignment.topLeft,
child: IconButton(
onPressed: onPressed,
icon: const Icon(
Icons.arrow_back,
color: Colors.black,
),
iconSize: 40,
),
),
);
}
}

View File

@ -1,167 +0,0 @@
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'mysql.dart';
import 'HomePage.dart';
import 'main.dart';
import 'user.dart';
import 'package:flutter_applicationdemo/globals.dart';
class SignInPage extends StatefulWidget{
@override
State<SignInPage> createState() => _SignInPageState();
}
class _SignInPageState extends State<SignInPage> {
Color pinkBackgroundColor = const Color.fromARGB(255, 240, 229, 229);
Color textColor = const Color.fromARGB(255, 79, 98, 114);
var db = mysql();
int loggedInID = 0;
late user loggedInUser;
TextEditingController emailController = TextEditingController();
TextEditingController passwordController = TextEditingController();
Future<void> loginVerification(String email, String password) async{
await db.getConnection().then((conn) async {
String sql = "select id, email, password from maen0574.user where email = '$email' and password = '$password'";
await conn.query(sql).then((results){
for(var row in results){
setState(() {
});
loggedInUser = new user(row[0], row[1], row[2]);
loggedInID = loggedInUser.getID();
}
});
});
}
@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
return Scaffold(
//resizeToAvoidBottomPadding: false,
resizeToAvoidBottomInset: false,
backgroundColor: pinkBackgroundColor,
body: SafeArea(
child: Column(
//mainAxisAlignment: MainAxisAlignment.center,
//crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
createBackButton(),
createTitleText(),
const Text(
'Login',
),
Padding(
padding: EdgeInsets.all(15),
child: TextField(
controller: emailController,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'email',
hintText: 'Enter your email',
),
),
),
Padding(
padding: EdgeInsets.all(15),
child: TextField(
controller: passwordController,
obscureText: true,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'Password',
hintText: 'Enter Password',
),
),
),
ElevatedButton(
style: ElevatedButton.styleFrom(
fixedSize: const Size(100, 50),
primary: const Color.fromARGB(204, 172, 123, 132),
elevation: 100,
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(400.0),
),
),
onPressed: () async {
if(emailController.text.contains("'") || passwordController.text.contains("'")){
loginError();
return;
}
await loginVerification(emailController.text, passwordController.text);
if(loggedInID != 0){
LOGGED_IN_USER = loggedInUser;
Navigator.push(
context,
MaterialPageRoute(builder: (context) => HomePage()), //Replace Container() with call to account-page.
);
}else{
loginError();
}
//print(loggedInUser.email + " " + loggedInUser.userID.toString());
},
child: Text('Sign In'),
),
],
),
),
// This trailing comma makes auto-formatting nicer for build methods.
);
}
void loginError() {
showDialog<String>(
context: context,
builder: (BuildContext context) => AlertDialog(
title: const Text('Login failed'),
content: const Text('Email or password incorrect'),
actions: <Widget>[
TextButton(
onPressed: () => Navigator.pop(context, 'OK'),
child: const Text('OK'),
),
],
),
);
}
Padding createBackButton() {
return Padding(
padding: const EdgeInsets.only(bottom: 20, left: 10),
child: Align(
alignment: Alignment.topLeft,
child: IconButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => HomePage()),
);
},
icon: Icon(Icons.arrow_back),
iconSize: 40,
),
),
);
}
Text createTitleText() {
return Text(
'Sun Chasers',
style: TextStyle(
fontSize: 50,
color: textColor,
fontFamily: 'Sacramento',
shadows: const <Shadow>[
Shadow(
offset: Offset(2, 2),
blurRadius: 10.0,
color: Color.fromARGB(255, 0, 0, 0),
),
],
),
);
}
}

View File

@ -1,18 +0,0 @@
class user{
late int userID;
late String username;
late String email;
user(int userID, String username, String email){
this.userID = userID;
this.username = username;
this.email = email;
}
user emptyUser(){
return user(0, "", "");
}
int getID(){
return userID;
}
}

View File

@ -1,6 +1,7 @@
import 'dart:convert';
import 'dart:io';
import 'package:flutter_applicationdemo/Venue.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
@ -149,15 +150,19 @@ class WeatherData {
}
class VenuePage extends StatefulWidget {
const VenuePage({Key? key}) : super(key: key);
const VenuePage(this.venue, {Key? key}) : super(key: key);
final Venue venue;
@override
State<VenuePage> createState() => _VenuePageState();
State<VenuePage> createState() => _VenuePageState(venue);
}
class _VenuePageState extends State<VenuePage> {
late WeatherData currentWeather;
final String imageLink = '';
late final Venue venue;
_VenuePageState(this.venue);
validateAndGetImageLink() {
if (imageLink == '') {
@ -200,10 +205,10 @@ class _VenuePageState extends State<VenuePage> {
return Scaffold(
backgroundColor: const Color(0xfffceff9),
appBar: AppBar(
title: const Text('My Venue'),
title: Text(venue.venueName),
backgroundColor: const Color(0xffac7b84),
),
body: Center(
body: Center(child: SingleChildScrollView(
child: Container(
alignment: Alignment.center,
child: Column(children: <Widget>[
@ -228,8 +233,8 @@ class _VenuePageState extends State<VenuePage> {
Row(children: [
Expanded(
child: Column(
children: const [
Text('This is the name'),
children: [
Text(venue.venueName),
Text('This is the address'),
],
)),
@ -271,14 +276,14 @@ class _VenuePageState extends State<VenuePage> {
)
]),
const AboutTheSpotTable(),
GridView.count(
/*GridView.count(
crossAxisCount: 2,
children: [],
)
)*/
]),
),
),
);
));
}
}

View File

@ -64,6 +64,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.2"
csslib:
dependency: transitive
description:
name: csslib
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.1"
cupertino_icons:
dependency: "direct main"
description:
@ -267,7 +274,7 @@ packages:
name: get
url: "https://pub.dartlang.org"
source: hosted
version: "4.6.3"
version: "4.6.5"
google_api_headers:
dependency: transitive
description:
@ -338,6 +345,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.1"
html:
dependency: "direct main"
description:
name: html
url: "https://pub.dartlang.org"
source: hosted
version: "0.15.0"
http:
dependency: transitive
description:

View File

@ -54,6 +54,7 @@ dependencies:
google_sign_in: ^5.0.3
get: ^4.6.1
mysql1: ^0.19.0
html: ^0.15.0
flutter_native_splash:
background_image: assets/images/outdoor.png