Column, Row and Box
Each row in Sprout's plant list has a photo, a name, a date, and a small "thirsty" badge on the photo's corner. Almost every screen you will ever build is some nesting of three layouts: Column, Row and Box.
The rule
Column goes down, Row goes across, Box stacks on top.
Columnplaces children one below another.Rowplaces children side by side.Boxplaces children on top of each other, like layers; later children are drawn above earlier ones.
Row(modifier = Modifier.padding(16.dp)) {
Box {
Image(painter = photo, contentDescription = plant.name)
ThirstyBadge(Modifier.align(Alignment.TopEnd))
}
Spacer(Modifier.width(12.dp))
Column {
Text(plant.name)
Text("Water on ${plant.nextDate}")
}
}Modifiers adjust any composable: size (fillMaxWidth(), size(48.dp)), spacing (padding), looks (background), behaviour (clickable). They are applied in order, so the order changes the result: padding then background leaves an uncoloured gap outside the colour, while background then padding colours the gap too.
Alignment comes from the parent: Column takes horizontalAlignment, Row takes verticalAlignment, and a child in a Box uses Modifier.align(...).