KotlinLeaner
08/29/2022, 8:25 PMKotlinLeaner
08/29/2022, 8:26 PMCompositionLocalProvider(LocalRippleTheme provides NoRippleTheme()) {
val interactionSource = remember { MutableInteractionSource() }
val isPressed by interactionSource.collectIsPressedAsState()
OutlinedButton(
colors = ButtonDefaults.outlinedButtonColors(
backgroundColor = if (isPressed) {
Aqua
} else {
Color.Transparent
}
),
interactionSource = interactionSource,
onClick = { onActionClick() },
modifier = Modifier.fillMaxWidth(),
border = BorderStroke(1.dp, Aqua),
shape = RoundedCornerShape(4.dp)
) {
Text(
text = text,
modifier = Modifier
.padding(8.dp),
style = if (isPressed) {
WhiteTypography.h5
} else {
AquaTypography.h5
}
)
}
}
KotlinLeaner
08/29/2022, 8:26 PMclass NoRippleTheme : RippleTheme {
@Composable
override fun defaultColor() = Color.Unspecified
@Composable
override fun rippleAlpha(): RippleAlpha = RippleAlpha(0.0f, 0.0f, 0.0f, 0.0f)
}
I want to remove shadow when user tap on button.KotlinLeaner
08/29/2022, 8:27 PMTobias Preuss
04/09/2024, 10:39 PM