Skip to content

uuranus/compose-shapes

Repository files navigation

Compose Shapes

Various shapes drawn with Jetpack Compose

compose shapes thumbnail

Rectangles

Name Screenshot Code
Parallelogram

ParallelogramShape(
  skewed = 0.2f,
  modifier = Modifier.fillMaxSize()
)

Rhombus

RhombusShape(
  modifier = Modifier.fillMaxSize()
)

Trapezoid

TrapezoidShape(
  leftSkewed = 0.2f,
  rightSkewed = 0.2f,
  modifier = Modifier.fillMaxSize()
)

Polygons

Name Screenshot Code
Regular Polygons

PolygonShape(
  numOfPoints = 5,
  modifier = Modifier.fillMaxWidth(),
)

Stars

Name Screenshot Code
Star

StarShape(
  innerRadiusRatio = 0.5f,
  numOfPoints = 5,
  modifier = Modifier
    .fillMaxWidth()
)

Get Started

Step 1. Add it in your root build.gradle at the end of repositories

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven(url = "https://jitpack.io")
    }
}

Step 2. Add the dependency

dependencies {
	  implementation("com.github.uuranus:compose-shapes:latest-version")
}