mirror of
https://github.com/JetBrains/intellij-platform-plugin-template.git
synced 2026-01-22 16:49:22 +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 focusRequester = remember { FocusRequester() }
|
||||||
|
|
||||||
val popupController = remember { CompletionPopupController(searchAutoCompletionItemProvider) }
|
val popupController = remember { CompletionPopupController(searchAutoCompletionItemProvider) }
|
||||||
|
val isInputFieldEmpty by remember { derivedStateOf { textFieldState.text.isBlank() } }
|
||||||
|
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit) {
|
||||||
snapshotFlow { textFieldState.text.toString() }
|
snapshotFlow { textFieldState.text.toString() }
|
||||||
@ -71,7 +72,7 @@ internal fun <T> SearchBarWithAutoCompletion(
|
|||||||
Icon(AllIconsKeys.Actions.Find, contentDescription = null, Modifier.padding(end = 8.dp))
|
Icon(AllIconsKeys.Actions.Find, contentDescription = null, Modifier.padding(end = 8.dp))
|
||||||
},
|
},
|
||||||
trailingIcon = {
|
trailingIcon = {
|
||||||
if (textFieldState.text.isNotBlank()) {
|
if (!isInputFieldEmpty) {
|
||||||
CloseIconButton {
|
CloseIconButton {
|
||||||
onClear()
|
onClear()
|
||||||
textFieldState.setTextAndPlaceCursorAtEnd("")
|
textFieldState.setTextAndPlaceCursorAtEnd("")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user