Don't show empty suggested account names dropdown (bitfireAT/davx5#555)

* Don't show empty suggested account names dropdown

* Hide the trailing dropdown icon if suggested account names list is empty
This commit is contained in:
Sunik Kupfer 2024-03-27 13:02:32 +01:00 committed by Ricki Hirner
parent 7760cbaa72
commit 557b5653e5

View file

@ -100,7 +100,7 @@ fun AccountDetailsPage(
@OptIn(ExperimentalMaterialApi::class)
@Composable
fun AccountDetailsPage_Content(
suggestedAccountNames: List<String>?,
suggestedAccountNames: List<String>,
accountName: String,
onUpdateAccountName: (String) -> Unit = {},
groupMethod: GroupMethod,
@ -127,18 +127,19 @@ fun AccountDetailsPage_Content(
keyboardType = KeyboardType.Email
),
trailingIcon = {
ExposedDropdownMenuDefaults.TrailingIcon(
expanded = expanded
)
if (suggestedAccountNames.isNotEmpty())
ExposedDropdownMenuDefaults.TrailingIcon(
expanded = expanded
)
},
modifier = Modifier.fillMaxWidth()
)
ExposedDropdownMenu(
expanded = expanded,
onDismissRequest = { expanded = false }
) {
if (suggestedAccountNames != null)
if (suggestedAccountNames.isNotEmpty())
ExposedDropdownMenu(
expanded = expanded,
onDismissRequest = { expanded = false }
) {
for (name in suggestedAccountNames)
Text(
name,
@ -150,7 +151,7 @@ fun AccountDetailsPage_Content(
expanded = false
}
)
}
}
}
// apostrophe warning