shas6395----- #56
23
lib/Map.dart
23
lib/Map.dart
@ -454,20 +454,21 @@ class MapState extends State<Map> {
|
||||
],
|
||||
),
|
||||
// columnCoveringRating(),
|
||||
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
children: const [
|
||||
weatherIconRow(),
|
||||
weatherStatusRow(),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
columnHandlingReadMoreButton(context, venue),
|
||||
],
|
||||
)
|
||||
@ -497,7 +498,7 @@ class MapState extends State<Map> {
|
||||
return ElevatedButton(
|
||||
child: const Text(
|
||||
'Read More',
|
||||
style: TextStyle(fontSize: 18),
|
||||
style: TextStyle(fontSize: 16),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
@ -519,7 +520,7 @@ class MapState extends State<Map> {
|
||||
textStyle: const TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 26,
|
||||
fontSize: 20,
|
||||
)),
|
||||
),
|
||||
Text(
|
||||
@ -528,7 +529,7 @@ class MapState extends State<Map> {
|
||||
textStyle: const TextStyle(
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w300,
|
||||
fontSize: 20,
|
||||
fontSize: 14,
|
||||
)),
|
||||
)
|
||||
],
|
||||
|
@ -2,13 +2,14 @@ import 'dart:convert';
|
||||
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:html/dom.dart' as dom;
|
||||
import 'package:intl/intl.dart';
|
||||
import 'dart:io';
|
||||
|
||||
import 'Venue.dart';
|
||||
|
||||
class VenueInfo {
|
||||
|
||||
static const photoSize = 'original'; //Can be replaced with custom size (Example Format: '300x400')
|
||||
static const photoSize = '600x400'; //Can be replaced with custom size (Example Format: '300x400')
|
||||
late String _photo = 'https://www.bing.com/th?id=OIP.ZSXrQuieNC-hoPC4kIv_vgAAAA&w=212&h=212&c=8&rs=1&qlt=90&o=6&dpr=1.35&pid=3.1&rm=2';
|
||||
late int _priceClass = -1;
|
||||
late double _rating = -1;
|
||||
@ -17,6 +18,7 @@ class VenueInfo {
|
||||
late String _openHoursToday = 'N/A';
|
||||
late String _fsqLink;
|
||||
late double _popularity = -1;
|
||||
late List<dynamic> _hoursPopular = [];
|
||||
|
||||
VenueInfo();
|
||||
|
||||
@ -36,7 +38,7 @@ class VenueInfo {
|
||||
if(results.isNotEmpty && data['results'][0]['link'] != null) {
|
||||
_fsqLink = data['results'][0]['link'];
|
||||
final response2 = await http.get(
|
||||
Uri.parse('https://api.foursquare.com$_fsqLink?fields=price%2Crating%2Cphotos%2Chours%2Cstats%2Cpopularity'),
|
||||
Uri.parse('https://api.foursquare.com$_fsqLink?fields=price%2Crating%2Cphotos%2Chours%2Cstats%2Cpopularity%2Chours_popular'),
|
||||
headers: {
|
||||
HttpHeaders.authorizationHeader: 'fsq3LBbeZ8imQK8X1hov7DTb9F64Xs1fs2bojHQ99QNm4TE=',
|
||||
}
|
||||
@ -51,6 +53,8 @@ class VenueInfo {
|
||||
data['popularity'] != null ? _popularity = data['popularity']: null;
|
||||
data['photos'][0]['prefix'] != null && data['photos'][0]['suffix'] != null ?
|
||||
_photo = data['photos'][0]['prefix'] + photoSize + data['photos'][0]['suffix']: null;
|
||||
_hoursPopular = data['hours_popular'] != null ? _hoursPopular = data['hours_popular']: null;
|
||||
|
||||
}
|
||||
else {
|
||||
throw const HttpException("No connection to api.foursquare.com");
|
||||
@ -110,6 +114,46 @@ class VenueInfo {
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
String getPopularHoursToday() {
|
||||
var today = DateFormat('EEEE').format(DateTime.now());
|
||||
if(_hoursPopular.isEmpty) {
|
||||
return 'N/A';
|
||||
}
|
||||
if(today == 'Monday') {
|
||||
return findPopularHours(1);
|
||||
}
|
||||
if(today == 'Tuesday') {
|
||||
return findPopularHours(2);
|
||||
}
|
||||
if(today == 'Wednesday') {
|
||||
return findPopularHours(3);
|
||||
}
|
||||
if(today == 'Thursday') {
|
||||
return findPopularHours(4);
|
||||
}
|
||||
if(today == 'Friday') {
|
||||
return findPopularHours(5);
|
||||
}
|
||||
if(today == 'Saturday') {
|
||||
return findPopularHours(6);
|
||||
}
|
||||
if(today == 'Sunday') {
|
||||
return findPopularHours(7);
|
||||
}
|
||||
return 'N/A';
|
||||
}
|
||||
|
||||
String findPopularHours(int dayNumber) {
|
||||
String toReturn = '';
|
||||
for(var h in _hoursPopular) {
|
||||
if(h['day'] == dayNumber) {
|
||||
toReturn += (h['open'] + '-' + h['close'] + '\n');
|
||||
}
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
String getRating() {
|
||||
return _rating != -1 ? _rating.toString() + '/10': 'N/A';
|
||||
}
|
||||
@ -119,7 +163,7 @@ class VenueInfo {
|
||||
}
|
||||
|
||||
String getOpenStatus() {
|
||||
return _openNow ? 'Open now!': 'Closed';
|
||||
return _openNow ? 'Yes': 'No';
|
||||
}
|
||||
|
||||
String getOpeningHours() {
|
||||
@ -145,4 +189,17 @@ class VenueInfo {
|
||||
String getVenueURL () {
|
||||
return 'https://api.foursquare.com$_fsqLink';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
enum WeekDays {
|
||||
monday,
|
||||
tuesday,
|
||||
wednesday,
|
||||
thursday,
|
||||
friday,
|
||||
saturday,
|
||||
sunday,
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user