mirror of
https://github.com/JetBrains/intellij-platform-plugin-template.git
synced 2026-01-20 15:49:23 +00:00
Refactor: Introduce isInputFieldEmpty for clarity in SearchBarWithAutoCompletion
This commit is contained in:
parent
2eb729d331
commit
7996e74e24
@ -44,6 +44,7 @@ internal fun <T> SearchBarWithAutoCompletion(
|
||||
val focusRequester = remember { FocusRequester() }
|
||||
|
||||
val popupController = remember { CompletionPopupController(searchAutoCompletionItemProvider) }
|
||||
val isInputFieldEmpty by remember { derivedStateOf { textFieldState.text.isBlank() } }
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
snapshotFlow { textFieldState.text.toString() }
|
||||
@ -71,7 +72,7 @@ internal fun <T> SearchBarWithAutoCompletion(
|
||||
Icon(AllIconsKeys.Actions.Find, contentDescription = null, Modifier.padding(end = 8.dp))
|
||||
},
|
||||
trailingIcon = {
|
||||
if (textFieldState.text.isNotBlank()) {
|
||||
if (!isInputFieldEmpty) {
|
||||
CloseIconButton {
|
||||
onClear()
|
||||
textFieldState.setTextAndPlaceCursorAtEnd("")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user