Kshitij Patil
11/12/2020, 7:17 AMColumn(
Modifier.fillMaxHeight().preferredWidth(72.dp),
) {
MockItem(Icons.Filled.Home)
MockItem(Icons.Filled.Search)
MockItem(Icons.Filled.Settings)
MockItem(Icons.Filled.Email)
}
The MockItem is my custom layout which is currently just placing items at (0,0) but is much convoluted than this
@Composable
fun ColumnScope.MockItem(icon: VectorAsset) {
Box(Modifier.weight(1f)) {
Layout(children = {
Icon(icon)
}) { measurables, constraints ->
val placeable = measurables.first().measure(constraints)
layout(constraints.maxWidth,constraints.maxHeight) {
placeable.placeRelative(0,0)
}
}
}
}
When I put Modifier.weight(1f)
, the layouts get equal amount of space in the column whereas, removing the same allocates the entire column height to first item.
My goal is to gain the ability arrange items vertically (Top,Center,Bottom). Am I supposed to drop Column
altogether and build my own "Column" here?