Skip to content

Commit

Permalink
fix jumping issue by wrapping inside box
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth Agarwal committed Oct 12, 2023
1 parent b88d14b commit 61366f5
Showing 1 changed file with 26 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.hisp.dhis.common.screens

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.size
import androidx.compose.material3.DropdownMenu
Expand Down Expand Up @@ -29,29 +30,31 @@ fun InputDropDownScreen() {

SubTitle("Basic Input Dropdown ", textColor = TextColor.OnSurfaceVariant)
var selectedItem by rememberSaveable { mutableStateOf<String?>(null) }
InputDropDown(
title = "Label",
state = InputShellState.UNFOCUSED,
selectedItem = selectedItem,
onResetButtonClicked = {
selectedItem = null
},
onArrowDropDownButtonClicked = {
expanded = !expanded
},
)
DropdownMenu(
expanded = expanded,
onDismissRequest = { expanded = false },
) {
options.forEach {
DropdownMenuItem(
text = { Text(it) },
onClick = {
selectedItem = it
expanded = false
},
)
Box {
InputDropDown(
title = "Label",
state = InputShellState.UNFOCUSED,
selectedItem = selectedItem,
onResetButtonClicked = {
selectedItem = null
},
onArrowDropDownButtonClicked = {
expanded = !expanded
},
)
DropdownMenu(
expanded = expanded,
onDismissRequest = { expanded = false },
) {
options.forEach {
DropdownMenuItem(
text = { Text(it) },
onClick = {
selectedItem = it
expanded = false
},
)
}
}
}
Spacer(Modifier.size(Spacing.Spacing18))
Expand Down

0 comments on commit 61366f5

Please sign in to comment.