mirror of
https://github.com/AdrianKuta/KahootQuiz.git
synced 2025-10-30 16:33:42 +01: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`.