mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-18 12:37:03 +05:30
ui: Add Modifier params to [Hottest|Saved]Posts composables
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
ca77d3cf2a
commit
43fb668c7d
2 changed files with 4 additions and 2 deletions
|
@ -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()
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue