getThemeData method

CupertinoThemeData getThemeData(
  1. BuildContext context,
  2. String initialAppearance,
  3. String initialColor
)

Implementation

CupertinoThemeData getThemeData(
    BuildContext context, String initialAppearance, String initialColor) {
  String appearance = "";

  if (appearanceConfig == "") {
    appearanceConfig = initialAppearance;
  }

  if (colorConfig == "") {
    colorConfig = initialColor;
  }

  // Set accent color
  initColors(colorConfig);
  CupertinoThemeData baseTheme =
      CupertinoThemeData(primaryColor: systemColors[colorConfig]);

  appearance =
      setAppearanceConfig(context, type: appearanceConfig, notify: false);

  // Set light/dark appearance colors and return theme
  if (appearance == "light") {
    return baseTheme.copyWith(
        brightness: Brightness.light, scaffoldBackgroundColor: background);
  } else {
    return baseTheme.copyWith(
        brightness: Brightness.dark, scaffoldBackgroundColor: background);
  }
}