Skip to content

Commit 7bacc25

Browse files
authored
Remove accentColorBrightness usage (#120577)
1 parent 0792c27 commit 7bacc25

File tree

2 files changed

+0
-59
lines changed

2 files changed

+0
-59
lines changed

packages/flutter/lib/src/material/theme_data.dart

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -388,13 +388,6 @@ class ThemeData with Diagnosticable {
388388
'This feature was deprecated after v2.3.0-0.1.pre.',
389389
)
390390
Color? accentColor,
391-
@Deprecated(
392-
'No longer used by the framework, please remove any reference to it. '
393-
'For more information, consult the migration guide at '
394-
'https://flutter.dev/docs/release/breaking-changes/theme-data-accent-properties#migration-guide. '
395-
'This feature was deprecated after v2.3.0-0.1.pre.',
396-
)
397-
Brightness? accentColorBrightness,
398391
@Deprecated(
399392
'This "fix" is now enabled by default. '
400393
'This feature was deprecated after v2.5.0-1.0.pre.',
@@ -486,7 +479,6 @@ class ThemeData with Diagnosticable {
486479
primaryColorBrightness = ThemeData.estimateBrightnessForColor(primarySurfaceColor);
487480
canvasColor ??= colorScheme.background;
488481
accentColor ??= colorScheme.secondary;
489-
accentColorBrightness ??= ThemeData.estimateBrightnessForColor(colorScheme.secondary);
490482
scaffoldBackgroundColor ??= colorScheme.background;
491483
bottomAppBarColor ??= colorScheme.surface;
492484
cardColor ??= colorScheme.surface;
@@ -506,7 +498,6 @@ class ThemeData with Diagnosticable {
506498
final bool primaryIsDark = estimatedPrimaryColorBrightness == Brightness.dark;
507499
toggleableActiveColor ??= isDark ? Colors.tealAccent[200]! : (accentColor ?? primarySwatch[600]!);
508500
accentColor ??= isDark ? Colors.tealAccent[200]! : primarySwatch[500]!;
509-
accentColorBrightness ??= estimateBrightnessForColor(accentColor);
510501
focusColor ??= isDark ? Colors.white.withOpacity(0.12) : Colors.black.withOpacity(0.12);
511502
hoverColor ??= isDark ? Colors.white.withOpacity(0.04) : Colors.black.withOpacity(0.04);
512503
shadowColor ??= Colors.black;
@@ -712,7 +703,6 @@ class ThemeData with Diagnosticable {
712703
tooltipTheme: tooltipTheme,
713704
// DEPRECATED (newest deprecations at the bottom)
714705
accentColor: accentColor,
715-
accentColorBrightness: accentColorBrightness,
716706
fixTextFieldOutlineLabel: fixTextFieldOutlineLabel,
717707
primaryColorBrightness: primaryColorBrightness,
718708
androidOverscrollIndicator: androidOverscrollIndicator,
@@ -830,13 +820,6 @@ class ThemeData with Diagnosticable {
830820
'This feature was deprecated after v2.3.0-0.1.pre.',
831821
)
832822
Color? accentColor,
833-
@Deprecated(
834-
'No longer used by the framework, please remove any reference to it. '
835-
'For more information, consult the migration guide at '
836-
'https://flutter.dev/docs/release/breaking-changes/theme-data-accent-properties#migration-guide. '
837-
'This feature was deprecated after v2.3.0-0.1.pre.',
838-
)
839-
Brightness? accentColorBrightness,
840823
@Deprecated(
841824
'This "fix" is now enabled by default. '
842825
'This feature was deprecated after v2.5.0-1.0.pre.',
@@ -883,7 +866,6 @@ class ThemeData with Diagnosticable {
883866
}) : // DEPRECATED (newest deprecations at the bottom)
884867
// should not be `required`, use getter pattern to avoid breakages.
885868
_accentColor = accentColor,
886-
_accentColorBrightness = accentColorBrightness,
887869
_fixTextFieldOutlineLabel = fixTextFieldOutlineLabel,
888870
_primaryColorBrightness = primaryColorBrightness,
889871
_toggleableActiveColor = toggleableActiveColor,
@@ -894,7 +876,6 @@ class ThemeData with Diagnosticable {
894876
assert(toggleableActiveColor != null),
895877
// DEPRECATED (newest deprecations at the bottom)
896878
assert(accentColor != null),
897-
assert(accentColorBrightness != null),
898879
assert(fixTextFieldOutlineLabel != null),
899880
assert(primaryColorBrightness != null),
900881
assert(errorColor != null),
@@ -946,7 +927,6 @@ class ThemeData with Diagnosticable {
946927
primaryColorBrightness: ThemeData.estimateBrightnessForColor(primarySurfaceColor),
947928
canvasColor: colorScheme.background,
948929
accentColor: colorScheme.secondary,
949-
accentColorBrightness: ThemeData.estimateBrightnessForColor(colorScheme.secondary),
950930
scaffoldBackgroundColor: colorScheme.background,
951931
bottomAppBarColor: colorScheme.surface,
952932
cardColor: colorScheme.surface,
@@ -1572,23 +1552,6 @@ class ThemeData with Diagnosticable {
15721552
Color get accentColor => _accentColor!;
15731553
final Color? _accentColor;
15741554

1575-
/// Obsolete property that was originally used to determine the color
1576-
/// of text and icons placed on top of the accent color (e.g. the
1577-
/// icons on a floating action button).
1578-
///
1579-
/// The material library no longer uses this property. The
1580-
/// [floatingActionButtonTheme] can be used to configure
1581-
/// the appearance of [FloatingActionButton]s. The brightness
1582-
/// of any color can be found with [ThemeData.estimateBrightnessForColor].
1583-
@Deprecated(
1584-
'No longer used by the framework, please remove any reference to it. '
1585-
'For more information, consult the migration guide at '
1586-
'https://flutter.dev/docs/release/breaking-changes/theme-data-accent-properties#migration-guide. '
1587-
'This feature was deprecated after v2.3.0-0.1.pre.',
1588-
)
1589-
Brightness get accentColorBrightness => _accentColorBrightness!;
1590-
final Brightness? _accentColorBrightness;
1591-
15921555
/// An obsolete flag to allow apps to opt-out of a
15931556
/// [small fix](https://github.com/flutter/flutter/issues/54028) for the Y
15941557
/// coordinate of the floating label in a [TextField] [OutlineInputBorder].
@@ -1780,13 +1743,6 @@ class ThemeData with Diagnosticable {
17801743
'This feature was deprecated after v2.3.0-0.1.pre.',
17811744
)
17821745
Color? accentColor,
1783-
@Deprecated(
1784-
'No longer used by the framework, please remove any reference to it. '
1785-
'For more information, consult the migration guide at '
1786-
'https://flutter.dev/docs/release/breaking-changes/theme-data-accent-properties#migration-guide. '
1787-
'This feature was deprecated after v2.3.0-0.1.pre.',
1788-
)
1789-
Brightness? accentColorBrightness,
17901746
@Deprecated(
17911747
'This "fix" is now enabled by default. '
17921748
'This feature was deprecated after v2.5.0-1.0.pre.',
@@ -1921,7 +1877,6 @@ class ThemeData with Diagnosticable {
19211877
tooltipTheme: tooltipTheme ?? this.tooltipTheme,
19221878
// DEPRECATED (newest deprecations at the bottom)
19231879
accentColor: accentColor ?? _accentColor,
1924-
accentColorBrightness: accentColorBrightness ?? _accentColorBrightness,
19251880
fixTextFieldOutlineLabel: fixTextFieldOutlineLabel ?? _fixTextFieldOutlineLabel,
19261881
primaryColorBrightness: primaryColorBrightness ?? _primaryColorBrightness,
19271882
androidOverscrollIndicator: androidOverscrollIndicator ?? this.androidOverscrollIndicator,
@@ -2113,7 +2068,6 @@ class ThemeData with Diagnosticable {
21132068
tooltipTheme: TooltipThemeData.lerp(a.tooltipTheme, b.tooltipTheme, t)!,
21142069
// DEPRECATED (newest deprecations at the bottom)
21152070
accentColor: Color.lerp(a.accentColor, b.accentColor, t),
2116-
accentColorBrightness: t < 0.5 ? a.accentColorBrightness : b.accentColorBrightness,
21172071
fixTextFieldOutlineLabel: t < 0.5 ? a.fixTextFieldOutlineLabel : b.fixTextFieldOutlineLabel,
21182072
primaryColorBrightness: t < 0.5 ? a.primaryColorBrightness : b.primaryColorBrightness,
21192073
androidOverscrollIndicator:t < 0.5 ? a.androidOverscrollIndicator : b.androidOverscrollIndicator,
@@ -2220,7 +2174,6 @@ class ThemeData with Diagnosticable {
22202174
other.tooltipTheme == tooltipTheme &&
22212175
// DEPRECATED (newest deprecations at the bottom)
22222176
other.accentColor == accentColor &&
2223-
other.accentColorBrightness == accentColorBrightness &&
22242177
other.fixTextFieldOutlineLabel == fixTextFieldOutlineLabel &&
22252178
other.primaryColorBrightness == primaryColorBrightness &&
22262179
other.androidOverscrollIndicator == androidOverscrollIndicator &&
@@ -2324,7 +2277,6 @@ class ThemeData with Diagnosticable {
23242277
tooltipTheme,
23252278
// DEPRECATED (newest deprecations at the bottom)
23262279
accentColor,
2327-
accentColorBrightness,
23282280
fixTextFieldOutlineLabel,
23292281
primaryColorBrightness,
23302282
androidOverscrollIndicator,
@@ -2430,7 +2382,6 @@ class ThemeData with Diagnosticable {
24302382
properties.add(DiagnosticsProperty<TooltipThemeData>('tooltipTheme', tooltipTheme, level: DiagnosticLevel.debug));
24312383
// DEPRECATED (newest deprecations at the bottom)
24322384
properties.add(ColorProperty('accentColor', accentColor, defaultValue: defaultData.accentColor, level: DiagnosticLevel.debug));
2433-
properties.add(EnumProperty<Brightness>('accentColorBrightness', accentColorBrightness, defaultValue: defaultData.accentColorBrightness, level: DiagnosticLevel.debug));
24342385
properties.add(DiagnosticsProperty<bool>('fixTextFieldOutlineLabel', fixTextFieldOutlineLabel, level: DiagnosticLevel.debug));
24352386
properties.add(EnumProperty<Brightness>('primaryColorBrightness', primaryColorBrightness, defaultValue: defaultData.primaryColorBrightness, level: DiagnosticLevel.debug));
24362387
properties.add(EnumProperty<AndroidOverscrollIndicator>('androidOverscrollIndicator', androidOverscrollIndicator, defaultValue: null, level: DiagnosticLevel.debug));

packages/flutter/test/material/theme_data_test.dart

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ void main() {
187187
expect(theme.primaryColorBrightness, Brightness.dark);
188188
expect(theme.canvasColor, theme.colorScheme.background);
189189
expect(theme.accentColor, theme.colorScheme.secondary);
190-
expect(theme.accentColorBrightness, Brightness.dark);
191190
expect(theme.scaffoldBackgroundColor, theme.colorScheme.background);
192191
expect(theme.bottomAppBarColor, theme.colorScheme.surface);
193192
expect(theme.cardColor, theme.colorScheme.surface);
@@ -239,7 +238,6 @@ void main() {
239238
expect(theme.primaryColorBrightness, Brightness.dark);
240239
expect(theme.canvasColor, theme.colorScheme.background);
241240
expect(theme.accentColor, theme.colorScheme.secondary);
242-
expect(theme.accentColorBrightness, Brightness.light);
243241
expect(theme.scaffoldBackgroundColor, theme.colorScheme.background);
244242
expect(theme.bottomAppBarColor, theme.colorScheme.surface);
245243
expect(theme.cardColor, theme.colorScheme.surface);
@@ -288,7 +286,6 @@ void main() {
288286
expect(theme.primaryColorBrightness, Brightness.dark);
289287
expect(theme.canvasColor, theme.colorScheme.background);
290288
expect(theme.accentColor, theme.colorScheme.secondary);
291-
expect(theme.accentColorBrightness, Brightness.dark);
292289
expect(theme.scaffoldBackgroundColor, theme.colorScheme.background);
293290
expect(theme.bottomAppBarColor, theme.colorScheme.surface);
294291
expect(theme.cardColor, theme.colorScheme.surface);
@@ -338,7 +335,6 @@ void main() {
338335
expect(theme.primaryColorBrightness, Brightness.dark);
339336
expect(theme.canvasColor, theme.colorScheme.background);
340337
expect(theme.accentColor, theme.colorScheme.secondary);
341-
expect(theme.accentColorBrightness, Brightness.dark);
342338
expect(theme.scaffoldBackgroundColor, theme.colorScheme.background);
343339
expect(theme.bottomAppBarColor, theme.colorScheme.surface);
344340
expect(theme.cardColor, theme.colorScheme.surface);
@@ -388,7 +384,6 @@ void main() {
388384
expect(theme.primaryColorBrightness, Brightness.dark);
389385
expect(theme.canvasColor, theme.colorScheme.background);
390386
expect(theme.accentColor, theme.colorScheme.secondary);
391-
expect(theme.accentColorBrightness, Brightness.light);
392387
expect(theme.scaffoldBackgroundColor, theme.colorScheme.background);
393388
expect(theme.bottomAppBarColor, theme.colorScheme.surface);
394389
expect(theme.cardColor, theme.colorScheme.surface);
@@ -814,7 +809,6 @@ void main() {
814809
tooltipTheme: const TooltipThemeData(height: 100),
815810
// DEPRECATED (newest deprecations at the bottom)
816811
accentColor: Colors.black,
817-
accentColorBrightness: Brightness.dark,
818812
fixTextFieldOutlineLabel: false,
819813
primaryColorBrightness: Brightness.dark,
820814
androidOverscrollIndicator: AndroidOverscrollIndicator.glow,
@@ -934,7 +928,6 @@ void main() {
934928

935929
// DEPRECATED (newest deprecations at the bottom)
936930
accentColor: Colors.white,
937-
accentColorBrightness: Brightness.light,
938931
fixTextFieldOutlineLabel: true,
939932
primaryColorBrightness: Brightness.light,
940933
androidOverscrollIndicator: AndroidOverscrollIndicator.stretch,
@@ -1037,7 +1030,6 @@ void main() {
10371030

10381031
// DEPRECATED (newest deprecations at the bottom)
10391032
accentColor: otherTheme.accentColor,
1040-
accentColorBrightness: otherTheme.accentColorBrightness,
10411033
fixTextFieldOutlineLabel: otherTheme.fixTextFieldOutlineLabel,
10421034
primaryColorBrightness: otherTheme.primaryColorBrightness,
10431035
androidOverscrollIndicator: otherTheme.androidOverscrollIndicator,
@@ -1141,7 +1133,6 @@ void main() {
11411133

11421134
// DEPRECATED (newest deprecations at the bottom)
11431135
expect(themeDataCopy.accentColor, equals(otherTheme.accentColor));
1144-
expect(themeDataCopy.accentColorBrightness, equals(otherTheme.accentColorBrightness));
11451136
expect(themeDataCopy.fixTextFieldOutlineLabel, equals(otherTheme.fixTextFieldOutlineLabel));
11461137
expect(themeDataCopy.primaryColorBrightness, equals(otherTheme.primaryColorBrightness));
11471138
expect(themeDataCopy.androidOverscrollIndicator, equals(otherTheme.androidOverscrollIndicator));
@@ -1277,7 +1268,6 @@ void main() {
12771268
'tooltipTheme',
12781269
// DEPRECATED (newest deprecations at the bottom)
12791270
'accentColor',
1280-
'accentColorBrightness',
12811271
'fixTextFieldOutlineLabel',
12821272
'primaryColorBrightness',
12831273
'androidOverscrollIndicator',

0 commit comments

Comments
 (0)