汉选英选项按钮内展示音标

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-07-18 21:13:54 +08:00
parent dc2e6a142e
commit d09edd395c
@@ -72,10 +72,17 @@ struct QuizView: View {
Button { Button {
select(option, for: question) select(option, for: question)
} label: { } label: {
VStack(spacing: 4) {
Text(option) Text(option)
.font(.headline) .font(.headline)
if config.mode == .zhToEn, let w = config.words.first(where: { $0.word == option }) {
Text(w.phonetic)
.font(.caption)
.foregroundStyle(.secondary)
}
}
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
.padding(.vertical, 14) .padding(.vertical, 10)
} }
.buttonStyle(.bordered) .buttonStyle(.bordered)
.tint(optionColor(option, for: question)) .tint(optionColor(option, for: question))
@@ -88,11 +95,6 @@ struct QuizView: View {
Text(selectedOption == question.answer ? "回答正确" : "正确答案:\(question.answer)") Text(selectedOption == question.answer ? "回答正确" : "正确答案:\(question.answer)")
.font(.headline) .font(.headline)
.foregroundStyle(selectedOption == question.answer ? .green : .red) .foregroundStyle(selectedOption == question.answer ? .green : .red)
if config.mode == .zhToEn, selectedOption != nil {
Text(question.word.phonetic)
.font(.subheadline)
.foregroundStyle(.secondary)
}
Button(currentIndex + 1 < questions.count ? "下一题" : "查看成绩") { Button(currentIndex + 1 < questions.count ? "下一题" : "查看成绩") {
next() next()
} }