mirror of
https://github.com/flutter/flutter
synced 2024-07-16 10:29:14 +00:00
Remove deprecated errorColor
from ThemeData
(#144078)
This PR is to remove deprecated `ThemeData.errorColor`. 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:
parent
cc33f44e41
commit
f38c5ad441
|
@ -366,12 +366,6 @@ class ThemeData with Diagnosticable {
|
|||
TimePickerThemeData? timePickerTheme,
|
||||
ToggleButtonsThemeData? toggleButtonsTheme,
|
||||
TooltipThemeData? tooltipTheme,
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
@Deprecated(
|
||||
'Use colorScheme.error instead. '
|
||||
'This feature was deprecated after v3.3.0-0.5.pre.',
|
||||
)
|
||||
Color? errorColor,
|
||||
}) {
|
||||
// GENERAL CONFIGURATION
|
||||
cupertinoOverrideTheme = cupertinoOverrideTheme?.noDefault();
|
||||
|
@ -428,7 +422,6 @@ class ThemeData with Diagnosticable {
|
|||
dividerColor ??= colorScheme.outline;
|
||||
dialogBackgroundColor ??= colorScheme.background;
|
||||
indicatorColor ??= onPrimarySurfaceColor;
|
||||
errorColor ??= colorScheme.error;
|
||||
applyElevationOverlayColor ??= brightness == Brightness.dark;
|
||||
}
|
||||
applyElevationOverlayColor ??= false;
|
||||
|
@ -545,9 +538,6 @@ class ThemeData with Diagnosticable {
|
|||
timePickerTheme ??= const TimePickerThemeData();
|
||||
toggleButtonsTheme ??= const ToggleButtonsThemeData();
|
||||
tooltipTheme ??= const TooltipThemeData();
|
||||
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
errorColor ??= Colors.red[700]!;
|
||||
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.
|
||||
|
@ -640,8 +630,6 @@ class ThemeData with Diagnosticable {
|
|||
timePickerTheme: timePickerTheme,
|
||||
toggleButtonsTheme: toggleButtonsTheme,
|
||||
tooltipTheme: tooltipTheme,
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
errorColor: errorColor,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -747,18 +735,7 @@ class ThemeData with Diagnosticable {
|
|||
required this.timePickerTheme,
|
||||
required this.toggleButtonsTheme,
|
||||
required this.tooltipTheme,
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
@Deprecated(
|
||||
'Use colorScheme.error instead. '
|
||||
'This feature was deprecated after v3.3.0-0.5.pre.',
|
||||
)
|
||||
Color? errorColor,
|
||||
|
||||
}) : // DEPRECATED (newest deprecations at the bottom)
|
||||
// should not be `required`, use getter pattern to avoid breakages.
|
||||
_errorColor = errorColor,
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
assert(errorColor != null);
|
||||
});
|
||||
|
||||
/// Create a [ThemeData] based on the colors in the given [colorScheme] and
|
||||
/// text styles of the optional [textTheme].
|
||||
|
@ -807,7 +784,6 @@ class ThemeData with Diagnosticable {
|
|||
dividerColor: colorScheme.onSurface.withOpacity(0.12),
|
||||
dialogBackgroundColor: colorScheme.background,
|
||||
indicatorColor: onPrimarySurfaceColor,
|
||||
errorColor: colorScheme.error,
|
||||
textTheme: textTheme,
|
||||
applyElevationOverlayColor: isDark,
|
||||
useMaterial3: useMaterial3,
|
||||
|
@ -1414,17 +1390,6 @@ class ThemeData with Diagnosticable {
|
|||
/// This is the value returned from [TooltipTheme.of].
|
||||
final TooltipThemeData tooltipTheme;
|
||||
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
|
||||
/// Obsolete property that was used for input validation errors, e.g. in
|
||||
/// [TextField] fields. Use [ColorScheme.error] instead.
|
||||
@Deprecated(
|
||||
'Use colorScheme.error instead. '
|
||||
'This feature was deprecated after v3.3.0-0.5.pre.',
|
||||
)
|
||||
Color get errorColor => _errorColor!;
|
||||
final Color? _errorColor;
|
||||
|
||||
/// Creates a copy of this theme but with the given fields replaced with the new values.
|
||||
///
|
||||
/// The [brightness] value is applied to the [colorScheme].
|
||||
|
@ -1524,11 +1489,6 @@ class ThemeData with Diagnosticable {
|
|||
ToggleButtonsThemeData? toggleButtonsTheme,
|
||||
TooltipThemeData? tooltipTheme,
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
@Deprecated(
|
||||
'Use colorScheme.error instead. '
|
||||
'This feature was deprecated after v3.3.0-0.5.pre.',
|
||||
)
|
||||
Color? errorColor,
|
||||
@Deprecated(
|
||||
'Use a ThemeData constructor (.from, .light, or .dark) instead. '
|
||||
'These constructors all have a useMaterial3 argument, '
|
||||
|
@ -1633,8 +1593,6 @@ class ThemeData with Diagnosticable {
|
|||
timePickerTheme: timePickerTheme ?? this.timePickerTheme,
|
||||
toggleButtonsTheme: toggleButtonsTheme ?? this.toggleButtonsTheme,
|
||||
tooltipTheme: tooltipTheme ?? this.tooltipTheme,
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
errorColor: errorColor ?? _errorColor,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1828,8 +1786,6 @@ class ThemeData with Diagnosticable {
|
|||
timePickerTheme: TimePickerThemeData.lerp(a.timePickerTheme, b.timePickerTheme, t),
|
||||
toggleButtonsTheme: ToggleButtonsThemeData.lerp(a.toggleButtonsTheme, b.toggleButtonsTheme, t)!,
|
||||
tooltipTheme: TooltipThemeData.lerp(a.tooltipTheme, b.tooltipTheme, t)!,
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
errorColor: Color.lerp(a.errorColor, b.errorColor, t),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1929,9 +1885,7 @@ class ThemeData with Diagnosticable {
|
|||
other.textSelectionTheme == textSelectionTheme &&
|
||||
other.timePickerTheme == timePickerTheme &&
|
||||
other.toggleButtonsTheme == toggleButtonsTheme &&
|
||||
other.tooltipTheme == tooltipTheme &&
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
other.errorColor == errorColor;
|
||||
other.tooltipTheme == tooltipTheme;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -2030,8 +1984,6 @@ class ThemeData with Diagnosticable {
|
|||
timePickerTheme,
|
||||
toggleButtonsTheme,
|
||||
tooltipTheme,
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
errorColor,
|
||||
];
|
||||
return Object.hashAll(values);
|
||||
}
|
||||
|
@ -2131,8 +2083,6 @@ class ThemeData with Diagnosticable {
|
|||
properties.add(DiagnosticsProperty<TimePickerThemeData>('timePickerTheme', timePickerTheme, defaultValue: defaultData.timePickerTheme, level: DiagnosticLevel.debug));
|
||||
properties.add(DiagnosticsProperty<ToggleButtonsThemeData>('toggleButtonsTheme', toggleButtonsTheme, level: DiagnosticLevel.debug));
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -640,7 +640,6 @@ void main() {
|
|||
dialogBackgroundColor: Colors.black,
|
||||
indicatorColor: Colors.black,
|
||||
hintColor: Colors.black,
|
||||
errorColor: Colors.black,
|
||||
textTheme: ThemeData.dark().textTheme,
|
||||
primaryTextTheme: ThemeData.dark().textTheme,
|
||||
inputDecorationTheme: ThemeData.dark().inputDecorationTheme.copyWith(border: const OutlineInputBorder()),
|
||||
|
|
|
@ -196,7 +196,6 @@ void main() {
|
|||
expect(theme.dividerColor, theme.colorScheme.outline);
|
||||
expect(theme.dialogBackgroundColor, theme.colorScheme.background);
|
||||
expect(theme.indicatorColor, theme.colorScheme.onPrimary);
|
||||
expect(theme.errorColor, theme.colorScheme.error);
|
||||
expect(theme.applyElevationOverlayColor, false);
|
||||
});
|
||||
|
||||
|
@ -264,7 +263,6 @@ void main() {
|
|||
expect(theme.dividerColor, theme.colorScheme.outline);
|
||||
expect(theme.dialogBackgroundColor, theme.colorScheme.background);
|
||||
expect(theme.indicatorColor, theme.colorScheme.onSurface);
|
||||
expect(theme.errorColor, theme.colorScheme.error);
|
||||
expect(theme.applyElevationOverlayColor, true);
|
||||
});
|
||||
|
||||
|
@ -327,7 +325,6 @@ void main() {
|
|||
expect(theme.dividerColor, theme.colorScheme.outline);
|
||||
expect(theme.dialogBackgroundColor, theme.colorScheme.background);
|
||||
expect(theme.indicatorColor, theme.colorScheme.onPrimary);
|
||||
expect(theme.errorColor, theme.colorScheme.error);
|
||||
expect(theme.applyElevationOverlayColor, false);
|
||||
});
|
||||
|
||||
|
@ -391,7 +388,6 @@ void main() {
|
|||
expect(theme.dividerColor, theme.colorScheme.outline);
|
||||
expect(theme.dialogBackgroundColor, theme.colorScheme.background);
|
||||
expect(theme.indicatorColor, theme.colorScheme.onPrimary);
|
||||
expect(theme.errorColor, theme.colorScheme.error);
|
||||
expect(theme.applyElevationOverlayColor, false);
|
||||
});
|
||||
|
||||
|
@ -454,7 +450,6 @@ void main() {
|
|||
expect(theme.dividerColor, theme.colorScheme.outline);
|
||||
expect(theme.dialogBackgroundColor, theme.colorScheme.background);
|
||||
expect(theme.indicatorColor, theme.colorScheme.onSurface);
|
||||
expect(theme.errorColor, theme.colorScheme.error);
|
||||
expect(theme.applyElevationOverlayColor, true);
|
||||
});
|
||||
|
||||
|
@ -468,7 +463,6 @@ void main() {
|
|||
expect(theme.canvasColor, equals(lightColors.background));
|
||||
expect(theme.scaffoldBackgroundColor, equals(lightColors.background));
|
||||
expect(theme.dialogBackgroundColor, equals(lightColors.background));
|
||||
expect(theme.errorColor, equals(lightColors.error));
|
||||
expect(theme.applyElevationOverlayColor, isFalse);
|
||||
});
|
||||
|
||||
|
@ -483,7 +477,6 @@ void main() {
|
|||
expect(theme.canvasColor, equals(darkColors.background));
|
||||
expect(theme.scaffoldBackgroundColor, equals(darkColors.background));
|
||||
expect(theme.dialogBackgroundColor, equals(darkColors.background));
|
||||
expect(theme.errorColor, equals(darkColors.error));
|
||||
expect(theme.applyElevationOverlayColor, isTrue);
|
||||
});
|
||||
|
||||
|
@ -894,8 +887,6 @@ void main() {
|
|||
timePickerTheme: const TimePickerThemeData(backgroundColor: Colors.black),
|
||||
toggleButtonsTheme: const ToggleButtonsThemeData(textStyle: TextStyle(color: Colors.black)),
|
||||
tooltipTheme: const TooltipThemeData(height: 100),
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
errorColor: Colors.black,
|
||||
);
|
||||
|
||||
final SliderThemeData otherSliderTheme = SliderThemeData.fromPrimaryColors(
|
||||
|
@ -1010,9 +1001,6 @@ void main() {
|
|||
timePickerTheme: const TimePickerThemeData(backgroundColor: Colors.white),
|
||||
toggleButtonsTheme: const ToggleButtonsThemeData(textStyle: TextStyle(color: Colors.white)),
|
||||
tooltipTheme: const TooltipThemeData(height: 100),
|
||||
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
errorColor: Colors.white,
|
||||
);
|
||||
|
||||
final ThemeData themeDataCopy = theme.copyWith(
|
||||
|
@ -1108,9 +1096,6 @@ void main() {
|
|||
timePickerTheme: otherTheme.timePickerTheme,
|
||||
toggleButtonsTheme: otherTheme.toggleButtonsTheme,
|
||||
tooltipTheme: otherTheme.tooltipTheme,
|
||||
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
errorColor: otherTheme.errorColor,
|
||||
);
|
||||
|
||||
// For the sanity of the reader, make sure these properties are in the same
|
||||
|
@ -1207,9 +1192,6 @@ void main() {
|
|||
expect(themeDataCopy.timePickerTheme, equals(otherTheme.timePickerTheme));
|
||||
expect(themeDataCopy.toggleButtonsTheme, equals(otherTheme.toggleButtonsTheme));
|
||||
expect(themeDataCopy.tooltipTheme, equals(otherTheme.tooltipTheme));
|
||||
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
expect(themeDataCopy.errorColor, equals(otherTheme.errorColor));
|
||||
});
|
||||
|
||||
testWidgets('ThemeData.toString has less than 200 characters output', (WidgetTester tester) async {
|
||||
|
@ -1244,7 +1226,6 @@ void main() {
|
|||
expect(theme.canvasColor, equals(lightColors.background));
|
||||
expect(theme.scaffoldBackgroundColor, equals(lightColors.background));
|
||||
expect(theme.dialogBackgroundColor, equals(lightColors.background));
|
||||
expect(theme.errorColor, equals(lightColors.error));
|
||||
expect(theme.applyElevationOverlayColor, isFalse);
|
||||
});
|
||||
|
||||
|
@ -1337,8 +1318,6 @@ void main() {
|
|||
'timePickerTheme',
|
||||
'toggleButtonsTheme',
|
||||
'tooltipTheme',
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
'errorColor',
|
||||
};
|
||||
|
||||
final DiagnosticPropertiesBuilder properties = DiagnosticPropertiesBuilder();
|
||||
|
|
Loading…
Reference in a new issue