setThemeData method

ThemeData? setThemeData(
  1. BuildContext context
)

Assigning the Material theme

Implementation

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

  // todo: Fluttery
  // if (_allowChangeTheme) {
  // If a saved preference
  final theme = _AppState.appObj.themeData;
  if (theme != null) {
    themeData = theme;
  }
  // }

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

  _AppState.appObj.themeData = themeData;

  return themeData;
}