Archie
01/28/2021, 10:10 AMmodifier.layout { measurable, constraints ->
val placeable = measurable.measure(constraints)
val wrapperWidth = placeable.width.coerceIn(constraints.minWidth, constraints.maxWidth)
val wrapperHeight = placeable.height.coerceIn(constraints.minHeight, constraints.maxHeight)
val size = wrapperWidth.coerceAtLeast(wrapperHeight)
layout(size, size) {
placeable.placeRelative(0, 0)
}
}
But I am only altering the position here since I already measured the placeable. Any hints?allan.conda
01/28/2021, 10:11 AMModifier.aspectRatio(1f)
Archie
01/28/2021, 10:12 AMallan.conda
01/28/2021, 10:12 AMallan.conda
01/28/2021, 10:12 AMallan.conda
01/28/2021, 10:12 AMallan.conda
01/28/2021, 10:13 AMallan.conda
01/28/2021, 10:13 AMallan.conda
01/28/2021, 10:15 AMweight
, wrapContentSize
. It really depends on your use-caseArchie
01/28/2021, 10:33 AMArchie
01/28/2021, 10:35 AMjim
01/28/2021, 10:43 AMallan.conda
01/28/2021, 10:43 AMArchie
01/28/2021, 10:58 AMSubcomposeLayout
would be the best fit for this usecase? I haven't really tried not really sure.Timo Drick
01/28/2021, 1:18 PMModifier.preferredHeight(IntrinsicSize.Min).aspectRatio(1f)
Archie
01/29/2021, 8:47 AM