copy compose-polygonshape
directory to your project directory.
Add entry compose-polygonshape
to the existing app entry settings.gradle
include ':app', ':compose-polygonshape'
Add as dependency in app/build.gradle
dependencies {
...
implementation project(path: ':compose-polygonshape')
}
In case of build errors, simply copy these classes to your project.
val roundedStarShape = RoundedStarShape(
sides = 5,
curve = 0.09,
rotation = 0f,
iterations = 360
)
Surface(
shape = roundedStarShape,
) {
Box(
modifier = Modifier
.background(color = Color(0x70205C47))
.size(160.dp),
contentAlignment = Center
) {
Image(
painter = painterResource(id = R.drawable.ic_icon),
contentDescription = "",
modifier = Modifier.size(56.dp)
)
}
}
### PolygonShape()
val polygonShape = PolygonShape(sides = 5, rotation = 0f)
Surface(
shape = polygonShape,
) {
Box(
modifier = Modifier
.background(color = Color(0x70205C47))
.size(160.dp),
contentAlignment = Center
) {
Image(
painter = painterResource(id = R.drawable.ic_icon_2),
contentDescription = "",
modifier = Modifier.size(56.dp)
)
}
}
Distributed under the MIT License. See LICENSE
for more information.