Skip to content

Commit

Permalink
Fix some deprecation details (flutter#136385)
Browse files Browse the repository at this point in the history
This fixes/notates a few deprecations from an audit for the next tech debt cycle.

- ThemeData errorColor and backgroundColor are notated as deprecated in multiple places, but one usage had a different version tag. Updated to match the rest.
- ThemeData.copyWith useMaterial3 was deprecated because it did not do what developers expected - it did not automatically reassign all of the color values and such. (confirmed with @HansMuller) I added a note so that when we later remove it we don't introduce a bug.
- the describeEnum deprecation was tagged wrong, it was a very long PR so by the time it merged the version it was finally tagged with was much later. (flutter#125016)
  • Loading branch information
Piinks committed Oct 11, 2023
1 parent 9a8a2c7 commit 156e348
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/foundation/diagnostics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2948,7 +2948,7 @@ String describeIdentity(Object? object) => '${objectRuntimeType(object, '<optimi
/// {@end-tool}
@Deprecated(
'Use the `name` getter on enums instead. '
'This feature was deprecated after v3.10.0-1.1.pre.'
'This feature was deprecated after v3.14.0-2.0.pre.'
)
String describeEnum(Object enumEntry) {
if (enumEntry is Enum) {
Expand Down
6 changes: 4 additions & 2 deletions packages/flutter/lib/src/material/theme_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1584,12 +1584,12 @@ class ThemeData with Diagnosticable {
Color? selectedRowColor,
@Deprecated(
'Use colorScheme.error instead. '
'This feature was deprecated after v2.6.0-11.0.pre.',
'This feature was deprecated after v3.3.0-0.5.pre.',
)
Color? errorColor,
@Deprecated(
'Use colorScheme.background instead. '
'This feature was deprecated after v2.6.0-11.0.pre.',
'This feature was deprecated after v3.3.0-0.5.pre.',
)
Color? backgroundColor,
@Deprecated(
Expand Down Expand Up @@ -1623,6 +1623,8 @@ class ThemeData with Diagnosticable {
platform: platform ?? this.platform,
scrollbarTheme: scrollbarTheme ?? this.scrollbarTheme,
splashFactory: splashFactory ?? this.splashFactory,
// When deprecated useMaterial3 removed, maintain `this.useMaterial3` here
// for == evaluation.
useMaterial3: useMaterial3 ?? this.useMaterial3,
visualDensity: visualDensity ?? this.visualDensity,
// COLOR
Expand Down

0 comments on commit 156e348

Please sign in to comment.