Display message if favorites or tag is empty

This commit is contained in:
MM20
2022-09-23 23:14:51 +02:00
parent 1f0db6c03e
commit d50013e490
3 changed files with 35 additions and 1 deletions
@@ -85,6 +85,25 @@ fun SearchColumn(
showLabels = showLabels,
key = "favorites",
reverse = reverse,
before = if (favorites.isEmpty()) {
{
Text(
modifier = Modifier
.fillMaxWidth()
.padding(
top = if (!reverse) 28.dp else 16.dp,
start = 16.dp,
end = 16.dp,
bottom = if (reverse) 28.dp else 16.dp,
),
text = stringResource(
if (selectedTag == null) R.string.favorites_empty else R.string.favorites_empty_tag
),
style = MaterialTheme.typography.labelSmall,
color = MaterialTheme.colorScheme.outline
)
}
} else null,
after = {
Row(
modifier = Modifier
@@ -27,7 +27,20 @@ fun FavoritesWidget() {
var showEditFavoritesDialog by remember { mutableStateOf(false) }
Column {
SearchResultGrid(favorites)
if (favorites.isNotEmpty()) {
SearchResultGrid(favorites)
} else {
Text(
modifier = Modifier
.fillMaxWidth()
.padding(top = 28.dp, start = 16.dp, end = 16.dp, bottom = 16.dp),
text = stringResource(
if (selectedTag == null) R.string.favorites_empty else R.string.favorites_empty_tag
),
style = MaterialTheme.typography.labelSmall,
color = MaterialTheme.colorScheme.outline
)
}
Row(
modifier = Modifier
.fillMaxWidth()