Remove deprecated backgroundColor from ThemeData (#144079)
This PR is to remove deprecated ThemeData.backgroundColor. These parameters are made obsolete in https://github.com/flutter/flutter/pull/110162. Part of https://github.com/flutter/flutter/issues/143956
This commit is contained in:
@@ -372,11 +372,6 @@ class ThemeData with Diagnosticable {
|
||||
'This feature was deprecated after v3.3.0-0.5.pre.',
|
||||
)
|
||||
Color? errorColor,
|
||||
@Deprecated(
|
||||
'Use colorScheme.background instead. '
|
||||
'This feature was deprecated after v3.3.0-0.5.pre.',
|
||||
)
|
||||
Color? backgroundColor,
|
||||
}) {
|
||||
// GENERAL CONFIGURATION
|
||||
cupertinoOverrideTheme = cupertinoOverrideTheme?.noDefault();
|
||||
@@ -431,7 +426,6 @@ class ThemeData with Diagnosticable {
|
||||
scaffoldBackgroundColor ??= colorScheme.background;
|
||||
cardColor ??= colorScheme.surface;
|
||||
dividerColor ??= colorScheme.outline;
|
||||
backgroundColor ??= colorScheme.background;
|
||||
dialogBackgroundColor ??= colorScheme.background;
|
||||
indicatorColor ??= onPrimarySurfaceColor;
|
||||
errorColor ??= colorScheme.error;
|
||||
@@ -554,8 +548,6 @@ class ThemeData with Diagnosticable {
|
||||
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
errorColor ??= Colors.red[700]!;
|
||||
backgroundColor ??= isDark ? Colors.grey[700]! : primarySwatch[200]!;
|
||||
|
||||
return ThemeData.raw(
|
||||
// For the sanity of the reader, make sure these properties are in the same
|
||||
// order in every place that they are separated by section comments (e.g.
|
||||
@@ -650,7 +642,6 @@ class ThemeData with Diagnosticable {
|
||||
tooltipTheme: tooltipTheme,
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
errorColor: errorColor,
|
||||
backgroundColor: backgroundColor,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -762,19 +753,12 @@ class ThemeData with Diagnosticable {
|
||||
'This feature was deprecated after v3.3.0-0.5.pre.',
|
||||
)
|
||||
Color? errorColor,
|
||||
@Deprecated(
|
||||
'Use colorScheme.background instead. '
|
||||
'This feature was deprecated after v3.3.0-0.5.pre.',
|
||||
)
|
||||
Color? backgroundColor,
|
||||
|
||||
}) : // DEPRECATED (newest deprecations at the bottom)
|
||||
// should not be `required`, use getter pattern to avoid breakages.
|
||||
_errorColor = errorColor,
|
||||
_backgroundColor = backgroundColor,
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
assert(errorColor != null),
|
||||
assert(backgroundColor != null);
|
||||
assert(errorColor != null);
|
||||
|
||||
/// Create a [ThemeData] based on the colors in the given [colorScheme] and
|
||||
/// text styles of the optional [textTheme].
|
||||
@@ -821,7 +805,6 @@ class ThemeData with Diagnosticable {
|
||||
scaffoldBackgroundColor: colorScheme.background,
|
||||
cardColor: colorScheme.surface,
|
||||
dividerColor: colorScheme.onSurface.withOpacity(0.12),
|
||||
backgroundColor: colorScheme.background,
|
||||
dialogBackgroundColor: colorScheme.background,
|
||||
indicatorColor: onPrimarySurfaceColor,
|
||||
errorColor: colorScheme.error,
|
||||
@@ -1442,15 +1425,6 @@ class ThemeData with Diagnosticable {
|
||||
Color get errorColor => _errorColor!;
|
||||
final Color? _errorColor;
|
||||
|
||||
/// Obsolete property that was unused by the framework.
|
||||
/// Use [ColorScheme.background] instead.
|
||||
@Deprecated(
|
||||
'Use colorScheme.background instead. '
|
||||
'This feature was deprecated after v3.3.0-0.5.pre.',
|
||||
)
|
||||
Color get backgroundColor => _backgroundColor!;
|
||||
final Color? _backgroundColor;
|
||||
|
||||
/// Creates a copy of this theme but with the given fields replaced with the new values.
|
||||
///
|
||||
/// The [brightness] value is applied to the [colorScheme].
|
||||
@@ -1555,11 +1529,6 @@ class ThemeData with Diagnosticable {
|
||||
'This feature was deprecated after v3.3.0-0.5.pre.',
|
||||
)
|
||||
Color? errorColor,
|
||||
@Deprecated(
|
||||
'Use colorScheme.background instead. '
|
||||
'This feature was deprecated after v3.3.0-0.5.pre.',
|
||||
)
|
||||
Color? backgroundColor,
|
||||
@Deprecated(
|
||||
'Use a ThemeData constructor (.from, .light, or .dark) instead. '
|
||||
'These constructors all have a useMaterial3 argument, '
|
||||
@@ -1666,7 +1635,6 @@ class ThemeData with Diagnosticable {
|
||||
tooltipTheme: tooltipTheme ?? this.tooltipTheme,
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
errorColor: errorColor ?? _errorColor,
|
||||
backgroundColor: backgroundColor ?? _backgroundColor,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1862,7 +1830,6 @@ class ThemeData with Diagnosticable {
|
||||
tooltipTheme: TooltipThemeData.lerp(a.tooltipTheme, b.tooltipTheme, t)!,
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
errorColor: Color.lerp(a.errorColor, b.errorColor, t),
|
||||
backgroundColor: Color.lerp(a.backgroundColor, b.backgroundColor, t),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1964,8 +1931,7 @@ class ThemeData with Diagnosticable {
|
||||
other.toggleButtonsTheme == toggleButtonsTheme &&
|
||||
other.tooltipTheme == tooltipTheme &&
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
other.errorColor == errorColor &&
|
||||
other.backgroundColor == backgroundColor;
|
||||
other.errorColor == errorColor;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -2066,7 +2032,6 @@ class ThemeData with Diagnosticable {
|
||||
tooltipTheme,
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
errorColor,
|
||||
backgroundColor,
|
||||
];
|
||||
return Object.hashAll(values);
|
||||
}
|
||||
@@ -2168,7 +2133,6 @@ class ThemeData with Diagnosticable {
|
||||
properties.add(DiagnosticsProperty<TooltipThemeData>('tooltipTheme', tooltipTheme, level: DiagnosticLevel.debug));
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
properties.add(ColorProperty('errorColor', errorColor, defaultValue: defaultData.errorColor, level: DiagnosticLevel.debug));
|
||||
properties.add(ColorProperty('backgroundColor', backgroundColor, defaultValue: defaultData.backgroundColor, level: DiagnosticLevel.debug));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user