Jetpack Compose ripple with radius is not propagating when used with pointerInput to display at touch position?

Viewed 280

I created an answer for the question here to display ripple on touch position as

// This is for emitting press or release event
val interactionSource = remember { MutableInteractionSource() }
val pointerModifier = Modifier
    .fillMaxSize()
    .indication(interactionSource, rememberRipple(color = Color.Red, radius = 50.dp))
    .pointerInput(Unit) {
        detectTapGestures(
            onPress = { offset: Offset ->

                val press = PressInteraction.Press(offset)
                interactionSource.emit(press)
                // Waits for the press to be released before returning.
                // If the press was released, true is returned, or if the gesture
                // was canceled by motion being consumed by another gesture, false is returned.
                tryAwaitRelease()
                // We emit a release press interaction here
                interactionSource.emit(PressInteraction.Release(press))

            }
        )
    }

Box(modifier = pointerModifier)

but when ripple radius is set it's is not created at touch position, center of the Composable instead, and not propagating as it does without radius.

The on at left with radius which is not working, the one at the right without radius propagates correctly from touch position

enter image description here enter image description here

0 Answers
Related