getThemeData method
CupertinoThemeData
getThemeData(
- BuildContext context,
- String initialAppearance,
- 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);
}
}