diff --git a/lib/ListViewPage.dart b/lib/ListViewPage.dart index 10195fa..05b2f7e 100644 --- a/lib/ListViewPage.dart +++ b/lib/ListViewPage.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; +import 'package:geolocator/geolocator.dart'; import 'package:google_fonts/google_fonts.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'globals.dart' as globals; import 'package:flutter_applicationdemo/Venue.dart'; @@ -20,7 +22,7 @@ class _ListViewPageState extends State { return Scaffold( appBar: AppBar( title: const Text('Venues near you',), - backgroundColor: globals.BACKGROUNDCOLOR, + backgroundColor: globals.BACKGROUNDCOLOR, ), body: buildListView(), ); @@ -32,13 +34,13 @@ class _ListViewPageState extends State { itemCount: allVenues.length, itemBuilder: (context, index) { return ListTile( - shape: buildBorder(), - onTap: () => _navigateToVenue(allVenues[index]), - leading: buildIconBox(index, context), - title: buildTitleText(index), - subtitle: buildWeatherRow(), + shape: buildBorder(), + onTap: () => _navigateToVenue(allVenues[index]), + leading: buildIconBox(index, context), + title: buildTitleText(index), + subtitle: buildWeatherRow(), - trailing: const Text('400m'), + // trailing: const Text('400m'), ); }, ); @@ -46,43 +48,45 @@ class _ListViewPageState extends State { RoundedRectangleBorder buildBorder() { return RoundedRectangleBorder( - side: const BorderSide(color: Color(0xffe9e9e9), width: 1), - borderRadius: BorderRadius.circular(5)); + side: const BorderSide(color: Color(0xffe9e9e9), width: 1), + borderRadius: BorderRadius.circular(5)); } SizedBox buildIconBox(int index, BuildContext context) { return SizedBox( - height: double.infinity, - child: allVenues[index].getIcon(context), - ); + height: double.infinity, + child: allVenues[index].getIcon(context), + ); } Row buildWeatherRow() { return Row( - children: [ - const Text('Current weather: '), - const Spacer( - flex: 2, - ), - globals.forecast.getCurrentWeatherIcon(), - const Spacer(), - ], - ); + children: [ + const Text('Current weather: '), + const Spacer( + flex: 2, + ), + globals.forecast.getCurrentWeatherIcon(), + const Spacer(), + ], + ); } Text buildTitleText(int index) { return Text( - allVenues[index].venueName.toString(), - style: GoogleFonts.roboto( - textStyle: const TextStyle( - fontSize: 18, - color: Color(0xff994411), - )), - ); + allVenues[index].venueName.toString(), + style: GoogleFonts.roboto( + textStyle: const TextStyle( + fontSize: 18, + color: Color(0xff994411), + )), + ); } void _navigateToVenue(Venue venue) { Navigator.of(context) .push(MaterialPageRoute(builder: (context) => VenuePage(venue))); } + + } diff --git a/lib/Map.dart b/lib/Map.dart index 2597682..41eb8c4 100644 --- a/lib/Map.dart +++ b/lib/Map.dart @@ -107,18 +107,18 @@ class MapState extends State { color: Colors.white, child: Center( child: Column( - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.min, - children: [ - /*const Text('BottomSheet'), + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + /*const Text('BottomSheet'), ElevatedButton( child: const Text('Close BottomSheet'), onPressed: () {Navigator.pop(context);})*/ - Container( - child: Text(webScraper.openingHoursThisWeek.length.toString()), - ), - ], - )), + Container( + child: Text(webScraper.openingHoursThisWeek.length.toString()), + ), + ], + )), ); })); } @@ -236,19 +236,19 @@ class MapState extends State { icon: Icon(Icons.filter_list), iconSize: 40, itemBuilder: (context) => [ - const PopupMenuItem( - child: Text( - "Filters", - style: TextStyle( - fontSize: 20, + const PopupMenuItem( + child: Text( + "Filters", + style: TextStyle( + fontSize: 20, + ), + ), + padding: EdgeInsets.only(left: 60), ), - ), - padding: EdgeInsets.only(left: 60), - ), - createCheckBoxes(), - createPriceSlider(), - PopupMenuItem( - child: ButtonBar( + createCheckBoxes(), + createPriceSlider(), + PopupMenuItem( + child: ButtonBar( alignment: MainAxisAlignment.center, children: [ ElevatedButton( @@ -264,7 +264,7 @@ class MapState extends State { ), ], )) - ]); + ]); } // Creates the checkboxes for the filter menu @@ -280,46 +280,46 @@ class MapState extends State { ), StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return CheckboxListTile( - value: _barFilterValue, - onChanged: (bool? newValue) { - setState(() { - _barFilterValue = newValue; - }); - }, - title: const Icon( - Icons.sports_bar, - color: Colors.orange, - )); - }), + return CheckboxListTile( + value: _barFilterValue, + onChanged: (bool? newValue) { + setState(() { + _barFilterValue = newValue; + }); + }, + title: const Icon( + Icons.sports_bar, + color: Colors.orange, + )); + }), StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return CheckboxListTile( - value: _restaurantFilterValue, - onChanged: (bool? newValue) { - setState(() { - _restaurantFilterValue = newValue; - }); - }, - title: Icon( - Icons.restaurant, - color: Colors.blueGrey[200], - ), - ); - }), + return CheckboxListTile( + value: _restaurantFilterValue, + onChanged: (bool? newValue) { + setState(() { + _restaurantFilterValue = newValue; + }); + }, + title: Icon( + Icons.restaurant, + color: Colors.blueGrey[200], + ), + ); + }), //Cafe checkbox StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return CheckboxListTile( - value: _cafeFilterValue, - onChanged: (bool? newValue) { - setState(() => _cafeFilterValue = newValue); - }, - title: Icon( - Icons.coffee, - color: Colors.brown[400], - )); - }), + return CheckboxListTile( + value: _cafeFilterValue, + onChanged: (bool? newValue) { + setState(() => _cafeFilterValue = newValue); + }, + title: Icon( + Icons.coffee, + color: Colors.brown[400], + )); + }), ], /*floatingActionButton: Padding( @@ -345,30 +345,30 @@ class MapState extends State { return PopupMenuItem( child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - return SfSlider( - value: _priceFilterValue, - onChanged: (dynamic newValue) { - setState((() => _priceFilterValue = newValue)); - }, - min: 1, - max: 3, - showTicks: true, - interval: 1, - activeColor: Colors.blue, - showLabels: true, - stepSize: 1.0, - labelFormatterCallback: (dynamic value, String formattedText) { - switch (value) { - case 1: - return '\$'; - case 2: - return '\$\$'; - case 3: - return '\$\$\$'; - } - return value.toString(); - }); - }), + return SfSlider( + value: _priceFilterValue, + onChanged: (dynamic newValue) { + setState((() => _priceFilterValue = newValue)); + }, + min: 1, + max: 3, + showTicks: true, + interval: 1, + activeColor: Colors.blue, + showLabels: true, + stepSize: 1.0, + labelFormatterCallback: (dynamic value, String formattedText) { + switch (value) { + case 1: + return '\$'; + case 2: + return '\$\$'; + case 3: + return '\$\$\$'; + } + return value.toString(); + }); + }), ); } @@ -378,40 +378,40 @@ class MapState extends State { 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( onTap: () { _gotoLocation(lat, lng); }, child: Container( child: FittedBox( - child: Material( - color: Colors.white, - elevation: 14.0, - borderRadius: BorderRadius.circular(24.0), - shadowColor: Color(0x802196F3), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 250, - height: 200, - child: ClipRRect( - borderRadius: new BorderRadius.circular(24.0), - child: + child: Material( + color: Colors.white, + elevation: 14.0, + borderRadius: BorderRadius.circular(24.0), + shadowColor: Color(0x802196F3), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 250, + height: 200, + child: ClipRRect( + borderRadius: new BorderRadius.circular(24.0), + child: 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 { } 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; - Scaffold.of(context).showBottomSheet(((context) { + // Scaffold.of(context).showBottomSheet(((context) { + showModalBottomSheet(context: context, builder: (BuildContext context) { return InkWell( onTap: () { Navigator.push( @@ -437,57 +436,59 @@ class MapState extends State { ); }, child: Container( - height: 250, + height: 175, color: const Color(0xFFF5F5F5), child: Center( child: Column( - // mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - Container( - margin: const EdgeInsets.all(8), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - // mainAxisSize: MainAxisSize.min, - children: [ - 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:'), - ], - ) - ], - ), - ) + bottomSheetWidgetContainer(venue, context), ], ), ), ), ); - })); + }); } - 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: [ + 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( mainAxisSize: MainAxisSize.min, children: [ @@ -496,19 +497,7 @@ class MapState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ - ElevatedButton( - child: const Text('Close'), - onPressed: () { - Navigator.pop(context); - _bottomSheetIsOpen = false; - }), - ElevatedButton( - child: const Text('ListView'), - onPressed: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) => ListViewPage())); - }, - ), + readMoreButton(context, venue), ], ), ), @@ -516,20 +505,20 @@ class MapState extends State { ); } - Column columnCoveringRating() { - return Column( - children: [ - Text( - 'Rating', - style: GoogleFonts.robotoCondensed( - textStyle: const TextStyle( - color: Colors.black87, - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - ], + ElevatedButton readMoreButton(BuildContext context, Venue venue) { + return ElevatedButton( + child: const Text( + 'Read More', + style: TextStyle(fontSize: 18), + ), + onPressed: () { + Navigator.push( + context, MaterialPageRoute(builder: (context) => VenuePage(venue))); + _bottomSheetIsOpen = false; + }, + style: ElevatedButton.styleFrom( + primary: globals.BUTTONCOLOR, + ), ); } @@ -540,19 +529,19 @@ class MapState extends State { venue.venueName, style: GoogleFonts.roboto( textStyle: const TextStyle( - color: Colors.black87, - fontWeight: FontWeight.bold, - fontSize: 24, - )), + color: Colors.black87, + fontWeight: FontWeight.bold, + fontSize: 26, + )), ), Text( venue.venueAddress + ' ' + venue.venueStreetNo, style: GoogleFonts.roboto( textStyle: const TextStyle( - color: Colors.black, - fontWeight: FontWeight.w300, - fontSize: 18, - )), + color: Colors.black, + fontWeight: FontWeight.w300, + fontSize: 20, + )), ) ], ); @@ -562,6 +551,7 @@ class MapState extends State { print(_bottomSheetIsOpen); if (_bottomSheetIsOpen) { Navigator.pop(context); + _bottomSheetIsOpen = false; } } @@ -597,6 +587,46 @@ class MapState extends State { }*/ } +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) { return Drawer( child: ListView( @@ -604,7 +634,7 @@ Widget buildDrawerSignedIn(BuildContext context) { children: [ DrawerHeader( decoration: - const BoxDecoration(color: Color.fromARGB(255, 190, 146, 160)), + const BoxDecoration(color: Color.fromARGB(255, 190, 146, 160)), child: Column( children: const [ Text( @@ -663,7 +693,7 @@ Widget buildDrawerSignedOut(BuildContext context) { children: [ DrawerHeader( decoration: - const BoxDecoration(color: Color.fromARGB(255, 190, 146, 160)), + const BoxDecoration(color: Color.fromARGB(255, 190, 146, 160)), child: Column( children: const [ Text( @@ -733,4 +763,4 @@ class _Marker { var coordinates; _Marker(this.Plats_1, this.Gatunr_1, this.coordinates); -} \ No newline at end of file +} diff --git a/lib/WeatherData.dart b/lib/WeatherData.dart index b555fe8..4726afd 100644 --- a/lib/WeatherData.dart +++ b/lib/WeatherData.dart @@ -88,6 +88,18 @@ class WeatherData { case 17: weatherStatus = 'Heavy snow showers'; 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: weatherStatus = 'Undefined'; } @@ -136,6 +148,14 @@ class WeatherData { return const FaIcon(FontAwesomeIcons.snowflake); case 17: 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: return const FaIcon(FontAwesomeIcons.times); } diff --git a/lib/main.dart b/lib/main.dart index 836f655..512d555 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -23,9 +23,9 @@ import 'globals.dart' as globals; void main() async { WidgetsFlutterBinding.ensureInitialized(); - // await Firebase.initializeApp(); - //await loadAllVenues(); - //await fetchWeather(); + await Firebase.initializeApp(); + await loadAllVenues(); + await fetchWeather(); runApp(MyApp()); } @@ -33,7 +33,7 @@ void main() async { Future fetchWeather() async { WeatherData tempWeather = WeatherData(0, 0); 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); @@ -67,7 +67,7 @@ class MyApp extends StatelessWidget { Future loadAllVenues() async { 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); @@ -77,7 +77,7 @@ Future loadAllVenues() async { // var sd = ShadowDetector(); // await sd.evaluateShadowsForAllVenues(seventyFiveVenues); } else { - throw const HttpException("Problem fetching the weather data"); + throw const HttpException("Problem fetching the venue data"); } } diff --git a/lib/venuePage.dart b/lib/venuePage.dart index 3d4a2ad..98c5328 100644 --- a/lib/venuePage.dart +++ b/lib/venuePage.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'dart:io'; +import 'package:share_plus/share_plus.dart'; import 'package:flutter_applicationdemo/Venue.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:flutter/material.dart'; @@ -10,7 +11,6 @@ import 'VenueInfo.dart'; import 'WeatherData.dart'; import 'globals.dart' as globals; - class VenuePage extends StatefulWidget { const VenuePage(this.venue, {Key? key}) : super(key: key); final Venue venue; @@ -24,37 +24,26 @@ class _VenuePageState extends State { final String imageLink = ''; late final Venue venue; late VenueInfo venueInfo; + _VenuePageState(this.venue); - - - validateAndGetImageLink() { - if (imageLink == '') { - return 'https://live.staticflickr.com/6205/6081773215_19444220b6_b.jpg'; - } else { - return imageLink; - } - } - @override void initState() { refreshWeather(); - gatherVenueInfo(); } - Future gatherVenueInfo( ) async { + Future gatherVenueInfo() async { VenueInfo vu = VenueInfo(); venueInfo = vu; - venueInfo = await vu.getVenueInfo(venue.venueName); + venueInfo = await vu.getVenueInfo(venue); } - Future refreshWeather() async { WeatherData tempWeather = WeatherData(0, 0); currentWeather = tempWeather; 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); @@ -80,70 +69,65 @@ class _VenuePageState extends State { backgroundColor: const Color(0xffac7b84), ), body: Center( - child: FutureBuilder( - future: gatherVenueInfo(), - builder: (context, snapshot) { - if(snapshot.connectionState == ConnectionState.done) { - return SingleChildScrollView( - child: Container( - alignment: Alignment.center, - child: Column(children: [ - Row( - children: const [ - ShareButton(), - SavePlaceButton(), - ], + child: FutureBuilder( + future: gatherVenueInfo(), + builder: (context, snapshot) { + if (snapshot.connectionState == ConnectionState.done) { + return SingleChildScrollView( + child: Expanded( + child: Container( + height: MediaQuery.of(context).size.height, + width: MediaQuery.of(context).size.width, + alignment: Alignment.center, + child: buildPageContentColumn(), ), - Row(children: [ - Expanded( - child: Image.network(venueInfo.getPhotoURL()), - ), - ]), - // 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), - ], - )), - 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, - children: [], - )*/ - ]), - ), - ); - } - else { - return CircularProgressIndicator(); - } - } - ) - )); + ), + ); + } else { + return const CircularProgressIndicator(); + } + }))); + } + + Column buildPageContentColumn() { + return Column(children: [ + Row( + children: const [ + ShareButton(), + SavePlaceButton(), + ], + ), + Row(children: [ + Expanded( + child: Image.network(venueInfo.getPhotoURL()), + ), + ]), + Row(children: [buildNameAndAddress(), buildWeatherInfo()]), + AboutTheSpotTable(venueInfo: venueInfo), + //Expanded(child: AboutTheSpotTable(venueInfo: venueInfo)), + ]); + } + + Expanded buildWeatherInfo() { + return Expanded( + child: Container( + child: buildWeatherColumn(), + ), + ); + } + + Expanded buildNameAndAddress() { + return Expanded( + child: Column( + children: [ + Text(venue.venueName, + style: const TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + )), + Text(venue.venueAddress + ' ' + venue.venueStreetNo), + ], + )); } Column buildWeatherColumn() { @@ -151,27 +135,16 @@ class _VenuePageState extends State { children: [ Padding( padding: const EdgeInsets.all(4.0), - child: /*Text('Weather Status:', - style: GoogleFonts.robotoCondensed( - textStyle: const TextStyle( - fontSize: 14, - fontWeight: FontWeight.bold, - ), - )),*/ - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, + child: + Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ + Column( children: [ - Column( - children: [ - currentWeather.getCurrentWeatherIcon(), - Text(currentWeather.getCurrentWeatherStatus()), - ], - ), - Text(currentWeather - .getCurrentTemperature() - .toString() + - '\u2103'), - ]), + currentWeather.getCurrentWeatherIcon(), + Text(currentWeather.getCurrentWeatherStatus()), + ], + ), + Text(currentWeather.getCurrentTemperature().toString() + '\u2103'), + ]), ), ], ); @@ -181,7 +154,8 @@ class _VenuePageState extends State { //Just an example table class AboutTheSpotTable extends StatefulWidget { final VenueInfo venueInfo; - AboutTheSpotTable({ + + AboutTheSpotTable({ Key? key, required this.venueInfo, }) : super(key: key); @@ -193,50 +167,53 @@ class AboutTheSpotTable extends StatefulWidget { class _AboutTheSpotTableState extends State { @override Widget build(BuildContext context) { - return DataTable( - headingRowHeight: 30, - columnSpacing: 100, - //dataRowHeight: 30, - dataTextStyle: GoogleFonts.robotoCondensed( - color: const Color(0xff4F6272), + return Center( + child: DataTable( + // headingRowHeight: 30, + // columnSpacing: 100, + //dataRowHeight: 30, + 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 { const SavePlaceButton({ Key? key, @@ -265,14 +242,26 @@ class ShareButton extends StatelessWidget { Key? key, }) : super(key: key); + @override Widget build(BuildContext context) { return Expanded( - child: TextButton.icon( - onPressed: () {}, - icon: const Icon(Icons.share), - label: const Text('Share'), + child: Column( + children: [ + TextButton.icon( + onPressed: () {shareVenue();}, + icon: const Icon(Icons.share), + label: const Text('Share'), + ), + ], ), ); } -} \ No newline at end of file + + void shareVenue() { + + Share.share('Share this venue', subject: 'Subject venue'); + + } + +} diff --git a/pubspec.yaml b/pubspec.yaml index 0e07ba2..19ea830 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -50,6 +50,7 @@ dependencies: webview_flutter: ^3.0.0 syncfusion_flutter_sliders: ^20.1.57 intl: ^0.17.0 + share_plus: ^4.0.4 #Google Sign-in firebase_auth: ^1.1.4 google_sign_in: ^5.0.3