the boxwithconstraints and its child box shares the same mutableinteractionsource.
The onNavigateBack() lambda was never called…
@Composable
fun CenterAlignedContentWithBlackOverlay(
onNavigateBack : () -> Unit,
content: @Composable () -> Unit
) {
val wrapperInteractionSource = remember {
MutableInteractionSource()
}
val boxInteractionSource = remember {
MutableInteractionSource()
}
BoxWithConstraints(modifier = Modifier
.clickable(interactionSource = boxInteractionSource, indication = null) {
}
.fillMaxSize()
.background(color = Color.Black.copy(alpha = 0.5f))) {
val width = maxWidth
Box(modifier = Modifier
.width(width / 4)
.align(Alignment.CenterStart)
.blur(3.dp).clickable(interactionSource = boxInteractionSource,indication = null, onClick = {
onNavigateBack.invoke()
})
)
Box(
modifier = Modifier
.width(width / 2)
.background(colors.background)
.align(Alignment.Center)
) {
content.invoke()
}
Box(modifier = Modifier
.width(width / 4)
.align(Alignment.CenterStart)
.blur(3.dp).clickable(interactionSource = boxInteractionSource,indication = null, onClick = {
onNavigateBack.invoke()
}))
}
}
I’ve tried giving the same mutableInteractionSource but it didn’t seem to work and i tried giving two different ones and still the results were same?
Can someone please point out what i am doing wrong and help me out?