I am new to Compose. I use the following code:
Card(
modifier = Modifier
.width(100.dp)
.height(100.dp),
shape = RoundedCornerShape(15.dp),
backgroundColor = Color.Gray
)
But for some unknown reason Card
takes up the whole screen and changes its size only if you use required modifiers. fillMaxWidth(0.2f)
doesn't work either. Help, please.
Only requiredHeight
and requiredWidth
work. The rest of the menus are fine
You are using as parent container of the
Card
aSurface
. It is aBox
withpropagateMinConstraints = true
parameter which forces first descendant to have same minimum constraints or dimensions.In the doc:
Use a Column to wrap the
Card
.