feat: added clear button on search form

This commit is contained in:
tapframe 2026-04-11 17:25:04 +05:30
parent a33558cbae
commit a55012d097
2 changed files with 15 additions and 0 deletions

View file

@ -293,6 +293,7 @@ fun NuvioInputField(
onValueChange: (String) -> Unit,
placeholder: String,
modifier: Modifier = Modifier,
trailingContent: (@Composable (() -> Unit))? = null,
) {
OutlinedTextField(
value = value,
@ -308,6 +309,7 @@ fun NuvioInputField(
)
},
textStyle = MaterialTheme.typography.bodyLarge.copy(color = MaterialTheme.colorScheme.onSurface),
trailingIcon = trailingContent,
colors = OutlinedTextFieldDefaults.colors(
focusedBorderColor = MaterialTheme.colorScheme.outline,
unfocusedBorderColor = MaterialTheme.colorScheme.outline,

View file

@ -179,6 +179,19 @@ fun SearchScreen(
value = query,
onValueChange = { query = it },
placeholder = "Search movies, shows...",
trailingContent = if (query.isNotBlank()) {
{
IconButton(onClick = { query = "" }) {
Icon(
imageVector = Icons.Rounded.Close,
contentDescription = "Clear search",
tint = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
}
} else {
null
},
)
}
androidx.compose.foundation.layout.Spacer(modifier = Modifier.height(14.dp))