mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Fix chevron orientation according to design and animate the change.
This commit is contained in:
+13
-2
@@ -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
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user