I currently have the following composable:
@Composable
fun ColorPicker(
modifier: Modifier = Modifier
) {
BoxWithConstraints(
modifier = modifier.aspectRatio(1F)
) {
val diameter = constraints.maxWidth
...
}
}
The problem is that it looks like if a user passes a
Modifier
to
ColorPicker
with size constraints, it would follow those. However,
BoxWithConstraints
uses the incoming constraints to size itself, not the constraints in its
Modifier
.
In a case like this, should I be wrapping
BoxWithConstraints
in a
Box
that uses the
Modifier
parameter, or is it expected that the caller of
ColorPicker
should wrap it in whatever layout it needs, and set the size constraints appropriately?