PanelStyle.of constructor

PanelStyle.of(
  1. BuildContext context
)

Implementation

factory PanelStyle.of(BuildContext context) {
  var theme = Theme.of(context);
  var scheme = theme.colorScheme;
  var ink = scheme.onSurface;
  TextStyle style(
    double size, {
    FontWeight weight = FontWeight.w400,
    Color? color,
    double letterSpacing = 0,
  }) => TextStyle(
    fontSize: size,
    fontWeight: weight,
    color: color ?? ink,
    letterSpacing: letterSpacing,
  );

  var muted = ink.withValues(alpha: 0.62);
  return PanelStyle._(
    surface: scheme.surface,
    raised: scheme.surfaceContainerHighest,
    ink: ink,
    muted: muted,
    faint: ink.withValues(alpha: 0.38),
    line: scheme.outlineVariant,
    accent: scheme.primary,
    // Status has no home in ColorScheme, so these are the one genuinely
    // hardcoded triple. Picked to read on both a light and a dark surface.
    good: const Color(0xFF2E9E5B),
    warn: const Color(0xFFB8860B),
    bad: scheme.error,
    // The `FwTypography` scale, verbatim: 16 / 12 / 13 / 12.5 / 11.5 / 10.5.
    heading: style(16, weight: FontWeight.w600),
    sectionLabel: style(
      12,
      weight: FontWeight.w600,
      color: muted,
      letterSpacing: 0.3,
    ),
    body: style(13),
    bodyStrong: style(13, weight: FontWeight.w600),
    small: style(12.5),
    caption: style(11.5, color: muted),
    micro: style(
      10.5,
      weight: FontWeight.w600,
      color: muted,
      letterSpacing: 0.2,
    ),
    // Verbatim from the reference panel (`server_plugin.dart:1859`), so a
    // payload reads the same in a descriptor tab as in the Requests tab
    // beside it.
    mono: style(12).copyWith(
      fontFamily: 'monospace',
      fontFamilyFallback: const ['Menlo', 'Consolas', 'Courier New'],
    ),
  );
}