This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2022 Google LLC. | |
// SPDX-License-Identifier: Apache-2.0 | |
@Composable | |
fun GreetingScreen(name: String) { | |
Column { | |
Header() | |
Greeting(name = name) | |
Footer() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2022 Google LLC. | |
// SPDX-License-Identifier: Apache-2.0 | |
@Composable | |
fun ListWithBug(myList: List<String>) { | |
var items = 0 | |
Row(horizontalArrangement = Arrangement.SpaceBetween) { | |
Column { | |
for (item in myList) { | |
Text("Item: $item") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2022 Google LLC. | |
// SPDX-License-Identifier: Apache-2.0 | |
@Composable | |
fun ListComposable(myList: List<String>) { | |
Row(horizontalArrangement = Arrangement.SpaceBetween) { | |
Column { | |
for (item in myList) { | |
Text("Item: $item") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2022 Google LLC. | |
// SPDX-License-Identifier: Apache-2.0 | |
@Composable | |
fun SingleChoiceQuestion(answers: List<Answer>) { | |
var selectedAnswer: MutableState<Answer?> = | |
rememberSaveable { mutableStateOf(null) } | |
answers.forEach { answer -> | |
SurveyAnswer( | |
answer = answer, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2022 Google LLC. | |
// SPDX-License-Identifier: Apache-2.0 | |
@Composable | |
fun SingleChoiceQuestion(answers: List<Answer>) { | |
// Initialize selectedAnswer to null since no answer will be selected at first | |
var selectedAnswer: MutableState<Answer?> = | |
mutableStateOf(null) | |
answers.forEach { answer -> | |
SurveyAnswer( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2022 Google LLC. | |
// SPDX-License-Identifier: Apache-2.0 | |
@Composable | |
fun SingleChoiceQuestion(answers: List<Answer>) { | |
answers.forEach { answer -> | |
SurveyAnswer( | |
answer = answer, | |
isSelected = false, | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2022 Google LLC. | |
// SPDX-License-Identifier: Apache-2.0 | |
@Composable | |
fun SingleChoiceQuestion(answers: List<Answer>) { | |
Column { | |
if (answers.isEmpty()) { | |
Text("There are no answers to choose from!") | |
} else { | |
answers.forEach { answer -> |