Created
June 13, 2021 04:53
-
-
Save hongbeomi/b7200cf3b9ace83409a776c08dd60f1c to your computer and use it in GitHub Desktop.
This file contains 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
@ExperimentalFoundationApi | |
@Composable | |
fun CharacterList( | |
characterFlow: Flow<List<Character>>, | |
modifier: Modifier = Modifier, | |
onClickItem: (Character) -> Unit = {} | |
) { | |
val characterList by getLifecycleAwareState(flow = characterFlow, initialValue = listOf()) | |
LazyVerticalGrid( | |
cells = GridCells.Fixed(3), | |
modifier = modifier | |
) { | |
items(characterList) { | |
CharacterItem( | |
character = it, | |
modifier = Modifier.height(240.dp), | |
onClick = onClickItem | |
) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment