object CardDefaults


Contains the default values used by Card

Summary

Public functions

CardColors

Creates a CardColors that represents the default container and content colors used in a Card, AppCard or TitleCard.

CardColors
@Composable
cardColors(
    containerColor: Color,
    contentColor: Color,
    appNameColor: Color,
    timeColor: Color,
    titleColor: Color,
    subtitleColor: Color
)

Creates a CardColors that represents the default container and content colors used in a Card, AppCard or TitleCard.

Painter
@Composable
containerPainter(
    image: Painter,
    scrim: Brush,
    sizeToIntrinsics: Boolean,
    alignment: Alignment,
    contentScale: ContentScale,
    alpha: Float
)

Creates a Painter for the background of an ImageCard that displays an image with a scrim on top to make sure that any content above the background will be legible.

CardColors

Creates a CardColors that represents the default container and content colors used in an ImageCard.

CardColors
@Composable
imageCardColors(
    contentColor: Color,
    appNameColor: Color,
    timeColor: Color,
    titleColor: Color,
    subtitleColor: Color
)

Creates a CardColors that represents the default container and content colors used in a TitleCard with Image set as a background.

BorderStroke
@Composable
outlinedCardBorder(outlineColor: Color, borderWidth: Dp)

Creates a BorderStroke that represents the default border used in Outlined Cards.

CardColors

Creates a CardColors that represents the default container and content colors used in an OutlinedCard, outlined AppCard or TitleCard.

CardColors
@Composable
outlinedCardColors(
    contentColor: Color,
    appNameColor: Color,
    timeColor: Color,
    titleColor: Color,
    subtitleColor: Color
)

Creates a CardColors that represents the default container and content colors used in an OutlinedCard, outlined AppCard or TitleCard.

Public properties

Dp

The default size of the app icon/image when used inside a AppCard.

PaddingValues

The default content padding used by Card

Dp

The default height of Card, AppCard and TitleCard.

Dp

Additional bottom padding added for TitleCard with an image background

PaddingValues

ContentPadding for use with an image background in order to show more of the image.

Color

Returns a scrim color that can be used to draw a scrim on top of an image to ensure that any text drawn over the image is legible.

Shape

The default shape of Card, which determines its corner radius.

Public functions

cardColors

Added in 1.0.0-alpha36
@Composable
fun cardColors(): CardColors

Creates a CardColors that represents the default container and content colors used in a Card, AppCard or TitleCard.

cardColors

@Composable
fun cardColors(
    containerColor: Color = Color.Unspecified,
    contentColor: Color = Color.Unspecified,
    appNameColor: Color = Color.Unspecified,
    timeColor: Color = Color.Unspecified,
    titleColor: Color = Color.Unspecified,
    subtitleColor: Color = Color.Unspecified
): CardColors

Creates a CardColors that represents the default container and content colors used in a Card, AppCard or TitleCard.

Parameters
containerColor: Color = Color.Unspecified

the container color of this Card.

contentColor: Color = Color.Unspecified

the content color of this Card.

appNameColor: Color = Color.Unspecified

the color used for appName, only applies to AppCard.

timeColor: Color = Color.Unspecified

the color used for time, applies to AppCard and TitleCard.

titleColor: Color = Color.Unspecified

the color used for title, applies to AppCard and TitleCard.

subtitleColor: Color = Color.Unspecified

the color used for subtitle, applies to TitleCard.

containerPainter

Added in 1.0.0-alpha36
@Composable
fun containerPainter(
    image: Painter,
    scrim: Brush = SolidColor(scrimColor),
    sizeToIntrinsics: Boolean = false,
    alignment: Alignment = Alignment.Center,
    contentScale: ContentScale = ContentScale.Fit,
    alpha: Float = DefaultAlpha
): Painter

Creates a Painter for the background of an ImageCard that displays an image with a scrim on top to make sure that any content above the background will be legible.

An Image background is a means to reinforce the meaning of information in a Card, e.g. to help to contextualize the information. Cards should have a content color that contrasts with the background image and scrim.

Parameters
image: Painter

The Painter to use to draw the container background of the Card

scrim: Brush = SolidColor(scrimColor)

