nathan
12/03/2024, 2:35 AMnathan
12/03/2024, 2:36 AMCompositionLocalProvider(LocalMinimumInteractiveComponentEnforcement provides false) {
Row(
modifier = Modifier
.height(IntrinsicSize.Max)
.border(2.dp, Color.Red)
) {
Text(
modifier = Modifier.weight(1f),
text = "Text"
)
Button(
modifier = Modifier.heightIn(min = 1.dp),
contentPadding = PaddingValues(0.dp),
onClick = {}
) {
Text(text = "Button")
}
// Must fill max height without growing the row
Box(
modifier = Modifier
.background(Color.Cyan)
.width(16.dp)
.fillMaxHeight()
)
}
}
If I either
• Remove the box and intrinsic height
• Remove the button
It will display as I intend, but it seems like the combo of button + intrinsic row height causes thisStylianos Gakis
12/03/2024, 9:32 AMnathan
12/03/2024, 9:35 AMdefaultMinSize
inside Button causing it (I can copy-paste the Button implementation and remove defaultMinSize to resolve it)
Do you know of a solution without doing this though? It works fine when I don't use intrinsic height, and I don't understand whyStylianos Gakis
12/03/2024, 9:43 AMButton
in particular. It's a button which follows the material/material3 specs, and those specs need to adhere to whatever their designers decided. In this case it looks like they decided it must have some default min size.
If your app does is not built using the material design system then you must make your own component. You will notice this more and more if you continue using material but you have your own custom needs. Those components are not really written in a way which makes such customization easy.nathan
12/03/2024, 9:48 AMdefaultMinSize
could be overridden with Modifier.heightIn(minSize = ...)
, but I am using this already so its behaviour seems unexpected (to me).
Do you know why heightIn isn't overriding defaultMinSize in this situation?Stylianos Gakis
12/03/2024, 9:50 AMnathan
12/03/2024, 9:51 AM