setThemeData method

ThemeData? setThemeData(
  1. BuildContext context
)

Assigning the Material theme

Implementation

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

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

  // If not explicitly provided by the user
  if (themeData == null) {
    // possibly Cupertino can provide
    final cupertinoThemeData = _iOSTheme ?? oniOSTheme() ?? App.iOSThemeData;

    if (cupertinoThemeData == null) {
      // The original theme
      App.themeData ??= ThemeData.fallback(useMaterial3: false);
    } else {
      // Cupertino values
      App.themeData = cupertinoThemeData;
    }
    themeData = App.themeData;
  } else {
    App.themeData = themeData;
  }
  return themeData;
}