Fix search bar title flickering
This commit is contained in:
1 parent
98c1a377ca
commit
97bb65aa35
3 files changed
+6
-12
No files matched your search
@@ -76,13 +76,11 @@ fun SearchBarInputField(
|
||||
singleLine = true,
|
||||
visualTransformation = VisualTransformation.None,
|
||||
interactionSource = interactionSource,
|
||||
label = label,
|
||||
placeholder = placeholder,
|
||||
leadingIcon = leadingIcon?.let { leading -> { Box(Modifier.offset(x = SearchBarIconOffsetX)) { leading() } } },
|
||||
trailingIcon = trailingIcon?.let { trailing -> { Box(Modifier.offset(x = -SearchBarIconOffsetX)) { trailing() } } },
|
||||
shape = SearchBarDefaults.inputFieldShape,
|
||||
colors = colors,
|
||||
contentPadding = TextFieldDefaults.contentPaddingWithLabel(),
|
||||
container = {},
|
||||
)
|
||||
},
|
||||
|
||||
@@ -546,8 +546,8 @@ fun GalleryListScreen(lub: ListUrlBuilder, navigator: DestinationsNavigator) = c
|
||||
fabHidden = it
|
||||
},
|
||||
title = suitableTitle,
|
||||
searchFieldState = searchFieldState,
|
||||
searchFieldHint = searchBarHint,
|
||||
searchFieldState = searchFieldState,
|
||||
suggestionProvider = {
|
||||
GalleryDetailUrlParser.parse(it, false)?.run {
|
||||
GalleryDetailUrlSuggestion(gid, token)
|
||||
|
||||
@@ -100,9 +100,9 @@ fun SearchBarScreen(
|
||||
onApplySearch: (String) -> Unit,
|
||||
expanded: Boolean,
|
||||
onExpandedChange: (Boolean) -> Unit,
|
||||
title: String? = null,
|
||||
title: String?,
|
||||
searchFieldHint: String,
|
||||
searchFieldState: TextFieldState = rememberTextFieldState(),
|
||||
searchFieldHint: String? = null,
|
||||
suggestionProvider: SuggestionProvider? = null,
|
||||
tagNamespace: Boolean = false,
|
||||
searchBarOffsetY: () -> Int = { 0 },
|
||||
@@ -226,14 +226,10 @@ fun SearchBarScreen(
|
||||
expanded = expanded,
|
||||
onExpandedChange = onExpandedChange,
|
||||
modifier = Modifier.widthIn(max = maxWidth - SearchBarHorizontalPadding * 2),
|
||||
label = title.ifNotNullThen {
|
||||
Text(title!!, overflow = TextOverflow.Ellipsis, maxLines = 1)
|
||||
}.takeUnless {
|
||||
placeholder = {
|
||||
val contentActive by activeState.state
|
||||
expanded || contentActive || searchFieldState.text.isNotEmpty()
|
||||
},
|
||||
placeholder = searchFieldHint.ifNotNullThen {
|
||||
Text(searchFieldHint!!, overflow = TextOverflow.Ellipsis, maxLines = 1)
|
||||
val text = title.takeUnless { expanded || contentActive } ?: searchFieldHint
|
||||
Text(text, overflow = TextOverflow.Ellipsis, maxLines = 1)
|
||||
},
|
||||
leadingIcon = {
|
||||
if (expanded) {
|
||||
|
||||
Reference in new issue
Block a user