ui: Add Modifier params to [Hottest|Saved]Posts composables

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2020-10-29 16:27:12 +05:30
parent ca77d3cf2a
commit 43fb668c7d
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
2 changed files with 4 additions and 2 deletions

View file

@ -14,6 +14,7 @@ import dev.msfjarvis.lobsters.urllauncher.UrlLauncherAmbient
@Composable @Composable
fun HottestPosts( fun HottestPosts(
viewModel: LobstersViewModel, viewModel: LobstersViewModel,
modifier: Modifier = Modifier,
) { ) {
val posts by viewModel.posts.collectAsState() val posts by viewModel.posts.collectAsState()
val listState = rememberLazyListState() val listState = rememberLazyListState()
@ -25,7 +26,7 @@ fun HottestPosts(
LazyColumnForIndexed( LazyColumnForIndexed(
items = posts, items = posts,
state = listState, state = listState,
modifier = Modifier.padding(horizontal = 8.dp) modifier = Modifier.padding(horizontal = 8.dp).then(modifier)
) { index, item -> ) { index, item ->
if (posts.lastIndex == index) { if (posts.lastIndex == index) {
viewModel.getMorePosts() viewModel.getMorePosts()

View file

@ -14,6 +14,7 @@ import dev.msfjarvis.lobsters.urllauncher.UrlLauncherAmbient
@Composable @Composable
fun SavedPosts( fun SavedPosts(
viewModel: LobstersViewModel, viewModel: LobstersViewModel,
modifier: Modifier = Modifier,
) { ) {
val posts by viewModel.savedPosts.collectAsState() val posts by viewModel.savedPosts.collectAsState()
val listState = rememberLazyListState() val listState = rememberLazyListState()
@ -25,7 +26,7 @@ fun SavedPosts(
LazyColumnFor( LazyColumnFor(
items = posts, items = posts,
state = listState, state = listState,
modifier = Modifier.padding(horizontal = 8.dp) modifier = Modifier.padding(horizontal = 8.dp).then(modifier)
) { item -> ) { item ->
LobstersItem( LobstersItem(
post = item, post = item,