Instagram home screen example - compose
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
@Composable | |
fun HomeScreen(modifier: Modifier = Modifier) { | |
val scrollState = rememberScrollState() | |
val context = LocalContext.current | |
Surface(modifier = modifier.fillMaxWidth()) { | |
LazyColumn(modifier = Modifier.verticalScroll(scrollState)) { | |
// LazyRow still able to be use, since it has different orientation with parent LazyColumn | |
item { | |
LazyRow(modifier = modifier.fillMaxWidth()) { | |
items(getStories()) { story -> | |
StoryThumbnail(story = story) | |
} | |
} | |
} | |
items(getPosts()) { post -> | |
PostCard( | |
post = post, | |
postCardListener = getPostCardListener(context), | |
modifier = Modifier.padding(vertical = 8.dp)) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment