feat: Display "Continue" button after answer selection and hide timer

This commit modifies the `QuizScreen` to show a "Continue" button once an answer is selected for the current question. The timer bar is hidden when an answer is chosen.

Key changes:

- **UI Layer (`ui:quiz` module):**
    - In `QuizScreen.kt`:
        - Conditionally display either the `TimerBar` or a `FilledTonalButton` with the text "Continue" based on whether `uiState.answer` is null.
        - The "Continue" button is styled with a grey background and black text.
    - Added a new string resource `continue_text` in `ui/quiz/src/main/res/values/strings.xml`.
This commit is contained in:
2025-09-04 14:09:59 +02:00
parent f0bd963d2d
commit 41fd729271
2 changed files with 24 additions and 5 deletions

View File

@@ -24,6 +24,8 @@ import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.itemsIndexed
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.FilledTonalButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
@@ -109,11 +111,27 @@ private fun QuizScreen(
onSelect = onSelect,
)
// Timer below choices
TimerBar(
totalSeconds = uiState.totalTimeSeconds,
remainingSeconds = uiState.remainingTimeSeconds,
modifier = Modifier.padding(8.dp),
)
if (uiState.answer == null) {
TimerBar(
totalSeconds = uiState.totalTimeSeconds,
remainingSeconds = uiState.remainingTimeSeconds,
modifier = Modifier.padding(8.dp),
)
} else {
FilledTonalButton(
onClick = {},
modifier = Modifier.align(Alignment.CenterHorizontally),
colors = ButtonDefaults.filledTonalButtonColors().copy(
containerColor = Grey,
contentColor = Color.Black
),
shape = RoundedCornerShape(4.dp),
) {
Text(
text = stringResource(R.string.continue_text),
)
}
}
}
}
}

View File

@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="quiz">Quiz</string>
<string name="continue_text">Continue</string>
</resources>