findKeyLabelPrompt function

Widget findKeyLabelPrompt({
  1. required String label,
  2. required bool anyOctave,
  3. required NoteNaming naming,
  4. required Color color,
})

A tecla pelo nome (find-key): o nome da nota em label, na cor color (a do acerto, do erro ou a comum). Sem anyOctave, o dó central fica marcado no teclado de referência.

Implementation

Widget findKeyLabelPrompt({
  required String label,
  required bool anyOctave,
  required NoteNaming naming,
  required Color color,
}) {
  return Builder(
    builder: (context) {
      final t = context.zt;
      return Column(
        children: [
          const ZGap(ZSpace.xl),
          Text(
            label,
            textAlign: TextAlign.center,
            style: t.text.display.copyWith(fontSize: 64, color: color),
          ),
          if (!anyOctave) ...[
            const ZGap(ZSpace.s),
            Text('O dó central está marcado.', style: t.text.caption),
            SizedBox(
              width: 320,
              child: KeyboardMarkView(
                mark: KeyboardMark(
                  line: 0,
                  from: Pitch.parse('C3'),
                  to: Pitch.parse('C5'),
                  mark: [Pitch.parse('C4')],
                  names: true,
                ),
                naming: naming,
              ),
            ),
          ] else ...[
            const ZGap(ZSpace.s),
            Text(
              'Toque a tecla (vale qualquer oitava).',
              style: t.text.caption,
            ),
          ],
          const ZGap(ZSpace.s),
          Icon(Icons.piano, size: 28, color: t.colors.inkCaption),
        ],
      );
    },
  );
}