testTheme function

MantleTheme testTheme({
  1. MantleColors? colors,
  2. MantleIcons? icons,
  3. MantleTypography? typography,
  4. MantleSpacing? spacing,
  5. MantleRadius? radius,
  6. MantleShadow? shadows,
  7. MantleBreakpoint? breakpoints,
  8. DelegateRegistry? components,
  9. ComponentDefaults? componentDefaults,
  10. String? debugName,
  11. String? primaryColor,
  12. MantleShade? primaryShade,
  13. MantleSize? defaultRadius,
  14. MantleGradient? defaultGradient,
  15. MantleTheme? baseline,
})

Compact theme for tests. Includes blue, red, and gray palettes.

Implementation

MantleTheme testTheme({
  MantleColors? colors,
  MantleIcons? icons,
  MantleTypography? typography,
  MantleSpacing? spacing,
  MantleRadius? radius,
  MantleShadow? shadows,
  MantleBreakpoint? breakpoints,
  DelegateRegistry? components,
  ComponentDefaults? componentDefaults,
  String? debugName,
  String? primaryColor,
  MantleShade? primaryShade,
  MantleSize? defaultRadius,
  MantleGradient? defaultGradient,
  MantleTheme? baseline,
}) {
  final theme = MantleTheme(
    colors:
        colors ??
        MantleColors({
          'blue': mantleTestPalette(0),
          'red': mantleTestPalette(200),
          'gray': mantleTestPalette(120),
        }),
    icons: icons ?? const MantleIcons.empty(),
    typography: typography ?? const MantleTypography.empty(),
    spacing: spacing ?? const MantleSpacing.empty(),
    radius: radius ?? MantleRadius(const {'sm': 4, 'md': 8, 'lg': 16}),
    shadows: shadows ?? const MantleShadow.empty(),
    breakpoints: breakpoints ?? const MantleBreakpoint.empty(),
    components: components ?? const DelegateRegistry.empty(),
    componentDefaults: componentDefaults ?? const ComponentDefaults.empty(),
    debugName: debugName,
    primaryColor: primaryColor ?? 'blue',
    primaryShade: primaryShade,
    defaultRadius: defaultRadius ?? 'md',
    defaultGradient: defaultGradient,
  );
  return baseline == null ? theme : theme.bindBaseline(baseline);
}