copyWith method Null safety

  1. @override
MaterialBasedCupertinoThemeData copyWith(
  1. {Brightness? brightness,
  2. Color? primaryColor,
  3. Color? primaryContrastingColor,
  4. CupertinoTextThemeData? textTheme,
  5. Color? barBackgroundColor,
  6. Color? scaffoldBackgroundColor}
)
override

Copies the ThemeData's cupertinoOverrideTheme.

Only the specified override attributes of the ThemeData's cupertinoOverrideTheme and the newly specified parameters are in the returned CupertinoThemeData. No derived attributes from iOS defaults or from cascaded Material theme attributes are copied.

MaterialBasedCupertinoThemeData.copyWith cannot change the base Material ThemeData. To change the base Material ThemeData, create a new Material Theme and use copyWith on the Material ThemeData instead.

Implementation

@override
MaterialBasedCupertinoThemeData copyWith({
  Brightness? brightness,
  Color? primaryColor,
  Color? primaryContrastingColor,
  CupertinoTextThemeData? textTheme,
  Color? barBackgroundColor,
  Color? scaffoldBackgroundColor,
}) {
  return MaterialBasedCupertinoThemeData._(
    _materialTheme,
    _cupertinoOverrideTheme.copyWith(
      brightness: brightness,
      primaryColor: primaryColor,
      primaryContrastingColor: primaryContrastingColor,
      textTheme: textTheme,
      barBackgroundColor: barBackgroundColor,
      scaffoldBackgroundColor: scaffoldBackgroundColor,
    ),
  );
}