adjust search component width

Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
sowjanyakch 2025-05-26 12:14:43 +02:00 committed by Marcel Hibbe
parent ebe374c9cb
commit e689e4f7f8
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B
2 changed files with 14 additions and 3 deletions

View File

@ -86,7 +86,8 @@ fun AppBar(
onUpdateSearchQuery(searchQuery) onUpdateSearchQuery(searchQuery)
onUpdateAutocompleteUsers() onUpdateAutocompleteUsers()
}, },
onDisableSearch = onDisableSearch onDisableSearch = onDisableSearch,
isAddParticipants = isAddParticipants
) )
if (searchQuery.isNotEmpty() && isAddParticipants) { if (searchQuery.isNotEmpty() && isAddParticipants) {
@ -99,6 +100,7 @@ fun AppBar(
) { ) {
Text(text = context.getString(R.string.add_participants)) Text(text = context.getString(R.string.add_participants))
} }
} else {
} }
} }
} }

View File

@ -34,12 +34,21 @@ import androidx.compose.ui.unit.sp
import com.nextcloud.talk.R import com.nextcloud.talk.R
@Composable @Composable
fun SearchComponent(text: String, onTextChange: (String) -> Unit, onDisableSearch: () -> Unit) { fun SearchComponent(
text: String,
onTextChange: (String) -> Unit,
onDisableSearch: () -> Unit,
isAddParticipants: Boolean
) {
var width_ratio = 0.85f
if (!isAddParticipants) {
width_ratio = 1.0f
}
val keyboardController = LocalSoftwareKeyboardController.current val keyboardController = LocalSoftwareKeyboardController.current
TextField( TextField(
modifier = Modifier modifier = Modifier
.background(MaterialTheme.colorScheme.background) .background(MaterialTheme.colorScheme.background)
.fillMaxWidth(SearchComponentCompanionClass.WIDTH_RATIO) .fillMaxWidth(width_ratio)
.height(60.dp), .height(60.dp),
value = text, value = text,
onValueChange = { onTextChange(it) }, onValueChange = { onTextChange(it) },