Hide tags section in edit favorites sheet if no tags have been created yet
This commit is contained in:
parent
d50013e490
commit
26e312f42f
@ -381,8 +381,8 @@ fun ReorderFavoritesGrid(viewModel: EditFavoritesSheetVM) {
|
|||||||
}
|
}
|
||||||
is FavoritesSheetGridItem.Tags -> {
|
is FavoritesSheetGridItem.Tags -> {
|
||||||
var showAddMenu by remember { mutableStateOf(false) }
|
var showAddMenu by remember { mutableStateOf(false) }
|
||||||
Column {
|
if (availableTags.isNotEmpty() || pinnedTags.isNotEmpty()) {
|
||||||
if (availableTags.isNotEmpty() || pinnedTags.isNotEmpty()) {
|
Column {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.padding(vertical = 8.dp),
|
modifier = Modifier.padding(vertical = 8.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
@ -427,53 +427,53 @@ fun ReorderFavoritesGrid(viewModel: EditFavoritesSheetVM) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
if (pinnedTags.isNotEmpty()) {
|
||||||
if (pinnedTags.isNotEmpty()) {
|
val rowState = rememberLazyDragAndDropListState { from, to ->
|
||||||
val rowState = rememberLazyDragAndDropListState { from, to ->
|
viewModel.moveTag(from, to)
|
||||||
viewModel.moveTag(from, to)
|
}
|
||||||
}
|
LazyDragAndDropRow(state = rowState) {
|
||||||
LazyDragAndDropRow(state = rowState) {
|
items(
|
||||||
items(
|
pinnedTags,
|
||||||
pinnedTags,
|
key = { it.key }
|
||||||
key = { it.key }
|
) { tag ->
|
||||||
) { tag ->
|
DraggableItem(state = rowState, key = tag.key) { dragged ->
|
||||||
DraggableItem(state = rowState, key = tag.key) { dragged ->
|
|
||||||
|
|
||||||
FilterChip(
|
FilterChip(
|
||||||
modifier = Modifier.padding(end = 12.dp),
|
modifier = Modifier.padding(end = 12.dp),
|
||||||
selected = false,
|
selected = false,
|
||||||
onClick = {},
|
onClick = {},
|
||||||
label = { Text(tag.label) },
|
label = { Text(tag.label) },
|
||||||
leadingIcon = {
|
leadingIcon = {
|
||||||
Icon(Icons.Rounded.Tag, null)
|
Icon(Icons.Rounded.Tag, null)
|
||||||
},
|
},
|
||||||
trailingIcon = {
|
trailingIcon = {
|
||||||
Icon(
|
Icon(
|
||||||
modifier = Modifier.clickable {
|
modifier = Modifier.clickable {
|
||||||
viewModel.unpinTag(tag)
|
viewModel.unpinTag(tag)
|
||||||
},
|
},
|
||||||
imageVector = Icons.Rounded.Close,
|
imageVector = Icons.Rounded.Close,
|
||||||
contentDescription = null
|
contentDescription = null
|
||||||
|
)
|
||||||
|
},
|
||||||
|
elevation = if (dragged) FilterChipDefaults.elevatedFilterChipElevation() else FilterChipDefaults.filterChipElevation(),
|
||||||
|
colors = if (dragged) FilterChipDefaults.elevatedFilterChipColors()
|
||||||
|
else FilterChipDefaults.filterChipColors(
|
||||||
|
containerColor = MaterialTheme.colorScheme.surface
|
||||||
)
|
)
|
||||||
},
|
|
||||||
elevation = if (dragged) FilterChipDefaults.elevatedFilterChipElevation() else FilterChipDefaults.filterChipElevation(),
|
|
||||||
colors = if (dragged) FilterChipDefaults.elevatedFilterChipColors()
|
|
||||||
else FilterChipDefaults.filterChipColors(
|
|
||||||
containerColor = MaterialTheme.colorScheme.surface
|
|
||||||
)
|
)
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Text(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(vertical = 4.dp),
|
||||||
|
text = stringResource(R.string.edit_favorites_dialog_tag_section_empty),
|
||||||
|
style = MaterialTheme.typography.labelSmall,
|
||||||
|
color = MaterialTheme.colorScheme.outline
|
||||||
|
)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Text(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(vertical = 4.dp),
|
|
||||||
text = stringResource(R.string.edit_favorites_dialog_tag_section_empty),
|
|
||||||
style = MaterialTheme.typography.labelSmall,
|
|
||||||
color = MaterialTheme.colorScheme.outline
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user