Compose Component

AppCard

Opinionated Wear Material Card that offers a specific 5 slot layout to show information about an application, e.g.

AppCardWithIcon

@Sampled
@Composable
fun AppCardWithIcon() {
    AppCard(
        onClick = {},
        appName = { Text("AppName") },
        appImage = {
            Icon(
                painter = painterResource(id = R.drawable.ic_airplanemode_active_24px),
                contentDescription = "airplane",
                modifier =
                    Modifier.size(CardDefaults.AppImageSize)
                        .wrapContentSize(align = Alignment.Center),
            )
        },
        title = { Text("AppCard") },
        time = { Text("now") },
    ) {
        Text("Some body content")
        Text("and some more body content")
    }
}

AppCardWithImage

@Sampled
@Composable
fun AppCardWithImage() {
    AppCard(
        onClick = {},
        appName = { Text("App name") },
        appImage = {
            Icon(
                painter = painterResource(id = R.drawable.ic_airplanemode_active_24px),
                contentDescription = "airplane",
                modifier =
                    Modifier.size(CardDefaults.AppImageSize)
                        .wrapContentSize(align = Alignment.Center),
            )
        },
        title = { Text(text = "Title with maximum two lines", maxLines = 2) },
        time = { Text("now") },
    ) {
        Spacer(Modifier.height(6.dp))
        Image(
            modifier =
                Modifier.padding(end = 28.dp).aspectRatio(16f / 9f).clip(RoundedCornerShape(16.dp)),
            painter = painterResource(R.drawable.card_background),
            contentScale = ContentScale.Crop,
            contentDescription = null,
        )
    }
}
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: