getSeparator function

StatusLineSeparator getSeparator(
  1. StatusLineSeparatorStyle style, {
  2. bool nerd = false,
})

Separator glyphs by style. The plain table is font-safe unicode; the nerd table swaps the powerline shapes for Nerd Font private-use glyphs (only the nerd preset sets StatusLineSpec.nerdSymbols).

Implementation

StatusLineSeparator getSeparator(
  StatusLineSeparatorStyle style, {
  bool nerd = false,
}) {
  final pwLeft = nerd ? '\u{e0b0}' : '▶';
  final pwRight = nerd ? '\u{e0b2}' : '◀';
  final pwThinLeft = nerd ? '\u{e0b1}' : '>';
  final pwThinRight = nerd ? '\u{e0b3}' : '<';
  return switch (style) {
    StatusLineSeparatorStyle.powerline => StatusLineSeparator(
      left: pwLeft,
      right: pwRight,
      capAfterLeft: pwRight,
      capBeforeRight: pwLeft,
    ),
    StatusLineSeparatorStyle.powerlineThin => StatusLineSeparator(
      left: pwThinLeft,
      right: pwThinRight,
      // Full-width caps even for the thin style (omp verbatim).
      capAfterLeft: pwRight,
      capBeforeRight: pwLeft,
    ),
    StatusLineSeparatorStyle.slash => const StatusLineSeparator(
      left: '/',
      right: '/',
    ),
    StatusLineSeparatorStyle.pipe => const StatusLineSeparator(
      left: '│',
      right: '│',
    ),
    StatusLineSeparatorStyle.block => StatusLineSeparator(
      left: nerd ? '█' : '▌',
      right: nerd ? '█' : '▌',
    ),
    StatusLineSeparatorStyle.space => const StatusLineSeparator(
      left: ' ',
      right: ' ',
    ),
    StatusLineSeparatorStyle.ascii => const StatusLineSeparator(
      left: '>',
      right: '<',
    ),
  };
}