CardDefaults
object CardDefaults
Contains the default values used by Card
Summary
Public functions |
|
|---|---|
Painter |
@Composable |
Painter |
@ComposableCreates a |
Public properties |
|
|---|---|
Dp |
The default size of the app icon/image when used inside a |
PaddingValues |
The default content padding used by |
Public functions
cardBackgroundPainter
@Composable
fun cardBackgroundPainter(
startBackgroundColor: Color = MaterialTheme.colors.primary .copy(alpha = 0.30f) .compositeOver(MaterialTheme.colors.background),
endBackgroundColor: Color = MaterialTheme.colors.onSurfaceVariant .copy(alpha = 0.20f) .compositeOver(MaterialTheme.colors.background),
gradientDirection: LayoutDirection = LocalLayoutDirection.current
): Painter
Creates a Painter for background colors for a Card. Cards typically have a linear gradient for a background. The gradient will be between startBackgroundColor and endBackgroundColor and at an angle of 45 degrees.
Cards should have a content color that contrasts with the background gradient.
| Parameters | |
|---|---|
startBackgroundColor: Color = MaterialTheme.colors.primary
.copy(alpha = 0.30f)
.compositeOver(MaterialTheme.colors.background) |
The background color used at the start of the gradient of this |
endBackgroundColor: Color = MaterialTheme.colors.onSurfaceVariant
.copy(alpha = 0.20f)
.compositeOver(MaterialTheme.colors.background) |
The background color used at the end of the gradient of this |
gradientDirection: LayoutDirection = LocalLayoutDirection.current |
Whether the cards gradient should be start to end (indicated by |
imageWithScrimBackgroundPainter
@Composable
fun imageWithScrimBackgroundPainter(
backgroundImagePainter: Painter,
backgroundImageScrimBrush: Brush = Brush.linearGradient( colors = listOf( MaterialTheme.colors.surface.copy(alpha = 1.0f), MaterialTheme.colors.surface.copy(alpha = 0f), ) )
): Painter
Creates a Painter for the background of a Card that displays an Image with a scrim over the image 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 in a TitleCard
Cards should have a content color that contrasts with the background image and scrim
| Parameters | |
|---|---|
backgroundImagePainter: Painter |
|
backgroundImageScrimBrush: Brush = Brush.linearGradient(
colors =
listOf(
MaterialTheme.colors.surface.copy(alpha = 1.0f),
MaterialTheme.colors.surface.copy(alpha = 0f),
)
) |
The |
Public properties
AppImageSize
val AppImageSize: Dp
The default size of the app icon/image when used inside a AppCard.
ContentPadding
val ContentPadding: PaddingValues
The default content padding used by Card