mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-04 01:19:33 +00:00
Fix display of trailing icon in the search bar
This commit is contained in:
+16
-10
@@ -154,18 +154,24 @@ fun CreateRoomSearchBar(
|
|||||||
leadingIcon = if (active) {
|
leadingIcon = if (active) {
|
||||||
{ BackButton(onClick = { onActiveChanged(false) }) }
|
{ BackButton(onClick = { onActiveChanged(false) }) }
|
||||||
} else null,
|
} else null,
|
||||||
trailingIcon = {
|
trailingIcon = when {
|
||||||
if (active) {
|
active && text.isNotEmpty() -> {
|
||||||
IconButton(onClick = { onTextChanged("") }) {
|
{
|
||||||
Icon(Icons.Default.Close, stringResource(StringR.string.a11y_clear))
|
IconButton(onClick = { onTextChanged("") }) {
|
||||||
|
Icon(Icons.Default.Close, stringResource(StringR.string.a11y_clear))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Icon(
|
|
||||||
imageVector = Icons.Default.Search,
|
|
||||||
contentDescription = stringResource(StringR.string.search),
|
|
||||||
modifier = Modifier.alpha(0.4f), // FIXME align on Design system theme (removing alpha should be fine)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
!active -> {
|
||||||
|
{
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Default.Search,
|
||||||
|
contentDescription = stringResource(StringR.string.search),
|
||||||
|
modifier = Modifier.alpha(0.4f), // FIXME align on Design system theme (removing alpha should be fine)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else -> null
|
||||||
},
|
},
|
||||||
shape = if (!active) SearchBarDefaults.dockedShape else SearchBarDefaults.fullScreenShape,
|
shape = if (!active) SearchBarDefaults.dockedShape else SearchBarDefaults.fullScreenShape,
|
||||||
colors = if (!active) SearchBarDefaults.colors() else SearchBarDefaults.colors(containerColor = Color.Transparent),
|
colors = if (!active) SearchBarDefaults.colors() else SearchBarDefaults.colors(containerColor = Color.Transparent),
|
||||||
|
|||||||
Reference in New Issue
Block a user