change modes

This commit is contained in:
Mohamed Nouffer
2022-07-09 22:51:34 +05:30
parent 131a8995e0
commit ce105a6754
22 changed files with 828 additions and 293 deletions

View File

@ -2,6 +2,7 @@ import 'dart:convert';
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
//import 'package:google_maps_webservice/directions.dart';
import 'package:http/http.dart' as http;
import 'package:rogapp/model/destination.dart';
import '../utils/const.dart';
@ -49,6 +50,7 @@ class DestinationService{
int cats = 0;
String server_url = ConstValues.currentServer();
String url = "${server_url}/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
print("---- url is ${url} -----");
//String url = "http://localhost:8100/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
final http.Response response = await http.get(
Uri.parse(url),
@ -63,12 +65,12 @@ class DestinationService{
return cats;
}
static Future<List<PointLatLng>>? getDestinationLine(List<dynamic> destinations) async{
static Future<List<PointLatLng>>? getDestinationLine(List<Destination> destinations) async{
PolylinePoints polylinePoints = PolylinePoints();
//print("##### @@@@@ ${destinations[0]["location"]["geometry"]["coordinates"][0][1]}");
PointLatLng origin = PointLatLng(destinations[0]["location"]["geometry"]["coordinates"][0][1], destinations[0]["location"]["geometry"]["coordinates"][0][0]);
PointLatLng dest = PointLatLng(destinations[destinations.length -1]["location"]["geometry"]["coordinates"][0][1], destinations[destinations.length -1]["location"]["geometry"]["coordinates"][0][0]);
print("##### @@@@@ ${destinations[0].lat}");
PointLatLng origin = PointLatLng(destinations[0].lat!, destinations[0].lon!);
PointLatLng dest = PointLatLng(destinations[destinations.length -1].lat!, destinations[destinations.length -1].lon!);
List<PolylineWayPoint> wayPoints = [];
@ -78,8 +80,8 @@ class DestinationService{
i+=1;
continue;
}
double la = d["location"]["geometry"]["coordinates"][0][1]as double;
double ln = d["location"]["geometry"]["coordinates"][0][0] as double;
double la = d.lat;
double ln = d.lon;
PolylineWayPoint pwp = PolylineWayPoint(location: "${la},${ln}", stopOver: true);
//print("----- UUUUUU ${pwp}");
//PointLatLng wp = PointLatLng(d["Location"]["geometry"][0][1], d["Location"]["geometry"][0][0]);