Skip to content

Commit

Permalink
feat: [ANDROAPP-6437] Implement configurable overflow for ListCardTitle.
Browse files Browse the repository at this point in the history
  • Loading branch information
xavimolloy committed Jan 14, 2025
1 parent 8c1dbff commit cbfbbc4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,7 @@ data class ListCardTitleModel(
val color: Color? = TextColor.OnPrimaryContainer,
val text: String,
val modifier: Modifier = Modifier,
val allowOverflow: Boolean = true,
)

data class ListCardDescriptionModel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,14 @@ internal fun ListCardTitle(
title: ListCardTitleModel,
modifier: Modifier = Modifier,
) {
val maxLines = if (title.allowOverflow) Int.MAX_VALUE else 2

Text(
title.text,
color = title.color ?: TextColor.OnPrimaryContainer,
style = title.style ?: MaterialTheme.typography.titleMedium.copy(fontWeight = FontWeight.Bold),
maxLines = maxLines,
overflow = TextOverflow.Ellipsis,
modifier = modifier,
)
}
Expand Down

0 comments on commit cbfbbc4

Please sign in to comment.