shas6395 #24
@ -602,7 +602,7 @@
|
|||||||
"languageVersion": "2.16"
|
"languageVersion": "2.16"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"generated": "2022-05-17T07:01:31.366070Z",
|
"generated": "2022-05-17T08:24:36.005738Z",
|
||||||
"generator": "pub",
|
"generator": "pub",
|
||||||
"generatorVersion": "2.16.2"
|
"generatorVersion": "2.16.2"
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# For more info see: https://dart.dev/go/dot-packages-deprecation
|
# For more info see: https://dart.dev/go/dot-packages-deprecation
|
||||||
#
|
#
|
||||||
# Generated by pub on 2022-05-17 09:01:31.340139.
|
# Generated by pub on 2022-05-17 10:24:35.878079.
|
||||||
archive:file:///C:/Users/morte/OneDrive/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/archive-3.3.0/lib/
|
archive:file:///C:/Users/morte/OneDrive/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/archive-3.3.0/lib/
|
||||||
args:file:///C:/Users/morte/OneDrive/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/args-2.3.0/lib/
|
args:file:///C:/Users/morte/OneDrive/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/args-2.3.0/lib/
|
||||||
async:file:///C:/Users/morte/OneDrive/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.8.2/lib/
|
async:file:///C:/Users/morte/OneDrive/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.8.2/lib/
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:google_maps_flutter_platform_interface/src/types/camera.dart';
|
||||||
import 'Map.dart';
|
import 'Map.dart';
|
||||||
import 'FavoritePage.dart';
|
import 'FavoritePage.dart';
|
||||||
import 'SettingsPage.dart';
|
import 'SettingsPage.dart';
|
||||||
|
|
||||||
|
|
||||||
class BottomNavPage extends StatefulWidget {
|
class BottomNavPage extends StatefulWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<BottomNavPage> createState() => BottomNavPageState();
|
State<BottomNavPage> createState() => BottomNavPageState();
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,95 @@
|
|||||||
|
import 'package:firebase_auth/firebase_auth.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_applicationdemo/BottomNavPage.dart';
|
||||||
|
import 'package:flutter_applicationdemo/GoogleSignInProvider.dart';
|
||||||
|
import 'package:flutter_applicationdemo/Map.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 'GoogleSignInProvider.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'Venue.dart';
|
||||||
|
import 'globals.dart';
|
||||||
|
import 'Map.dart';
|
||||||
|
import 'user.dart';
|
||||||
|
import 'HomePage.dart';
|
||||||
|
|
||||||
class FavoritePage extends StatelessWidget {
|
// Standard color of app
|
||||||
@override
|
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 likedVenuesList = LOGGED_IN_USER.likedVenuesList;
|
||||||
|
|
||||||
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return MaterialApp(
|
||||||
body: Center(child: Text('FavoritePage',style: TextStyle(fontSize: 60),)),
|
home: Scaffold(
|
||||||
|
// No appbar provided to the Scaffold, only a body with a
|
||||||
|
// CustomScrollView.
|
||||||
|
body: CustomScrollView(
|
||||||
|
slivers: [
|
||||||
|
// Add the app bar to the CustomScrollView.
|
||||||
|
SliverAppBar(
|
||||||
|
// Provide a standard title.
|
||||||
|
title: Text("Liked places"),
|
||||||
|
// Allows the user to reveal the app bar if they begin scrolling
|
||||||
|
// back up the list of items.
|
||||||
|
pinned: true,
|
||||||
|
floating: true,
|
||||||
|
// Make the initial height of the SliverAppBar larger than normal.
|
||||||
|
expandedHeight: 50,
|
||||||
|
backgroundColor: const Color.fromARGB(255, 190, 146, 160),
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(Icons.arrow_back),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) => HomePage()),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
),
|
||||||
|
// Next, create a SliverList
|
||||||
|
SliverList(
|
||||||
|
// Use a delegate to build items as they're scrolled on screen.
|
||||||
|
delegate: SliverChildBuilderDelegate(
|
||||||
|
// The builder function returns a ListTile with a title that
|
||||||
|
// displays the index of the current item.
|
||||||
|
(context, index) => ListTile(title: Text('Item #$index'), trailing: IconButton(icon: Icon(Icons.favorite, color: Colors.red), onPressed: (){
|
||||||
|
setState(() {
|
||||||
|
});
|
||||||
|
print("tabort");
|
||||||
|
},), onTap: (){
|
||||||
|
setState(() {
|
||||||
|
});
|
||||||
|
print("gå till venue");
|
||||||
|
},),
|
||||||
|
// Builds 1000 ListTiles
|
||||||
|
childCount: 20,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||||
import 'BottomNavPage.dart';
|
import 'BottomNavPage.dart';
|
||||||
import 'package:flutter_applicationdemo/CreateAccountPage.dart';
|
import 'package:flutter_applicationdemo/CreateAccountPage.dart';
|
||||||
|
import 'Venue.dart';
|
||||||
import 'globals.dart';
|
import 'globals.dart';
|
||||||
|
import 'mysql.dart';
|
||||||
import 'signInPage.dart';
|
import 'signInPage.dart';
|
||||||
import 'user.dart';
|
import 'user.dart';
|
||||||
import 'globals.dart' as globals;
|
import 'globals.dart' as globals;
|
||||||
@ -19,7 +22,6 @@ class _HomePageState extends State<HomePage> {
|
|||||||
Color textColor = const Color.fromARGB(255, 79, 98, 114);
|
Color textColor = const Color.fromARGB(255, 79, 98, 114);
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
print(LOGGED_IN_USER.userID);
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: pinkBackgroundColor,
|
backgroundColor: pinkBackgroundColor,
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
@ -187,4 +189,6 @@ class _HomePageState extends State<HomePage> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
41
lib/Map.dart
41
lib/Map.dart
@ -7,6 +7,8 @@ import 'package:flutter_google_places/flutter_google_places.dart';
|
|||||||
import 'package:google_maps_webservice/places.dart';
|
import 'package:google_maps_webservice/places.dart';
|
||||||
import 'package:google_api_headers/google_api_headers.dart';
|
import 'package:google_api_headers/google_api_headers.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'user.dart';
|
||||||
|
import 'Venue.dart';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -29,23 +31,14 @@ class MapState extends State<Map> {
|
|||||||
var url = Uri.parse('https://openstreetgs.stockholm.se/geoservice/api/b8e20fd7-5654-465e-8976-35b4de902b41/wfs?service=wfs&version=1.1.0&request=GetFeature&typeNames=od_gis:Markupplatelse&srsName=EPSG:4326&outputFormat=json');
|
var url = Uri.parse('https://openstreetgs.stockholm.se/geoservice/api/b8e20fd7-5654-465e-8976-35b4de902b41/wfs?service=wfs&version=1.1.0&request=GetFeature&typeNames=od_gis:Markupplatelse&srsName=EPSG:4326&outputFormat=json');
|
||||||
var response = await http.get(url);
|
var response = await http.get(url);
|
||||||
|
|
||||||
print('Response status: ${response.statusCode}');
|
//print('Response status: ${response.statusCode}');
|
||||||
// print('Response body: ${response.body.toString()}');
|
// print('Response body: ${response.body.toString()}');
|
||||||
var jsonData = jsonDecode(response.body);
|
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'][1]['geometry']['coordinates']);*/
|
||||||
|
|
||||||
//print(jsonData['features'][0]['properties']['MAIN_ATTRIBUTE_VALUE']);
|
//print(jsonData['features'][0]['properties']['MAIN_ATTRIBUTE_VALUE']);
|
||||||
|
|
||||||
@ -55,25 +48,13 @@ class MapState extends State<Map> {
|
|||||||
String data = m['properties']['Kategorityp'];
|
String data = m['properties']['Kategorityp'];
|
||||||
String typ = m['properties']['MAIN_ATTRIBUTE_VALUE'];
|
String typ = m['properties']['MAIN_ATTRIBUTE_VALUE'];
|
||||||
if(m['properties']['Kategorityp'] == "1.400I, Uteservering A-läge") {
|
if(m['properties']['Kategorityp'] == "1.400I, Uteservering A-läge") {
|
||||||
print(m['properties']['Kategorityp']);
|
//print(m['properties']['Kategorityp']);
|
||||||
_Marker marker = _Marker(m['properties']['Plats_1'],m['properties']['Gatunr_1'],m['geometry']['coordinates']);
|
_Marker marker = _Marker(m['properties']['Plats_1'],m['properties']['Gatunr_1'],m['geometry']['coordinates']);
|
||||||
markers.add(marker);
|
markers.add(marker);
|
||||||
}
|
}
|
||||||
|
|
||||||
print(markers.length);
|
//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']);
|
//print(m['properties']['Kategorityp']);
|
||||||
}
|
}
|
||||||
@ -97,6 +78,7 @@ class MapState extends State<Map> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
intilize() {
|
intilize() {
|
||||||
|
List<Venue> venues;
|
||||||
Marker marker_1;
|
Marker marker_1;
|
||||||
//for(var marker in markers) {
|
//for(var marker in markers) {
|
||||||
marker_1 = const Marker(
|
marker_1 = const Marker(
|
||||||
@ -105,7 +87,7 @@ class MapState extends State<Map> {
|
|||||||
infoWindow: InfoWindow(
|
infoWindow: InfoWindow(
|
||||||
title: 'Münchenbryggeriet Beer Garden',
|
title: 'Münchenbryggeriet Beer Garden',
|
||||||
snippet: 'Uteservering',
|
snippet: 'Uteservering',
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
Marker marker_2 = const Marker(
|
Marker marker_2 = const Marker(
|
||||||
@ -215,7 +197,7 @@ class MapState extends State<Map> {
|
|||||||
markersList.add(marker_6);
|
markersList.add(marker_6);
|
||||||
markersList.add(marker_7);
|
markersList.add(marker_7);
|
||||||
markersList.add(marker_8);
|
markersList.add(marker_8);
|
||||||
markersList.add(marker_9);
|
markersList.add(marker_9);
|
||||||
markersList.add(marker_10);
|
markersList.add(marker_10);
|
||||||
markersList.add(marker_11);
|
markersList.add(marker_11);
|
||||||
markersList.add(marker_12);
|
markersList.add(marker_12);
|
||||||
@ -246,7 +228,7 @@ class MapState extends State<Map> {
|
|||||||
textCapitalization: TextCapitalization.words,
|
textCapitalization: TextCapitalization.words,
|
||||||
decoration: const InputDecoration(hintText: 'Find your place'),
|
decoration: const InputDecoration(hintText: 'Find your place'),
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
print(value);
|
//print(value);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
backgroundColor: const Color.fromARGB(255, 190, 146, 160),
|
backgroundColor: const Color.fromARGB(255, 190, 146, 160),
|
||||||
@ -308,6 +290,7 @@ class MapState extends State<Map> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class _Marker {
|
class _Marker {
|
||||||
|
|
||||||
var Plats_1;
|
var Plats_1;
|
||||||
|
16
lib/Venue.dart
Normal file
16
lib/Venue.dart
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
Venue(this.venueName,
|
||||||
|
this.venueID, this.typeOfVenue, this.position);
|
||||||
|
}
|
||||||
|
|
||||||
|
enum VenueType{
|
||||||
|
cafe, restaurant, bar
|
||||||
|
}
|
@ -1,5 +1,7 @@
|
|||||||
|
import 'Venue.dart';
|
||||||
import 'user.dart';
|
import 'user.dart';
|
||||||
import 'HomePage.dart';
|
import 'HomePage.dart';
|
||||||
import 'main.dart';
|
import 'main.dart';
|
||||||
|
|
||||||
user LOGGED_IN_USER = user(0, "", "");
|
user LOGGED_IN_USER = user(0, "", "");
|
||||||
|
late List<Venue> VENUES;
|
||||||
|
@ -4,16 +4,20 @@ import 'package:firebase_auth/firebase_auth.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:firebase_core/firebase_core.dart';
|
import 'package:firebase_core/firebase_core.dart';
|
||||||
import 'package:flutter_applicationdemo/GoogleSignInProvider.dart';
|
import 'package:flutter_applicationdemo/GoogleSignInProvider.dart';
|
||||||
|
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import 'Map.dart';
|
import 'Map.dart';
|
||||||
import 'HomePage.dart';
|
import 'HomePage.dart';
|
||||||
|
import 'Venue.dart';
|
||||||
|
import 'mysql.dart';
|
||||||
import 'user.dart';
|
import 'user.dart';
|
||||||
import 'globals.dart';
|
import 'globals.dart';
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
await Firebase.initializeApp();
|
await Firebase.initializeApp();
|
||||||
|
await loadAllVenues();
|
||||||
|
|
||||||
runApp(MyApp());
|
runApp(MyApp());
|
||||||
}
|
}
|
||||||
@ -34,26 +38,15 @@ class MyApp extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Future<void> loadAllVenues() async{
|
||||||
/*
|
VENUES = [];
|
||||||
class HomePage extends StatefulWidget {
|
var db = mysql();
|
||||||
@override
|
await db.getConnection().then((conn) async {
|
||||||
State<HomePage> createState() => HomePageState();
|
String sql = "select venueName, venueID, latitude, longitude from maen0574.venue";
|
||||||
|
await conn.query(sql).then((results){
|
||||||
|
for(var row in results){
|
||||||
|
VENUES.add(Venue(row[0], row[1], VenueType.restaurant, LatLng(row[2], row[3])));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
class HomePageState extends State<HomePage> {
|
|
||||||
|
|
||||||
@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),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
@ -23,7 +23,7 @@ class _SignInPageState extends State<SignInPage> {
|
|||||||
|
|
||||||
Future<void> loginVerification(String email, String password) async{
|
Future<void> loginVerification(String email, String password) async{
|
||||||
await db.getConnection().then((conn) async {
|
await db.getConnection().then((conn) async {
|
||||||
String sql = "select id, email, password from maen0574.user where email = '$email' and password = '$password'";
|
String sql = "select id, username, email from maen0574.user where email = '$email' and password = '$password'";
|
||||||
await conn.query(sql).then((results){
|
await conn.query(sql).then((results){
|
||||||
for(var row in results){
|
for(var row in results){
|
||||||
setState(() {
|
setState(() {
|
||||||
|
@ -1,12 +1,20 @@
|
|||||||
|
import 'package:flutter_applicationdemo/user.dart';
|
||||||
|
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||||
|
import 'Venue.dart';
|
||||||
|
import 'mysql.dart';
|
||||||
|
|
||||||
class user{
|
class user{
|
||||||
late int userID;
|
late int userID;
|
||||||
late String username;
|
late String username;
|
||||||
late String email;
|
late String email;
|
||||||
|
late List<int> likedVenuesList;
|
||||||
|
|
||||||
user(int userID, String username, String email){
|
user(int userID, String username, String email){
|
||||||
this.userID = userID;
|
this.userID = userID;
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.email = email;
|
this.email = email;
|
||||||
|
likedVenuesList = List.empty(growable: true);
|
||||||
|
getFavoriteVenues();
|
||||||
}
|
}
|
||||||
|
|
||||||
user emptyUser(){
|
user emptyUser(){
|
||||||
@ -15,4 +23,17 @@ class user{
|
|||||||
int getID(){
|
int getID(){
|
||||||
return userID;
|
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){
|
||||||
|
likedVenuesList.add(row[0]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user