mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Use FlowRow for labels on cards
This commit is contained in:
parent
42d9c5fea8
commit
9fba4aa1af
2 changed files with 4 additions and 11 deletions
|
|
@ -16,7 +16,7 @@ fun LabelChip(
|
|||
modifier: Modifier = Modifier.padding(0.dp),
|
||||
) {
|
||||
Surface(
|
||||
modifier = modifier.padding(4.dp),
|
||||
modifier = modifier.padding(2.dp),
|
||||
shape = MaterialTheme.shapes.medium,
|
||||
color = colors.containerColor
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import app.omnivore.omnivore.ui.library.SavedItemAction
|
|||
import app.omnivore.omnivore.ui.library.SavedItemViewModel
|
||||
import coil.compose.rememberAsyncImagePainter
|
||||
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@OptIn(ExperimentalFoundationApi::class, ExperimentalLayoutApi::class)
|
||||
@Composable
|
||||
fun SavedItemCard(savedItemViewModel: SavedItemViewModel, savedItem: SavedItemWithLabelsAndHighlights, onClickHandler: () -> Unit, actionHandler: (SavedItemAction) -> Unit) {
|
||||
val listState = rememberLazyListState()
|
||||
|
|
@ -96,21 +96,14 @@ fun SavedItemCard(savedItemViewModel: SavedItemViewModel, savedItem: SavedItemWi
|
|||
)
|
||||
}
|
||||
|
||||
LazyRow(
|
||||
state = listState,
|
||||
horizontalArrangement = Arrangement.Start,
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier
|
||||
.padding(start = 5.dp, bottom = 5.dp, end = 10.dp)
|
||||
) {
|
||||
items(savedItem.labels.sortedWith(compareBy { it.name.toLowerCase(Locale.current) })) { label ->
|
||||
FlowRow(modifier = Modifier.fillMaxWidth().padding(10.dp)) {
|
||||
savedItem.labels.sortedWith(compareBy { it.name.toLowerCase(Locale.current) }).forEach { label ->
|
||||
val chipColors = LabelChipColors.fromHex(label.color)
|
||||
|
||||
LabelChip(
|
||||
name = label.name,
|
||||
colors = chipColors,
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue