Skip to content

Commit 27bf98a

Browse files
committed
feat(provider-ux): add provider card enter/exit animation
1 parent 834c2e7 commit 27bf98a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

core/ui/mobile/src/main/kotlin/com/flixclusive/core/ui/mobile/component/provider/InstalledProviderCard.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import com.flixclusive.model.provider.Status
2929

3030
@Composable
3131
fun InstalledProviderCard(
32+
modifier: Modifier = Modifier,
3233
providerData: ProviderData,
3334
enabled: Boolean,
3435
isDraggable: Boolean,
@@ -51,7 +52,7 @@ fun InstalledProviderCard(
5152
val cardColor = MaterialTheme.colorScheme.surfaceColorAtElevation(elevation)
5253

5354
Box(
54-
modifier = Modifier
55+
modifier = modifier
5556
.graphicsLayer { translationY = if (!isDraggable) 0F else displacementOffset ?: 0f }
5657
.fillMaxWidth(),
5758
contentAlignment = Alignment.Center

feature/mobile/provider-list/src/main/kotlin/com/flixclusive/feature/mobile/provider/ProvidersScreen.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ import com.flixclusive.model.provider.Status
7373
import com.ramcosta.composedestinations.annotation.Destination
7474
import kotlinx.coroutines.Job
7575
import kotlinx.coroutines.launch
76-
import com.flixclusive.core.ui.common.R as UiCommonR
7776
import com.flixclusive.core.locale.R as LocaleR
77+
import com.flixclusive.core.ui.common.R as UiCommonR
7878

7979
private val FabButtonSize = 56.dp
8080
private fun Context.getHelpGuideTexts()
@@ -257,7 +257,10 @@ internal fun ProvidersScreen(
257257
}
258258
}
259259

260-
itemsIndexed(items = filteredProviders ?: viewModel.providerDataList) { index, providerData ->
260+
itemsIndexed(
261+
items = filteredProviders ?: viewModel.providerDataList,
262+
key = { _, item -> item.id }
263+
) { index, providerData ->
261264
val displacementOffset =
262265
// +1 since there's a header
263266
if (index + 1 == dragDropListState.getCurrentIndexOfDraggedListItem()) {
@@ -269,6 +272,7 @@ internal fun ProvidersScreen(
269272
&& (providerSettings.getOrNull(index)?.isDisabled?.not() ?: true)
270273

271274
InstalledProviderCard(
275+
modifier = Modifier.animateItem(),
272276
providerData = providerData,
273277
enabled = isEnabled,
274278
isDraggable = !searchExpanded.value,

0 commit comments

Comments
 (0)