Object

ClickableSurfaceDefaults

Contains the default values used by clickable Surface.

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free
Android
object ClickableSurfaceDefaults

Contains the default values used by clickable Surface.

Functions

shape

@ReadOnlyComposable
    @Composable
    fun shape(
        shape: Shape = MaterialTheme.shapes.medium,
        focusedShape: Shape = shape,
        pressedShape: Shape = shape,
        disabledShape: Shape = shape,
        focusedDisabledShape: Shape = disabledShape,
    ) =
        ClickableSurfaceShape(
            shape = shape,
            focusedShape = focusedShape,
            pressedShape = pressedShape,
            disabledShape = disabledShape,
            focusedDisabledShape = focusedDisabledShape,
        )

Creates a ClickableSurfaceShape that represents the default container shapes used in a Surface.

Parameters

shape the shape used when the Surface is enabled, and has no other Interactions.
focusedShape the shape used when the Surface is enabled and focused.
pressedShape the shape used when the Surface is enabled pressed.
disabledShape the shape used when the Surface is not enabled.
focusedDisabledShape the shape used when the Surface is not enabled and focused.

colors

@ReadOnlyComposable
    @Composable
    fun colors(
        containerColor: Color = MaterialTheme.colorScheme.surface,
        contentColor: Color = contentColorFor(containerColor),
        focusedContainerColor: Color = MaterialTheme.colorScheme.inverseSurface,
        focusedContentColor: Color = contentColorFor(focusedContainerColor),
        pressedContainerColor: Color = focusedContainerColor,
        pressedContentColor: Color = contentColorFor(pressedContainerColor),
        disabledContainerColor: Color =
            MaterialTheme.colorScheme.surfaceVariant.copy(alpha = DisabledContainerAlpha),
        disabledContentColor: Color = MaterialTheme.colorScheme.onSurface,
    ) =
        ClickableSurfaceColors(
            containerColor = containerColor,
            contentColor = contentColor,
            focusedContainerColor = focusedContainerColor,
            focusedContentColor = focusedContentColor,
            pressedContainerColor = pressedContainerColor,
            pressedContentColor = pressedContentColor,
            disabledContainerColor = disabledContainerColor,
            disabledContentColor = disabledContentColor,
        )

Creates a ClickableSurfaceColors that represents the default container & content colors used in a Surface.

Parameters

containerColor the container color of this Surface when enabled
contentColor the content color of this Surface when enabled
focusedContainerColor the container color of this Surface when enabled and focused
focusedContentColor the content color of this Surface when enabled and focused
pressedContainerColor the container color of this Surface when enabled and pressed
pressedContentColor the content color of this Surface when enabled and pressed
disabledContainerColor the container color of this Surface when not enabled
disabledContentColor the content color of this Surface when not enabled

scale

fun scale(
        @FloatRange(from = 0.0) scale: Float = 1f,
        @FloatRange(from = 0.0) focusedScale: Float = 1.1f,
        @FloatRange(from = 0.0) pressedScale: Float = scale,
        @FloatRange(from = 0.0) disabledScale: Float = scale,
        @FloatRange(from = 0.0) focusedDisabledScale: Float = disabledScale,
    ) =
        ClickableSurfaceScale(
            scale = scale,
            focusedScale = focusedScale,
            pressedScale = pressedScale,
            disabledScale = disabledScale,
            focusedDisabledScale = focusedDisabledScale,
        )

Creates a ClickableSurfaceScale that represents the default scales used in a Surface. scales are used to modify the size of a composable in different Interaction states e.g. 1f (original) in default state, 1.2f (scaled up) in focused state, 0.8f (scaled down) in pressed state, etc.

Parameters

scale the scale to be used for this Surface when enabled
focusedScale the scale to be used for this Surface when focused
pressedScale the scale to be used for this Surface when pressed
disabledScale the scale to be used for this Surface when disabled
focusedDisabledScale the scale to be used for this Surface when disabled and focused

border

@ReadOnlyComposable
    @Composable
    fun border(
        border: Border = Border.None,
        focusedBorder: Border = border,
        pressedBorder: Border = focusedBorder,
        disabledBorder: Border = border,
        focusedDisabledBorder: Border =
            Border(
                border = BorderStroke(width = 2.dp, color = MaterialTheme.colorScheme.border),
                inset = 0.dp,
                shape = ShapeDefaults.Small,
            ),
    ) =
        ClickableSurfaceBorder(
            border = border,
            focusedBorder = focusedBorder,
            pressedBorder = pressedBorder,
            disabledBorder = disabledBorder,
            focusedDisabledBorder = focusedDisabledBorder,
        )

Creates a ClickableSurfaceBorder that represents the default Borders applied on a Surface in different Interaction states.

Parameters

border the Border to be used for this Surface when enabled
focusedBorder the Border to be used for this Surface when focused
pressedBorder the Border to be used for this Surface when pressed
disabledBorder the Border to be used for this Surface when disabled
focusedDisabledBorder the Border to be used for this Surface when disabled and focused

glow

fun glow(glow: Glow = Glow.None, focusedGlow: Glow = glow, pressedGlow: Glow = glow) =
        ClickableSurfaceGlow(glow = glow, focusedGlow = focusedGlow, pressedGlow = pressedGlow)

Creates a ClickableSurfaceGlow that represents the default Glows used in a Surface.

Parameters

glow the Glow behind this Surface when enabled
focusedGlow the Glow behind this Surface when focused
pressedGlow the Glow behind this Surface when pressed