Skip to content

Commit

Permalink
Fix content slots reuse in comparison quiz screen
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomanaia committed Nov 24, 2024
1 parent 64b7d49 commit 89af4ef
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import androidx.compose.material3.windowsizeclass.WindowWidthSizeClass
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.movableContentOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
Expand Down Expand Up @@ -328,6 +329,8 @@ private fun ComparisonQuizContainer(
label = "Main Content"
)

val reusableMidContent = remember(midContent) { movableContentOf(midContent) }

Scaffold(
modifier = modifier,
topBar = {
Expand Down Expand Up @@ -363,7 +366,7 @@ private fun ComparisonQuizContainer(
)
}
Spacer(modifier = Modifier.height(spaceMedium))
midContent()
reusableMidContent()
Spacer(modifier = Modifier.height(spaceMedium))
mainContentTransition.AnimatedVisibility(
visible = { state -> state != AnimationState.StartGame },
Expand Down Expand Up @@ -411,7 +414,7 @@ private fun ComparisonQuizContainer(
)
}
Spacer(modifier = Modifier.width(spaceMedium))
midContent()
reusableMidContent()
Spacer(modifier = Modifier.width(spaceMedium))
mainContentTransition.AnimatedVisibility(
visible = { state -> state != AnimationState.StartGame },
Expand Down

0 comments on commit 89af4ef

Please sign in to comment.