SimpleAspectRatio
@Sampled
@Composable
fun SimpleAspectRatio() {
Box(Modifier.width(100.dp).aspectRatio(2f).background(Color.Green))
}Attempts to size the content to match a specified aspect ratio by trying to match one of the incoming constraints in the following order: Constraints.maxWidth, Constraints.maxHeight, Constraints.minWidth, Constraints.minHeight if matchHeightConstraintsFirst is false (which is the default), or Constraints.maxHeight, Constraints.maxWidth, Constraints.minHeight, Constraints.minWidth if matchHeightConstraintsFirst is true.
CodeRabbit
AI writes the code. CodeRabbit catches the slop.
Robomori
Run Android emulators and devices outside Android Studio.
@Sampled
@Composable
fun SimpleAspectRatio() {
Box(Modifier.width(100.dp).aspectRatio(2f).background(Color.Green))
}Content updated: