Last active
August 5, 2023 08:38
-
-
Save manojbhadane/7526ce6dc466ee6f489087cac6f33d67 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val options = listOf("Food", "Bill Payment", "Recharges", "Outing", "Other") | |
var expanded by remember { mutableStateOf(false) } | |
var selectedOptionText by remember { mutableStateOf(options[0]) } | |
@Composable | |
ExposedDropdownMenuBox( | |
expanded = expanded, | |
onExpandedChange = { | |
expanded = !expanded | |
} | |
) { | |
TextField( | |
readOnly = true, | |
value = selectedOptionText, | |
onValueChange = { }, | |
label = { Text("Categories") }, | |
trailingIcon = { | |
ExposedDropdownMenuDefaults.TrailingIcon( | |
expanded = expanded | |
) | |
}, | |
colors = ExposedDropdownMenuDefaults.textFieldColors() | |
) | |
ExposedDropdownMenu( | |
expanded = expanded, | |
onDismissRequest = { | |
expanded = false | |
} | |
) { | |
options.forEach { selectionOption -> | |
DropdownMenuItem( | |
onClick = { | |
selectedOptionText = selectionOption | |
expanded = false | |
} | |
) { | |
Text(text = selectionOption) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment