refactor: make functions private and extract constant

This commit is contained in:
Leonardo Murça 2025-07-19 17:51:49 -03:00
parent a1382d0ee4
commit ff112ce890
2 changed files with 5 additions and 3 deletions

View file

@ -90,7 +90,7 @@ fun MatchDetailsScreen(
}
@Composable
fun DualPlayerLists(
private fun DualPlayerLists(
leftPlayers: List<Player>,
rightPlayers: List<Player>,
modifier: Modifier = Modifier

View file

@ -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,