VenuInfo blabla #46
@ -18,9 +18,7 @@ class VenueInfo {
|
|||||||
late String _openHoursToday;
|
late String _openHoursToday;
|
||||||
|
|
||||||
|
|
||||||
VenueInfo() {
|
VenueInfo(/*this._photos, this._tastes, this._priceClass, this._rating, this._totalRatings, this._openNow, this._openHoursToday*/);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Future getVenueInfo(String venueName) async {
|
Future getVenueInfo(String venueName) async {
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import 'package:font_awesome_flutter/font_awesome_flutter.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 'WeatherData.dart';
|
import 'WeatherData.dart';
|
||||||
import 'globals.dart' as globals;
|
import 'globals.dart' as globals;
|
||||||
|
|
||||||
@ -22,7 +23,7 @@ class _VenuePageState extends State<VenuePage> {
|
|||||||
late WeatherData currentWeather;
|
late WeatherData currentWeather;
|
||||||
final String imageLink = '';
|
final String imageLink = '';
|
||||||
late final Venue venue;
|
late final Venue venue;
|
||||||
|
late VenueInfo venueInfo;
|
||||||
_VenuePageState(this.venue);
|
_VenuePageState(this.venue);
|
||||||
|
|
||||||
|
|
||||||
@ -38,8 +39,16 @@ class _VenuePageState extends State<VenuePage> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
refreshWeather();
|
refreshWeather();
|
||||||
|
gatherVenueInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future gatherVenueInfo( ) async {
|
||||||
|
VenueInfo vu = VenueInfo();
|
||||||
|
venueInfo = vu;
|
||||||
|
venueInfo = await vu.getVenueInfo(venue.venueName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Future refreshWeather() async {
|
Future refreshWeather() async {
|
||||||
WeatherData tempWeather = WeatherData(0, 0);
|
WeatherData tempWeather = WeatherData(0, 0);
|
||||||
currentWeather = tempWeather;
|
currentWeather = tempWeather;
|
||||||
@ -70,7 +79,12 @@ class _VenuePageState extends State<VenuePage> {
|
|||||||
title: Text(venue.venueName),
|
title: Text(venue.venueName),
|
||||||
backgroundColor: const Color(0xffac7b84),
|
backgroundColor: const Color(0xffac7b84),
|
||||||
),
|
),
|
||||||
body: Center(child: SingleChildScrollView(
|
body: Center(
|
||||||
|
child: FutureBuilder(
|
||||||
|
future: gatherVenueInfo(),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if(snapshot.connectionState == ConnectionState.done) {
|
||||||
|
return SingleChildScrollView(
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
@ -82,7 +96,7 @@ class _VenuePageState extends State<VenuePage> {
|
|||||||
),
|
),
|
||||||
Row(children: [
|
Row(children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Image.network(validateAndGetImageLink()),
|
child: Image.network(venueInfo.getPhotoURL()),
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
// Row(
|
// Row(
|
||||||
@ -115,14 +129,20 @@ class _VenuePageState extends State<VenuePage> {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
const AboutTheSpotTable(),
|
AboutTheSpotTable(venueInfo: venueInfo),
|
||||||
/*GridView.count(
|
/*GridView.count(
|
||||||
crossAxisCount: 2,
|
crossAxisCount: 2,
|
||||||
children: [],
|
children: [],
|
||||||
)*/
|
)*/
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return CircularProgressIndicator();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,17 +179,24 @@ class _VenuePageState extends State<VenuePage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Just an example table
|
//Just an example table
|
||||||
class AboutTheSpotTable extends StatelessWidget {
|
class AboutTheSpotTable extends StatefulWidget {
|
||||||
const AboutTheSpotTable({
|
final VenueInfo venueInfo;
|
||||||
|
AboutTheSpotTable({
|
||||||
Key? key,
|
Key? key,
|
||||||
|
required this.venueInfo,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<AboutTheSpotTable> createState() => _AboutTheSpotTableState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AboutTheSpotTableState extends State<AboutTheSpotTable> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return DataTable(
|
return DataTable(
|
||||||
headingRowHeight: 30,
|
headingRowHeight: 30,
|
||||||
columnSpacing: 100,
|
columnSpacing: 100,
|
||||||
dataRowHeight: 30,
|
//dataRowHeight: 30,
|
||||||
dataTextStyle: GoogleFonts.robotoCondensed(
|
dataTextStyle: GoogleFonts.robotoCondensed(
|
||||||
color: const Color(0xff4F6272),
|
color: const Color(0xff4F6272),
|
||||||
),
|
),
|
||||||
@ -182,18 +209,18 @@ class AboutTheSpotTable extends StatelessWidget {
|
|||||||
)))),
|
)))),
|
||||||
const DataColumn(label: Text('', style: TextStyle())),
|
const DataColumn(label: Text('', style: TextStyle())),
|
||||||
],
|
],
|
||||||
rows: const [
|
rows: [
|
||||||
DataRow(cells: [
|
DataRow(cells: [
|
||||||
DataCell(Text('Type of venue')),
|
DataCell(Text('Type of venue')),
|
||||||
DataCell(Text('Saloon')),
|
DataCell(Text('Saloon')),
|
||||||
]),
|
]),
|
||||||
DataRow(cells: [
|
DataRow(cells: [
|
||||||
DataCell(Text('Pricing')),
|
DataCell(Text('Pricing')),
|
||||||
DataCell(Text('\$\$\$')),
|
DataCell(Text(widget.venueInfo.getPriceClass())),
|
||||||
]),
|
]),
|
||||||
DataRow(cells: [
|
DataRow(cells: [
|
||||||
DataCell(Text('Rating')),
|
DataCell(Text('Rating')),
|
||||||
DataCell(Text('4.2/5')),
|
DataCell(Text(widget.venueInfo.getRating().toString() + ' (' + widget.venueInfo.getTotalRatings().toString() + ' ratings)')),
|
||||||
]),
|
]),
|
||||||
DataRow(cells: [
|
DataRow(cells: [
|
||||||
DataCell(Text('Current activity')),
|
DataCell(Text('Current activity')),
|
||||||
@ -201,7 +228,7 @@ class AboutTheSpotTable extends StatelessWidget {
|
|||||||
]),
|
]),
|
||||||
DataRow(cells: [
|
DataRow(cells: [
|
||||||
DataCell(Text('Opening hours')),
|
DataCell(Text('Opening hours')),
|
||||||
DataCell(Text('11:00-23:00')),
|
DataCell(Text(widget.venueInfo.getOpeningHours())),
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user