Added in 1.7.0-alpha01
public object CardDefaults
Contains the default values used by Card
Properties
scrimColor
Added in 1.7.0-alpha01
public val scrimColor: 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.
ContentPadding
Added in 1.7.0-alpha01
public val ContentPadding: PaddingValues
The default content padding used by Card
minimumVerticalListContentPadding
Added in 1.7.0-alpha01
public val minimumVerticalListContentPadding: Dp
The minimum vertical content padding for the list when a Card is placed at the top or bottom edge. Recommended for use with androidx.wear.compose.foundation.lazy.TransformingLazyColumnItemScope's androidx.wear.compose.foundation.lazy.TransformingLazyColumnItemScope.minimumVerticalContentPadding, which allows items to choose a preferred content padding for the list. TransformingLazyColumn takes its contentPadding as the maximum of the preferred content padding values and its own contentPadding parameter.
ImageBottomPadding
Added in 1.7.0-alpha01
public val ImageBottomPadding: Dp
Additional bottom padding added for TitleCard with an image background
CardWithContainerPainterContentPadding
Added in 1.7.0-alpha01
public val CardWithContainerPainterContentPadding: PaddingValues
ContentPadding for use cards that have an image background in order to show more of the image
AppImageSize
Added in 1.7.0-alpha01
public val AppImageSize: Dp
The default size of the app icon/image when used inside a AppCard.
shape
Added in 1.7.0-alpha01
public val shape: Shape
The default shape of Card, which determines its corner radius.
Height
Added in 1.7.0-alpha01
public val Height: Dp
The default height of Card, AppCard and TitleCard. The card will increase its height to accommodate the contents, if necessary.
Functions
cardColors
Added in 1.7.0-alpha01
@Composable public fun cardColors(): CardColors
Creates a CardColors that represents the default container and content colors used in a Card, AppCard or TitleCard.
cardColors
cardColors
Added in 1.7.0-alpha01
@Composable
public 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 | the container color of this Card. |
| contentColor | the content color of this Card. |
| appNameColor | the color used for appName, only applies to AppCard. |
| timeColor | the color used for time, applies to AppCard and TitleCard. |
| titleColor | the color used for title, applies to AppCard and TitleCard. |
| subtitleColor | the color used for subtitle, applies to TitleCard. |
outlinedCardColors
outlinedCardColors
Added in 1.7.0-alpha01
@Composable
public fun outlinedCardColors(): CardColors
Creates a CardColors that represents the default container and content colors used in an OutlinedCard, outlined AppCard or TitleCard.
outlinedCardColors
outlinedCardColors
Added in 1.7.0-alpha01
@Composable
public 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 | the content color of this OutlinedCard. |
| appNameColor | the color used for appName, only applies to AppCard. |
| timeColor | the color used for time, applies to AppCard and TitleCard. |
| titleColor | the color used for title, applies to AppCard and TitleCard. |
| subtitleColor | the color used for subtitle, applies to TitleCard. |
cardWithContainerPainterColors
cardWithContainerPainterColors
Added in 1.7.0-alpha01
@Composable
public fun cardWithContainerPainterColors(): CardColors
Creates a CardColors that represents the default container and content colors used in a Card with image container painter.
cardWithContainerPainterColors
cardWithContainerPainterColors
Added in 1.7.0-alpha01
@Composable
public fun cardWithContainerPainterColors(
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 | the content color of this Card. |
| appNameColor | the color used for appName, only applies to AppCard. |
| timeColor | the color used for time. |
| titleColor | the color used for title. |
| subtitleColor | the color used for subtitle. |
containerPainter
containerPainter
Added in 1.7.0-alpha01
@Composable
public fun containerPainter(
image: Painter,
scrim: Brush = scrimBrush(),
sizeToIntrinsics: Boolean = false,
alignment: Alignment = Alignment.Center,
contentScale: ContentScale = ContentScale.Fit,
alpha: Float = DefaultAlpha,
): Painter
Creates a Painter for the background of an Card 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 | The Painter to use to draw the container background of the Card |
| scrim | The Brush to use to paint a scrim over the container image to ensure that any text drawn over the image is legible |
| sizeToIntrinsics | When false (the default), fills the available space within the container. Pass true to retain the size of the image. |
| alignment | Specifies alignment of the container image painter relative to the container. |
| contentScale | Strategy for scaling the painter if its size does not match the container. |
| alpha | Opacity of the container image painter and scrim. |
scrimBrush
scrimBrush
Added in 1.7.0-alpha01
@Composable
public fun scrimBrush(): Brush
Creates a Brush for the recommended scrim drawn on top of image container backgrounds.
outlinedCardBorder
outlinedCardBorder
Added in 1.7.0-alpha01
@Composable
public 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 | The color to be used for drawing an outline. |
| borderWidth | width of the border in Dp. |