|
|
|
|
@ -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';
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|