Feed: [Fix] Not trying to add Feed if not select anything on dialog box

Fix warning with RadioSelector declaration
This commit is contained in:
Cuong M. Tran 2024-01-31 12:03:03 +07:00
parent 27a1c3aa76
commit 46e7e1fbca
No known key found for this signature in database
GPG key ID: 733AA7624B9315C2

View file

@ -208,7 +208,7 @@ fun FeedAddSearchDialog(
},
onDismissRequest = onDismiss,
confirmButton = {
TextButton(onClick = { onClickAdd(source, selected?.let { savedSearches[it] }) }) {
TextButton(onClick = { onClickAdd(source, selected?.let { savedSearches[it] }) }, /* KMK --> */ enabled = selected != null /* KMK <-- */) {
Text(text = stringResource(MR.strings.action_ok))
}
},
@ -218,9 +218,9 @@ fun FeedAddSearchDialog(
@Composable
fun <T> RadioSelector(
options: ImmutableList<T>,
optionStrings: ImmutableList<String> = remember { options.map { it.toString() }.toImmutableList() },
selected: Int?,
onSelectOption: (Int) -> Unit,
optionStrings: ImmutableList<String> = remember { options.map { it.toString() }.toImmutableList() },
onSelectOption: (Int) -> Unit /* KMK --> */ = {} /* KMK <-- */,
) {
Column(Modifier.verticalScroll(rememberScrollState())) {
optionStrings.forEachIndexed { index, option ->