Fix chevron orientation according to design and animate the change.
This commit is contained in:
parent
5bff4677fb
commit
c26b24235f
1 changed files with 13 additions and 2 deletions
|
|
@ -16,6 +16,8 @@
|
||||||
|
|
||||||
package io.element.android.features.messages.impl.timeline.components.group
|
package io.element.android.features.messages.impl.timeline.components.group
|
||||||
|
|
||||||
|
import androidx.compose.animation.core.animateFloatAsState
|
||||||
|
import androidx.compose.animation.core.tween
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
|
|
@ -26,6 +28,7 @@ import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
|
|
@ -76,9 +79,17 @@ fun GroupHeaderView(
|
||||||
color = MaterialTheme.colorScheme.secondary,
|
color = MaterialTheme.colorScheme.secondary,
|
||||||
style = ElementTheme.typography.fontBodyMdRegular,
|
style = ElementTheme.typography.fontBodyMdRegular,
|
||||||
)
|
)
|
||||||
|
val rotation: Float by animateFloatAsState(
|
||||||
|
targetValue = if (isExpanded) 90f else 0f,
|
||||||
|
animationSpec = tween(
|
||||||
|
delayMillis = 0,
|
||||||
|
durationMillis = 300,
|
||||||
|
),
|
||||||
|
label = "chevron"
|
||||||
|
)
|
||||||
Icon(
|
Icon(
|
||||||
modifier = Modifier.rotate(if (isExpanded) 180f else 0f),
|
modifier = Modifier.rotate(rotation),
|
||||||
imageVector = CompoundIcons.ChevronDown,
|
imageVector = CompoundIcons.ChevronRight,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = MaterialTheme.colorScheme.secondary
|
tint = MaterialTheme.colorScheme.secondary
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue