Skip to content

Instantly share code, notes, and snippets.

@alexaleluia12
Created April 24, 2024 13:50
Show Gist options
  • Save alexaleluia12/969eb86c75bc4c8c670d44bc676a1ade to your computer and use it in GitHub Desktop.
Save alexaleluia12/969eb86c75bc4c8c670d44bc676a1ade to your computer and use it in GitHub Desktop.
dois triangulos lados opostos (shape compose) - todo: fz uma estrela
class PentagoShape : Shape {
override fun createOutline(
size: Size,
layoutDirection: LayoutDirection,
density: Density
): Outline {
return Outline.Generic(
path = mycustonDraw(size = size)
)
}
// TODO(deixar estrela certinho)
fun mycustonDraw(size: Size): Path {
val path = Path()
path.moveTo(0f, 0f)
path.lineTo(size.width / 2f, size.height / 2f)
path.lineTo(size.width, 0f)
path
path.close()
val tp = Path().apply {
moveTo(0f, 0f)
lineTo(size.width / 2f, size.height / 2f)
lineTo(size.width, 0f)
close()
}
val bt = Path().apply {
moveTo(0f, size.height)
lineTo(size.width / 2f, size.height / 2f)
lineTo(size.width, size.height)
close()
}
tp.addPath(bt, Offset(0f, 0f))
return tp
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment