Theme constructor

Theme({
  1. WaveAppBarTheme? appBarTheme,
  2. ColorScheme? colorScheme,
  3. TextTheme? textTheme,
  4. ButtonTheme? buttonTheme,
})

Creates a Theme.

If any parameter is omitted, a default value is used.

Implementation

factory Theme({
  WaveAppBarTheme? appBarTheme,
  ColorScheme? colorScheme,
  TextTheme? textTheme,
  ButtonTheme? buttonTheme,
}) {
  colorScheme ??= ColorScheme.light();
  textTheme ??= TextTheme().apply(color: colorScheme.textPrimary);
  appBarTheme ??= WaveAppBarTheme(
    backgroundColor: colorScheme.surfacePrimary,
    foregroundColor: colorScheme.textPrimary,
    titleStyle: textTheme.h6,
  );

  buttonTheme ??= ButtonTheme(
    primaryButton: ButtonTypeTheme(
      labelStyle: textTheme.h6.copyWith(color: colorScheme.onBrandPrimary),
      iconTheme: IconThemeData(size: 20, color: colorScheme.onBrandPrimary),
      backgroundColor: colorScheme.brandPrimary,
      borderColor: colorScheme.brandPrimary.darkerShade(0.05),
    ),
    secondaryButton: ButtonTypeTheme(
      labelStyle: textTheme.h6.copyWith(color: colorScheme.onBrandSecondary),
      iconTheme: IconThemeData(size: 20, color: colorScheme.onBrandSecondary),
      backgroundColor: colorScheme.brandSecondary,
    ),
    ghostButton: ButtonTypeTheme(
      labelStyle: textTheme.h6.copyWith(color: colorScheme.textPrimary),
      iconTheme: IconThemeData(size: 20, color: colorScheme.textPrimary),
      backgroundColor: colorScheme.surfacePrimary,
    ),
    outlineButton: ButtonTypeTheme(
      labelStyle: textTheme.h6.copyWith(color: colorScheme.textPrimary),
      iconTheme: IconThemeData(size: 20, color: colorScheme.textPrimary),
      backgroundColor: colorScheme.surfacePrimary,
      borderColor: colorScheme.outlineStandard,
    ),
    destructiveButton: ButtonTypeTheme(
      labelStyle: textTheme.h6.copyWith(color: colorScheme.onBrandPrimary),
      iconTheme: IconThemeData(size: 20, color: colorScheme.onBrandPrimary),
      backgroundColor: colorScheme.statusError,
      borderColor: colorScheme.statusError.darkerShade(0.05),
    ),
    tertiaryButton: ButtonTypeTheme(
      labelStyle: textTheme.h6.copyWith(color: colorScheme.onBrandTertiary),
      iconTheme: IconThemeData(size: 20, color: colorScheme.onBrandTertiary),
      backgroundColor: colorScheme.brandTertiary,
      borderColor: colorScheme.brandTertiary.darkerShade(0.05),
    ),
  );
  return Theme._internal(
    appBarTheme: appBarTheme,
    colorScheme: colorScheme,
    textTheme: textTheme,
    buttonTheme: buttonTheme,
  );
}