ImageCardSample
@Sampled
@Composable
fun ImageCardSample() {
ImageCard(
image = { Image(MyImage, "Localized description", contentScale = ContentScale.FillWidth) }
) {
Text("This is an image card")
}
}
ImageCardWithTitleAndSubtitleAndLeadingIconSample
@Sampled
@Composable
fun ImageCardWithTitleAndSubtitleAndLeadingIconSample() {
ImageCard(
image = { Image(MyImage, "Localized description", contentScale = ContentScale.FillWidth) },
title = { Text("Title") },
subtitle = { Text("Subtitle") },
leadingIcon = { Icon(FavoriteIcon, "Localized description") },
) {
Text("This is an image card with a title, subtitle, and leading icon")
}
}
@Sampled
@Composable
fun NonFocusableCardWithButtonGroupSample() {
Column(verticalArrangement = Arrangement.spacedBy(GlimmerTheme.componentSpacingValues.large)) {
Card(focusable = false) { Text("This is a non-focusable card with a button group") }
ButtonGroup(modifier = Modifier.fillMaxWidth()) {
Button(onClick = {}) { Text("Button 1") }
Button(onClick = {}) { Text("Button 2") }
Button(onClick = {}) { Text("Button 3") }
}
}
}
// -------------------------------------------------------------------------------------------------
// ActionCard samples
// -------------------------------------------------------------------------------------------------
ClickableImageCardSample
@Sampled
@Composable
fun ClickableImageCardSample() {
ImageCard(
onClick = {},
image = { Image(MyImage, "Localized description", contentScale = ContentScale.FillWidth) },
) {
Text("This is an image card")
}
}
ClickableImageCardWithTitleAndSubtitleAndLeadingIconSample
@Sampled
@Composable
fun ClickableImageCardWithTitleAndSubtitleAndLeadingIconSample() {
ImageCard(
onClick = {},
image = { Image(MyImage, "Localized description", contentScale = ContentScale.FillWidth) },
title = { Text("Title") },
subtitle = { Text("Subtitle") },
leadingIcon = { Icon(FavoriteIcon, "Localized description") },
) {
Text("This is an image card with a title, subtitle, and leading icon")
}
}
// -------------------------------------------------------------------------------------------------
// Leading/Trailing ImageCard samples
// -------------------------------------------------------------------------------------------------