Skip to content

Instantly share code, notes, and snippets.

@arriolac
Created September 21, 2022 15:06
Show Gist options
  • Save arriolac/28b6fd7f00344834322d9b13462a9037 to your computer and use it in GitHub Desktop.
Save arriolac/28b6fd7f00344834322d9b13462a9037 to your computer and use it in GitHub Desktop.
// Copyright 2022 Google LLC.
// SPDX-License-Identifier: Apache-2.0
@Composable
fun SingleChoiceQuestion(answers: List<Answer>) {
var selectedAnswer: Answer? by
rememberSaveable { mutableStateOf(null) }
answers.forEach { answer ->
SurveyAnswer(
answer = answer,
isSelected = (selectedAnswer == answer),
onAnswerSelected = { answer -> selectedAnswer = answer }
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment