ZdsThemeService constructor

ZdsThemeService(
  1. {required SharedPreferences preferences,
  2. String? assetPath}
)

Creates an instance of ZdsThemeService.

Throws an ArgumentError if assetPath or preferences is null.

The optional assetPath parameter defines the path to theme assets.

  • This asset path should point to a valid json file.
  • The JSON string should conform to the structure of ZdsThemeData. Example: { "identifier": "default", "themeMode": "system", // Possible values "dark", "light", "system" "contrast": "aa", // Possible values "aa", "aaa" "fontFamily": "packages/zeta_flutter/IBMPlexSans", "adjustAccessibility": true, "light": { "appBarStyle": "primary", // Possible values "surface", "background", "secondary", "primary" "primary": "#0073e6", "secondary": "#0073e6", "error": "#D70015" }, "dark": { "appBarStyle": "surface", // Possible values "surface", "background", "secondary", "primary" "primary": "#0073e6", "secondary": "#0073e6", "error": "#D70015" } The preferences parameter manages local storage for user settings.

Implementation

ZdsThemeService