Skip to content

Commit

Permalink
fix integration with country
Browse files Browse the repository at this point in the history
  • Loading branch information
gmonso committed Jul 25, 2024
1 parent 8f0f2b1 commit 39e0e54
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions lib/screens/nasa_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ class _NasaApiPageState extends State<NasaApiPage> {
showSnackbar(context,
"Could not open the map.");
}*/

_pinToLatLang(satelliteData.latitude, satelliteData.longitude, MarkerId(satelliteData.id));

},
),
Expand All @@ -237,7 +237,16 @@ class _NasaApiPageState extends State<NasaApiPage> {
target: LatLng(10.7749, -122.4194), // replace with your initial coordinates
zoom: 0.0,
),

markers: _satelliteData
.map((e) => Marker(
markerId: MarkerId(e.id),
position: LatLng(e.latitude, e.longitude),
infoWindow: InfoWindow(
title: e.countryId,
snippet: e.acqDate.toString(),
),
))
.toSet(),
onMapCreated: (GoogleMapController controller) {
setState(() {
_mapsController = controller;
Expand Down Expand Up @@ -273,13 +282,28 @@ class _NasaApiPageState extends State<NasaApiPage> {
await Future.delayed(const Duration(seconds: 3));

CameraPosition position = CameraPosition(
bearing: 192.8334901395799,
//bearing: 80.8334901395799,
target: LatLng(lat, lng),
zoom: 5.0,
//tilt: 59.440717697143555,
);
setState(() {
_mapsController?.animateCamera(CameraUpdate.newCameraPosition(position));
});
}

Future<void> _pinToLatLang(double lat, double lng, MarkerId markerId) async {
// wait 1 second
//await Future.delayed(const Duration(seconds: 3));
CameraPosition position = CameraPosition(
// bearing: 192.8334901395799,
target: LatLng(lat, lng),
zoom: 12.0,
tilt: 59.440717697143555,
);
setState(() {
_mapsController?.animateCamera(CameraUpdate.newCameraPosition(position));
_mapsController?.showMarkerInfoWindow(markerId);
});
}

Expand Down

0 comments on commit 39e0e54

Please sign in to comment.