Why does this not work? kotlin fun drawHalfandHalf(scope: DrawScope){ val midPoint =…
- User
Why does this not work?
`kotlin fun drawHalfandHalf(scope: DrawScope){ val midPoint = scope.size.width / 2 val lineWidthPx = 10.dp.toPx() scope.drawRect(color = Color.Green, topLeft = Offset(0f, 0f), size=scope.size.copy(width = midPoint)) scope.drawRect(color = Color.Red, topLeft = Offset(midPoint, 0f), size = scope.size.copy(width = midPoint)) scope.drawLine(color = Color.White, start = Offset(midPoint, 0f), end = Offset(midPoint, scope.size.height), strokeWidth=lineWidthPx) } @Composable fun Greeting(greetingName: String) { Canvas(modifier = Modifier.fillMaxSize()) { drawHalfandHalf(this) } Text( modifier = Modifier.fillMaxWidth(), textAlign = TextAlign.Center, color = MaterialTheme.colors.primary, text = stringResource(R.string.hello_world, greetingName) ) }
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.