Do not show "Clear" text button in SearchScreen if the text input is already empty

This commit is contained in:
vfsfitvnm
2022-09-24 13:15:51 +02:00
parent 4362456995
commit a54b795666
2 changed files with 24 additions and 24 deletions

View File

@@ -105,19 +105,19 @@ fun LibrarySearchTab(
) )
}, },
actionsContent = { actionsContent = {
if (textFieldValue.text.isNotEmpty()) {
BasicText( BasicText(
text = "Clear", text = "Clear",
style = typography.xxs.medium, style = typography.xxs.medium,
modifier = Modifier modifier = Modifier
.clip(RoundedCornerShape(16.dp)) .clip(RoundedCornerShape(16.dp))
.clickable(enabled = textFieldValue.text.isNotEmpty()) { .clickable { onTextFieldValueChanged(TextFieldValue()) }
onTextFieldValueChanged(TextFieldValue())
}
.background(colorPalette.background2) .background(colorPalette.background2)
.padding(all = 8.dp) .padding(all = 8.dp)
.padding(horizontal = 8.dp) .padding(horizontal = 8.dp)
) )
} }
}
) )
} }

View File

@@ -156,19 +156,19 @@ fun OnlineSearchTab(
.weight(1f) .weight(1f)
) )
if (textFieldValue.text.isNotEmpty()) {
BasicText( BasicText(
text = "Clear", text = "Clear",
style = typography.xxs.medium, style = typography.xxs.medium,
modifier = Modifier modifier = Modifier
.clip(RoundedCornerShape(16.dp)) .clip(RoundedCornerShape(16.dp))
.clickable(enabled = textFieldValue.text.isNotEmpty()) { .clickable { onTextFieldValueChanged(TextFieldValue()) }
onTextFieldValueChanged(TextFieldValue())
}
.background(colorPalette.background2) .background(colorPalette.background2)
.padding(all = 8.dp) .padding(all = 8.dp)
.padding(horizontal = 8.dp) .padding(horizontal = 8.dp)
) )
} }
}
) )
} }