From 3e3d092ee9048120f4710d0262dedce3912ce808 Mon Sep 17 00:00:00 2001 From: another-simple-pixel Date: Sat, 16 May 2026 08:48:56 -0700 Subject: [PATCH] =?UTF-8?q?Section:=20fix=20item=20divider=20position=20?= =?UTF-8?q?=E2=80=94=20paint=20via=20drawWithContent=20at=20full=20row=20b?= =?UTF-8?q?ottom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 8050676b moved sectionItemDivider() AFTER clickable.padding() in the modifier chain to make the line paint on top of clickable's hover indication. Side effect: drawBehind then saw the size of the padding-reduced content area, not the full row, so dividers rendered 15dp ABOVE the actual row bottom (in the middle of the row's bottom padding zone) instead of at the row edge between adjacent items. Fix: keep sectionItemDivider() in the modifier val BEFORE clickable/ padding (so size = full row outer bounds) AND switch from drawBehind to drawWithContent { drawContent(); drawLine(...) } so the line is painted AFTER the chain's content + hover indication draw. Both goals satisfied: divider sits at the true row bottom AND paints on top of hover overlay. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../simplex/common/views/helpers/Section.kt | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/Section.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/Section.kt index e35ae40ac3..bee0420982 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/Section.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/Section.kt @@ -6,7 +6,7 @@ import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip -import androidx.compose.ui.draw.drawBehind +import androidx.compose.ui.draw.drawWithContent import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.painter.Painter @@ -36,7 +36,8 @@ private val LocalInSectionCard = staticCompositionLocalOf { false } @Composable private fun Modifier.sectionItemDivider(): Modifier { if (!LocalInSectionCard.current) return this - return this.drawBehind { + return this.drawWithContent { + drawContent() drawLine(canvasColorForCurrentTheme(), Offset(0f, size.height), Offset(size.width, size.height), strokeWidth = 2.dp.toPx()) } } @@ -183,9 +184,9 @@ fun SectionItemView( val modifier = Modifier .fillMaxWidth() .sizeIn(minHeight = minHeight) + .sectionItemDivider() Row( - (if (click == null || disabled) modifier.padding(padding) else modifier.clickable(onClick = click).padding(padding)) - .sectionItemDivider(), + if (click == null || disabled) modifier.padding(padding) else modifier.clickable(onClick = click).padding(padding), verticalAlignment = Alignment.CenterVertically ) { content() @@ -223,12 +224,13 @@ fun SectionItemViewLongClickable( val modifier = Modifier .fillMaxWidth() .sizeIn(minHeight = minHeight) + .sectionItemDivider() Row( - (if (disabled) { + if (disabled) { modifier.padding(padding) } else { modifier.combinedClickable(onClick = click, onLongClick = longClick).onRightClick(longClick).padding(padding) - }).sectionItemDivider(), + }, verticalAlignment = Alignment.CenterVertically ) { content() @@ -247,10 +249,11 @@ fun SectionItemViewSpaceBetween( val modifier = Modifier .fillMaxWidth() .sizeIn(minHeight = minHeight) + .sectionItemDivider() Row( - (if (click == null || disabled) modifier.padding(padding).padding(vertical = DEFAULT_MIN_SECTION_ITEM_PADDING_VERTICAL) else modifier + if (click == null || disabled) modifier.padding(padding).padding(vertical = DEFAULT_MIN_SECTION_ITEM_PADDING_VERTICAL) else modifier .combinedClickable(onClick = click, onLongClick = onLongClick).padding(padding) - .onRightClick { onLongClick?.invoke() }).sectionItemDivider(), + .onRightClick { onLongClick?.invoke() }, horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically ) {