https://kotlinlang.org logo
Title
c

Christoph Wiesner

04/11/2022, 7:35 AM
Material
Button
applies some inset even though
elevation
+
contentPadding
is set to zero.
Button(
        modifier = modifier
            .size(46.dp)
            .padding(0.dp).background(Color.Green),
        elevation = ButtonDefaults.buttonElevation(
            // all zero
        ),
        shape = RoundedCornerShape(13.dp),
        contentPadding = PaddingValues(0.dp)
    ) {
        Icon(
            painter = iconPainter,
            contentDescription = contentDescription,
            modifier = Modifier.size(20.dp)
        )
    }
gives me
f

Filip Wiesner

04/11/2022, 9:02 AM
Not sure, just a guess but I think thats enforced LocalMinimumTouchTarget size (48 dp)
c

Christoph Wiesner

04/11/2022, 9:03 AM
oh, thanks. wasn’t considering that 🤔
f

Filip Wiesner

04/11/2022, 9:04 AM
You can disable that by overriding
LocalMinimumTouchTargetEnforcement
composition local on your button
c

Christoph Wiesner

04/11/2022, 9:13 AM
thank you - that was actually the cause. 👍
👌 1