|
1 | 1 | package org.datepollsystems.waiterrobot.android.ui.common |
2 | 2 |
|
| 3 | +import androidx.compose.foundation.background |
3 | 4 | import androidx.compose.foundation.layout.Row |
4 | 5 | import androidx.compose.foundation.layout.padding |
5 | | -import androidx.compose.foundation.lazy.grid.GridItemSpan |
6 | | -import androidx.compose.foundation.lazy.grid.LazyGridItemScope |
7 | 6 | import androidx.compose.foundation.lazy.grid.LazyGridScope |
8 | | -import androidx.compose.material3.Divider |
| 7 | +import androidx.compose.material3.HorizontalDivider |
| 8 | +import androidx.compose.material3.MaterialTheme |
9 | 9 | import androidx.compose.material3.Text |
10 | | -import androidx.compose.runtime.Composable |
11 | 10 | import androidx.compose.ui.Alignment |
12 | 11 | import androidx.compose.ui.Modifier |
13 | 12 | import androidx.compose.ui.unit.dp |
14 | 13 |
|
15 | | -fun LazyGridScope.header( |
16 | | - key: Any? = null, |
17 | | - contentType: Any? = null, |
18 | | - content: @Composable LazyGridItemScope.() -> Unit |
19 | | -) { |
20 | | - item( |
21 | | - key = key, |
22 | | - contentType = contentType, |
23 | | - span = { GridItemSpan(this.maxLineSpan) }, |
24 | | - content = content |
25 | | - ) |
26 | | -} |
27 | | - |
28 | 14 | fun LazyGridScope.sectionHeader( |
29 | 15 | key: Any? = null, |
30 | 16 | contentType: Any? = null, |
31 | 17 | title: String |
32 | 18 | ) { |
33 | | - header(key = key, contentType = contentType) { |
| 19 | + stickyHeader(key = key, contentType = contentType) { |
34 | 20 | Row( |
| 21 | + modifier = Modifier.background(MaterialTheme.colorScheme.surface), |
35 | 22 | verticalAlignment = Alignment.CenterVertically |
36 | 23 | ) { |
37 | | - Divider(modifier = Modifier.weight(1f)) |
| 24 | + HorizontalDivider(modifier = Modifier.weight(1f)) |
38 | 25 | Text( |
39 | 26 | text = title, |
40 | 27 | modifier = Modifier.padding(horizontal = 10.dp), |
41 | 28 | maxLines = 1, |
42 | 29 | ) |
43 | | - Divider(modifier = Modifier.weight(1f)) |
| 30 | + HorizontalDivider(modifier = Modifier.weight(1f)) |
44 | 31 | } |
45 | 32 | } |
46 | 33 | } |
0 commit comments