Skip to content

Instantly share code, notes, and snippets.

@vitoksmile
Created February 11, 2025 18:06
Show Gist options
  • Select an option

  • Save vitoksmile/01a425f8fdb4e4f2113290e81f538d4e to your computer and use it in GitHub Desktop.

Select an option

Save vitoksmile/01a425f8fdb4e4f2113290e81f538d4e to your computer and use it in GitHub Desktop.
ComposeHints
@Composable
fun HintOverlay(
anchors: () -> List<HintAnchorState>,
) {
//...
BoxWithConstraints(
modifier = Modifier
.fillMaxSize()
.overlayBackground(anchors)
) {
anchors().forEach { anchor ->
Box(
modifier = Modifier
.graphicsLayer {
translationX = anchor.offset.x
translationY = anchor.offset.y + anchor.size.height
},
) {
anchor.hint.content()
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment