Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fun MedicalHistoryDiagnosisWithTreatment(
color = MaterialTheme.colors.onSurface,
)

AnswerChipsGroup(
MedicalHistoryQuestionOptions(
modifier = Modifier.align(Alignment.End),
selectedAnswer = diagnosisAnswer,
onSelectionChange = { newAnswer ->
Expand Down Expand Up @@ -88,7 +88,7 @@ fun MedicalHistoryDiagnosisWithTreatment(
color = MaterialTheme.colors.onSurface,
)

AnswerChipsGroup(
MedicalHistoryQuestionOptions(
modifier = Modifier.align(Alignment.End),
selectedAnswer = treatmentAnswer,
onSelectionChange = { newAnswer ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ fun MedicalHistoryQuestionItem(
overflow = TextOverflow.Ellipsis,
)

AnswerChipsGroup(
MedicalHistoryQuestionOptions(
selectedAnswer = selectedAnswer,
onSelectionChange = { newAnswer ->
if (newAnswer == selectedAnswer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import org.simple.clinic.R
import org.simple.clinic.medicalhistory.Answer

@Composable
fun AnswerChipsGroup(
fun MedicalHistoryQuestionOptions(
modifier: Modifier = Modifier,
selectedAnswer: Answer?,
onSelectionChange: (Answer) -> Unit
Expand All @@ -30,15 +30,15 @@ fun AnswerChipsGroup(
horizontalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.spacing_8)),
verticalAlignment = Alignment.CenterVertically,
) {
MedicalHistoryAnswerChip(
MedicalHistoryQuestionOption(
label = stringResource(R.string.newmedicalhistory_yes),
selected = selectedAnswer == Answer.Yes,
onSelectionChange = {
onSelectionChange(Answer.Yes)
}
)

MedicalHistoryAnswerChip(
MedicalHistoryQuestionOption(
label = stringResource(R.string.newmedicalhistory_no),
selected = selectedAnswer == Answer.No,
onSelectionChange = {
Expand All @@ -50,7 +50,7 @@ fun AnswerChipsGroup(

@OptIn(ExperimentalMaterialApi::class)
@Composable
fun MedicalHistoryAnswerChip(
fun MedicalHistoryQuestionOption(
label: String,
selected: Boolean,
onSelectionChange: () -> Unit
Expand Down
Loading