Composables UI is out: our new component library for Compose Multiplatform ->
Compose Component

TitleCardContent

Lays out the content of a TitleCard with support for a title, time, subtitle, and body content.

TitleCardContentWithOneHandedGestureSample

@Composable
fun TitleCardContentWithOneHandedGestureSample() {
    var label by remember { mutableStateOf("Title 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,
            ) {
                TitleCardContent(
                    title = { Text(label) },
                    time = { Text("now") },
                    subtitle = { Text("Subtitle") },
                ) {
                    Text("Card body")
                }
            }
        }
    }
}

Last updated: