Closed giohappy closed 4 years ago
The CameraUpdate for the route is wrong. It always assume the source and destination to be located from southwest to northeast.
The following lines
https://github.com/sbis04/flutter_maps/blob/7a439ee016c4fc1ba621047aa2d0cf624cf5ffb2/lib/main.dart#L204-L210
should be replaced with the following (or similar code):
double miny = (startCoordinates.latitude <= destinationCoordinates.latitude) ? startCoordinates.latitude : destinationCoordinates.latitude; double minx = (startCoordinates.longitude <= destinationCoordinates.longitude) ? startCoordinates.longitude : destinationCoordinates.longitude; double maxy = (startCoordinates.latitude <= destinationCoordinates.latitude) ? destinationCoordinates.latitude : startCoordinates.latitude; double maxx = (startCoordinates.longitude <= destinationCoordinates.longitude) ? destinationCoordinates.longitude : startCoordinates.longitude; Position _southwestCoordinates = Position( latitude: miny, longitude: minx ); Position _northeastCoordinates = Position( latitude: maxy, longitude: maxx );
thanks man.. thats why my camera was moving to different continent lol..
thank you. My problem is sorted now
Thanks @giohappy for this solution. I have updated the example as per that.
The CameraUpdate for the route is wrong. It always assume the source and destination to be located from southwest to northeast.
The following lines
https://github.com/sbis04/flutter_maps/blob/7a439ee016c4fc1ba621047aa2d0cf624cf5ffb2/lib/main.dart#L204-L210
should be replaced with the following (or similar code):