
Horizontal value slider enabling highly customizable numeric selection: adjustable range, segmented ticks with variable "bar breaks", custom labels, colors and stateful control for precise value picking.
It is a Horizontal slider value picker, which can be customized heavily to pick the desired number. Build fully in Jetpack Compose.
Add it in your root build.gradle or settings.gradle at the end of repositories:
repositories {
mavenCentral()
}Add the dependency
dependencies {
implementation(io.github.rajdeepvaghela.valuepickerslider:slider:2.0.1)
} val sliderState = rememberSliderState(
range = 880..1080,
currentValue = 910f,
barBreaks = listOf(
BarBreak(10, 1f),
BarBreak(5, .75f),
BarBreak(1, .5f)
)
)
ValuePickerSlider(
state = sliderState,
numSegments = 32,
currentValueLabel = {
Text(
text = getFmName(it / 10f),
color = MaterialTheme.colorScheme.onBackground,
modifier = Modifier.background(MaterialTheme.colorScheme.background)
)
},
indicatorLabel = {
if (it % 10 == 0) {
Text(
text = numberFormat.format(it / 10f),
color = MaterialTheme.colorScheme.onBackground,
)
}
},
currentBarColor = Color.Red,
modifier = Modifier.fillMaxWidth()
)Copyright 2024 Rajdeep Vaghela
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
It is a Horizontal slider value picker, which can be customized heavily to pick the desired number. Build fully in Jetpack Compose.
Add it in your root build.gradle or settings.gradle at the end of repositories:
repositories {
mavenCentral()
}Add the dependency
dependencies {
implementation(io.github.rajdeepvaghela.valuepickerslider:slider:2.0.1)
} val sliderState = rememberSliderState(
range = 880..1080,
currentValue = 910f,
barBreaks = listOf(
BarBreak(10, 1f),
BarBreak(5, .75f),
BarBreak(1, .5f)
)
)
ValuePickerSlider(
state = sliderState,
numSegments = 32,
currentValueLabel = {
Text(
text = getFmName(it / 10f),
color = MaterialTheme.colorScheme.onBackground,
modifier = Modifier.background(MaterialTheme.colorScheme.background)
)
},
indicatorLabel = {
if (it % 10 == 0) {
Text(
text = numberFormat.format(it / 10f),
color = MaterialTheme.colorScheme.onBackground,
)
}
},
currentBarColor = Color.Red,
modifier = Modifier.fillMaxWidth()
)Copyright 2024 Rajdeep Vaghela
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.