This is the logic. that I have:
Box(
Modifier
.pullRefresh(pullRefreshState)
.fillMaxSize()
.padding(all = 0.dp)
.background(color = colorResource(id = R.color.inbox_list_color))
) {
LazyColumn(modifier = Modifier.fillMaxHeight()) {
items(items = listState, itemContent = { item ->
ToDoRow(todo = item)
})
}
PullRefreshIndicator(isRefreshing.value, pullRefreshState, Modifier.align(Alignment.TopCenter))
}
This works fine on phones but I it does not pull to refresh when using a trackpad/mouse. Is there a way to do this properly?
I see that I can use pointerInput to see my drags.
.pointerInput(Unit) {
detectDragGestures(
onDragStart = {
Log.i("TAG", "MOUSE-: onDragStart")
},
onDrag = { change: PointerInputChange, dragAmount: Offset ->
Log.i("TAG", "MOUSE-: onDrag -> $dragAmount")
},
onDragCancel = {
Log.i("TAG", "MOUSE-: onDragCancel")
},
onDragEnd = {
Log.i("TAG", "MOUSE-: onDragEnd")
}
)
}
Is there a way to link this to the PullRefresh? I am doing this:
https://developer.android.com/reference/kotlin/androidx/compose/material/pullrefresh/package-summary