copyWith method
- {ZetaThemeData? themeData,
- ThemeMode? themeMode,
- ZetaAppBarStyle? darkAppBarStyle,
- ZetaAppBarStyle? lightAppBarStyle,
- ZetaContrast? contrast,
- bool? adjustAccessibility}
Creates a copy of this ZdsThemeData but with the given fields replaced with the new values.
themeData
(optional): The ZetaThemeData that is paired with ZdsThemeData.
This is the raw ThemeData instance that is used to construct the ZdsThemeData object.
themeMode
(optional): Specifies the mode of the theme - light, dark etc. If a themeMode
is not provided, it will default to the current ZdsThemeData theme mode.
darkAppBarStyle
(optional): Defines the style of the app bar in dark theme. If not provided,
it will use the existing style from this ZdsThemeData for the dark app bar style.
lightAppBarStyle
(optional): Same as darkAppBarStyle
, but for light theme.
contrast
(optional): Specifies the contrast level for the theme. If not provided,
it defaults to the current contrast level of this ZdsThemeData instance.
adjustAccessibility
(optional): Boolean value that controls whether to adjust the accessibility
options depending on the theme contrast. If not provided, it will preserve the original value
of adjustAccessibility
from this ZdsThemeData instance.
Returns a new ZdsThemeData instance.
Implementation
ZdsThemeData copyWith({
ZetaThemeData? themeData,
ThemeMode? themeMode,
ZetaAppBarStyle? darkAppBarStyle,
ZetaAppBarStyle? lightAppBarStyle,
ZetaContrast? contrast,
bool? adjustAccessibility,
}) {
var lightColors = _lightColors;
var darkColors = _darkColors;
if (themeData != null) {
lightColors = _ZdsBaseColors(
primary: themeData.colorsLight.primary.shade60,
secondary: themeData.colorsLight.secondary.shade60,
error: themeData.colorsLight.error.shade60,
);
darkColors = _ZdsBaseColors(
primary: themeData.colorsLight.primary.shade50,
secondary: themeData.colorsLight.secondary.shade50,
error: themeData.colorsLight.error.shade50,
);
}
return ZdsThemeData._(
lightColors: lightColors,
darkColors: darkColors,
themeData: themeData ?? this.themeData,
themeMode: themeMode ?? this.themeMode,
darkAppBarStyle: darkAppBarStyle ?? this.darkAppBarStyle,
lightAppBarStyle: lightAppBarStyle ?? this.lightAppBarStyle,
contrast: contrast ?? this.contrast,
adjustAccessibility: adjustAccessibility ?? this.adjustAccessibility,
);
}