From 89af4ef6d2b05c5faf78503d43d85c6e0bd38b99 Mon Sep 17 00:00:00 2001 From: joaomanaia Date: Sun, 24 Nov 2024 16:38:27 +0000 Subject: [PATCH] Fix content slots reuse in comparison quiz screen --- .../newquiz/comparison_quiz/ui/ComparisonQuizScreen.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/comparison-quiz/src/main/java/com/infinitepower/newquiz/comparison_quiz/ui/ComparisonQuizScreen.kt b/comparison-quiz/src/main/java/com/infinitepower/newquiz/comparison_quiz/ui/ComparisonQuizScreen.kt index de578de8..f7b36bdf 100644 --- a/comparison-quiz/src/main/java/com/infinitepower/newquiz/comparison_quiz/ui/ComparisonQuizScreen.kt +++ b/comparison-quiz/src/main/java/com/infinitepower/newquiz/comparison_quiz/ui/ComparisonQuizScreen.kt @@ -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 @@ -328,6 +329,8 @@ private fun ComparisonQuizContainer( label = "Main Content" ) + val reusableMidContent = remember(midContent) { movableContentOf(midContent) } + Scaffold( modifier = modifier, topBar = { @@ -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 }, @@ -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 },