Skip to content

Instantly share code, notes, and snippets.

@CostaFot
Created April 21, 2025 15:59
Show Gist options
  • Save CostaFot/77857778ecac23f498951cd7e0cc6e3f to your computer and use it in GitHub Desktop.
Save CostaFot/77857778ecac23f498951cd7e0cc6e3f to your computer and use it in GitHub Desktop.
@Composable
private fun MainScreen(
viewModel: PullToRefreshViewModel = hiltViewModel()
) {
Box(
modifier = Modifier
.fillMaxWidth()
.background(Color.Blue)
) {
val isRefreshing: Boolean by viewModel.isRefreshingState.collectAsStateWithLifecycle()
PullToRefreshBox(
isRefreshing = isRefreshing,
onRefresh = {
viewModel.onRefresh()
},
) {
// ....
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment