CardDefaults
object CardDefaults
Contains the default values used by Card
Summary
Public functions |
|
|---|---|
CardColors |
Creates a |
CardColors |
@ComposableCreates a |
CardColors |
Creates a |
CardColors |
@ComposableCreates a |
Painter |
@ComposableCreates a |
BorderStroke |
@ComposableCreates a |
CardColors |
Creates a |
CardColors |
@ComposableCreates a |
Brush |
Creates a |
Public properties |
|
|---|---|
Dp |
The default size of the app icon/image when used inside a |
PaddingValues |
ContentPadding for use cards that have an image background in order to show more of the image |
PaddingValues |
The default content padding used by |
Dp |
|
Dp |
Additional bottom padding added for TitleCard with an image background |
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 |
Public functions
cardColors
@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 |
contentColor: Color = Color.Unspecified |
the content color of this |
appNameColor: Color = Color.Unspecified |
the color used for appName, only applies to |
timeColor: Color = Color.Unspecified |
|
titleColor: Color = Color.Unspecified |
|
subtitleColor: Color = Color.Unspecified |
the color used for subtitle, applies to |
cardWithContainerPainterColors
@Composable
fun cardWithContainerPainterColors(): CardColors
Creates a CardColors that represents the default container and content colors used in a Card with image container painter.
cardWithContainerPainterColors
@Composable
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: Color = Color.Unspecified |
the content color of this |
appNameColor: Color = Color.Unspecified |
the color used for appName, only applies to |
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. |
containerPainter
@Composable
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: Painter |
The |
scrim: Brush = scrimBrush() |
The |
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. |
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.
outlinedCardColors
@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 |
appNameColor: Color = Color.Unspecified |
the color used for appName, only applies to |
timeColor: Color = Color.Unspecified |
|
titleColor: Color = Color.Unspecified |
|
subtitleColor: Color = Color.Unspecified |
the color used for subtitle, applies to |
scrimBrush
@Composable
fun scrimBrush(): Brush
Creates a Brush for the recommended scrim drawn on top of image container backgrounds.
Public properties
AppImageSize
val AppImageSize: Dp
The default size of the app icon/image when used inside a AppCard.
CardWithContainerPainterContentPadding
val CardWithContainerPainterContentPadding: PaddingValues
ContentPadding for use cards that have an image background in order to show more of the image
ContentPadding
val ContentPadding: PaddingValues
The default content padding used by Card
Height
val Height: Dp
The default height of Card, AppCard and TitleCard. The card will increase its height to accommodate the contents, if necessary.
ImageBottomPadding
val ImageBottomPadding: Dp
Additional bottom padding added for TitleCard with an image background
scrimColor
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.