Jan
06/21/2023, 3:34 PMJan
06/21/2023, 3:36 PM@Composable
fun CustomTheme(
    darkTheme: Boolean = false/*isSystemInDarkTheme()*/,
    content: @Composable () -> Unit
) {
    val customColors = if (darkTheme) DarkColorPalette else LightColorPalette
    CompositionLocalProvider(
        LocalCustomColors provides customColors,
        LocalRippleTheme provides NoRippleTheme,
        content = content
    )
}
@Immutable
object NoRippleTheme : RippleTheme {
    @Composable
    override fun defaultColor() = Color.Unspecified
    @Composable
    override fun rippleAlpha(): RippleAlpha = RippleAlpha(0.0F, 0.0F, 0.0f, 0.0F)
}Jan
06/21/2023, 3:37 PMŁukasz Nowakowski
06/21/2023, 3:41 PMCompositionLocalProvider(
   LocalIndication provides NoRipple,
   ...
   content = content,
)
private object NoRipple : Indication, IndicationInstance {
    @Composable
    override fun rememberUpdatedInstance(interactionSource: InteractionSource) = this
    override fun ContentDrawScope.drawIndication() = drawContent()
}Jan
06/21/2023, 3:44 PMŁukasz Nowakowski
06/21/2023, 3:57 PM@Composable
fun CustomTheme(
    darkTheme: Boolean = false/*isSystemInDarkTheme()*/,
    content: @Composable () -> Unit
) {
    val customColors = if (darkTheme) DarkColorPalette else LightColorPalette
    CompositionLocalProvider(
        LocalIndication provides NoRipple,
        content = content
    )
}
private object NoRipple : Indication, IndicationInstance {
    @Composable
    override fun rememberUpdatedInstance(interactionSource: InteractionSource) = this
    override fun ContentDrawScope.drawIndication() = drawContent()
}Jan
06/21/2023, 4:15 PMJan
06/22/2023, 7:30 AMJan
06/22/2023, 7:31 AM@OptIn(ExperimentalResourceApi::class)
@Composable
fun App() {
    //MaterialTheme {
        CompositionLocalProvider(LocalIndication provides NoRipple) {
            var greetingText by remember { mutableStateOf("Hello, World!") }
            var showImage by remember { mutableStateOf(false) }
            Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) {
                Button(onClick = {
                    greetingText = "Hello, ${getPlatformName()}"
                    showImage = !showImage
                }) {
                    Text(greetingText)
                }
                AnimatedVisibility(showImage) {
                    Image(
                        painterResource("compose-multiplatform.xml"),
                        null
                    )
                }
            }
        }
    //}
}
object NoRipple : Indication, IndicationInstance {
    @Composable
    override fun rememberUpdatedInstance(interactionSource: InteractionSource) = this
    override fun ContentDrawScope.drawIndication() = drawContent()
}Jan
06/22/2023, 7:31 AMJan
06/22/2023, 7:42 AMJan
06/22/2023, 7:46 AMJan
06/22/2023, 7:46 AMJan
06/22/2023, 8:02 AMJan
06/22/2023, 8:02 AMJan
06/22/2023, 8:03 AM