From 115d08315100fde80a613fb4ee705f4786c659c0 Mon Sep 17 00:00:00 2001 From: Rui Date: Thu, 25 Apr 2024 09:13:13 -0700 Subject: [PATCH] Fix market info's stats/about tab animation issue --- .../market/marketinfo/DydxMarketInfoView.kt | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/v4/feature/market/src/main/java/exchange/dydx/trading/feature/market/marketinfo/DydxMarketInfoView.kt b/v4/feature/market/src/main/java/exchange/dydx/trading/feature/market/marketinfo/DydxMarketInfoView.kt index a309921e..7695ab16 100644 --- a/v4/feature/market/src/main/java/exchange/dydx/trading/feature/market/marketinfo/DydxMarketInfoView.kt +++ b/v4/feature/market/src/main/java/exchange/dydx/trading/feature/market/marketinfo/DydxMarketInfoView.kt @@ -1,5 +1,8 @@ package exchange.dydx.trading.feature.market.marketinfo +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.animation.expandVertically +import androidx.compose.animation.shrinkVertically import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -155,11 +158,23 @@ object DydxMarketInfoView : DydxComponent { ) } item(key = "stats") { - when (state.statsTabSelection) { - DydxMarketStatsTabView.Selection.Statistics -> { - DydxMarketStatsView.Content(Modifier) - } - DydxMarketStatsTabView.Selection.About -> { + AnimatedVisibility( + visible = + state.statsTabSelection == DydxMarketStatsTabView.Selection.Statistics, + enter = expandVertically(), + exit = shrinkVertically(), + ) { + DydxMarketStatsView.Content(Modifier) + } + AnimatedVisibility( + visible = + state.statsTabSelection == DydxMarketStatsTabView.Selection.About, + enter = expandVertically(), + exit = shrinkVertically(), + ) { + Column( + modifier = Modifier, + ) { DydxMarketResourcesView.Content(Modifier) Spacer(modifier = Modifier.height(ThemeShapes.VerticalPadding)) DydxMarketConfigsView.Content(Modifier)