Created
February 2, 2022 11:27
-
-
Save UndeRus/56647b21ab19bdf4171f8f506e497e21 to your computer and use it in GitHub Desktop.
ripple.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun Modifier.ripple(): Modifier = composed { | |
val source = MutableInteractionSource() | |
indication(interactionSource = source, indication = rememberRipple()) | |
.pointerInput(Unit) { | |
detectTapGestures( | |
onPress = { offset -> | |
val press = PressInteraction.Press(offset) | |
source.emit(press) | |
tryAwaitRelease() | |
source.emit(PressInteraction.Release(press)) | |
} | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment