SliderDefaults
object SliderDefaults
Defaults used by slider.
Summary
Public functions |
|
|---|---|
Unit |
@ComposableThe recommended decrease icon. |
Unit |
@ComposableThe recommended increase icon. |
SliderColors |
Creates a |
SliderColors |
@ComposableCreates a |
SliderColors |
Creates a |
SliderColors |
@ComposableCreates a |
Public properties |
|
|---|---|
Dp |
The recommended size for Slider button icons. |
Int |
The maximum recommended number of steps for a segmented |
String |
The default content description for the decrease button |
String |
The default content description for the increase icon |
Shape |
The recommended |
Public functions
DecreaseIcon
@Composable
fun DecreaseIcon(
modifier: Modifier = Modifier,
contentDescription: String = decreaseIconContentDescription
): Unit
The recommended decrease icon.
IncreaseIcon
@Composable
fun IncreaseIcon(
modifier: Modifier = Modifier,
contentDescription: String = increaseIconContentDescription
): Unit
The recommended increase icon.
sliderColors
@Composable
fun sliderColors(): SliderColors
Creates a SliderColors that represents the default background and content colors used in an Slider.
sliderColors
@Composable
fun sliderColors(
containerColor: Color = Color.Unspecified,
buttonIconColor: Color = Color.Unspecified,
selectedBarColor: Color = Color.Unspecified,
unselectedBarColor: Color = Color.Unspecified,
selectedBarSeparatorColor: Color = Color.Unspecified,
unselectedBarSeparatorColor: Color = Color.Unspecified,
disabledContainerColor: Color = Color.Unspecified,
disabledButtonIconColor: Color = Color.Unspecified,
disabledSelectedBarColor: Color = Color.Unspecified,
disabledUnselectedBarColor: Color = Color.Unspecified,
disabledSelectedBarSeparatorColor: Color = Color.Unspecified,
disabledUnselectedBarSeparatorColor: Color = Color.Unspecified
): SliderColors
Creates a SliderColors that represents the default background and content colors used in an Slider.
| Parameters | |
|---|---|
containerColor: Color = Color.Unspecified |
The background color of this |
buttonIconColor: Color = Color.Unspecified |
The color of the icon of buttons when enabled |
selectedBarColor: Color = Color.Unspecified |
The color of the progress bar when enabled |
unselectedBarColor: Color = Color.Unspecified |
The background color of the progress bar when enabled |
selectedBarSeparatorColor: Color = Color.Unspecified |
The color of separator between visible segments within the selected portion of the bar when enabled |
unselectedBarSeparatorColor: Color = Color.Unspecified |
The color of unselected separator between visible segments within the unselected portion of the bar when enabled |
disabledContainerColor: Color = Color.Unspecified |
The background color of this |
disabledButtonIconColor: Color = Color.Unspecified |
The color of the icon of buttons when disabled |
disabledSelectedBarColor: Color = Color.Unspecified |
The color of the progress bar when disabled |
disabledUnselectedBarColor: Color = Color.Unspecified |
The background color of the progress bar when disabled |
disabledSelectedBarSeparatorColor: Color = Color.Unspecified |
The color of selected separator between visible segments when disabled |
disabledUnselectedBarSeparatorColor: Color = Color.Unspecified |
The color of unselected separator between visible segments when disabled |
variantSliderColors
@Composable
fun variantSliderColors(): SliderColors
Creates a SliderColors as an alternative to the default colors, providing a visual indication of value changes within a Slider.
Example of a slider uses variantSliderColors when its value is different from the initial value:
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.wear.compose.material3.Slider import androidx.wear.compose.material3.SliderDefaults val initialValue = 4.5f var value by remember { mutableStateOf(initialValue) } Slider( value = value, onValueChange = { value = it }, valueRange = 3f..6f, steps = 5, segmented = false, colors = if (value == initialValue) { SliderDefaults.sliderColors() } else { SliderDefaults.variantSliderColors() }, )
variantSliderColors
@Composable
fun variantSliderColors(
containerColor: Color = Color.Unspecified,
buttonIconColor: Color = Color.Unspecified,
selectedBarColor: Color = Color.Unspecified,
unselectedBarColor: Color = Color.Unspecified,
selectedBarSeparatorColor: Color = Color.Unspecified,
unselectedBarSeparatorColor: Color = Color.Unspecified,
disabledContainerColor: Color = Color.Unspecified,
disabledButtonIconColor: Color = Color.Unspecified,
disabledSelectedBarColor: Color = Color.Unspecified,
disabledUnselectedBarColor: Color = Color.Unspecified,
disabledSelectedBarSeparatorColor: Color = Color.Unspecified,
disabledUnselectedBarSeparatorColor: Color = Color.Unspecified
): SliderColors
Creates a SliderColors as an alternative to the default colors, providing a visual indication of value changes within a Slider.
Example of a slider uses variantSliderColors when its value is different from the initial value:
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.wear.compose.material3.Slider import androidx.wear.compose.material3.SliderDefaults val initialValue = 4.5f var value by remember { mutableStateOf(initialValue) } Slider( value = value, onValueChange = { value = it }, valueRange = 3f..6f, steps = 5, segmented = false, colors = if (value == initialValue) { SliderDefaults.sliderColors() } else { SliderDefaults.variantSliderColors() }, )
| Parameters | |
|---|---|
containerColor: Color = Color.Unspecified |
The background color of this |
buttonIconColor: Color = Color.Unspecified |
The color of the icon of buttons when enabled |
selectedBarColor: Color = Color.Unspecified |
The color of the progress bar when enabled |
unselectedBarColor: Color = Color.Unspecified |
The background color of the progress bar when enabled |
selectedBarSeparatorColor: Color = Color.Unspecified |
The color of separator between visible segments within the selected portion of the bar when enabled |
unselectedBarSeparatorColor: Color = Color.Unspecified |
The color of unselected separator between visible segments within the unselected portion of the bar when enabled |
disabledContainerColor: Color = Color.Unspecified |
The background color of this |
disabledButtonIconColor: Color = Color.Unspecified |
The color of the icon of buttons when disabled |
disabledSelectedBarColor: Color = Color.Unspecified |
The color of the progress bar when disabled |
disabledUnselectedBarColor: Color = Color.Unspecified |
The background color of the progress bar when disabled |
disabledSelectedBarSeparatorColor: Color = Color.Unspecified |
The color of selected separator between visible segments when disabled |
disabledUnselectedBarSeparatorColor: Color = Color.Unspecified |
The color of unselected separator between visible segments when disabled |
Public properties
MaxSegmentSteps
val MaxSegmentSteps: Int
The maximum recommended number of steps for a segmented Slider.
decreaseIconContentDescription
val decreaseIconContentDescription: String
The default content description for the decrease button
increaseIconContentDescription
val increaseIconContentDescription: String
The default content description for the increase icon