fix: unify dropdown state management in FieldInput component
This commit is contained in:
+11
-11
@@ -2328,8 +2328,8 @@ fun FieldInput(
|
|||||||
var expanded by remember { mutableStateOf(false) }
|
var expanded by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
ExposedDropdownMenuBox(
|
ExposedDropdownMenuBox(
|
||||||
expanded = dropdownExpanded,
|
expanded = expanded,
|
||||||
onExpandedChange = { dropdownExpanded = !dropdownExpanded },
|
onExpandedChange = { expanded = !expanded },
|
||||||
) {
|
) {
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = value,
|
value = value,
|
||||||
@@ -2337,7 +2337,7 @@ fun FieldInput(
|
|||||||
readOnly = true,
|
readOnly = true,
|
||||||
label = { Text(field.name) },
|
label = { Text(field.name) },
|
||||||
trailingIcon = {
|
trailingIcon = {
|
||||||
ExposedDropdownMenuDefaults.TrailingIcon(expanded = dropdownExpanded)
|
ExposedDropdownMenuDefaults.TrailingIcon(expanded = expanded)
|
||||||
},
|
},
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
@@ -2346,15 +2346,15 @@ fun FieldInput(
|
|||||||
)
|
)
|
||||||
|
|
||||||
ExposedDropdownMenu(
|
ExposedDropdownMenu(
|
||||||
expanded = dropdownExpanded,
|
expanded = expanded,
|
||||||
onDismissRequest = { dropdownExpanded = false },
|
onDismissRequest = { expanded = false },
|
||||||
) {
|
) {
|
||||||
options.forEach { option ->
|
options.forEach { option ->
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
text = { Text(option) },
|
text = { Text(option) },
|
||||||
onClick = {
|
onClick = {
|
||||||
onValueChange(option)
|
onValueChange(option)
|
||||||
dropdownExpanded = false
|
expanded = false
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -2370,8 +2370,8 @@ fun FieldInput(
|
|||||||
}
|
}
|
||||||
|
|
||||||
ExposedDropdownMenuBox(
|
ExposedDropdownMenuBox(
|
||||||
expanded = dropdownExpanded,
|
expanded = expanded,
|
||||||
onExpandedChange = { dropdownExpanded = !dropdownExpanded },
|
onExpandedChange = { expanded = !expanded },
|
||||||
) {
|
) {
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = value,
|
value = value,
|
||||||
@@ -2379,7 +2379,7 @@ fun FieldInput(
|
|||||||
readOnly = true,
|
readOnly = true,
|
||||||
label = { Text(field.name) },
|
label = { Text(field.name) },
|
||||||
trailingIcon = {
|
trailingIcon = {
|
||||||
ExposedDropdownMenuDefaults.TrailingIcon(expanded = dropdownExpanded)
|
ExposedDropdownMenuDefaults.TrailingIcon(expanded = expanded)
|
||||||
},
|
},
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
@@ -2388,8 +2388,8 @@ fun FieldInput(
|
|||||||
)
|
)
|
||||||
|
|
||||||
ExposedDropdownMenu(
|
ExposedDropdownMenu(
|
||||||
expanded = dropdownExpanded,
|
expanded = expanded,
|
||||||
onDismissRequest = { dropdownExpanded = false },
|
onDismissRequest = { expanded = false },
|
||||||
) {
|
) {
|
||||||
options.forEach { option ->
|
options.forEach { option ->
|
||||||
val isSelected = selectedOptions.contains(option)
|
val isSelected = selectedOptions.contains(option)
|
||||||
|
|||||||
Reference in New Issue
Block a user