added map luncher

merge-requests/560/head
Fatimah Alshammari 4 years ago
parent 1b9e3b75bd
commit 7ffb431454

@ -96,3 +96,19 @@
<true/>
</dict>
</plist>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>comgooglemaps</string>
<string>baidumap</string>
<string>iosamap</string>
<string>waze</string>
<string>yandexmaps</string>
<string>yandexnavi</string>
<string>citymapper</string>
<string>mapswithme</string>
<string>osmandmaps</string>
<string>dgis</string>
<string>qqmap</string>
<string>here-location</string>
</array>

@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';
import 'package:maps_launcher/maps_launcher.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:map_launcher/map_launcher.dart';
class AvailabilityInfo extends StatelessWidget {
final ProductDetailViewModel previousModel;
@ -54,7 +55,14 @@ class AvailabilityInfo extends StatelessWidget {
icon: Icon(Icons.location_on),
color: Colors.red,
onPressed: () {
MapsLauncher.launchCoordinates(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude), previousModel.productLocationService[index].locationDescription);
MapLauncher.showMarker(
mapType: MapType.google,
coords: Coords(double.parse(previousModel.productLocationService[index].latitude),
double.parse(previousModel.productLocationService[index].longitude)),
title: previousModel.productLocationService[index].locationDescription,
// description: location.locationName,
);
// MapsLauncher.launchCoordinates(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude), previousModel.productLocationService[index].locationDescription);
},
),
),

@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import 'package:maps_launcher/maps_launcher.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:map_launcher/map_launcher.dart';
import 'avatar/large_avatar.dart';
import 'my_rich_text.dart';
@ -15,6 +16,7 @@ class HospitalLocation extends StatelessWidget {
final bool showCity;
final String waitingTime;
HospitalLocation(this.location, {Key key, this.showCity = false, this.waitingTime}) : super(key: key);
@override
@ -76,8 +78,12 @@ class HospitalLocation extends StatelessWidget {
children: [
contactButton(Icons.location_on, TranslationBase.of(context).locationa, () {
// MapsLauncher.launchCoordinates(double.parse(location.latitude), double.parse(location.longitude), location.locationName);
// launchMap( double.parse(location.latitude), double.parse(location.longitude));
navigateTo(double.parse(location.latitude), double.parse(location.longitude));
MapLauncher.showMarker(
mapType: MapType.google,
coords: Coords(double.parse(location.latitude), double.parse(location.longitude)),
title: location.locationName,
// description: location.locationName,
);
}),
SizedBox(height: 10),
contactButton(Icons.call, TranslationBase.of(context).callNow, () {
@ -111,38 +117,6 @@ class HospitalLocation extends StatelessWidget {
);
}
static void navigateTo(double latitude, double longitude) async {
var uri = Uri.parse("google.navigation:q=$latitude,$longitude&mode=d");
if (await canLaunch(uri.toString())) {
await launch(uri.toString());
} else {
throw 'Could not launch ${uri.toString()}';
}
}
// launchMap(latitude, longitude) async {
// var url = '';
// var urlAppleMaps = '';
// if (Platform.isAndroid) {
// url = "https://www.google.com/maps/search/?api=1&query=${latitude},${longitude}";
// } else {
// urlAppleMaps = 'https://maps.apple.com/?q=$latitude,$longitude';
// url = "comgooglemaps://?saddr=&daddr=$latitude,$longitude&directionsmode=driving";
// if (await canLaunch(url)) {
// await launch(url);
// } else {
// throw 'Could not launch $url';
// }
// }
//
// if (await canLaunch(url)) {
// await launch(url);
// } else if (await canLaunch(urlAppleMaps)) {
// await launch(urlAppleMaps);
// } else {
// throw 'Could not launch $url';
// }
// }
}

@ -143,6 +143,7 @@ dependencies:
#google maps places
google_maps_place_picker: ^1.0.0
map_launcher: ^1.1.3
#countdown timer for Upcoming List
flutter_countdown_timer: ^1.6.0

Loading…
Cancel
Save