Skip to content

Instantly share code, notes, and snippets.

@vinaygaba
Last active September 25, 2022 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vinaygaba/c0c369d973c2743f1914ccfacdba96ce to your computer and use it in GitHub Desktop.
Save vinaygaba/c0c369d973c2743f1914ccfacdba96ce to your computer and use it in GitHub Desktop.
fun Modifier.boundingBox(
color: Color = Color.Red,
strokeWidth: Float = 5f,
) = drawWithCache {
val stroke = Stroke(strokeWidth)
val size = Size(size.width, size.height)
onDrawWithContent {
drawContent()
drawRect(
color = color,
size = size,
style = stroke
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment