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 16, 2023
1 parent aae84e1 commit e6d3dab
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 e6d3dab

Please sign in to comment.