update to routing
This commit is contained in:
@ -14,6 +14,7 @@ class MatrixService{
|
||||
|
||||
String locs = "";
|
||||
String origin = "";
|
||||
String destination = "";
|
||||
int i = 0;
|
||||
for(Destination d in destinations){
|
||||
|
||||
@ -21,6 +22,14 @@ class MatrixService{
|
||||
|
||||
if(i==0){
|
||||
origin = "${d.lat}, ${d.lon}";
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(i == (destinations.length - 1)){
|
||||
destination = "${d.lat}, ${d.lon}";
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
print("lat is ${d.lat}, long is ${d.lon}");
|
||||
@ -28,6 +37,8 @@ class MatrixService{
|
||||
i++;
|
||||
}
|
||||
|
||||
locs = "optimize:false|${locs}";
|
||||
|
||||
String _mode = "walking";
|
||||
switch (destinationController.travelMode.value) {
|
||||
case 1:
|
||||
@ -42,7 +53,7 @@ class MatrixService{
|
||||
}
|
||||
|
||||
Map<String, dynamic> cats = {};
|
||||
String url = "https://maps.googleapis.com/maps/api/distancematrix/json?destinations=${locs}&mode=${_mode}&origins=${origin}&key=AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE";
|
||||
String url = "https://maps.googleapis.com/maps/api/directions/json?destination=${destination}&mode=${_mode}&waypoints=${locs}&origin=${origin}&key=AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE";
|
||||
print(url);
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse(url),
|
||||
|
||||
Reference in New Issue
Block a user