nitrog42
05/04/2021, 2:38 PMnitrog42
05/04/2021, 2:39 PM@Composable
private fun Map(latitude: Double, longitude: Double) {
val mapView = rememberMapViewWithLifecycle()
LaunchedEffect(map, mapInitialized) {
if (!mapInitialized) {
val googleMap = map.awaitMap()
val position = LatLng(latitude, longitude)
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(position, 16f))
mapInitialized = true
}
AndroidView({ map })
}
}
Box {
Map {
}
FloatingActionButton(onClick = {
//what to do here ?
}) {
}
}
nitrog42
05/04/2021, 2:39 PMnitrog42
05/04/2021, 2:40 PMnitrog42
05/04/2021, 2:57 PMval mapView = rememberMapViewWithLifecycle()
in the Box block actually, so that I can do something on the mapview from the FloatingActionButton