VenuInfo blabla #46

Merged
shas6395 merged 1 commits from shas6395 into master 2022-05-27 11:34:03 +02:00
2 changed files with 85 additions and 60 deletions
Showing only changes of commit 475e036c7f - Show all commits

View File

@ -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 {

View File

@ -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,59 +79,70 @@ 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: Container( child: FutureBuilder(
alignment: Alignment.center, future: gatherVenueInfo(),
child: Column(children: <Widget>[ builder: (context, snapshot) {
Row( if(snapshot.connectionState == ConnectionState.done) {
children: const [ return SingleChildScrollView(
ShareButton(), child: Container(
SavePlaceButton(), alignment: Alignment.center,
], child: Column(children: <Widget>[
), Row(
Row(children: [ children: const [
Expanded( ShareButton(),
child: Image.network(validateAndGetImageLink()), SavePlaceButton(),
), ],
]),
// Row(
// children: const [
// Text(
// 'Placeholder for image',
// ),
// ],
// ),
Row(children: [
Expanded(
child: Column(
children: [
Text(venue.venueName,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
)
), ),
Text(venue.venueAddress + ' ' + venue.venueStreetNo), Row(children: [
], Expanded(
)), child: Image.network(venueInfo.getPhotoURL()),
Expanded( ),
child: Container( ]),
// decoration: BoxDecoration( // Row(
// border: Border.all(color: const Color(0xffaaaaaa)), // children: const [
// ), // Text(
// color: const Color(0xffe9e9e9), // 'Placeholder for image',
child: buildWeatherColumn(), // ),
), // ],
) // ),
]), Row(children: [
const AboutTheSpotTable(), Expanded(
/*GridView.count( child: Column(
children: [
Text(venue.venueName,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
)
),
Text(venue.venueAddress + ' ' + venue.venueStreetNo),
],
)),
Expanded(
child: Container(
// decoration: BoxDecoration(
// border: Border.all(color: const Color(0xffaaaaaa)),
// ),
// color: const Color(0xffe9e9e9),
child: buildWeatherColumn(),
),
)
]),
AboutTheSpotTable(venueInfo: venueInfo),
/*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())),
]), ]),
], ],
); );