BottomModalSheet & Venue details #53
|
@ -1,5 +1,7 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:geolocator/geolocator.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.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';
|
||||||
|
@ -20,7 +22,7 @@ class _ListViewPageState extends State<ListViewPage> {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('Venues near you',),
|
title: const Text('Venues near you',),
|
||||||
backgroundColor: globals.BACKGROUNDCOLOR,
|
backgroundColor: globals.BACKGROUNDCOLOR,
|
||||||
),
|
),
|
||||||
body: buildListView(),
|
body: buildListView(),
|
||||||
);
|
);
|
||||||
|
@ -32,13 +34,13 @@ class _ListViewPageState extends State<ListViewPage> {
|
||||||
itemCount: allVenues.length,
|
itemCount: allVenues.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
shape: buildBorder(),
|
shape: buildBorder(),
|
||||||
onTap: () => _navigateToVenue(allVenues[index]),
|
onTap: () => _navigateToVenue(allVenues[index]),
|
||||||
leading: buildIconBox(index, context),
|
leading: buildIconBox(index, context),
|
||||||
title: buildTitleText(index),
|
title: buildTitleText(index),
|
||||||
subtitle: buildWeatherRow(),
|
subtitle: buildWeatherRow(),
|
||||||
|
|
||||||
trailing: const Text('400m'),
|
// trailing: const Text('400m'),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -46,43 +48,45 @@ class _ListViewPageState extends State<ListViewPage> {
|
||||||
|
|
||||||
RoundedRectangleBorder buildBorder() {
|
RoundedRectangleBorder buildBorder() {
|
||||||
return RoundedRectangleBorder(
|
return RoundedRectangleBorder(
|
||||||
side: const BorderSide(color: Color(0xffe9e9e9), width: 1),
|
side: const BorderSide(color: Color(0xffe9e9e9), width: 1),
|
||||||
borderRadius: BorderRadius.circular(5));
|
borderRadius: BorderRadius.circular(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
SizedBox buildIconBox(int index, BuildContext context) {
|
SizedBox buildIconBox(int index, BuildContext context) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
child: allVenues[index].getIcon(context),
|
child: allVenues[index].getIcon(context),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Row buildWeatherRow() {
|
Row buildWeatherRow() {
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
const Text('Current weather: '),
|
const Text('Current weather: '),
|
||||||
const Spacer(
|
const Spacer(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
),
|
),
|
||||||
globals.forecast.getCurrentWeatherIcon(),
|
globals.forecast.getCurrentWeatherIcon(),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Text buildTitleText(int index) {
|
Text buildTitleText(int index) {
|
||||||
return Text(
|
return Text(
|
||||||
allVenues[index].venueName.toString(),
|
allVenues[index].venueName.toString(),
|
||||||
style: GoogleFonts.roboto(
|
style: GoogleFonts.roboto(
|
||||||
textStyle: const TextStyle(
|
textStyle: const TextStyle(
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
color: Color(0xff994411),
|
color: Color(0xff994411),
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _navigateToVenue(Venue venue) {
|
void _navigateToVenue(Venue venue) {
|
||||||
Navigator.of(context)
|
Navigator.of(context)
|
||||||
.push(MaterialPageRoute(builder: (context) => VenuePage(venue)));
|
.push(MaterialPageRoute(builder: (context) => VenuePage(venue)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
406
lib/Map.dart
406
lib/Map.dart
|
@ -107,18 +107,18 @@ class MapState extends State<Map> {
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
/*const Text('BottomSheet'),
|
/*const Text('BottomSheet'),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
child: const Text('Close BottomSheet'),
|
child: const Text('Close BottomSheet'),
|
||||||
onPressed: () {Navigator.pop(context);})*/
|
onPressed: () {Navigator.pop(context);})*/
|
||||||
Container(
|
Container(
|
||||||
child: Text(webScraper.openingHoursThisWeek.length.toString()),
|
child: Text(webScraper.openingHoursThisWeek.length.toString()),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -236,19 +236,19 @@ class MapState extends State<Map> {
|
||||||
icon: Icon(Icons.filter_list),
|
icon: Icon(Icons.filter_list),
|
||||||
iconSize: 40,
|
iconSize: 40,
|
||||||
itemBuilder: (context) => [
|
itemBuilder: (context) => [
|
||||||
const PopupMenuItem(
|
const PopupMenuItem(
|
||||||
child: Text(
|
child: Text(
|
||||||
"Filters",
|
"Filters",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
padding: EdgeInsets.only(left: 60),
|
||||||
),
|
),
|
||||||
),
|
createCheckBoxes(),
|
||||||
padding: EdgeInsets.only(left: 60),
|
createPriceSlider(),
|
||||||
),
|
PopupMenuItem(
|
||||||
createCheckBoxes(),
|
child: ButtonBar(
|
||||||
createPriceSlider(),
|
|
||||||
PopupMenuItem(
|
|
||||||
child: ButtonBar(
|
|
||||||
alignment: MainAxisAlignment.center,
|
alignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
|
@ -264,7 +264,7 @@ class MapState extends State<Map> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
))
|
))
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates the checkboxes for the filter menu
|
// Creates the checkboxes for the filter menu
|
||||||
|
@ -280,46 +280,46 @@ class MapState extends State<Map> {
|
||||||
),
|
),
|
||||||
StatefulBuilder(
|
StatefulBuilder(
|
||||||
builder: (BuildContext context, StateSetter setState) {
|
builder: (BuildContext context, StateSetter setState) {
|
||||||
return CheckboxListTile(
|
return CheckboxListTile(
|
||||||
value: _barFilterValue,
|
value: _barFilterValue,
|
||||||
onChanged: (bool? newValue) {
|
onChanged: (bool? newValue) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_barFilterValue = newValue;
|
_barFilterValue = newValue;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
title: const Icon(
|
title: const Icon(
|
||||||
Icons.sports_bar,
|
Icons.sports_bar,
|
||||||
color: Colors.orange,
|
color: Colors.orange,
|
||||||
));
|
));
|
||||||
}),
|
}),
|
||||||
StatefulBuilder(
|
StatefulBuilder(
|
||||||
builder: (BuildContext context, StateSetter setState) {
|
builder: (BuildContext context, StateSetter setState) {
|
||||||
return CheckboxListTile(
|
return CheckboxListTile(
|
||||||
value: _restaurantFilterValue,
|
value: _restaurantFilterValue,
|
||||||
onChanged: (bool? newValue) {
|
onChanged: (bool? newValue) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_restaurantFilterValue = newValue;
|
_restaurantFilterValue = newValue;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
title: Icon(
|
title: Icon(
|
||||||
Icons.restaurant,
|
Icons.restaurant,
|
||||||
color: Colors.blueGrey[200],
|
color: Colors.blueGrey[200],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
//Cafe checkbox
|
//Cafe checkbox
|
||||||
StatefulBuilder(
|
StatefulBuilder(
|
||||||
builder: (BuildContext context, StateSetter setState) {
|
builder: (BuildContext context, StateSetter setState) {
|
||||||
return CheckboxListTile(
|
return CheckboxListTile(
|
||||||
value: _cafeFilterValue,
|
value: _cafeFilterValue,
|
||||||
onChanged: (bool? newValue) {
|
onChanged: (bool? newValue) {
|
||||||
setState(() => _cafeFilterValue = newValue);
|
setState(() => _cafeFilterValue = newValue);
|
||||||
},
|
},
|
||||||
title: Icon(
|
title: Icon(
|
||||||
Icons.coffee,
|
Icons.coffee,
|
||||||
color: Colors.brown[400],
|
color: Colors.brown[400],
|
||||||
));
|
));
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|
||||||
/*floatingActionButton: Padding(
|
/*floatingActionButton: Padding(
|
||||||
|
@ -345,30 +345,30 @@ class MapState extends State<Map> {
|
||||||
return PopupMenuItem(
|
return PopupMenuItem(
|
||||||
child: StatefulBuilder(
|
child: StatefulBuilder(
|
||||||
builder: (BuildContext context, StateSetter setState) {
|
builder: (BuildContext context, StateSetter setState) {
|
||||||
return SfSlider(
|
return SfSlider(
|
||||||
value: _priceFilterValue,
|
value: _priceFilterValue,
|
||||||
onChanged: (dynamic newValue) {
|
onChanged: (dynamic newValue) {
|
||||||
setState((() => _priceFilterValue = newValue));
|
setState((() => _priceFilterValue = newValue));
|
||||||
},
|
},
|
||||||
min: 1,
|
min: 1,
|
||||||
max: 3,
|
max: 3,
|
||||||
showTicks: true,
|
showTicks: true,
|
||||||
interval: 1,
|
interval: 1,
|
||||||
activeColor: Colors.blue,
|
activeColor: Colors.blue,
|
||||||
showLabels: true,
|
showLabels: true,
|
||||||
stepSize: 1.0,
|
stepSize: 1.0,
|
||||||
labelFormatterCallback: (dynamic value, String formattedText) {
|
labelFormatterCallback: (dynamic value, String formattedText) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case 1:
|
case 1:
|
||||||
return '\$';
|
return '\$';
|
||||||
case 2:
|
case 2:
|
||||||
return '\$\$';
|
return '\$\$';
|
||||||
case 3:
|
case 3:
|
||||||
return '\$\$\$';
|
return '\$\$\$';
|
||||||
}
|
}
|
||||||
return value.toString();
|
return value.toString();
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,40 +378,40 @@ class MapState extends State<Map> {
|
||||||
CameraPosition(target: LatLng(lat, lng), zoom: 15)));
|
CameraPosition(target: LatLng(lat, lng), zoom: 15)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _boxes(double lat, double lng, String resturantName) {
|
Widget _boxes(double lat, double lng, String restaurantName) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_gotoLocation(lat, lng);
|
_gotoLocation(lat, lng);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
child: FittedBox(
|
child: FittedBox(
|
||||||
child: Material(
|
child: Material(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
elevation: 14.0,
|
elevation: 14.0,
|
||||||
borderRadius: BorderRadius.circular(24.0),
|
borderRadius: BorderRadius.circular(24.0),
|
||||||
shadowColor: Color(0x802196F3),
|
shadowColor: Color(0x802196F3),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
width: 250,
|
width: 250,
|
||||||
height: 200,
|
height: 200,
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
borderRadius: new BorderRadius.circular(24.0),
|
borderRadius: new BorderRadius.circular(24.0),
|
||||||
child:
|
child:
|
||||||
const Image(image: AssetImage('assets/images/bild.png')),
|
const Image(image: AssetImage('assets/images/bild.png')),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
Container(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Text(resturantName),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
Container(
|
||||||
)),
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text(restaurantName),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,10 +425,9 @@ class MapState extends State<Map> {
|
||||||
}
|
}
|
||||||
|
|
||||||
createBottomDrawer(Venue venue) async {
|
createBottomDrawer(Venue venue) async {
|
||||||
// Position? position = await Geolocator.getLastKnownPosition();
|
|
||||||
// double bar = Geolocator.bearingBetween(position != null? position.latitude : 0, position != null? position.longitude : 0, venue.position.latitude, venue.position.longitude);
|
|
||||||
_bottomSheetIsOpen = true;
|
_bottomSheetIsOpen = true;
|
||||||
Scaffold.of(context).showBottomSheet<void>(((context) {
|
// Scaffold.of(context).showBottomSheet<void>(((context) {
|
||||||
|
showModalBottomSheet(context: context, builder: (BuildContext context) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
|
@ -437,57 +436,59 @@ class MapState extends State<Map> {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 250,
|
height: 175,
|
||||||
color: const Color(0xFFF5F5F5),
|
color: const Color(0xFFF5F5F5),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: [
|
children: [
|
||||||
Container(
|
bottomSheetWidgetContainer(venue, context),
|
||||||
margin: const EdgeInsets.all(8),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
// mainAxisSize: MainAxisSize.min,
|
|
||||||
children: <Widget>[
|
|
||||||
columnCoveringNameAndAddress(venue),
|
|
||||||
columnCoveringRating(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
columnHandlingCloseButton(context),
|
|
||||||
Container(
|
|
||||||
padding: const EdgeInsets.all(16.0),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
const Text('Weather: \t\t'),
|
|
||||||
globals.forecast.getCurrentWeatherIcon(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Text('– ' +
|
|
||||||
globals.forecast.getCurrentWeatherStatus()),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
const Text('Distance:'),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Column columnHandlingCloseButton(BuildContext context) {
|
Container bottomSheetWidgetContainer(Venue venue, BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
margin: const EdgeInsets.all(16),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
// mainAxisSize: MainAxisSize.min,
|
||||||
|
children: <Widget>[
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
columnCoveringNameAndAddress(venue),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
// columnCoveringRating(),
|
||||||
|
Column(
|
||||||
|
children: const [
|
||||||
|
weatherIconRow(),
|
||||||
|
weatherStatusRow(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
columnHandlingReadMoreButton(context, venue),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Column columnHandlingReadMoreButton(BuildContext context, Venue venue) {
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
|
@ -496,19 +497,7 @@ class MapState extends State<Map> {
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
ElevatedButton(
|
readMoreButton(context, venue),
|
||||||
child: const Text('Close'),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
_bottomSheetIsOpen = false;
|
|
||||||
}),
|
|
||||||
ElevatedButton(
|
|
||||||
child: const Text('ListView'),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.push(context,
|
|
||||||
MaterialPageRoute(builder: (context) => ListViewPage()));
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -516,20 +505,20 @@ class MapState extends State<Map> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Column columnCoveringRating() {
|
ElevatedButton readMoreButton(BuildContext context, Venue venue) {
|
||||||
return Column(
|
return ElevatedButton(
|
||||||
children: [
|
child: const Text(
|
||||||
Text(
|
'Read More',
|
||||||
'Rating',
|
style: TextStyle(fontSize: 18),
|
||||||
style: GoogleFonts.robotoCondensed(
|
),
|
||||||
textStyle: const TextStyle(
|
onPressed: () {
|
||||||
color: Colors.black87,
|
Navigator.push(
|
||||||
fontSize: 20,
|
context, MaterialPageRoute(builder: (context) => VenuePage(venue)));
|
||||||
fontWeight: FontWeight.bold,
|
_bottomSheetIsOpen = false;
|
||||||
),
|
},
|
||||||
),
|
style: ElevatedButton.styleFrom(
|
||||||
),
|
primary: globals.BUTTONCOLOR,
|
||||||
],
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -540,19 +529,19 @@ class MapState extends State<Map> {
|
||||||
venue.venueName,
|
venue.venueName,
|
||||||
style: GoogleFonts.roboto(
|
style: GoogleFonts.roboto(
|
||||||
textStyle: const TextStyle(
|
textStyle: const TextStyle(
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 24,
|
fontSize: 26,
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
venue.venueAddress + ' ' + venue.venueStreetNo,
|
venue.venueAddress + ' ' + venue.venueStreetNo,
|
||||||
style: GoogleFonts.roboto(
|
style: GoogleFonts.roboto(
|
||||||
textStyle: const TextStyle(
|
textStyle: const TextStyle(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
fontWeight: FontWeight.w300,
|
fontWeight: FontWeight.w300,
|
||||||
fontSize: 18,
|
fontSize: 20,
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
@ -562,6 +551,7 @@ class MapState extends State<Map> {
|
||||||
print(_bottomSheetIsOpen);
|
print(_bottomSheetIsOpen);
|
||||||
if (_bottomSheetIsOpen) {
|
if (_bottomSheetIsOpen) {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
_bottomSheetIsOpen = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,6 +587,46 @@ class MapState extends State<Map> {
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class weatherIconRow extends StatelessWidget {
|
||||||
|
const weatherIconRow({
|
||||||
|
Key? key,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
const Text(
|
||||||
|
'Weather: \t\t',
|
||||||
|
style: TextStyle(fontSize: 18),
|
||||||
|
),
|
||||||
|
globals.forecast.getCurrentWeatherIcon(),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class weatherStatusRow extends StatelessWidget {
|
||||||
|
const weatherStatusRow({
|
||||||
|
Key? key,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'– ' + globals.forecast.getCurrentWeatherStatus(),
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontStyle: FontStyle.italic,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Widget buildDrawerSignedIn(BuildContext context) {
|
Widget buildDrawerSignedIn(BuildContext context) {
|
||||||
return Drawer(
|
return Drawer(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
|
@ -604,7 +634,7 @@ Widget buildDrawerSignedIn(BuildContext context) {
|
||||||
children: [
|
children: [
|
||||||
DrawerHeader(
|
DrawerHeader(
|
||||||
decoration:
|
decoration:
|
||||||
const BoxDecoration(color: Color.fromARGB(255, 190, 146, 160)),
|
const BoxDecoration(color: Color.fromARGB(255, 190, 146, 160)),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: const <Widget>[
|
children: const <Widget>[
|
||||||
Text(
|
Text(
|
||||||
|
@ -663,7 +693,7 @@ Widget buildDrawerSignedOut(BuildContext context) {
|
||||||
children: [
|
children: [
|
||||||
DrawerHeader(
|
DrawerHeader(
|
||||||
decoration:
|
decoration:
|
||||||
const BoxDecoration(color: Color.fromARGB(255, 190, 146, 160)),
|
const BoxDecoration(color: Color.fromARGB(255, 190, 146, 160)),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: const <Widget>[
|
children: const <Widget>[
|
||||||
Text(
|
Text(
|
||||||
|
@ -733,4 +763,4 @@ class _Marker {
|
||||||
var coordinates;
|
var coordinates;
|
||||||
|
|
||||||
_Marker(this.Plats_1, this.Gatunr_1, this.coordinates);
|
_Marker(this.Plats_1, this.Gatunr_1, this.coordinates);
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,6 +88,18 @@ class WeatherData {
|
||||||
case 17:
|
case 17:
|
||||||
weatherStatus = 'Heavy snow showers';
|
weatherStatus = 'Heavy snow showers';
|
||||||
break;
|
break;
|
||||||
|
case 18:
|
||||||
|
weatherStatus = 'Light rain';
|
||||||
|
break;
|
||||||
|
case 19:
|
||||||
|
weatherStatus = 'Moderate rain';
|
||||||
|
break;
|
||||||
|
case 20:
|
||||||
|
weatherStatus = 'Heavy rain';
|
||||||
|
break;
|
||||||
|
case 21:
|
||||||
|
weatherStatus = 'Thunder';
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
weatherStatus = 'Undefined';
|
weatherStatus = 'Undefined';
|
||||||
}
|
}
|
||||||
|
@ -136,6 +148,14 @@ class WeatherData {
|
||||||
return const FaIcon(FontAwesomeIcons.snowflake);
|
return const FaIcon(FontAwesomeIcons.snowflake);
|
||||||
case 17:
|
case 17:
|
||||||
return const FaIcon(FontAwesomeIcons.snowflake);
|
return const FaIcon(FontAwesomeIcons.snowflake);
|
||||||
|
case 18:
|
||||||
|
return const FaIcon(FontAwesomeIcons.cloudRain);
|
||||||
|
case 19:
|
||||||
|
return const FaIcon(FontAwesomeIcons.cloudRain);
|
||||||
|
case 20:
|
||||||
|
return const FaIcon(FontAwesomeIcons.cloudShowersHeavy);
|
||||||
|
case 21:
|
||||||
|
return const FaIcon(FontAwesomeIcons.bolt);
|
||||||
default:
|
default:
|
||||||
return const FaIcon(FontAwesomeIcons.times);
|
return const FaIcon(FontAwesomeIcons.times);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,9 @@ import 'globals.dart' as globals;
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
// await Firebase.initializeApp();
|
await Firebase.initializeApp();
|
||||||
//await loadAllVenues();
|
await loadAllVenues();
|
||||||
//await fetchWeather();
|
await fetchWeather();
|
||||||
|
|
||||||
runApp(MyApp());
|
runApp(MyApp());
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ void main() async {
|
||||||
Future fetchWeather() async {
|
Future fetchWeather() async {
|
||||||
WeatherData tempWeather = WeatherData(0, 0);
|
WeatherData tempWeather = WeatherData(0, 0);
|
||||||
Uri weatherDataURI = Uri.parse(
|
Uri weatherDataURI = Uri.parse(
|
||||||
'https://group-4-75.pvt.dsv.su.se/target/weather-0.0.2-SNAPSHOT.war/weather');
|
'https://group-4-75.pvt.dsv.su.se/target/info.war/weather');
|
||||||
|
|
||||||
final response = await http.get(weatherDataURI);
|
final response = await http.get(weatherDataURI);
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class MyApp extends StatelessWidget {
|
||||||
|
|
||||||
Future loadAllVenues() async {
|
Future loadAllVenues() async {
|
||||||
Uri venueDataURI = Uri.parse(
|
Uri venueDataURI = Uri.parse(
|
||||||
'https://group-4-75.pvt.dsv.su.se/target/weather-0.0.4-SNAPSHOT.war/venue');
|
'https://group-4-75.pvt.dsv.su.se/target/info.war/venue');
|
||||||
|
|
||||||
final response = await http.get(venueDataURI);
|
final response = await http.get(venueDataURI);
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ Future loadAllVenues() async {
|
||||||
// var sd = ShadowDetector();
|
// var sd = ShadowDetector();
|
||||||
// await sd.evaluateShadowsForAllVenues(seventyFiveVenues);
|
// await sd.evaluateShadowsForAllVenues(seventyFiveVenues);
|
||||||
} else {
|
} else {
|
||||||
throw const HttpException("Problem fetching the weather data");
|
throw const HttpException("Problem fetching the venue data");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:share_plus/share_plus.dart';
|
||||||
import 'package:flutter_applicationdemo/Venue.dart';
|
import 'package:flutter_applicationdemo/Venue.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -10,7 +11,6 @@ import 'VenueInfo.dart';
|
||||||
import 'WeatherData.dart';
|
import 'WeatherData.dart';
|
||||||
import 'globals.dart' as globals;
|
import 'globals.dart' as globals;
|
||||||
|
|
||||||
|
|
||||||
class VenuePage extends StatefulWidget {
|
class VenuePage extends StatefulWidget {
|
||||||
const VenuePage(this.venue, {Key? key}) : super(key: key);
|
const VenuePage(this.venue, {Key? key}) : super(key: key);
|
||||||
final Venue venue;
|
final Venue venue;
|
||||||
|
@ -24,37 +24,26 @@ class _VenuePageState extends State<VenuePage> {
|
||||||
final String imageLink = '';
|
final String imageLink = '';
|
||||||
late final Venue venue;
|
late final Venue venue;
|
||||||
late VenueInfo venueInfo;
|
late VenueInfo venueInfo;
|
||||||
|
|
||||||
_VenuePageState(this.venue);
|
_VenuePageState(this.venue);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
validateAndGetImageLink() {
|
|
||||||
if (imageLink == '') {
|
|
||||||
return 'https://live.staticflickr.com/6205/6081773215_19444220b6_b.jpg';
|
|
||||||
} else {
|
|
||||||
return imageLink;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
refreshWeather();
|
refreshWeather();
|
||||||
gatherVenueInfo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future gatherVenueInfo( ) async {
|
Future gatherVenueInfo() async {
|
||||||
VenueInfo vu = VenueInfo();
|
VenueInfo vu = VenueInfo();
|
||||||
venueInfo = vu;
|
venueInfo = vu;
|
||||||
venueInfo = await vu.getVenueInfo(venue.venueName);
|
venueInfo = await vu.getVenueInfo(venue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Future refreshWeather() async {
|
Future refreshWeather() async {
|
||||||
WeatherData tempWeather = WeatherData(0, 0);
|
WeatherData tempWeather = WeatherData(0, 0);
|
||||||
currentWeather = tempWeather;
|
currentWeather = tempWeather;
|
||||||
|
|
||||||
Uri weatherDataURI = Uri.parse(
|
Uri weatherDataURI = Uri.parse(
|
||||||
'https://group-4-75.pvt.dsv.su.se/target/weather-0.0.4-SNAPSHOT.war/weather');
|
'https://group-4-75.pvt.dsv.su.se/target/info.war/weather');
|
||||||
|
|
||||||
final response = await http.get(weatherDataURI);
|
final response = await http.get(weatherDataURI);
|
||||||
|
|
||||||
|
@ -80,70 +69,65 @@ class _VenuePageState extends State<VenuePage> {
|
||||||
backgroundColor: const Color(0xffac7b84),
|
backgroundColor: const Color(0xffac7b84),
|
||||||
),
|
),
|
||||||
body: Center(
|
body: Center(
|
||||||
child: FutureBuilder(
|
child: FutureBuilder(
|
||||||
future: gatherVenueInfo(),
|
future: gatherVenueInfo(),
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if(snapshot.connectionState == ConnectionState.done) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
child: Container(
|
child: Expanded(
|
||||||
alignment: Alignment.center,
|
child: Container(
|
||||||
child: Column(children: <Widget>[
|
height: MediaQuery.of(context).size.height,
|
||||||
Row(
|
width: MediaQuery.of(context).size.width,
|
||||||
children: const [
|
alignment: Alignment.center,
|
||||||
ShareButton(),
|
child: buildPageContentColumn(),
|
||||||
SavePlaceButton(),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
Row(children: [
|
),
|
||||||
Expanded(
|
);
|
||||||
child: Image.network(venueInfo.getPhotoURL()),
|
} else {
|
||||||
),
|
return const CircularProgressIndicator();
|
||||||
]),
|
}
|
||||||
// Row(
|
})));
|
||||||
// children: const [
|
}
|
||||||
// Text(
|
|
||||||
// 'Placeholder for image',
|
Column buildPageContentColumn() {
|
||||||
// ),
|
return Column(children: <Widget>[
|
||||||
// ],
|
Row(
|
||||||
// ),
|
children: const [
|
||||||
Row(children: [
|
ShareButton(),
|
||||||
Expanded(
|
SavePlaceButton(),
|
||||||
child: Column(
|
],
|
||||||
children: [
|
),
|
||||||
Text(venue.venueName,
|
Row(children: [
|
||||||
style: const TextStyle(
|
Expanded(
|
||||||
fontSize: 18,
|
child: Image.network(venueInfo.getPhotoURL()),
|
||||||
fontWeight: FontWeight.bold,
|
),
|
||||||
)
|
]),
|
||||||
),
|
Row(children: [buildNameAndAddress(), buildWeatherInfo()]),
|
||||||
Text(venue.venueAddress + ' ' + venue.venueStreetNo),
|
AboutTheSpotTable(venueInfo: venueInfo),
|
||||||
],
|
//Expanded(child: AboutTheSpotTable(venueInfo: venueInfo)),
|
||||||
)),
|
]);
|
||||||
Expanded(
|
}
|
||||||
child: Container(
|
|
||||||
// decoration: BoxDecoration(
|
Expanded buildWeatherInfo() {
|
||||||
// border: Border.all(color: const Color(0xffaaaaaa)),
|
return Expanded(
|
||||||
// ),
|
child: Container(
|
||||||
// color: const Color(0xffe9e9e9),
|
child: buildWeatherColumn(),
|
||||||
child: buildWeatherColumn(),
|
),
|
||||||
),
|
);
|
||||||
)
|
}
|
||||||
]),
|
|
||||||
AboutTheSpotTable(venueInfo: venueInfo),
|
Expanded buildNameAndAddress() {
|
||||||
/*GridView.count(
|
return Expanded(
|
||||||
crossAxisCount: 2,
|
child: Column(
|
||||||
children: [],
|
children: [
|
||||||
)*/
|
Text(venue.venueName,
|
||||||
]),
|
style: const TextStyle(
|
||||||
),
|
fontSize: 18,
|
||||||
);
|
fontWeight: FontWeight.bold,
|
||||||
}
|
)),
|
||||||
else {
|
Text(venue.venueAddress + ' ' + venue.venueStreetNo),
|
||||||
return CircularProgressIndicator();
|
],
|
||||||
}
|
));
|
||||||
}
|
|
||||||
)
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Column buildWeatherColumn() {
|
Column buildWeatherColumn() {
|
||||||
|
@ -151,27 +135,16 @@ class _VenuePageState extends State<VenuePage> {
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(4.0),
|
padding: const EdgeInsets.all(4.0),
|
||||||
child: /*Text('Weather Status:',
|
child:
|
||||||
style: GoogleFonts.robotoCondensed(
|
Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
|
||||||
textStyle: const TextStyle(
|
Column(
|
||||||
fontSize: 14,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
)),*/
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: [
|
children: [
|
||||||
Column(
|
currentWeather.getCurrentWeatherIcon(),
|
||||||
children: [
|
Text(currentWeather.getCurrentWeatherStatus()),
|
||||||
currentWeather.getCurrentWeatherIcon(),
|
],
|
||||||
Text(currentWeather.getCurrentWeatherStatus()),
|
),
|
||||||
],
|
Text(currentWeather.getCurrentTemperature().toString() + '\u2103'),
|
||||||
),
|
]),
|
||||||
Text(currentWeather
|
|
||||||
.getCurrentTemperature()
|
|
||||||
.toString() +
|
|
||||||
'\u2103'),
|
|
||||||
]),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
@ -181,7 +154,8 @@ class _VenuePageState extends State<VenuePage> {
|
||||||
//Just an example table
|
//Just an example table
|
||||||
class AboutTheSpotTable extends StatefulWidget {
|
class AboutTheSpotTable extends StatefulWidget {
|
||||||
final VenueInfo venueInfo;
|
final VenueInfo venueInfo;
|
||||||
AboutTheSpotTable({
|
|
||||||
|
AboutTheSpotTable({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.venueInfo,
|
required this.venueInfo,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
@ -193,50 +167,53 @@ class AboutTheSpotTable extends StatefulWidget {
|
||||||
class _AboutTheSpotTableState extends State<AboutTheSpotTable> {
|
class _AboutTheSpotTableState extends State<AboutTheSpotTable> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return DataTable(
|
return Center(
|
||||||
headingRowHeight: 30,
|
child: DataTable(
|
||||||
columnSpacing: 100,
|
// headingRowHeight: 30,
|
||||||
//dataRowHeight: 30,
|
// columnSpacing: 100,
|
||||||
dataTextStyle: GoogleFonts.robotoCondensed(
|
//dataRowHeight: 30,
|
||||||
color: const Color(0xff4F6272),
|
dataTextStyle: GoogleFonts.robotoCondensed(
|
||||||
|
color: const Color(0xff4F6272),
|
||||||
|
),
|
||||||
|
columns: [
|
||||||
|
DataColumn(
|
||||||
|
label: Text('About the spot',
|
||||||
|
style: GoogleFonts.roboto(
|
||||||
|
textStyle: const TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
)))),
|
||||||
|
const DataColumn(label: Text('', style: TextStyle())),
|
||||||
|
],
|
||||||
|
rows: [
|
||||||
|
const DataRow(cells: [
|
||||||
|
DataCell(Text('Type of venue')),
|
||||||
|
DataCell(Text('Restaurant')),
|
||||||
|
]),
|
||||||
|
DataRow(cells: [
|
||||||
|
const DataCell(Text('Pricing')),
|
||||||
|
DataCell(Text(widget.venueInfo.getPriceClass())),
|
||||||
|
]),
|
||||||
|
DataRow(cells: [
|
||||||
|
const DataCell(Text('Rating')),
|
||||||
|
DataCell(Text(widget.venueInfo.getRating().toString() +
|
||||||
|
' (' +
|
||||||
|
widget.venueInfo.getTotalRatings().toString() +
|
||||||
|
' ratings)')),
|
||||||
|
]),
|
||||||
|
const DataRow(cells: [
|
||||||
|
DataCell(Text('Current activity')),
|
||||||
|
DataCell(Text('Moderate')),
|
||||||
|
]),
|
||||||
|
DataRow(cells: [
|
||||||
|
const DataCell(Text('Opening hours')),
|
||||||
|
DataCell(Text(widget.venueInfo.getOpeningHours())),
|
||||||
|
]),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
columns: [
|
|
||||||
DataColumn(
|
|
||||||
label: Text('About the spot',
|
|
||||||
style: GoogleFonts.roboto(
|
|
||||||
textStyle: const TextStyle(
|
|
||||||
fontSize: 18,
|
|
||||||
)))),
|
|
||||||
const DataColumn(label: Text('', style: TextStyle())),
|
|
||||||
],
|
|
||||||
rows: [
|
|
||||||
DataRow(cells: [
|
|
||||||
DataCell(Text('Type of venue')),
|
|
||||||
DataCell(Text('Saloon')),
|
|
||||||
]),
|
|
||||||
DataRow(cells: [
|
|
||||||
DataCell(Text('Pricing')),
|
|
||||||
DataCell(Text(widget.venueInfo.getPriceClass())),
|
|
||||||
]),
|
|
||||||
DataRow(cells: [
|
|
||||||
DataCell(Text('Rating')),
|
|
||||||
DataCell(Text(widget.venueInfo.getRating().toString() + ' (' + widget.venueInfo.getTotalRatings().toString() + ' ratings)')),
|
|
||||||
]),
|
|
||||||
DataRow(cells: [
|
|
||||||
DataCell(Text('Current activity')),
|
|
||||||
DataCell(Text('Moderate')),
|
|
||||||
]),
|
|
||||||
DataRow(cells: [
|
|
||||||
DataCell(Text('Opening hours')),
|
|
||||||
DataCell(Text(widget.venueInfo.getOpeningHours())),
|
|
||||||
]),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class SavePlaceButton extends StatelessWidget {
|
class SavePlaceButton extends StatelessWidget {
|
||||||
const SavePlaceButton({
|
const SavePlaceButton({
|
||||||
Key? key,
|
Key? key,
|
||||||
|
@ -265,14 +242,26 @@ class ShareButton extends StatelessWidget {
|
||||||
Key? key,
|
Key? key,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: TextButton.icon(
|
child: Column(
|
||||||
onPressed: () {},
|
children: <Widget>[
|
||||||
icon: const Icon(Icons.share),
|
TextButton.icon(
|
||||||
label: const Text('Share'),
|
onPressed: () {shareVenue();},
|
||||||
|
icon: const Icon(Icons.share),
|
||||||
|
label: const Text('Share'),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
void shareVenue() {
|
||||||
|
|
||||||
|
Share.share('Share this venue', subject: 'Subject venue');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -50,6 +50,7 @@ dependencies:
|
||||||
webview_flutter: ^3.0.0
|
webview_flutter: ^3.0.0
|
||||||
syncfusion_flutter_sliders: ^20.1.57
|
syncfusion_flutter_sliders: ^20.1.57
|
||||||
intl: ^0.17.0
|
intl: ^0.17.0
|
||||||
|
share_plus: ^4.0.4
|
||||||
#Google Sign-in
|
#Google Sign-in
|
||||||
firebase_auth: ^1.1.4
|
firebase_auth: ^1.1.4
|
||||||
google_sign_in: ^5.0.3
|
google_sign_in: ^5.0.3
|
||||||
|
|
Loading…
Reference in New Issue
Block a user