Created
October 27, 2019 10:41
-
-
Save wangerekaharun/2e5cef7cf7ef5667d037f108bd09e80a to your computer and use it in GitHub Desktop.
Sample code for filtering a list in compose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun FilteredList(contacts : List<Contact>, filterTet : String = ""){ | |
val state = +state { filterTet } | |
VerticalScroller{ | |
Column{ | |
TextField(filterText, onValueChange { state.value = it }){ | |
contacts.filter{ it.contains(state.value) }.forEach { | |
Row{ | |
Image(it.photo) | |
Text(it.name | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment