mirror of
https://github.com/AdrianKuta/KahootQuiz.git
synced 2025-09-15 01:24:23 +02:00
This commit introduces an `AnswerFeedbackBanner` composable that displays whether a selected answer is correct or wrong. It's integrated into the `Toolbar` section of the `QuizScreen`. Key changes: - **UI Layer (`ui:quiz` module):** - Created `AnswerFeedbackBanner.kt` composable: - Displays "Correct" or "Wrong" text with a green or red background respectively. - Uses `Surface` for elevation and `zIndex` to appear above other elements. - In `QuizScreen.kt`: - Modified the `toolbar` item to include a `Box` that layers the `Toolbar` and the new `AnswerFeedbackBanner`. - The `AnswerFeedbackBanner` is shown when `uiState.isAnswerCorrect` is not null. - In `QuizScreenViewModel.kt`: - Added `isAnswerCorrect: Boolean?` to `ScreenUiState.Success`. - Calculated `isAnswerCorrect` based on the selected choice and the correct answer for the current question. - **Resources (`ui:quiz` module):** - Added new string resources for "Correct" and "Wrong" in `strings.xml`.
7 lines
236 B
XML
7 lines
236 B
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<resources>
|
|
<string name="quiz">Quiz</string>
|
|
<string name="continue_text">Continue</string>
|
|
<string name="correct">Correct</string>
|
|
<string name="wrong">Wrong</string>
|
|
</resources> |