getThemeValuesFromPreferences method

Future<void> getThemeValuesFromPreferences()

Retrieves the theme values from the shared preferences.

Implementation

Future<void> getThemeValuesFromPreferences() async {
  final ZetaThemeServiceData themeServiceData = await widget.themeService.loadTheme();

  // Set the initial theme mode.
  _themeMode = themeServiceData.themeMode ?? widget.initialThemeMode ?? ThemeMode.system;

  // Set the initial contrast.
  _contrast = themeServiceData.contrast ?? widget.initialContrast ?? ZetaContrast.aa;

  final loadedTheme = _customThemes[themeServiceData.themeId ?? widget.initialTheme];

  if (loadedTheme != null) {
    _customTheme = loadedTheme;
  }

  // Ensure this is only triggered once.
  _gotTheme = true;
}