Use material3 color for SwipeRefreshIndicator (#299)

This commit is contained in:
Rahul Krishna 2022-02-20 16:06:36 +05:30 committed by GitHub
parent 34393ef2dc
commit 3b833083e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,11 +3,14 @@ package dev.msfjarvis.claw.android.ui.lists
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.contentColorFor
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.paging.LoadState
import androidx.paging.compose.LazyPagingItems
import com.google.accompanist.swiperefresh.SwipeRefresh
import com.google.accompanist.swiperefresh.SwipeRefreshIndicator
import com.google.accompanist.swiperefresh.rememberSwipeRefreshState
import dev.msfjarvis.claw.common.posts.PostActions
import dev.msfjarvis.claw.database.local.SavedPost
@ -26,6 +29,15 @@ fun HottestPosts(
SwipeRefresh(
state = rememberSwipeRefreshState(isRefreshing),
onRefresh = reloadPosts,
indicator = { state, trigger ->
val backgroundColor = MaterialTheme.colorScheme.surface
SwipeRefreshIndicator(
state = state,
refreshTriggerDistance = trigger,
backgroundColor = backgroundColor,
contentColor = contentColorFor(backgroundColor)
)
}
) {
if (items.itemCount == 0) {
Box(modifier = Modifier.fillMaxSize())