Skip to content

mdrlzy/ComposeCounterSlider

Repository files navigation

ComposeCounterSlider

Fork of this article with refactoring and improvements such as custom size, colors, vertical variant and more.

slider.mp4

Installation

  • Update your settings.gradle
dependencyResolutionManagement {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
  • Update your module level build.gradle. Check latest version on the tags page
dependencies {
    implementation 'com.github.mdrlzy:ComposeCounterSlider:$version'
}

Usage

var valueCounter by remember {
    mutableStateOf(0)
}
HorizontalCounterSlider(
    modifier = Modifier,
    size = DpSize(200.dp, 80.dp),
    value = valueCounter.toString(),
    allowTopToReset = true,
    allowBottomToReset = true,
    customization = CounterSliderCustomization(),
    colors = CounterSliderColors(),
    onValueIncreaseClick = {
        valueCounter += 1
    },
    onValueDecreaseClick = {
        valueCounter = maxOf(valueCounter - 1, 0)
    },
    onValueClearClick = {
        valueCounter = 0
    }
)

About

Counter slider for Android Jetpack Compose

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages