-
-
Save sbis04/ec9402f37dec341dd8401e6fdce3ca26 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Define two position variables | |
Position _northeastCoordinates; | |
Position _southwestCoordinates; | |
// Calculating to check that | |
// southwest coordinate <= northeast coordinate | |
if (startCoordinates.latitude <= destinationCoordinates.latitude) { | |
_southwestCoordinates = startCoordinates; | |
_northeastCoordinates = destinationCoordinates; | |
} else { | |
_southwestCoordinates = destinationCoordinates; | |
_northeastCoordinates = startCoordinates; | |
} | |
// Accommodate the two locations within the | |
// camera view of the map | |
mapController.animateCamera( | |
CameraUpdate.newLatLngBounds( | |
LatLngBounds( | |
northeast: LatLng( | |
_northeastCoordinates.latitude, | |
_northeastCoordinates.longitude, | |
), | |
southwest: LatLng( | |
_southwestCoordinates.latitude, | |
_southwestCoordinates.longitude, | |
), | |
), | |
100.0, // padding | |
), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment