chordDegreeCard function
- TheoryDraw draw
"Que grau é «0» em Fá maior?": a cifra do grau, e o botão com o numeral. Os erros são os graus vizinhos (quem confunde o grau de cima ou o de baixo).
Implementation
TheoryCard chordDegreeCard(TheoryDraw draw) {
final i = draw.rng.nextInt(_diatonicForms.length);
final (numeral, position, seventh) = _diatonicForms[i];
final chord = degreeChord(seventh, draw.tonic);
final name = tonicName(draw.tonic);
final choice = choices(
textOption(numeral, numeral),
[
for (final j in [i - 1, i + 1])
if (j >= 0 && j < 7)
textOption(_diatonicForms[j].$1, _diatonicForms[j].$1),
],
[for (final form in _diatonicForms) textOption(form.$1, form.$1)],
draw.rng,
);
return TheoryCard(
prompt: 'Que grau é «0» em $name?',
explanation:
'«0» tem a fundamental no $position.º grau de $name: é o $numeral.',
chords: [chord],
options: choice.options,
correct: choice.correct,
);
}