Nat Strangerweather
01/06/2023, 2:37 PMPullRefreshIndicator
which stays stuck halfway down the screen and does not execute the function. Please see code in thread.Nat Strangerweather
01/06/2023, 2:37 PMval isRefreshing by viewModel.isRefreshing.collectAsState()
val pullRefreshState = rememberPullRefreshState(refreshing = isRefreshing, onRefresh = {
viewModel.updateLocalFeeds()
})
Scaffold(
vignette = { Vignette(vignettePosition = VignettePosition.TopAndBottom) },
positionIndicator = { PositionIndicator(scalingLazyListState = scalingLazyListState) },
timeText = { TimeText() }
) {
when {
state.isLoading -> {
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
CircularProgressIndicator()
}
}
state.isSuccess -> {
Box(modifier = Modifier.pullRefresh(pullRefreshState)) {
ScalingLazyColumn(
state = scalingLazyListState,
modifier = Modifier.fillMaxWidth(),
anchorType = ScalingLazyListAnchorType.ItemStart,
contentPadding = PaddingValues(
horizontal = 8.dp,
),
horizontalAlignment = Alignment.CenterHorizontally
) {
item {
if (title != null) {
Text(
text = title, textAlign = TextAlign.Center,
modifier = Modifier.padding(
top = 30.dp,
start = 20.dp,
end = 20.dp,
bottom = 10.dp
)
)
}
}
items(state.newsFeedItems) { item ->
ResultsChip(item, navController)
}
}
PullRefreshIndicator(
modifier = Modifier.align(Alignment.TopCenter),
refreshing = isRefreshing,
state = pullRefreshState,
)
}
}
Nat Strangerweather
01/06/2023, 2:37 PMAndrew Neal
01/06/2023, 3:17 PMNat Strangerweather
01/06/2023, 3:30 PM