RoomList: improve filter
This commit is contained in:
parent
07363dbe63
commit
de122a6340
1 changed files with 6 additions and 2 deletions
|
|
@ -23,6 +23,7 @@ import androidx.compose.ui.text.TextStyle
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import io.element.android.x.core.compose.LogCompositions
|
import io.element.android.x.core.compose.LogCompositions
|
||||||
|
import io.element.android.x.core.compose.textFieldState
|
||||||
import io.element.android.x.designsystem.components.dialogs.ConfirmationDialog
|
import io.element.android.x.designsystem.components.dialogs.ConfirmationDialog
|
||||||
import io.element.android.x.features.roomlist.model.MatrixUser
|
import io.element.android.x.features.roomlist.model.MatrixUser
|
||||||
|
|
||||||
|
|
@ -44,6 +45,7 @@ fun RoomListTopBar(
|
||||||
text = filter,
|
text = filter,
|
||||||
onFilterChanged = onFilterChanged,
|
onFilterChanged = onFilterChanged,
|
||||||
onCloseClicked = {
|
onCloseClicked = {
|
||||||
|
onFilterChanged("")
|
||||||
searchWidgetStateIsOpened = false
|
searchWidgetStateIsOpened = false
|
||||||
},
|
},
|
||||||
scrollBehavior = scrollBehavior,
|
scrollBehavior = scrollBehavior,
|
||||||
|
|
@ -68,6 +70,7 @@ fun SearchRoomListTopBar(
|
||||||
onCloseClicked: () -> Unit,
|
onCloseClicked: () -> Unit,
|
||||||
scrollBehavior: TopAppBarScrollBehavior
|
scrollBehavior: TopAppBarScrollBehavior
|
||||||
) {
|
) {
|
||||||
|
var filterState by textFieldState(stateValue = text)
|
||||||
val focusRequester = remember { FocusRequester() }
|
val focusRequester = remember { FocusRequester() }
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|
@ -77,11 +80,12 @@ fun SearchRoomListTopBar(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.focusRequester(focusRequester),
|
.focusRequester(focusRequester),
|
||||||
value = text,
|
value = filterState,
|
||||||
textStyle = TextStyle(
|
textStyle = TextStyle(
|
||||||
fontSize = 17.sp
|
fontSize = 17.sp
|
||||||
),
|
),
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
|
filterState = it
|
||||||
onFilterChanged(it)
|
onFilterChanged(it)
|
||||||
},
|
},
|
||||||
placeholder = {
|
placeholder = {
|
||||||
|
|
@ -100,7 +104,7 @@ fun SearchRoomListTopBar(
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Default.Close,
|
imageVector = Icons.Default.Close,
|
||||||
contentDescription = "close",
|
contentDescription = "clear",
|
||||||
tint = MaterialTheme.colorScheme.onBackground
|
tint = MaterialTheme.colorScheme.onBackground
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue