mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-15 08:47:03 +05:30
Use material3 color for SwipeRefreshIndicator (#299)
This commit is contained in:
parent
34393ef2dc
commit
3b833083e1
1 changed files with 12 additions and 0 deletions
|
@ -3,11 +3,14 @@ package dev.msfjarvis.claw.android.ui.lists
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.lazy.LazyListState
|
import androidx.compose.foundation.lazy.LazyListState
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.contentColorFor
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.paging.LoadState
|
import androidx.paging.LoadState
|
||||||
import androidx.paging.compose.LazyPagingItems
|
import androidx.paging.compose.LazyPagingItems
|
||||||
import com.google.accompanist.swiperefresh.SwipeRefresh
|
import com.google.accompanist.swiperefresh.SwipeRefresh
|
||||||
|
import com.google.accompanist.swiperefresh.SwipeRefreshIndicator
|
||||||
import com.google.accompanist.swiperefresh.rememberSwipeRefreshState
|
import com.google.accompanist.swiperefresh.rememberSwipeRefreshState
|
||||||
import dev.msfjarvis.claw.common.posts.PostActions
|
import dev.msfjarvis.claw.common.posts.PostActions
|
||||||
import dev.msfjarvis.claw.database.local.SavedPost
|
import dev.msfjarvis.claw.database.local.SavedPost
|
||||||
|
@ -26,6 +29,15 @@ fun HottestPosts(
|
||||||
SwipeRefresh(
|
SwipeRefresh(
|
||||||
state = rememberSwipeRefreshState(isRefreshing),
|
state = rememberSwipeRefreshState(isRefreshing),
|
||||||
onRefresh = reloadPosts,
|
onRefresh = reloadPosts,
|
||||||
|
indicator = { state, trigger ->
|
||||||
|
val backgroundColor = MaterialTheme.colorScheme.surface
|
||||||
|
SwipeRefreshIndicator(
|
||||||
|
state = state,
|
||||||
|
refreshTriggerDistance = trigger,
|
||||||
|
backgroundColor = backgroundColor,
|
||||||
|
contentColor = contentColorFor(backgroundColor)
|
||||||
|
)
|
||||||
|
}
|
||||||
) {
|
) {
|
||||||
if (items.itemCount == 0) {
|
if (items.itemCount == 0) {
|
||||||
Box(modifier = Modifier.fillMaxSize())
|
Box(modifier = Modifier.fillMaxSize())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue