Я разрабатываю ресторанное приложение, где я показываю кучу ресторана на карте.@Composable
fun HoaxMapBox(
hoaxVenueList: ImmutableList,
modifier: Modifier = Modifier,
) {
val context = LocalContext.current
var mapLoaded by remember { mutableStateOf(false) }
val venueBitmapList = remember {
val cache = hashMapOf()
HoaxVenueTypes.entries.forEach { type ->
cache[type] = context.getDrawable(type.resId)?.toBitmapOrNull()
}
cache
}
val hoaxVenueMapboxDataList = remember(hoaxVenueList) {
if (hoaxVenueList.isEmpty()) return@remember persistentListOf()
hoaxVenueList.toHoaxMapbox(
bitmapList = venueBitmapList
)
}
......
MapboxMap(...
if (mapLoaded && hoaxVenueMapboxDataList.isNotEmpty()) {
PointAnnotationGroup(
annotations = hoaxVenueMapboxDataList,
annotationConfig = AnnotationConfig(
annotationSourceOptions = AnnotationSourceOptions(
clusterOptions = ClusterOptions(
clusterRadius = 40,
circleRadius = 16.0,
textColor = Color.WHITE,
textSize = 20.0,
colorLevels = listOf(
Pair(0, Color.BLACK)
)
)
)
),
onClick = {
false
}
)
}
Подробнее здесь: https://stackoverflow.com/questions/795 ... ible-items