shouldShow method

bool shouldShow(
  1. List notes
)

Determina if o bracket must be mostrado with base nas notes

Regras (Behind Bars standard):

  • Not mostrar if all as notes are beamed juntas
  • MOSTRAR if está of the lado of the cabeça (music vocal)
  • MOSTRAR if notes not têm beams or há rests
  • MOSTRAR if show=false (força escwherer)

Implementation

bool shouldShow(List<dynamic> notes) {
  // If está of the lado of the cabeça, always mostrar
  if (side == BracketSide.notehead) return true;

  // If show=false, forçar escwherer
  if (!show) return false;

  // ✅ CORREÇÃO P9: Check if all as notes têm beam
  // If sim, escwherer bracket (Behind Bars standard)
  // If not (rests, unbeamed notes), mostrar bracket

  // Filtrar only Notes (ignorar rests)
  final actualNotes = notes.whereType<Note>().toList();

  // If not há notes, or há rests misturados, mostrar bracket
  if (actualNotes.isEmpty || actualNotes.length < notes.length) {
    return true;
  }

  // Check if All as notes têm beam defined
  final allNotesBeamed = actualNotes.every((note) => note.beam != null);

  // If all têm beam, escwherer bracket (only mostrar number)
  // If some not tem beam, mostrar bracket
  return !allNotesBeamed;
}