ToggleButtonDefaults
object ToggleButtonDefaults
Contains default values used by ToggleButtons.
Summary
Public functions |
|
|---|---|
Shape |
@ComposableProvides a |
Color |
@ComposableCalculates the checked background color for a |
ToggleButtonColors |
@ComposableCreates |
PaddingValues |
@ComposableDefault content padding used for a |
Shape |
@ComposableChooses a |
Public properties |
|
|---|---|
Shape |
Default shape for |
Public functions
animatedShape
@Composable
fun animatedShape(checked: Boolean): Shape
Provides a Shape that uses the default Glimmer shapes for buttons and animates transitions between states. If you require an animated transition between your own custom shapes, please consider creating a custom animated shape.
| Parameters | |
|---|---|
checked: Boolean |
whether the button is in the checked state |
checkedBackgroundColor
@Composable
fun checkedBackgroundColor(color: Color = GlimmerTheme.colors.primary): Color
Calculates the checked background color for a ToggleButton derived from a primary or custom color.
colors
@Composable
fun colors(
backgroundColor: Color = GlimmerTheme.colors.surface,
checkedBackgroundColor: Color = checkedBackgroundColor(),
contentColor: Color = calculateContentColor(backgroundColor),
checkedContentColor: Color = calculateContentColor(checkedBackgroundColor)
): ToggleButtonColors
Creates ToggleButtonColors with default values for a ToggleButton.
| Parameters | |
|---|---|
backgroundColor: Color = GlimmerTheme.colors.surface |
the background color when the button is unchecked |
checkedBackgroundColor: Color = checkedBackgroundColor() |
the background color when the button is checked |
contentColor: Color = calculateContentColor(backgroundColor) |
the content color when the button is unchecked |
checkedContentColor: Color = calculateContentColor(checkedBackgroundColor) |
the content color when the button is checked |
contentPadding
@Composable
fun contentPadding(buttonSize: ButtonSize): PaddingValues
Default content padding used for a ToggleButton with the specified buttonSize.
shape
@Composable
fun shape(
checked: Boolean,
checkedShape: Shape = CheckedShape,
uncheckedShape: Shape = GlimmerTheme.shapes.large
): Shape
Chooses a Shape based on the checked state and can be used to override the default Glimmer button shapes. Note that it simply switches shapes without animation.
If you require an animated version, please refer to ToggleButtonDefaults.animatedShape, which uses default Glimmer animations and shapes, or consider creating a custom animated shape.
Public properties
CheckedShape
val CheckedShape: Shape
Default shape for ToggleButton and IconToggleButton in the checked state.