Migrate to M3 Expressive loading indicator

This commit is contained in:
FooIbar committed 2025-05-17 23:10:17 +08:00
1 parent 7d05e5382a
commit ebf99eda55
2 files changed
+12 -1

No files matched your search

@@ -223,7 +223,7 @@ fun GalleryList(
}
}
PullToRefreshDefaults.Indicator(
PullToRefreshDefaults.LoadingIndicator(
state = refreshState,
isRefreshing = isRefreshing,
modifier = Modifier.align(Alignment.TopCenter).padding(top = contentPadding.calculateTopPadding())
@@ -47,6 +47,8 @@ import androidx.compose.material3.TextButton
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.material3.pulltorefresh.PullToRefreshBox
import androidx.compose.material3.pulltorefresh.PullToRefreshDefaults
import androidx.compose.material3.pulltorefresh.rememberPullToRefreshState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.LaunchedEffect
@@ -297,6 +299,7 @@ fun AnimatedVisibilityScope.GalleryCommentsScreen(gid: Long, navigator: Destinat
val keylineMargin = dimensionResource(id = R.dimen.keyline_margin)
var editTextMeasured by remember { mutableStateOf(MinimumContentPaddingEditText) }
var isRefreshing by remember { mutableStateOf(false) }
val refreshState = rememberPullToRefreshState()
PullToRefreshBox(
isRefreshing = isRefreshing,
onRefresh = {
@@ -309,6 +312,14 @@ fun AnimatedVisibilityScope.GalleryCommentsScreen(gid: Long, navigator: Destinat
}
},
modifier = Modifier.fillMaxSize().imePadding().padding(top = paddingValues.calculateTopPadding()),
state = refreshState,
indicator = {
PullToRefreshDefaults.LoadingIndicator(
modifier = Modifier.align(Alignment.TopCenter),
isRefreshing = isRefreshing,
state = refreshState,
)
},
) {
val additionalPadding = if (commenting) {
editTextMeasured