mirror of
https://github.com/owenlejeune/TVTime.git
synced 2026-01-01 04:11:19 -05:00
expand person bio card when tapping anywhere
This commit is contained in:
@@ -79,12 +79,20 @@ fun ExpandableContentCard(
|
|||||||
collapsedText: String = stringResource(id = R.string.expandable_see_more),
|
collapsedText: String = stringResource(id = R.string.expandable_see_more),
|
||||||
expandedText: String = stringResource(id = R.string.expandable_see_less),
|
expandedText: String = stringResource(id = R.string.expandable_see_less),
|
||||||
toggleTextColor: Color = MaterialTheme.colorScheme.onSurfaceVariant,
|
toggleTextColor: Color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
content: @Composable (Boolean) -> Unit = {}
|
expandOnTouchAnywhere: Boolean = false,
|
||||||
|
content: @Composable (Boolean) -> Unit
|
||||||
) {
|
) {
|
||||||
var expandedState by remember { mutableStateOf(false) }
|
var expandedState by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
Card(
|
Card(
|
||||||
modifier = modifier,
|
modifier = modifier.then(
|
||||||
|
Modifier.clickable(
|
||||||
|
enabled = expandOnTouchAnywhere,
|
||||||
|
onClick = {
|
||||||
|
expandedState = true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
),
|
||||||
shape = RoundedCornerShape(10.dp),
|
shape = RoundedCornerShape(10.dp),
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = 8.dp),
|
elevation = CardDefaults.cardElevation(defaultElevation = 8.dp),
|
||||||
colors = CardDefaults.cardColors(containerColor = backgroundColor)
|
colors = CardDefaults.cardColors(containerColor = backgroundColor)
|
||||||
|
|||||||
@@ -138,7 +138,9 @@ fun PersonDetailScreen(
|
|||||||
@Composable
|
@Composable
|
||||||
private fun BiographyCard(person: DetailPerson?) {
|
private fun BiographyCard(person: DetailPerson?) {
|
||||||
if (person != null && person.biography.isNotEmpty()) {
|
if (person != null && person.biography.isNotEmpty()) {
|
||||||
ExpandableContentCard { isExpanded ->
|
ExpandableContentCard(
|
||||||
|
expandOnTouchAnywhere = true
|
||||||
|
) { isExpanded ->
|
||||||
Text(
|
Text(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
|||||||
Reference in New Issue
Block a user