Is there a reason `Layout` composable function has...
# compose
o
Is there a reason
Layout
composable function has
content
parameter first and not last, so it would allow for container-like invocation?
z
You can specify the parameters in whatever order you want if you name them
j
but that forces to specify all names except content one to get the container invocation
o
I can’t invoke it like
Layout(measureBlocks) { … }
in named parameters form
Oh, I got it. Confused by a different overload.
MeasureBlock
is a lambda typealias
a
yes, the intended usage here is for implementing a custom layout composable, e.g.:
Copy code
@Composable fun MyLayout(
  modifier: Modifier = Modifier,
  content: @Composable () -> Unit
) = Layout(content, modifier) { measurables, constraints ->
  // measure logic here
  layout(myWidth, myHeight) {
    // placement logic here
  }
}
so the measure/layout DSL block gets the trailing lambda position