Skip to content

Commit 4ef0ddf

Browse files
Draw horizontal dividers
1 parent e509b94 commit 4ef0ddf

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

  • libraries/block-kit/ui/src/main/kotlin/io/adventech/blockkit/ui

libraries/block-kit/ui/src/main/kotlin/io/adventech/blockkit/ui/TableContent.kt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,25 @@ fun TableContent(
139139
strokeWidth = borderWidthPx
140140
)
141141
}
142+
143+
// Draw horizontal dividers
144+
var divY = 0f
145+
for (r in 0 until layoutInfo.rowHeights.size - 1) {
146+
divY += layoutInfo.rowHeights[r]
147+
drawLine(
148+
color = borderColor,
149+
start = Offset(0f, divY),
150+
end = Offset(size.width, divY),
151+
strokeWidth = borderWidthPx
152+
)
153+
}
142154
},
143155
content = {
144156
allRows.forEach { rowCells ->
145157
for (c in 0 until columnCount) {
146158
val cell = rowCells.getOrNull(c)
147159
if (cell != null) {
148-
Box(modifier = Modifier, contentAlignment = Alignment.CenterStart) {
160+
Box(modifier = Modifier, contentAlignment = Alignment.TopStart) {
149161
Column {
150162
cell.items.forEach { item ->
151163
BlockContent(
@@ -194,8 +206,7 @@ fun TableContent(
194206
var x = 0
195207
for (c in 0 until columnCount) {
196208
val placeable = placeables[r * columnCount + c]
197-
val yOffset = y + (rowHeights[r] - placeable.height) / 2
198-
placeable.placeRelative(x, yOffset)
209+
placeable.placeRelative(x, y)
199210

200211
x += columnWidths[c]
201212
}

0 commit comments

Comments
 (0)