Skip to content

Commit

Permalink
fix: VitaminTopBars.Search crash (#153)
Browse files Browse the repository at this point in the history
Co-authored-by: ManonPolle <[email protected]>
  • Loading branch information
adrienbusin and ManonPolle committed Jun 20, 2023
1 parent 794e307 commit cb1d8c4
Showing 1 changed file with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,24 +152,26 @@ object VitaminTopBars {
keyboardActions = keyboardActions,
cursorBrush = SolidColor(colors.cursorColor!!),
decorationBox = { textField ->
if (value == "") {
Text(text = placeholder)
} else {
Row(verticalAlignment = Alignment.CenterVertically) {
Box(
modifier = Modifier
.fillMaxHeight()
.weight(1f),
contentAlignment = Alignment.CenterStart,
) {
textField()
Row(verticalAlignment = Alignment.CenterVertically) {
Box(
modifier = Modifier
.fillMaxHeight()
.weight(1f),
contentAlignment = Alignment.CenterStart,
) {
if (value.isEmpty()) {
Text(text = placeholder)
}
textField()
}
if (value.isNotEmpty()) {
actions.forEach {
when (it) {
is SearchActionItem.Microphone -> VitaminSearchMenuIconButtons.Microphone(
onClick = it.onClick,
contentDescription = it.contentDescription
)

is SearchActionItem.Close -> VitaminSearchMenuIconButtons.Close(
onClick = it.onClick,
contentDescription = it.contentDescription
Expand Down

0 comments on commit cb1d8c4

Please sign in to comment.