The Brush to use to paint a scrim over the container image to ensure that any text drawn over the image is legible

sizeToIntrinsics: Boolean = false

When false (the default), fills the available space within the container. Pass true to retain the size of the image.

alignment: Alignment = Alignment.Center

Specifies alignment of the container image painter relative to the container.

contentScale: ContentScale = ContentScale.Fit

Strategy for scaling the painter if its size does not match the container.

alpha: Float = DefaultAlpha

Opacity of the container image painter and scrim.

imageCardColors

Added in 1.0.0-alpha36
@Composable
fun imageCardColors(): CardColors

Creates a CardColors that represents the default container and content colors used in an ImageCard.

imageCardColors

@Composable
fun imageCardColors(
    contentColor: Color = Color.Unspecified,
    appNameColor: Color = Color.Unspecified,
    timeColor: Color = Color.Unspecified,
    titleColor: Color = Color.Unspecified,
    subtitleColor: Color = Color.Unspecified
): CardColors

Creates a CardColors that represents the default container and content colors used in a TitleCard with Image set as a background.

Parameters
contentColor: Color = Color.Unspecified

the content color of this Card.

appNameColor: Color = Color.Unspecified

the color used for appName, only applies to AppCard.

timeColor: Color = Color.Unspecified

the color used for time.

titleColor: Color = Color.Unspecified

the color used for title.

subtitleColor: Color = Color.Unspecified

the color used for subtitle.

outlinedCardBorder

@Composable
fun outlinedCardBorder(
    outlineColor: Color = OutlinedCardTokens.ContainerBorderColor.value,
    borderWidth: Dp = OutlinedCardTokens.BorderWidth
): BorderStroke

Creates a BorderStroke that represents the default border used in Outlined Cards.

Parameters
outlineColor: Color = OutlinedCardTokens.ContainerBorderColor.value

The color to be used for drawing an outline.

borderWidth: Dp = OutlinedCardTokens.BorderWidth

width of the border in Dp.

outlinedCardColors

Added in 1.0.0-alpha36
@Composable
fun outlinedCardColors(): CardColors

Creates a CardColors that represents the default container and content colors used in an OutlinedCard, outlined AppCard or TitleCard.

outlinedCardColors

@Composable
fun outlinedCardColors(
    contentColor: Color = Color.Unspecified,
    appNameColor: Color = Color.Unspecified,
    timeColor: Color = Color.Unspecified,
    titleColor: Color = Color.Unspecified,
    subtitleColor: Color = Color.Unspecified
): CardColors

Creates a CardColors that represents the default container and content colors used in an OutlinedCard, outlined AppCard or TitleCard.

Parameters
contentColor: Color = Color.Unspecified

the content color of this OutlinedCard.

appNameColor: Color = Color.Unspecified

the color used for appName, only applies to AppCard.

timeColor: Color = Color.Unspecified

the color used for time, applies to AppCard and TitleCard.

titleColor: Color = Color.Unspecified

the color used for title, applies to AppCard and TitleCard.

subtitleColor: Color = Color.Unspecified

the color used for subtitle, applies to TitleCard.

Public properties

AppImageSize

Added in 1.0.0-alpha36
val AppImageSizeDp

The default size of the app icon/image when used inside a AppCard.

ContentPadding

Added in 1.0.0-alpha36
val ContentPaddingPaddingValues

The default content padding used by Card

Height

Added in 1.0.0-alpha36
val HeightDp

The default height of Card, AppCard and TitleCard. The card will increase its height to accommodate the contents, if necessary.

ImageBottomPadding

Added in 1.0.0-alpha36
val ImageBottomPaddingDp

Additional bottom padding added for TitleCard with an image background

ImageContentPadding

Added in 1.0.0-alpha36
val ImageContentPaddingPaddingValues

ContentPadding for use with an image background in order to show more of the image. Expected to be used with TitleCard's with an image background

scrimColor

Added in 1.0.0-alpha36
val scrimColorColor

Returns a scrim color that can be used to draw a scrim on top of an image to ensure that any text drawn over the image is legible.

shape

Added in 1.0.0-alpha36
val shapeShape

The default shape of Card, which determines its corner radius.