Lays out the content of an AppCard with support for an app icon, app name, time, title, and body content.
AppCardContentWithOneHandedGestureSample
@Composable
fun AppCardContentWithOneHandedGestureSample() {
var label by remember { mutableStateOf("App Card") }
val onClick = remember { { label = "Gestured" } }
val interactionSource = remember { MutableInteractionSource() }
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Card(
onClick = onClick,
interactionSource = interactionSource,
modifier =
Modifier.padding(horizontal = 12.dp)
.fillMaxWidth()
.oneHandedGesture(
action = GestureAction.Primary,
interactionSource = interactionSource,
onGesture = onClick,
),
) {
OneHandedGestureIndicator(
interactionSource = interactionSource,
gestureIndicatorTint = MaterialTheme.colorScheme.onSurface,
) {
AppCardContent(
appName = { Text("App Name") },
title = { Text(label) },
appImage = {
Icon(
painter = painterResource(R.drawable.ic_favorite_rounded),
contentDescription = "Favorite icon",
modifier = Modifier.size(CardDefaults.AppImageSize),
)
},
time = { Text("now") },
) {
Text("Card body")
}
}
}
}
}