Do not show "Clear" text button in SearchScreen if the text input is already empty
This commit is contained in:
parent
4362456995
commit
a54b795666
2 changed files with 24 additions and 24 deletions
|
@ -105,18 +105,18 @@ fun LibrarySearchTab(
|
|||
)
|
||||
},
|
||||
actionsContent = {
|
||||
BasicText(
|
||||
text = "Clear",
|
||||
style = typography.xxs.medium,
|
||||
modifier = Modifier
|
||||
.clip(RoundedCornerShape(16.dp))
|
||||
.clickable(enabled = textFieldValue.text.isNotEmpty()) {
|
||||
onTextFieldValueChanged(TextFieldValue())
|
||||
}
|
||||
.background(colorPalette.background2)
|
||||
.padding(all = 8.dp)
|
||||
.padding(horizontal = 8.dp)
|
||||
)
|
||||
if (textFieldValue.text.isNotEmpty()) {
|
||||
BasicText(
|
||||
text = "Clear",
|
||||
style = typography.xxs.medium,
|
||||
modifier = Modifier
|
||||
.clip(RoundedCornerShape(16.dp))
|
||||
.clickable { onTextFieldValueChanged(TextFieldValue()) }
|
||||
.background(colorPalette.background2)
|
||||
.padding(all = 8.dp)
|
||||
.padding(horizontal = 8.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
@ -156,18 +156,18 @@ fun OnlineSearchTab(
|
|||
.weight(1f)
|
||||
)
|
||||
|
||||
BasicText(
|
||||
text = "Clear",
|
||||
style = typography.xxs.medium,
|
||||
modifier = Modifier
|
||||
.clip(RoundedCornerShape(16.dp))
|
||||
.clickable(enabled = textFieldValue.text.isNotEmpty()) {
|
||||
onTextFieldValueChanged(TextFieldValue())
|
||||
}
|
||||
.background(colorPalette.background2)
|
||||
.padding(all = 8.dp)
|
||||
.padding(horizontal = 8.dp)
|
||||
)
|
||||
if (textFieldValue.text.isNotEmpty()) {
|
||||
BasicText(
|
||||
text = "Clear",
|
||||
style = typography.xxs.medium,
|
||||
modifier = Modifier
|
||||
.clip(RoundedCornerShape(16.dp))
|
||||
.clickable { onTextFieldValueChanged(TextFieldValue()) }
|
||||
.background(colorPalette.background2)
|
||||
.padding(all = 8.dp)
|
||||
.padding(horizontal = 8.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue