LoginPage #60
File diff suppressed because one or more lines are too long
|
@ -1,7 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'Map.dart';
|
import 'Map.dart';
|
||||||
import 'FavoritePage.dart';
|
import 'FavoritePage.dart';
|
||||||
import 'SettingsPage.dart';
|
|
||||||
import 'globals.dart' as globals;
|
import 'globals.dart' as globals;
|
||||||
import 'ListViewPage.dart';
|
import 'ListViewPage.dart';
|
||||||
|
|
||||||
|
|
|
@ -87,11 +87,12 @@ class _FavoritePageState extends State<FavoritePage> {
|
||||||
primary: globals.BUTTONCOLOR,
|
primary: globals.BUTTONCOLOR,
|
||||||
elevation: 100,
|
elevation: 100,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () async{
|
||||||
Navigator.push(
|
await Navigator.push(
|
||||||
context, //SignInPage()
|
context, //SignInPage()
|
||||||
MaterialPageRoute(builder: (context) =>SignInPage()), //Replace Container() with call to Map-page.
|
MaterialPageRoute(builder: (context) =>SignInPage()), //Replace Container() with call to Map-page.
|
||||||
);
|
);
|
||||||
|
(context as Element).reassemble();
|
||||||
},
|
},
|
||||||
child: Text('Sign in',
|
child: Text('Sign in',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
|
|
@ -76,25 +76,6 @@ class FormForFeedbackState extends State<FormForFeedback> {
|
||||||
resizeToAvoidBottomInset: true, //för att undvika RenderFlex overflow när man får upp skrivbordet
|
resizeToAvoidBottomInset: true, //för att undvika RenderFlex overflow när man får upp skrivbordet
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
backgroundColor: buttonColor,
|
backgroundColor: buttonColor,
|
||||||
title: Row(
|
|
||||||
children: <Widget>[
|
|
||||||
|
|
||||||
FlatButton(
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(builder: (context) => BottomNavPage()),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
child: Text("Close",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 25,
|
|
||||||
color: appBarColor),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
|
|
|
@ -1,150 +0,0 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
|
||||||
import 'BottomNavPage.dart';
|
|
||||||
import 'login/CreateAccountPage.dart';
|
|
||||||
import 'login/signInPage.dart';
|
|
||||||
import 'package:flutter_applicationdemo/login/User.dart' as User;
|
|
||||||
import 'globals.dart' as globals;
|
|
||||||
|
|
||||||
|
|
||||||
class HomePage extends StatefulWidget {
|
|
||||||
const HomePage({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<HomePage> createState() => _HomePageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _HomePageState extends State<HomePage> {
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: globals.PINKBACKGROUND,
|
|
||||||
body: SafeArea(
|
|
||||||
child: Center(
|
|
||||||
child: Column(children: <Widget>[
|
|
||||||
Container(
|
|
||||||
padding: EdgeInsets.fromLTRB(80, 80, 80, 0),
|
|
||||||
child: Text(
|
|
||||||
'Sun Chasers',
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
fontSize: 52,
|
|
||||||
color: globals.TEXTCOLOR,
|
|
||||||
),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.fromLTRB(80, 80, 80, 80),
|
|
||||||
child: ElevatedButton(
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
fixedSize: const Size(200, 200),
|
|
||||||
primary: globals.BUTTONCOLOR,
|
|
||||||
elevation: globals.elevation,
|
|
||||||
shape: const CircleBorder(),
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(builder: (context) => BottomNavPage()), //Replace Container() with call to account-page.
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
(globals.LOGGED_IN_USER.userID == 0 ? '\nFIND SPOT BY LOCATION \n \n as guest' : 'FIND SPOT BY LOCATION'),
|
|
||||||
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 18,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
globals.LOGGED_IN_USER.userID == 0 ?
|
|
||||||
buildLoginAndCreateUserButton() : buildLogOutButton()
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Container buildLoginAndCreateUserButton() {
|
|
||||||
return Container(
|
|
||||||
child: Column(
|
|
||||||
children: <Widget> [
|
|
||||||
ElevatedButton(
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
fixedSize: const Size(200, 50),
|
|
||||||
primary: globals.BUTTONCOLOR,
|
|
||||||
elevation: globals.elevation,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.push(
|
|
||||||
context, //SignInPage()
|
|
||||||
MaterialPageRoute(builder: (context) =>SignInPage()), //Replace Container() with call to Map-page.
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Text('Sign in',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 18,
|
|
||||||
color: Colors.white,
|
|
||||||
)
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5)),
|
|
||||||
ElevatedButton(
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
fixedSize: const Size(200, 50),
|
|
||||||
primary: globals.BUTTONCOLOR,
|
|
||||||
elevation: globals.elevation,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(builder: (context) => CreateAccountPage()), //Replace Container() with call to Map-page.
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: const Text('Create account',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 18,
|
|
||||||
color: Colors.white,
|
|
||||||
)
|
|
||||||
),
|
|
||||||
)
|
|
||||||
]
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
ElevatedButton buildLogOutButton() {
|
|
||||||
return ElevatedButton(
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
fixedSize: const Size(200, 50),
|
|
||||||
primary: globals.BUTTONCOLOR,
|
|
||||||
elevation: globals.elevation,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
globals.LOGGED_IN_USER = User.User(0, "", "");
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(builder: (context) => HomePage()), //Replace Container() with call to Map-page.
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Text('Log out',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 18,
|
|
||||||
color: Colors.white,
|
|
||||||
shadows: <Shadow> [
|
|
||||||
Shadow(
|
|
||||||
offset: Offset(2, 2),
|
|
||||||
blurRadius: 10.0,
|
|
||||||
color: globals.SHADOWCOLOR,
|
|
||||||
),
|
|
||||||
])
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -4,7 +4,6 @@ import 'package:flutter_applicationdemo/login/EncryptData.dart';
|
||||||
import 'package:flutter_applicationdemo/reusables/InputField.dart';
|
import 'package:flutter_applicationdemo/reusables/InputField.dart';
|
||||||
import 'package:flutter_applicationdemo/globals.dart' as globals;
|
import 'package:flutter_applicationdemo/globals.dart' as globals;
|
||||||
import 'package:flutter_applicationdemo/mysql.dart';
|
import 'package:flutter_applicationdemo/mysql.dart';
|
||||||
import 'HomePage.dart';
|
|
||||||
|
|
||||||
class ManageAccountPage extends StatefulWidget {
|
class ManageAccountPage extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
|
@ -43,38 +42,37 @@ class ManageAccountPageState extends State<ManageAccountPage> {
|
||||||
//title: const Text('ManageAccountPage'),
|
//title: const Text('ManageAccountPage'),
|
||||||
backgroundColor: const Color.fromARGB(255, 190, 146, 160),
|
backgroundColor: const Color.fromARGB(255, 190, 146, 160),
|
||||||
),
|
),
|
||||||
body: Container(
|
body: Center(
|
||||||
margin: EdgeInsets.all(24),
|
child: SingleChildScrollView(
|
||||||
child: Form(
|
child: Column(
|
||||||
child: Column(
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
children: <Widget>[
|
||||||
children: <Widget>[
|
const Text('Update user data' ,style: TextStyle(fontWeight: FontWeight.bold, fontSize: 25)),
|
||||||
const Text('Update user data' ,style: TextStyle(fontWeight: FontWeight.bold, fontSize: 25)),
|
const SizedBox(height: 50),
|
||||||
const SizedBox(height: 50),
|
_buildOldPasswordFiled(),
|
||||||
_buildOldPasswordFiled(),
|
_buildPasswordFiled(passwordController),
|
||||||
_buildPasswordFiled(passwordController),
|
_buildPasswordFiled(confirmPasswordController),
|
||||||
_buildPasswordFiled(confirmPasswordController),
|
ElevatedButton(
|
||||||
ElevatedButton(
|
onPressed: () async {
|
||||||
onPressed: () async {
|
await verifyUserInput(previousPasswordController.text, passwordController.text, confirmPasswordController.text);
|
||||||
await verifyUserInput(previousPasswordController.text, passwordController.text, confirmPasswordController.text);
|
if(userInput.isValid) {
|
||||||
if(userInput.isValid) {
|
await updateUserInSQL(previousPasswordController.text, confirmPasswordController.text);
|
||||||
await updateUserInSQL(previousPasswordController.text, confirmPasswordController.text);
|
Navigator.push(
|
||||||
Navigator.push(
|
context,
|
||||||
context,
|
MaterialPageRoute(builder: (context) => BottomNavPage()),
|
||||||
MaterialPageRoute(builder: (context) => BottomNavPage()),
|
);
|
||||||
);
|
} else {
|
||||||
} else {
|
createUserError(userInput.errorMessage);
|
||||||
createUserError(userInput.errorMessage);
|
}
|
||||||
}
|
},
|
||||||
},
|
child: const Text('Change password'),
|
||||||
child: const Text('Change password'),
|
style: ElevatedButton.styleFrom(
|
||||||
style: ElevatedButton.styleFrom(
|
primary: const Color.fromARGB(255, 190, 146, 160)
|
||||||
primary: const Color.fromARGB(255, 190, 146, 160)
|
),
|
||||||
),
|
)
|
||||||
)
|
],
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
54
lib/Map.dart
54
lib/Map.dart
|
@ -2,11 +2,11 @@ import 'dart:convert';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_applicationdemo/BottomNavPage.dart';
|
import 'package:flutter_applicationdemo/BottomNavPage.dart';
|
||||||
import 'package:flutter_applicationdemo/ListViewPage.dart';
|
import 'package:flutter_applicationdemo/ListViewPage.dart';
|
||||||
|
import 'package:flutter_applicationdemo/ManageAccountPage.dart';
|
||||||
import 'package:flutter_applicationdemo/WeatherData.dart';
|
import 'package:flutter_applicationdemo/WeatherData.dart';
|
||||||
import 'package:flutter_applicationdemo/WebScraper.dart';
|
import 'package:flutter_applicationdemo/WebScraper.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:flutter_applicationdemo/HomePage.dart';
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'login/User.dart';
|
import 'login/User.dart';
|
||||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||||
|
@ -18,14 +18,10 @@ import 'package:location/location.dart';
|
||||||
import 'package:geolocator/geolocator.dart';
|
import 'package:geolocator/geolocator.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:flutter_applicationdemo/login/User.dart';
|
import 'package:flutter_applicationdemo/login/User.dart';
|
||||||
import 'SettingsPage.dart';
|
|
||||||
import 'venuePage.dart';
|
import 'venuePage.dart';
|
||||||
import 'Venue.dart';
|
import 'Venue.dart';
|
||||||
import 'globals.dart' as globals;
|
import 'globals.dart' as globals;
|
||||||
|
|
||||||
import 'package:syncfusion_flutter_sliders/sliders.dart';
|
import 'package:syncfusion_flutter_sliders/sliders.dart';
|
||||||
|
|
||||||
import 'HomePage.dart';
|
|
||||||
import 'FeedbackPage.dart';
|
import 'FeedbackPage.dart';
|
||||||
import 'login/CreateAccountPage.dart';
|
import 'login/CreateAccountPage.dart';
|
||||||
import 'login/signInPage.dart';
|
import 'login/signInPage.dart';
|
||||||
|
@ -631,17 +627,6 @@ Widget buildDrawerSignedIn(BuildContext context) {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
|
||||||
leading: Icon(Icons.logout),
|
|
||||||
title: Text('Sign out'),
|
|
||||||
onTap: () {
|
|
||||||
globals.LOGGED_IN_USER = User(0, "", "");
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(builder: (context) => BottomNavPage()), //Replace Container() with call to Map-page.
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: Icon(Icons.thumb_up_alt),
|
leading: Icon(Icons.thumb_up_alt),
|
||||||
title: Text('Give feedback'),
|
title: Text('Give feedback'),
|
||||||
|
@ -656,16 +641,27 @@ Widget buildDrawerSignedIn(BuildContext context) {
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: Icon(Icons.settings),
|
leading: Icon(Icons.settings),
|
||||||
title: Text('Settings'),
|
title: Text('Change password'),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => SettingsPage(),
|
builder: (context) => ManageAccountPage(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
ListTile(
|
||||||
|
leading: Icon(Icons.logout),
|
||||||
|
title: Text('Sign out'),
|
||||||
|
onTap: () {
|
||||||
|
globals.LOGGED_IN_USER = User(0, "", "");
|
||||||
|
Navigator.pop(
|
||||||
|
context,
|
||||||
|
);
|
||||||
|
(context as Element).reassemble();
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -692,25 +688,27 @@ Widget buildDrawerSignedOut(BuildContext context) {
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: Icon(Icons.account_box_rounded),
|
leading: Icon(Icons.account_box_rounded),
|
||||||
title: Text('Create account'),
|
title: Text('Create account'),
|
||||||
onTap: () {
|
onTap: () async{
|
||||||
Navigator.push(
|
await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => CreateAccountPage(),
|
builder: (context) => CreateAccountPage(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
(context as Element).reassemble();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: Icon(Icons.login),
|
leading: Icon(Icons.login),
|
||||||
title: Text('Sign in'),
|
title: Text('Sign in'),
|
||||||
onTap: () {
|
onTap: () async {
|
||||||
Navigator.push(
|
await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => SignInPage(),
|
builder: (context) => SignInPage(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
(context as Element).reassemble();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
|
@ -725,18 +723,6 @@ Widget buildDrawerSignedOut(BuildContext context) {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
|
||||||
leading: Icon(Icons.settings),
|
|
||||||
title: Text('Settings'),
|
|
||||||
onTap: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => SettingsPage(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,380 +0,0 @@
|
||||||
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:google_sign_in/google_sign_in.dart';
|
|
||||||
import 'package:settings_ui/settings_ui.dart';
|
|
||||||
import 'ManageAccountPage.dart';
|
|
||||||
import 'login/GoogleSignInProvider.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
import 'FeedbackPage.dart';
|
|
||||||
|
|
||||||
// Standard color of app
|
|
||||||
Color _backgroundColor = const Color.fromARGB(255, 190, 146, 160);
|
|
||||||
|
|
||||||
// Color status of priceRange
|
|
||||||
Color _colorContainerLow = Colors.purple;
|
|
||||||
Color _colorContainerMedium = _backgroundColor;
|
|
||||||
Color _colorContainerHigh = _backgroundColor;
|
|
||||||
|
|
||||||
// Logic status of priceRange
|
|
||||||
Map<String, bool> _priceRangeBool = {
|
|
||||||
"LowPriceRange": true,
|
|
||||||
"MediumPriceRange": false,
|
|
||||||
"HighPriceRange": false
|
|
||||||
};
|
|
||||||
|
|
||||||
// Status of switches
|
|
||||||
bool _cafeSwitch = true;
|
|
||||||
bool _barSwitch = true;
|
|
||||||
bool _restaurantSwitch = true;
|
|
||||||
|
|
||||||
// Standard
|
|
||||||
@override
|
|
||||||
class SettingsPage extends StatefulWidget {
|
|
||||||
const SettingsPage({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
_SettingsPageState createState() => _SettingsPageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _SettingsPageState extends State<SettingsPage> {
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
appBar: AppBar(
|
|
||||||
//leading: IconButton(icon: Icon(Icons.search), onPressed:() {},),
|
|
||||||
centerTitle: true,
|
|
||||||
title: const Text(
|
|
||||||
'Settings',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 30,
|
|
||||||
color: Colors.white,
|
|
||||||
shadows: <Shadow>[
|
|
||||||
Shadow(
|
|
||||||
offset: Offset(2, 2),
|
|
||||||
blurRadius: 10.0,
|
|
||||||
color: Color.fromARGB(255, 0, 0, 0),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
backgroundColor: _backgroundColor,
|
|
||||||
),
|
|
||||||
body: SettingsList(
|
|
||||||
sections: [
|
|
||||||
SettingsSection(
|
|
||||||
title: const Text(
|
|
||||||
'Filter preferences',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
color: Color.fromARGB(255, 0, 0, 0),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
tiles: <SettingsTile>[
|
|
||||||
SettingsTile.switchTile(
|
|
||||||
onToggle: (value) {
|
|
||||||
setState(() {
|
|
||||||
_cafeSwitch = value;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
initialValue: _cafeSwitch,
|
|
||||||
leading: const Icon(Icons.local_cafe),
|
|
||||||
title: const Text('Cafe'),
|
|
||||||
),
|
|
||||||
SettingsTile.switchTile(
|
|
||||||
onToggle: (value) {
|
|
||||||
setState(() {
|
|
||||||
_barSwitch = value;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
initialValue: _barSwitch,
|
|
||||||
leading: const Icon(Icons.local_bar),
|
|
||||||
title: const Text('Bar'),
|
|
||||||
),
|
|
||||||
SettingsTile.switchTile(
|
|
||||||
onToggle: (value) {
|
|
||||||
setState(() {
|
|
||||||
_restaurantSwitch = value;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
initialValue: _restaurantSwitch,
|
|
||||||
leading: const Icon(Icons.local_restaurant),
|
|
||||||
title: const Text('Restaurant'),
|
|
||||||
),
|
|
||||||
SettingsTile(
|
|
||||||
title: const Text("Price"),
|
|
||||||
value: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: <Widget>[
|
|
||||||
Expanded(
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () {
|
|
||||||
setState(() {
|
|
||||||
onClickPriceColor("LowPriceRange");
|
|
||||||
|
|
||||||
if (_priceRangeBool["LowPriceRange"] == true) {
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
|
||||||
duration: Duration(milliseconds: 1000),
|
|
||||||
behavior: SnackBarBehavior.floating,
|
|
||||||
content: Text('Selected £'),
|
|
||||||
),);
|
|
||||||
}else{
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
|
||||||
duration: Duration(milliseconds: 1000),
|
|
||||||
content: Text('Unselected £'),
|
|
||||||
behavior: SnackBarBehavior.floating,
|
|
||||||
),);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
color: _colorContainerLow,
|
|
||||||
height: 60,
|
|
||||||
width: 75,
|
|
||||||
margin:
|
|
||||||
const EdgeInsets.only(left: 20.0, right: 20.0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: const <Widget>[
|
|
||||||
Icon(
|
|
||||||
Icons.attach_money,
|
|
||||||
size: 27,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () {
|
|
||||||
setState(() {
|
|
||||||
onClickPriceColor("MediumPriceRange");
|
|
||||||
|
|
||||||
if (_priceRangeBool["MediumPriceRange"] == true) {
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
|
||||||
duration: Duration(milliseconds: 1000),
|
|
||||||
behavior: SnackBarBehavior.floating,
|
|
||||||
content: Text('Selected ££'),
|
|
||||||
));
|
|
||||||
}else{
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
|
||||||
duration: Duration(milliseconds: 1000),
|
|
||||||
content: Text('Unselected ££'),
|
|
||||||
behavior: SnackBarBehavior.floating,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
print("Tapped double dollarSign");
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
color: _colorContainerMedium,
|
|
||||||
height: 60,
|
|
||||||
width: 75,
|
|
||||||
margin:
|
|
||||||
const EdgeInsets.only(left: 20.0, right: 20.0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: const <Widget>[
|
|
||||||
Icon(
|
|
||||||
Icons.attach_money,
|
|
||||||
size: 27,
|
|
||||||
),
|
|
||||||
Icon(
|
|
||||||
Icons.attach_money,
|
|
||||||
size: 27,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () {
|
|
||||||
setState(() {
|
|
||||||
onClickPriceColor("HighPriceRange");
|
|
||||||
|
|
||||||
if (_priceRangeBool["HighPriceRange"] == true) {
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
|
||||||
duration: Duration(milliseconds: 1000),
|
|
||||||
behavior: SnackBarBehavior.floating,
|
|
||||||
content: Text('Selected £££'),
|
|
||||||
));
|
|
||||||
}else{
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
|
||||||
duration: Duration(milliseconds: 1000),
|
|
||||||
content: Text('Unselected £££'),
|
|
||||||
behavior: SnackBarBehavior.floating,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
print("Tapped Tripple dollarSign");
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
color: _colorContainerHigh,
|
|
||||||
height: 60,
|
|
||||||
width: 75,
|
|
||||||
margin:
|
|
||||||
const EdgeInsets.only(left: 20.0, right: 20.0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: const <Widget>[
|
|
||||||
Icon(
|
|
||||||
Icons.attach_money,
|
|
||||||
size: 27,
|
|
||||||
),
|
|
||||||
Icon(
|
|
||||||
Icons.attach_money,
|
|
||||||
size: 27,
|
|
||||||
),
|
|
||||||
Icon(
|
|
||||||
Icons.attach_money,
|
|
||||||
size: 27,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
CustomSettingsSection(
|
|
||||||
child: Column(children: [
|
|
||||||
SizedBox(
|
|
||||||
width: double.infinity,
|
|
||||||
child: Container(
|
|
||||||
margin: const EdgeInsets.only(left: 25.0, top: 10),
|
|
||||||
child: const Text(
|
|
||||||
'Account',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 25,
|
|
||||||
color: Color.fromARGB(255, 0, 0, 0),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Column(
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
InkWell(
|
|
||||||
onTap: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => ManageAccountPage()),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
margin: const EdgeInsets.only(left: 15.0, top: 10),
|
|
||||||
color: _backgroundColor,
|
|
||||||
height: 60,
|
|
||||||
width: 175,
|
|
||||||
child: const Center(
|
|
||||||
child: Text(
|
|
||||||
'Change password',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight. bold,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
InkWell(
|
|
||||||
onTap: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => FormForFeedback()),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
margin: const EdgeInsets.only(left: 15.0, top: 10),
|
|
||||||
color: _backgroundColor,
|
|
||||||
height: 60,
|
|
||||||
width: 175,
|
|
||||||
child: const Center(
|
|
||||||
child: Text(
|
|
||||||
'Leave feedback',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight. bold,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Center(
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () async {
|
|
||||||
final provider = Provider.of<GoogleSignInProvider>(context, listen: false);
|
|
||||||
provider.logOut();
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
margin: const EdgeInsets.only(top: 10, right: 15),
|
|
||||||
color: _backgroundColor,
|
|
||||||
height: 60,
|
|
||||||
width: 175,
|
|
||||||
child: const Center(
|
|
||||||
child: Text(
|
|
||||||
'Log out',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight. bold,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
]))
|
|
||||||
],
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void onClickPriceColor(String priceRange) {
|
|
||||||
if (priceRange == "LowPriceRange") {
|
|
||||||
if (_priceRangeBool["LowPriceRange"] == true) {
|
|
||||||
_priceRangeBool["LowPriceRange"] = false;
|
|
||||||
_colorContainerLow = _backgroundColor;
|
|
||||||
} else {
|
|
||||||
_priceRangeBool["LowPriceRange"] = true;
|
|
||||||
_colorContainerLow = Colors.purple;
|
|
||||||
}
|
|
||||||
} else if (priceRange == "MediumPriceRange") {
|
|
||||||
if (_priceRangeBool["MediumPriceRange"] == true) {
|
|
||||||
_priceRangeBool["MediumPriceRange"] = false;
|
|
||||||
_colorContainerMedium = _backgroundColor;
|
|
||||||
} else {
|
|
||||||
_priceRangeBool["MediumPriceRange"] = true;
|
|
||||||
_colorContainerMedium = Colors.purple;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (_priceRangeBool["HighPriceRange"] == true) {
|
|
||||||
_priceRangeBool["HighPriceRange"] = false;
|
|
||||||
_colorContainerHigh = _backgroundColor;
|
|
||||||
} else {
|
|
||||||
_priceRangeBool["HighPriceRange"] = true;
|
|
||||||
_colorContainerHigh = Colors.purple;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -7,7 +7,6 @@ import 'dart:ui';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'HomePage.dart';
|
|
||||||
import 'Venue.dart';
|
import 'Venue.dart';
|
||||||
import 'main.dart';
|
import 'main.dart';
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,6 @@ import 'package:flutter_applicationdemo/BottomNavPage.dart';
|
||||||
import 'package:flutter_applicationdemo/login/EncryptData.dart';
|
import 'package:flutter_applicationdemo/login/EncryptData.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:flutter_applicationdemo/mysql.dart';
|
import 'package:flutter_applicationdemo/mysql.dart';
|
||||||
|
|
||||||
import 'package:flutter_applicationdemo/HomePage.dart';
|
|
||||||
import '../globals.dart' as globals;
|
import '../globals.dart' as globals;
|
||||||
import '../reusables/InputField.dart';
|
import '../reusables/InputField.dart';
|
||||||
import 'User.dart';
|
import 'User.dart';
|
||||||
|
@ -29,15 +27,7 @@ class _CreateAccountPageState extends State<CreateAccountPage> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
backgroundColor: globals.PINKBACKGROUND,
|
backgroundColor: const Color.fromARGB(204, 172, 123, 132),
|
||||||
leading: ReturnButton(
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(builder: (context) => BottomNavPage()),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
backgroundColor: pinkBackgroundColor,
|
backgroundColor: pinkBackgroundColor,
|
||||||
|
|
||||||
|
@ -115,9 +105,8 @@ class _CreateAccountPageState extends State<CreateAccountPage> {
|
||||||
if (userInput.isValid) {
|
if (userInput.isValid) {
|
||||||
await createUserInSQL(emailController.text, userNameController.text,
|
await createUserInSQL(emailController.text, userNameController.text,
|
||||||
passwordController.text);
|
passwordController.text);
|
||||||
Navigator.push(
|
Navigator.pop(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) => BottomNavPage()),
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
createUserError(userInput.errorMessage);
|
createUserError(userInput.errorMessage);
|
||||||
|
|
|
@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_applicationdemo/login/EncryptData.dart';
|
import 'package:flutter_applicationdemo/login/EncryptData.dart';
|
||||||
import 'package:flutter_applicationdemo/BottomNavPage.dart';
|
import 'package:flutter_applicationdemo/BottomNavPage.dart';
|
||||||
import '../mysql.dart';
|
import '../mysql.dart';
|
||||||
import '../HomePage.dart';
|
|
||||||
import '../main.dart';
|
import '../main.dart';
|
||||||
import 'User.dart';
|
import 'User.dart';
|
||||||
import '../reusables/InputField.dart';
|
import '../reusables/InputField.dart';
|
||||||
|
@ -13,6 +12,7 @@ import 'package:flutter_signin_button/flutter_signin_button.dart';
|
||||||
import 'GoogleSignInProvider.dart';
|
import 'GoogleSignInProvider.dart';
|
||||||
import 'CreateAccountPage.dart';
|
import 'CreateAccountPage.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:flutter_applicationdemo/Map.dart' as map;
|
||||||
import 'package:flutter_applicationdemo/globals.dart' as globals;
|
import 'package:flutter_applicationdemo/globals.dart' as globals;
|
||||||
|
|
||||||
class SignInPage extends StatefulWidget {
|
class SignInPage extends StatefulWidget {
|
||||||
|
@ -48,15 +48,7 @@ class _SignInPageState extends State<SignInPage> {
|
||||||
backgroundColor: globals.PINKBACKGROUND,
|
backgroundColor: globals.PINKBACKGROUND,
|
||||||
resizeToAvoidBottomInset: true,
|
resizeToAvoidBottomInset: true,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
backgroundColor: globals.PINKBACKGROUND,
|
backgroundColor: const Color.fromARGB(204, 172, 123, 132),
|
||||||
leading: ReturnButton(
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(builder: (context) => BottomNavPage()),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
body: Center(child: SingleChildScrollView(
|
body: Center(child: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
@ -151,11 +143,8 @@ class _SignInPageState extends State<SignInPage> {
|
||||||
await loginVerification(emailController.text, passwordController.text);
|
await loginVerification(emailController.text, passwordController.text);
|
||||||
if (globals.LOGGED_IN_USER.userID != 0) {
|
if (globals.LOGGED_IN_USER.userID != 0) {
|
||||||
globals.LOGGED_IN_USER = loggedInUser;
|
globals.LOGGED_IN_USER = loggedInUser;
|
||||||
Navigator.push(
|
Navigator.pop(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) =>
|
|
||||||
BottomNavPage()), //Replace Container() with call to account-page.
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
print(globals.LOGGED_IN_USER.userID);
|
print(globals.LOGGED_IN_USER.userID);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_applicationdemo/HomePage.dart';
|
|
||||||
|
|
||||||
class ReturnButton extends StatelessWidget {
|
class ReturnButton extends StatelessWidget {
|
||||||
final onPressed;
|
final onPressed;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user