sections static method

String sections(
  1. Map<String, List<String>> groups,
  2. PromptTheme theme
)

Renders grouped sections such as "Navigation", "Editing", "Confirm".

Use this when distinct command categories exist. Each group title uses bold styling so it stands out even when the caller applies additional framing around the hint block.

Implementation

static String sections(Map<String, List<String>> groups, PromptTheme theme) {
  final buffer = StringBuffer();
  final color = theme.gray;

  buffer.writeln('${theme.dim}Controls${theme.reset}');
  buffer.writeln('${theme.dim}────────────────────${theme.reset}');
  for (final entry in groups.entries) {
    buffer.writeln(
        ' ${theme.bold}${entry.key}:${theme.reset}  $color${entry.value.join('   ')}${theme.reset}');
  }
  return buffer.toString();
}