ZdsThemeData.defaultData constructor

ZdsThemeData.defaultData()

Creates a default ZdsThemeData instance with predefined settings.

This factory constructor initializes a ZdsThemeData object with a set of default values. It is useful for creating a standard theme data configuration that can be used across the app when specific customizations are not required.

The default settings include:

  • A primary and secondary color set to blue.
  • An error color set to red.
  • The theme mode set to the system's default.
  • Default styles for both dark and light app bar styles.
  • A default contrast level.
  • Accessibility adjustments set to false.
  • The same color settings applied for both light and dark themes.

Implementation

factory ZdsThemeData.defaultData() {
  // Initialize base colors with default primary, secondary, and error colors.
  final baseColors = _ZdsBaseColors(
    primary: ZetaColorBase.blue, // Default primary color set to blue.
    secondary: ZetaColorBase.blue, // Default secondary color set to blue.
    error: ZetaColorBase.red, // Default error color set to red.
  );

  // Return a new instance of ZdsThemeData with default settings.
  return ZdsThemeData._(
    themeData: ZetaThemeData(),
    // Initialize with default ZetaThemeData.
    themeMode: ThemeMode.system,
    // Use system default theme mode.
    darkAppBarStyle: ZetaAppBarStyle.surface,
    // Default style for dark app bar.
    lightAppBarStyle: ZetaAppBarStyle.primary,
    // Default style for light app bar.
    contrast: ZetaContrast.aa,
    // Set default contrast level.
    adjustAccessibility: false,
    // Accessibility adjustments are turned off by default.
    lightColors: baseColors,
    // Apply the base colors to light theme.
    darkColors: baseColors, // Apply the same base colors to dark theme.
  );
}