nextRound method

  1. @override
Future<ExerciseRound> nextRound(
  1. Random rng, {
  2. int roundIndex = 0,
})
override

Com _earNext, a pergunta de ouvido sobre a última leitura. Ela fica pronta até recordRound: se a tela pedir de novo antes (a caixa da partitura mudou de tamanho), a mesma pergunta volta.

Implementation

@override
Future<ExerciseRound> nextRound(Random rng, {int roundIndex = 0}) async {
  if (_earNext) {
    _lastWasEar = true;
    _lastWasRehearsal = false;
    return QuestionRound([sightListenQuestion(_lastStep!, _lastSeed!)]);
  }
  _lastWasEar = false;
  if (_next == _Next.sample) {
    // No sem fim, cada rodada sorteia a figura, o tamanho e a margem da volta.
    _lastStep = progress.isEndless
        ? sightEndlessRound(progress.lap, rng)
        : progress.step;
    _lastSeed = rng.nextInt(1 << 31);
    _readingName = progress.stepOn(SightTrack.reading).name;
    _next = _rehearsalFor(_lastStep!) ? _Next.rehearsal : _Next.reading;
  }
  if (_next == _Next.rehearsal) {
    // O ensaio fica pronto até ser gravado: se a tela pedir de novo antes,
    // o mesmo ensaio volta.
    _lastWasRehearsal = true;
    return sightRehearsalRound(_lastStep!, _lastSeed!);
  }
  _lastWasRehearsal = false;
  _next = _Next.sample;
  return _round(_lastStep!, _lastSeed!);
}