Search field fixes
This commit is contained in:
parent
0bf15a1647
commit
5bce9d6108
4 changed files with 44 additions and 16 deletions
|
@ -227,12 +227,14 @@ fun SearchField(
|
|||
onValueChange: (String) -> Unit,
|
||||
onSubmit: () -> Unit,
|
||||
@StringRes label: Int,
|
||||
modifier: Modifier = Modifier
|
||||
modifier: Modifier = Modifier,
|
||||
enabled: Boolean = true
|
||||
) {
|
||||
OutlinedTextField(
|
||||
value = value,
|
||||
onValueChange = onValueChange,
|
||||
modifier = modifier,
|
||||
enabled = enabled,
|
||||
label = { Text(text = stringResource(id = label)) },
|
||||
trailingIcon = {
|
||||
IconButton(onClick = onSubmit) {
|
||||
|
|
|
@ -10,10 +10,12 @@ import androidx.compose.material.icons.Icons
|
|||
import androidx.compose.material.icons.filled.ArrowBack
|
||||
import androidx.compose.material.icons.filled.Delete
|
||||
import androidx.compose.material.icons.filled.Person
|
||||
import androidx.compose.material.icons.filled.Search
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.modifier.modifierLocalConsumer
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.res.vectorResource
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
|
@ -89,13 +91,32 @@ fun FriendsOverviewScreen(
|
|||
topBar = {
|
||||
TopAppBar(
|
||||
title = {
|
||||
// TODO Link to each other
|
||||
SearchField(
|
||||
value = uiState.queryString,
|
||||
onValueChange = friendsOverviewActions.onQueryStringChange,
|
||||
onSubmit = friendsOverviewActions.onSubmit,
|
||||
label = AppText.search_friends
|
||||
)
|
||||
// TODO Make search field
|
||||
// SearchField(
|
||||
// value = uiState.queryString,
|
||||
// onValueChange = friendsOverviewActions.onQueryStringChange,
|
||||
// onSubmit = friendsOverviewActions.onSubmit,
|
||||
// label = AppText.search_friends,
|
||||
// enabled = false
|
||||
// )
|
||||
IconButton(
|
||||
onClick = friendsOverviewActions.onSubmit,
|
||||
// modifier = Modifier.background(
|
||||
// color = MaterialTheme.colors.background
|
||||
// ),
|
||||
) {
|
||||
Row {
|
||||
Text(
|
||||
text = stringResource(id = AppText.click_search_friends),
|
||||
color = MaterialTheme.colors.onPrimary
|
||||
)
|
||||
Icon(
|
||||
imageVector = Icons.Default.Search,
|
||||
contentDescription = stringResource(AppText.search_friends),
|
||||
tint = MaterialTheme.colors.onPrimary
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
navigationIcon = {
|
||||
IconButton(onClick = popUp) {
|
||||
|
|
|
@ -9,6 +9,7 @@ import androidx.compose.material.*
|
|||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.ArrowBack
|
||||
import androidx.compose.material.icons.filled.Person
|
||||
import androidx.compose.material.icons.filled.Search
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
|
@ -82,14 +83,16 @@ fun SearchFriendsScreen(
|
|||
topBar = {
|
||||
TopAppBar(
|
||||
title = {
|
||||
SearchField(
|
||||
value = query,
|
||||
onValueChange = { newValue ->
|
||||
searchFriendsActions.onQueryStringChange(newValue)
|
||||
query = newValue
|
||||
},
|
||||
onSubmit = { },
|
||||
label = AppText.search_friends
|
||||
// TODO Make search field
|
||||
// SearchField(
|
||||
// value = uiState.queryString,
|
||||
// onValueChange = friendsOverviewActions.onQueryStringChange,
|
||||
// onSubmit = friendsOverviewActions.onSubmit,
|
||||
// label = AppText.search_friends,
|
||||
// enabled = false
|
||||
// )
|
||||
Text(
|
||||
text = stringResource(id = AppText.searching_friends)
|
||||
)
|
||||
},
|
||||
navigationIcon = {
|
||||
|
|
|
@ -132,6 +132,8 @@
|
|||
<string name="send_friend_request">Send friend request</string>
|
||||
<string name="remove_friend">Remove as friend</string>
|
||||
<string name="show_profile">Show profile</string>
|
||||
<string name="click_search_friends">Click to search friends</string>
|
||||
<string name="searching_friends">Searching friends</string>
|
||||
|
||||
<!-- ========== Create & edit screens ========== -->
|
||||
|
||||
|
|
Reference in a new issue