expand person bio card when tapping anywhere

This commit is contained in:
Owen LeJeune
2023-07-08 21:11:18 -04:00
parent bcb856bdf5
commit 1ff35387c8
2 changed files with 13 additions and 3 deletions

View File

@@ -79,12 +79,20 @@ fun ExpandableContentCard(
collapsedText: String = stringResource(id = R.string.expandable_see_more),
expandedText: String = stringResource(id = R.string.expandable_see_less),
toggleTextColor: Color = MaterialTheme.colorScheme.onSurfaceVariant,
content: @Composable (Boolean) -> Unit = {}
expandOnTouchAnywhere: Boolean = false,
content: @Composable (Boolean) -> Unit
) {
var expandedState by remember { mutableStateOf(false) }
Card(
modifier = modifier,
modifier = modifier.then(
Modifier.clickable(
enabled = expandOnTouchAnywhere,
onClick = {
expandedState = true
}
)
),
shape = RoundedCornerShape(10.dp),
elevation = CardDefaults.cardElevation(defaultElevation = 8.dp),
colors = CardDefaults.cardColors(containerColor = backgroundColor)

View File

@@ -138,7 +138,9 @@ fun PersonDetailScreen(
@Composable
private fun BiographyCard(person: DetailPerson?) {
if (person != null && person.biography.isNotEmpty()) {
ExpandableContentCard { isExpanded ->
ExpandableContentCard(
expandOnTouchAnywhere = true
) { isExpanded ->
Text(
modifier = Modifier
.fillMaxWidth()