From 844fd4fe9b5d7ff6a6b4f63c4d48beb05a8e83d2 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Fri, 27 Nov 2026 14:58:41 +0100 Subject: [PATCH] A full-width count tile lays out in a row (#59) --- .../agendula/ui/lists/HomeBlocks.kt | 33 +++++++++++++++++-- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/ui/lists/HomeBlocks.kt b/app/src/main/java/de/jeanlucmakiola/agendula/ui/lists/HomeBlocks.kt index 21f9519..8fcef2b 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/ui/lists/HomeBlocks.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/ui/lists/HomeBlocks.kt @@ -283,7 +283,7 @@ internal fun Tile(block: Block, state: ListsUiState.Content, actions: BlockActio } } is BlockOptions.CountTile -> state.counts[block.id]?.takeIf { filter != null }?.let { count -> - CountCard(tileStyle(block, options, state), count, marked, modifier, open) + CountCard(tileStyle(block, options, state), count, marked, block.width == BlockWidth.FULL, modifier, open) } else -> null } ?: Spacer(modifier.height(FloretDensity.tileHeight)) @@ -539,7 +539,14 @@ internal fun tileColors(color: TileColor): Pair { * silhouette. Full width it lays out in a row: icon and name, count at the end. */ @Composable -private fun CountCard(style: TileStyle, count: Int, marked: Boolean, modifier: Modifier = Modifier, onClick: () -> Unit) { +private fun CountCard( + style: TileStyle, + count: Int, + marked: Boolean, + full: Boolean, + modifier: Modifier = Modifier, + onClick: () -> Unit, +) { val interaction = remember { MutableInteractionSource() } Surface( onClick = onClick, @@ -547,8 +554,28 @@ private fun CountCard(style: TileStyle, count: Int, marked: Boolean, modifier: M color = style.container, contentColor = style.onContainer, interactionSource = interaction, - modifier = modifier.height(FloretDensity.tileHeight), + modifier = modifier.height(if (full) FloretDensity.rowHeight else FloretDensity.tileHeight), ) { + if (full) { + Row( + modifier = Modifier.fillMaxSize().padding(horizontal = 20.dp), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(16.dp), + ) { + Icon(style.icon, contentDescription = null) + Text( + style.label, + style = MaterialTheme.typography.titleMedium, + maxLines = 1, + overflow = TextOverflow.Ellipsis, + modifier = Modifier.weight(1f, fill = false), + ) + if (marked) IgnoredScopeMark(style.onContainer) + Spacer(Modifier.weight(1f)) + Text(count.toString(), style = MaterialTheme.typography.headlineSmall) + } + return@Surface + } Column( modifier = Modifier.fillMaxSize().padding(byDensity(16.dp, 12.dp)), verticalArrangement = Arrangement.SpaceBetween,