Cleaning #58

Merged
shas6395 merged 1 commits from shas6395----- into master 2022-06-01 13:12:41 +02:00
29 changed files with 84 additions and 168 deletions
Showing only changes of commit f952e53581 - Show all commits

View File

@ -1,9 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'Map.dart'; import 'map.dart';
import 'FavoritePage.dart'; import 'favorite_page.dart';
import 'SettingsPage.dart'; import 'settings_page.dart';
import 'globals.dart' as globals; import 'globals.dart' as globals;
import 'ListViewPage.dart'; import 'list_view_page.dart';
class BottomNavPage extends StatefulWidget { class BottomNavPage extends StatefulWidget {
@override @override

View File

@ -1,8 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_applicationdemo/venuePage.dart'; import 'package:flutter_applicationdemo/venue_page.dart';
import 'Venue.dart'; import 'venue.dart';
import 'globals.dart' as globals; import 'globals.dart' as globals;
import 'login/signInPage.dart'; import 'login/sign_in_page.dart';
import 'mysql.dart'; import 'mysql.dart';

View File

@ -1,8 +1,8 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_applicationdemo/mysql.dart'; import 'package:flutter_applicationdemo/mysql.dart';
import 'BottomNavPage.dart'; import 'bottom_nav_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'Form.dart'; import 'form.dart';
Color _backgroundColor = const Color.fromARGB(255, 190, 146, 160); Color _backgroundColor = const Color.fromARGB(255, 190, 146, 160);

View File

@ -1,14 +1,14 @@
import 'package:flutter_applicationdemo/WeatherData.dart'; import 'package:flutter_applicationdemo/weather_data.dart';
import 'Venue.dart'; import 'venue.dart';
import 'package:flutter_applicationdemo/login/User.dart'; import 'package:flutter_applicationdemo/login/user.dart';
import '../login/User.dart'; import '../login/user.dart';
import 'dart:ui'; import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'HomePage.dart'; import 'home_page.dart';
import 'Venue.dart'; import 'venue.dart';
import 'main.dart'; import 'main.dart';
User LOGGED_IN_USER = User(0, "", ""); User LOGGED_IN_USER = User(0, "", "");

View File

@ -1,9 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'BottomNavPage.dart'; import 'bottom_nav_page.dart';
import 'login/CreateAccountPage.dart'; import 'login/create_account_page.dart';
import 'login/signInPage.dart'; import 'login/sign_in_page.dart';
import 'package:flutter_applicationdemo/login/User.dart' as User; import 'package:flutter_applicationdemo/login/user.dart' as User;
import 'globals.dart' as globals; import 'globals.dart' as globals;

View File

@ -4,8 +4,8 @@ import 'package:google_fonts/google_fonts.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'globals.dart' as globals; import 'globals.dart' as globals;
import 'package:flutter_applicationdemo/Venue.dart'; import 'package:flutter_applicationdemo/venue.dart';
import 'VenuePage.dart'; import 'venue_page.dart';
class ListViewPage extends StatefulWidget { class ListViewPage extends StatefulWidget {
const ListViewPage({Key? key}) : super(key: key); const ListViewPage({Key? key}) : super(key: key);

View File

@ -1,16 +1,16 @@
// ignore_for_file: prefer_const_constructors // ignore_for_file: prefer_const_constructors
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_applicationdemo/BottomNavPage.dart'; import 'package:flutter_applicationdemo/bottom_nav_page.dart';
import 'package:flutter_applicationdemo/login/EncryptData.dart'; import 'package:flutter_applicationdemo/login/encrypt_data.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 'package:flutter_applicationdemo/home_page.dart';
import '../globals.dart' as globals; import '../globals.dart' as globals;
import '../reusables/InputField.dart'; import '../reusables/input_field.dart';
import 'User.dart'; import 'user.dart';
import '../reusables/returnButton.dart'; import '../reusables/return_button.dart';
class CreateAccountPage extends StatefulWidget { class CreateAccountPage extends StatefulWidget {
_CreateAccountPageState createState() => _CreateAccountPageState(); _CreateAccountPageState createState() => _CreateAccountPageState();

View File

@ -1,17 +1,17 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_applicationdemo/login/EncryptData.dart'; import 'package:flutter_applicationdemo/login/encrypt_data.dart';
import 'package:flutter_applicationdemo/BottomNavPage.dart'; import 'package:flutter_applicationdemo/bottom_nav_page.dart';
import '../mysql.dart'; import '../mysql.dart';
import '../HomePage.dart'; import '../home_page.dart';
import '../main.dart'; import '../main.dart';
import 'User.dart'; import 'user.dart';
import '../reusables/InputField.dart'; import '../reusables/input_field.dart';
import '../reusables/returnButton.dart'; import '../reusables/return_button.dart';
import 'package:flutter_signin_button/flutter_signin_button.dart'; import 'package:flutter_signin_button/flutter_signin_button.dart';
import 'GoogleSignInProvider.dart'; import 'google_sign_in_provider.dart';
import 'CreateAccountPage.dart'; import 'create_account_page.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:flutter_applicationdemo/globals.dart' as globals; import 'package:flutter_applicationdemo/globals.dart' as globals;

View File

@ -1,4 +1,4 @@
import 'package:flutter_applicationdemo/Venue.dart'; import 'package:flutter_applicationdemo/venue.dart';
import 'package:flutter_applicationdemo/mysql.dart'; import 'package:flutter_applicationdemo/mysql.dart';
import 'package:flutter_applicationdemo/globals.dart' as globals; import 'package:flutter_applicationdemo/globals.dart' as globals;

View File

@ -5,20 +5,20 @@ import 'dart:io';
import 'package:firebase_auth/firebase_auth.dart'; 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/ShadowDetector.dart'; import 'package:flutter_applicationdemo/shadow_detector.dart';
import 'package:flutter_applicationdemo/login/GoogleSignInProvider.dart'; import 'package:flutter_applicationdemo/login/google_sign_in_provider.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:flutter_applicationdemo/login/GoogleSignInProvider.dart'; import 'package:flutter_applicationdemo/login/google_sign_in_provider.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'BottomNavPage.dart'; import 'bottom_nav_page.dart';
import 'Map.dart'; import 'map.dart';
import 'WeatherData.dart'; import 'weather_data.dart';
import 'Venue.dart'; import 'venue.dart';
import 'mysql.dart'; import 'mysql.dart';
import 'package:flutter_applicationdemo/login/User.dart'; import 'package:flutter_applicationdemo/login/user.dart';
import 'login/User.dart'; import 'login/user.dart';
import 'globals.dart' as globals; import 'globals.dart' as globals;
void main() async { void main() async {

View File

@ -1,9 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_applicationdemo/login/EncryptData.dart'; import 'package:flutter_applicationdemo/login/encrypt_data.dart';
import 'package:flutter_applicationdemo/reusables/InputField.dart'; import 'package:flutter_applicationdemo/reusables/input_field.dart';
import 'package:flutter_applicationdemo/mysql.dart'; import 'package:flutter_applicationdemo/mysql.dart';
import 'HomePage.dart'; import 'home_page.dart';
class ManageAccountPage extends StatefulWidget { class ManageAccountPage extends StatefulWidget {
@override @override

View File

@ -1,23 +1,22 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_applicationdemo/BottomNavPage.dart'; import 'package:flutter_applicationdemo/bottom_nav_page.dart';
import 'package:flutter_applicationdemo/WebScraper.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.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';
import 'package:flutter_google_places/flutter_google_places.dart'; import 'package:flutter_google_places/flutter_google_places.dart';
import 'package:location/location.dart'; import 'package:location/location.dart';
import 'package:flutter_applicationdemo/login/User.dart'; import 'package:flutter_applicationdemo/login/user.dart';
import 'SettingsPage.dart'; import 'settings_page.dart';
import 'venuePage.dart'; import 'venue_page.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 'FeedbackPage.dart'; import 'feedback_page.dart';
import 'login/CreateAccountPage.dart'; import 'login/create_account_page.dart';
import 'login/signInPage.dart'; import 'login/sign_in_page.dart';
class Map extends StatefulWidget { class Map extends StatefulWidget {
@override @override
@ -63,25 +62,6 @@ class MapState extends State<Map> {
hiddenVenues.addAll(globals.VENUES); hiddenVenues.addAll(globals.VENUES);
} }
void createBottomSheet(String venueName) async {
var webScraper = WebScraper();
await webScraper.getWebsiteData(venueName);
Scaffold.of(context).showBottomSheet<void>(((context) {
return Container(
height: 420,
color: Colors.white,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(webScraper.openingHoursThisWeek.length.toString()),
],
)),
);
}));
}
Future<LocationData> _getLocationPermission() async { Future<LocationData> _getLocationPermission() async {
Location location = Location(); Location location = Location();
@ -170,8 +150,6 @@ class MapState extends State<Map> {
closeBottomSheetIfOpen(); closeBottomSheetIfOpen();
}, },
), ),
// ElevatedButton(onPressed: () {} //_handelPressButton
// ,child: const Text("Search Placses"))
], ],
), ),
floatingActionButton: Padding( floatingActionButton: Padding(
@ -362,7 +340,7 @@ class MapState extends State<Map> {
Marker marker = Marker( Marker marker = Marker(
markerId: MarkerId(globals.VENUES[i].venueID.toString()), markerId: MarkerId(globals.VENUES[i].venueID.toString()),
position: globals.VENUES[i].position, position: globals.VENUES[i].position,
onTap: () => createBottomDrawer(globals.VENUES[i]), onTap: () => createBottomSheet(globals.VENUES[i]),
icon: globals.VENUES[i].drawIconColor()); icon: globals.VENUES[i].drawIconColor());
globals.VENUES[i].isShownOnMap = true; globals.VENUES[i].isShownOnMap = true;
closeByMarkersList.add(marker); closeByMarkersList.add(marker);
@ -370,7 +348,7 @@ class MapState extends State<Map> {
} }
} }
createBottomDrawer(Venue venue) async { createBottomSheet(Venue venue) async {
_bottomSheetIsOpen = true; _bottomSheetIsOpen = true;
// Scaffold.of(context).showBottomSheet<void>(((context) { // Scaffold.of(context).showBottomSheet<void>(((context) {
showModalBottomSheet( showModalBottomSheet(

View File

@ -1,6 +1,6 @@
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'; import 'package:flutter_applicationdemo/home_page.dart';
class ReturnButton extends StatelessWidget { class ReturnButton extends StatelessWidget {
final onPressed; final onPressed;

View File

@ -1,14 +1,14 @@
import 'package:firebase_auth/firebase_auth.dart'; import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/cupertino.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/bottom_nav_page.dart';
import 'package:flutter_applicationdemo/login/GoogleSignInProvider.dart'; import 'package:flutter_applicationdemo/login/google_sign_in_provider.dart';
import 'package:google_sign_in/google_sign_in.dart'; import 'package:google_sign_in/google_sign_in.dart';
import 'package:settings_ui/settings_ui.dart'; import 'package:settings_ui/settings_ui.dart';
import 'ManageAccountPage.dart'; import 'manage_account_page.dart';
import 'login/GoogleSignInProvider.dart'; import 'login/google_sign_in_provider.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'FeedbackPage.dart'; import 'feedback_page.dart';
// Standard color of app // Standard color of app
Color _backgroundColor = const Color.fromARGB(255, 190, 146, 160); Color _backgroundColor = const Color.fromARGB(255, 190, 146, 160);

View File

@ -2,7 +2,7 @@
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:http/http.dart'; import 'package:http/http.dart';
import 'dart:async'; import 'dart:async';
import 'Venue.dart'; import 'venue.dart';
class ShadowDetector { class ShadowDetector {

View File

@ -1,6 +1,6 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_applicationdemo/ShadowDetector.dart'; import 'package:flutter_applicationdemo/shadow_detector.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
class Venue { class Venue {

View File

@ -5,7 +5,7 @@ import 'package:html/dom.dart' as dom;
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'dart:io'; import 'dart:io';
import 'Venue.dart'; import 'venue.dart';
class VenueInfo { class VenueInfo {
@ -66,55 +66,6 @@ class VenueInfo {
} }
} }
/*Future getVenueInfo(String venueName) async {
final fourSquareURL =
Uri.parse('https://foursquare.com/explore?mode=url&near=Stockholm%2C%20Sweden&nearGeoId=72057594040601666&q=$venueName');
final response1 = await http.get(fourSquareURL);
if(response1.statusCode == 200) {
dom.Document html = dom.Document.html(response1.body);
var fsqId = html.getElementsByClassName('card singleRecommendation hasPhoto tipWithLogging leftPhotoLayout').map((e) => e.attributes['data-id']).toList()[0];
final response2 = await http.get(
Uri.parse('https://api.foursquare.com/v3/places/$fsqId?fields=price%2Crating%2Cphotos%2Chours%2Cstats%2Ctastes'),
headers: {
HttpHeaders.authorizationHeader: 'fsq3LBbeZ8imQK8X1hov7DTb9F64Xs1fs2bojHQ99QNm4TE='
},
);
if(response2.statusCode == 200) {
Map data = jsonDecode(response2.body);
if(data['price'] != null) {
_priceClass = data['price'];
}
if(data['rating'] != null) {
_rating = data['rating'];
}
if(data['photos'][0] != null) {
_photos = data['photos'][0];
}
if(data['hours']['open now'] != null) {
_openNow = data['hours']['open_now'];
}
if(data['stats']['total_ratings'] != null) {
_totalRatings = data['stats']['total_ratings'];
}
if(data['hours']['display'] != null) {
_openHoursToday = data['hours']['display'];
}
}
else {
throw const HttpException("No connection to api.foursquare.com");
}
}
else {
throw const HttpException("No connection to foursquare.com");
}
}*/
String getPopularHoursToday() { String getPopularHoursToday() {
var today = DateFormat('EEEE').format(DateTime.now()); var today = DateFormat('EEEE').format(DateTime.now());
if(_hoursPopular.isEmpty) { if(_hoursPopular.isEmpty) {
@ -189,17 +140,4 @@ class VenueInfo {
String getVenueURL () { String getVenueURL () {
return 'https://api.foursquare.com$_fsqLink'; return 'https://api.foursquare.com$_fsqLink';
} }
}
enum WeekDays {
monday,
tuesday,
wednesday,
thursday,
friday,
saturday,
sunday,
} }

View File

@ -2,14 +2,14 @@ import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:share_plus/share_plus.dart'; import 'package:share_plus/share_plus.dart';
import 'package:flutter_applicationdemo/Venue.dart'; import 'package:flutter_applicationdemo/venue.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'VenueInfo.dart'; import 'venue_info.dart';
import 'WeatherData.dart'; import 'weather_data.dart';
import 'globals.dart' as globals; import 'globals.dart' as globals;
import 'Venue.dart'; import 'venue.dart';
// Color _backgroundColor = const Color(0xffac7b84); // Color _backgroundColor = const Color(0xffac7b84);
@ -38,9 +38,9 @@ class VenuePageState extends State<VenuePage> {
} }
Future gatherVenueInfo() async { Future gatherVenueInfo() async {
VenueInfo vu = VenueInfo(); VenueInfo vi = VenueInfo();
venueInfo = vu; venueInfo = vi;
venueInfo = await vu.getVenueInfo(venue); venueInfo = await vi.getVenueInfo(venue);
} }
Future refreshWeather() async { Future refreshWeather() async {
@ -264,7 +264,7 @@ class LikeVenueButton extends StatelessWidget {
), ),
label: const Text('Like place'), label: const Text('Like place'),
style: TextButton.styleFrom( style: TextButton.styleFrom(
primary: Color(0xff4f6272), primary: const Color(0xff4f6272),
), ),
)); ));
} }

View File

@ -1,8 +1,8 @@
import 'dart:math'; import 'dart:math';
import 'package:flutter_applicationdemo/ListViewPage.dart'; import 'package:flutter_applicationdemo/list_view_page.dart';
import 'package:flutter_applicationdemo/Venue.dart'; import 'package:flutter_applicationdemo/venue.dart';
import 'package:flutter_applicationdemo/globals.dart' as globals; import 'package:flutter_applicationdemo/globals.dart' as globals;
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';

View File

@ -1,5 +1,5 @@
import 'package:test/test.dart'; import 'package:test/test.dart';
import 'package:flutter_applicationdemo/ManageAccountPage.dart'; import 'package:flutter_applicationdemo/manage_account_page.dart';
void main() { void main() {
group('ManageAccountPage', () { group('ManageAccountPage', () {

View File

@ -1,6 +1,6 @@
import 'package:flutter_applicationdemo/Venue.dart'; import 'package:flutter_applicationdemo/venue.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_applicationdemo/VenueInfo.dart'; import 'package:flutter_applicationdemo/venue_info.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
main() { main() {

View File

@ -1,6 +1,6 @@
import 'package:flutter_applicationdemo/Venue.dart'; import 'package:flutter_applicationdemo/venue.dart';
import 'package:flutter_applicationdemo/WeatherData.dart'; import 'package:flutter_applicationdemo/weather_data.dart';
import 'package:flutter_applicationdemo/venuePage.dart'; import 'package:flutter_applicationdemo/venue_page.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';