Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save vitoksmile/f5a21c77274413ddef84db5f54598807 to your computer and use it in GitHub Desktop.
ComposeHints
@Composable
internal fun HintOverlay(
anchor: HintAnchorState,
onDismiss: () -> Unit,
) {
Popup(
onDismissRequest = onDismiss,
// Set focusable to handle back press events
properties = remember { PopupProperties(focusable = true) },
) {
//...draw our hints here
}
}
@Composable
internal fun HintsContainer(
modifier: Modifier,
anchor: HintAnchorState,
onDismiss: () -> Unit,
) {
Layout(
modifier = modifier
.overlayBackground(anchor)
.clickable(
interactionSource = null,
// Disable ripple
indication = null,
onClick = onDismiss,
)
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment