Skip to content

schott12521/compose-activity-rings

Repository files navigation

Compose Activity Rings

image

Simple Kotlin Multiplatform library supporting iOS, Android, Web (WasmJS), and Desktop (JVM) to create Activity Rings similar to Apple's Activity Rings for Fitness tracking

Usage

For now this package is only available via github packages.

Add the following to your settings.gradle.kts, making sure that you have set or provided mavenUser and mavenPassword to your github username and a Personal Access Token.

maven {
    url = uri("https://maven.pkg.github.com/schott12521/compose-activity-rings")
    credentials {
        username = mavenUser
        password = mavenPassword
    }
}

Then you can depend on the latest version of the library, in libs.versions.toml:

activity-rings = "$latestVersion"

compose-activity-rings = { group = "com.slapps.compose.activityrings", name = "compose-activity-rings", version.ref = "activity-rings" }

Try it

Wanna see what the library feels like? The latest version builds and deploys the Kotlin/WasmJS target to github pages: https://schott12521.github.io/compose-activity-rings/

Docs

ActivityRing can be created via:

ActivityRings(
    gap: Dp,
    size: Dp,
    lineWidth: Dp,
    animationSpec: AnimationSpec<Float> = tween(durationMillis = 350, easing = FastOutSlowInEasing),
    vararg rings: Ring
)

where Ring can be created via:

data class Ring(
    val progress: Float,
    val color: Color
)

For more reference, check the example app usage here