Skip to content

Commit

Permalink
Add labels to animations
Browse files Browse the repository at this point in the history
  • Loading branch information
HeroBrine1st committed Nov 12, 2023
1 parent cce2212 commit 1a2740c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/src/main/java/ru/herobrine1st/e621/ui/screen/post/Post.kt
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,15 @@ fun Post(
modifier = Modifier.fillMaxWidth()
) {
// TODO expose animation state from CollapsibleColumn and use it here
val rotation: Float by animateFloatAsState(if (expanded) 180f else 360f)
val rotation: Float by animateFloatAsState(if (expanded) 180f else 360f,
label = "Expand-collapse button icon rotation"
)
Icon(
Icons.Default.ExpandMore, null, modifier = Modifier
.padding(start = 4.dp, end = 12.dp)
.rotate(rotation)
)
Crossfade(expanded) { state ->
Crossfade(expanded, label = "Expand-collapse button text crossfade") { state ->
Text(
stringResource(if (!state) R.string.expand else R.string.collapse),
modifier = Modifier.weight(1f)
Expand Down Expand Up @@ -503,7 +505,7 @@ fun CommentsBottomSheetContent(
if (!loadComments) return@Box

val comments = commentsFlow.collectAsLazyPagingItems()
Crossfade(comments.loadState.refresh is LoadState.Error) {
Crossfade(comments.loadState.refresh is LoadState.Error, label = "Comments sheet animation between error and content") {
if (it) Column(
Modifier.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
Expand Down

0 comments on commit 1a2740c

Please sign in to comment.