onRelease method

void onRelease(
  1. HoldRelease release, {
  2. required bool animate,
})

O aluno soltou uma nota certa do passo cedo (release). Não é erro: a cápsula esvazia a partir do enchimento que tinha (release.fraction), se animate; senão só some. Só o passo que a cápsula mostra conta.

Implementation

void onRelease(HoldRelease release, {required bool animate}) {
  final hold = state.shape.hold;
  if (hold == null || release.stepIndex != hold.index) return;
  final emptying = animate
      ? HoldEmptyingMark(serial: _nextSerial(), hold: hold)
      : state.shape.emptying;
  emit(
    HoldCapsuleState(
      shape: HoldShape(bursts: state.shape.bursts, emptying: emptying),
      fill: state.fill,
      emptyingFill: animate ? release.fraction : state.emptyingFill,
    ),
  );
}