From 4be78895d2f9a579275555ed5063aaf82e9e3006 Mon Sep 17 00:00:00 2001 From: Gibran Chevalley Date: Tue, 20 Aug 2024 08:57:03 +0200 Subject: [PATCH] Add checkmark animation --- .../swisstransfer/ui/components/SettingOption.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SettingOption.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SettingOption.kt index 24be130bb..6561e27bf 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SettingOption.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SettingOption.kt @@ -20,6 +20,9 @@ package com.infomaniak.swisstransfer.ui.components import android.content.res.Configuration import androidx.annotation.StringRes +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.animation.scaleIn +import androidx.compose.animation.scaleOut import androidx.compose.foundation.layout.* import androidx.compose.foundation.selection.selectable import androidx.compose.foundation.selection.selectableGroup @@ -69,8 +72,12 @@ private fun SettingOptionItem(item: SettingOption, isSelected: Boolean, onClick: Text(text = stringResource(id = item.title), Modifier.weight(1f)) - if (isSelected) { - Spacer(modifier = Modifier.width(Margin.Medium)) + if (isSelected) Spacer(modifier = Modifier.width(Margin.Medium)) + AnimatedVisibility( + visible = isSelected, + enter = scaleIn(), + exit = scaleOut(), + ) { Icon( imageVector = AppIcons.Checkmark, contentDescription = null,