setThemeData method

ThemeData? setThemeData(
  1. BuildContext context
)

Assigning the Material theme

Implementation

ThemeData? setThemeData(BuildContext context) {
  //
  ThemeData? themeData = _theme ?? onTheme(context);

  if (_allowChangeTheme) {
    // If a saved preference
    final theme = v.App.themeData;
    if (theme != null) {
      themeData = theme;
    }
  }

  // If not explicitly provided by the user
  if (themeData == null) {
    // If running in the Apple platform
    if (UniversalPlatform.isApple) {
      // possibly Cupertino can provide
      final cupertinoThemeData =
          _iOSTheme ?? oniOSTheme() ?? v.App.iOSThemeData;
      if (cupertinoThemeData != null) {
        // Cupertino converted to ThemeData
        v.App.themeData = cupertinoThemeData;
        // Convert back
        themeData = v.App.themeData;
      }
    }
    // The original theme
    themeData ??= ThemeData.fallback();
  }

  v.App.themeData = themeData;

  return themeData;
}