refactor: make functions private and extract constant
This commit is contained in:
parent
a1382d0ee4
commit
ff112ce890
2 changed files with 5 additions and 3 deletions
|
@ -90,7 +90,7 @@ fun MatchDetailsScreen(
|
|||
}
|
||||
|
||||
@Composable
|
||||
fun DualPlayerLists(
|
||||
private fun DualPlayerLists(
|
||||
leftPlayers: List<Player>,
|
||||
rightPlayers: List<Player>,
|
||||
modifier: Modifier = Modifier
|
||||
|
|
|
@ -35,6 +35,8 @@ import xyz.leomurca.csgomatches.ui.navigation.MatchDetailsRoute
|
|||
import xyz.leomurca.csgomatches.ui.screens.matches.MatchesViewModel.MatchesUiState
|
||||
import xyz.leomurca.csgomatches.ui.theme.White
|
||||
|
||||
private const val ITEMS_PAGINATION_THRESHOLD = 3
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun MatchesScreen(
|
||||
|
@ -49,7 +51,7 @@ fun MatchesScreen(
|
|||
snapshotFlow { listState.layoutInfo.visibleItemsInfo.lastOrNull()?.index }
|
||||
.collect { lastVisibleIndex ->
|
||||
val totalItems = listState.layoutInfo.totalItemsCount
|
||||
if (lastVisibleIndex != null && lastVisibleIndex >= totalItems - 3) {
|
||||
if (lastVisibleIndex != null && lastVisibleIndex >= totalItems - ITEMS_PAGINATION_THRESHOLD) {
|
||||
viewModel.loadNextPage()
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +105,7 @@ fun MatchesScreen(
|
|||
}
|
||||
|
||||
@Composable
|
||||
fun MatchesList(
|
||||
private fun MatchesList(
|
||||
matches: List<Match>,
|
||||
onTapCard: (MatchDetailsRoute) -> Unit,
|
||||
listState: LazyListState,
|
||||
|
|
Loading…
Add table
Reference in a new issue