Skip to content

Commit

Permalink
Remove accentColorBrightness usage (#120577)
Browse files Browse the repository at this point in the history
  • Loading branch information
QuncCccccc authored Feb 13, 2023
1 parent 0792c27 commit 7bacc25
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 59 deletions.
49 changes: 0 additions & 49 deletions packages/flutter/lib/src/material/theme_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -388,13 +388,6 @@ class ThemeData with Diagnosticable {
'This feature was deprecated after v2.3.0-0.1.pre.',
)
Color? accentColor,
@Deprecated(
'No longer used by the framework, please remove any reference to it. '
'For more information, consult the migration guide at '
'https://flutter.dev/docs/release/breaking-changes/theme-data-accent-properties#migration-guide. '
'This feature was deprecated after v2.3.0-0.1.pre.',
)
Brightness? accentColorBrightness,
@Deprecated(
'This "fix" is now enabled by default. '
'This feature was deprecated after v2.5.0-1.0.pre.',
Expand Down Expand Up @@ -486,7 +479,6 @@ class ThemeData with Diagnosticable {
primaryColorBrightness = ThemeData.estimateBrightnessForColor(primarySurfaceColor);
canvasColor ??= colorScheme.background;
accentColor ??= colorScheme.secondary;
accentColorBrightness ??= ThemeData.estimateBrightnessForColor(colorScheme.secondary);
scaffoldBackgroundColor ??= colorScheme.background;
bottomAppBarColor ??= colorScheme.surface;
cardColor ??= colorScheme.surface;
Expand All @@ -506,7 +498,6 @@ class ThemeData with Diagnosticable {
final bool primaryIsDark = estimatedPrimaryColorBrightness == Brightness.dark;
toggleableActiveColor ??= isDark ? Colors.tealAccent[200]! : (accentColor ?? primarySwatch[600]!);
accentColor ??= isDark ? Colors.tealAccent[200]! : primarySwatch[500]!;
accentColorBrightness ??= estimateBrightnessForColor(accentColor);
focusColor ??= isDark ? Colors.white.withOpacity(0.12) : Colors.black.withOpacity(0.12);
hoverColor ??= isDark ? Colors.white.withOpacity(0.04) : Colors.black.withOpacity(0.04);
shadowColor ??= Colors.black;
Expand Down Expand Up @@ -712,7 +703,6 @@ class ThemeData with Diagnosticable {
tooltipTheme: tooltipTheme,
// DEPRECATED (newest deprecations at the bottom)
accentColor: accentColor,
accentColorBrightness: accentColorBrightness,
fixTextFieldOutlineLabel: fixTextFieldOutlineLabel,
primaryColorBrightness: primaryColorBrightness,
androidOverscrollIndicator: androidOverscrollIndicator,
Expand Down Expand Up @@ -830,13 +820,6 @@ class ThemeData with Diagnosticable {
'This feature was deprecated after v2.3.0-0.1.pre.',
)
Color? accentColor,
@Deprecated(
'No longer used by the framework, please remove any reference to it. '
'For more information, consult the migration guide at '
'https://flutter.dev/docs/release/breaking-changes/theme-data-accent-properties#migration-guide. '
'This feature was deprecated after v2.3.0-0.1.pre.',
)
Brightness? accentColorBrightness,
@Deprecated(
'This "fix" is now enabled by default. '
'This feature was deprecated after v2.5.0-1.0.pre.',
Expand Down Expand Up @@ -883,7 +866,6 @@ class ThemeData with Diagnosticable {
}) : // DEPRECATED (newest deprecations at the bottom)
// should not be `required`, use getter pattern to avoid breakages.
_accentColor = accentColor,
_accentColorBrightness = accentColorBrightness,
_fixTextFieldOutlineLabel = fixTextFieldOutlineLabel,
_primaryColorBrightness = primaryColorBrightness,
_toggleableActiveColor = toggleableActiveColor,
Expand All @@ -894,7 +876,6 @@ class ThemeData with Diagnosticable {
assert(toggleableActiveColor != null),
// DEPRECATED (newest deprecations at the bottom)
assert(accentColor != null),
assert(accentColorBrightness != null),
assert(fixTextFieldOutlineLabel != null),
assert(primaryColorBrightness != null),
assert(errorColor != null),
Expand Down Expand Up @@ -946,7 +927,6 @@ class ThemeData with Diagnosticable {
primaryColorBrightness: ThemeData.estimateBrightnessForColor(primarySurfaceColor),
canvasColor: colorScheme.background,
accentColor: colorScheme.secondary,
accentColorBrightness: ThemeData.estimateBrightnessForColor(colorScheme.secondary),
scaffoldBackgroundColor: colorScheme.background,
bottomAppBarColor: colorScheme.surface,
cardColor: colorScheme.surface,
Expand Down Expand Up @@ -1572,23 +1552,6 @@ class ThemeData with Diagnosticable {
Color get accentColor => _accentColor!;
final Color? _accentColor;

/// Obsolete property that was originally used to determine the color
/// of text and icons placed on top of the accent color (e.g. the
/// icons on a floating action button).
///
/// The material library no longer uses this property. The
/// [floatingActionButtonTheme] can be used to configure
/// the appearance of [FloatingActionButton]s. The brightness
/// of any color can be found with [ThemeData.estimateBrightnessForColor].
@Deprecated(
'No longer used by the framework, please remove any reference to it. '
'For more information, consult the migration guide at '
'https://flutter.dev/docs/release/breaking-changes/theme-data-accent-properties#migration-guide. '
'This feature was deprecated after v2.3.0-0.1.pre.',
)
Brightness get accentColorBrightness => _accentColorBrightness!;
final Brightness? _accentColorBrightness;

/// An obsolete flag to allow apps to opt-out of a
/// [small fix](https://github.com/flutter/flutter/issues/54028) for the Y
/// coordinate of the floating label in a [TextField] [OutlineInputBorder].
Expand Down Expand Up @@ -1780,13 +1743,6 @@ class ThemeData with Diagnosticable {
'This feature was deprecated after v2.3.0-0.1.pre.',
)
Color? accentColor,
@Deprecated(
'No longer used by the framework, please remove any reference to it. '
'For more information, consult the migration guide at '
'https://flutter.dev/docs/release/breaking-changes/theme-data-accent-properties#migration-guide. '
'This feature was deprecated after v2.3.0-0.1.pre.',
)
Brightness? accentColorBrightness,
@Deprecated(
'This "fix" is now enabled by default. '
'This feature was deprecated after v2.5.0-1.0.pre.',
Expand Down Expand Up @@ -1921,7 +1877,6 @@ class ThemeData with Diagnosticable {
tooltipTheme: tooltipTheme ?? this.tooltipTheme,
// DEPRECATED (newest deprecations at the bottom)
accentColor: accentColor ?? _accentColor,
accentColorBrightness: accentColorBrightness ?? _accentColorBrightness,
fixTextFieldOutlineLabel: fixTextFieldOutlineLabel ?? _fixTextFieldOutlineLabel,
primaryColorBrightness: primaryColorBrightness ?? _primaryColorBrightness,
androidOverscrollIndicator: androidOverscrollIndicator ?? this.androidOverscrollIndicator,
Expand Down Expand Up @@ -2113,7 +2068,6 @@ class ThemeData with Diagnosticable {
tooltipTheme: TooltipThemeData.lerp(a.tooltipTheme, b.tooltipTheme, t)!,
// DEPRECATED (newest deprecations at the bottom)
accentColor: Color.lerp(a.accentColor, b.accentColor, t),
accentColorBrightness: t < 0.5 ? a.accentColorBrightness : b.accentColorBrightness,
fixTextFieldOutlineLabel: t < 0.5 ? a.fixTextFieldOutlineLabel : b.fixTextFieldOutlineLabel,
primaryColorBrightness: t < 0.5 ? a.primaryColorBrightness : b.primaryColorBrightness,
androidOverscrollIndicator:t < 0.5 ? a.androidOverscrollIndicator : b.androidOverscrollIndicator,
Expand Down Expand Up @@ -2220,7 +2174,6 @@ class ThemeData with Diagnosticable {
other.tooltipTheme == tooltipTheme &&
// DEPRECATED (newest deprecations at the bottom)
other.accentColor == accentColor &&
other.accentColorBrightness == accentColorBrightness &&
other.fixTextFieldOutlineLabel == fixTextFieldOutlineLabel &&
other.primaryColorBrightness == primaryColorBrightness &&
other.androidOverscrollIndicator == androidOverscrollIndicator &&
Expand Down Expand Up @@ -2324,7 +2277,6 @@ class ThemeData with Diagnosticable {
tooltipTheme,
// DEPRECATED (newest deprecations at the bottom)
accentColor,
accentColorBrightness,
fixTextFieldOutlineLabel,
primaryColorBrightness,
androidOverscrollIndicator,
Expand Down Expand Up @@ -2430,7 +2382,6 @@ class ThemeData with Diagnosticable {
properties.add(DiagnosticsProperty<TooltipThemeData>('tooltipTheme', tooltipTheme, level: DiagnosticLevel.debug));
// DEPRECATED (newest deprecations at the bottom)
properties.add(ColorProperty('accentColor', accentColor, defaultValue: defaultData.accentColor, level: DiagnosticLevel.debug));
properties.add(EnumProperty<Brightness>('accentColorBrightness', accentColorBrightness, defaultValue: defaultData.accentColorBrightness, level: DiagnosticLevel.debug));
properties.add(DiagnosticsProperty<bool>('fixTextFieldOutlineLabel', fixTextFieldOutlineLabel, level: DiagnosticLevel.debug));
properties.add(EnumProperty<Brightness>('primaryColorBrightness', primaryColorBrightness, defaultValue: defaultData.primaryColorBrightness, level: DiagnosticLevel.debug));
properties.add(EnumProperty<AndroidOverscrollIndicator>('androidOverscrollIndicator', androidOverscrollIndicator, defaultValue: null, level: DiagnosticLevel.debug));
Expand Down
10 changes: 0 additions & 10 deletions packages/flutter/test/material/theme_data_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ void main() {
expect(theme.primaryColorBrightness, Brightness.dark);
expect(theme.canvasColor, theme.colorScheme.background);
expect(theme.accentColor, theme.colorScheme.secondary);
expect(theme.accentColorBrightness, Brightness.dark);
expect(theme.scaffoldBackgroundColor, theme.colorScheme.background);
expect(theme.bottomAppBarColor, theme.colorScheme.surface);
expect(theme.cardColor, theme.colorScheme.surface);
Expand Down Expand Up @@ -239,7 +238,6 @@ void main() {
expect(theme.primaryColorBrightness, Brightness.dark);
expect(theme.canvasColor, theme.colorScheme.background);
expect(theme.accentColor, theme.colorScheme.secondary);
expect(theme.accentColorBrightness, Brightness.light);
expect(theme.scaffoldBackgroundColor, theme.colorScheme.background);
expect(theme.bottomAppBarColor, theme.colorScheme.surface);
expect(theme.cardColor, theme.colorScheme.surface);
Expand Down Expand Up @@ -288,7 +286,6 @@ void main() {
expect(theme.primaryColorBrightness, Brightness.dark);
expect(theme.canvasColor, theme.colorScheme.background);
expect(theme.accentColor, theme.colorScheme.secondary);
expect(theme.accentColorBrightness, Brightness.dark);
expect(theme.scaffoldBackgroundColor, theme.colorScheme.background);
expect(theme.bottomAppBarColor, theme.colorScheme.surface);
expect(theme.cardColor, theme.colorScheme.surface);
Expand Down Expand Up @@ -338,7 +335,6 @@ void main() {
expect(theme.primaryColorBrightness, Brightness.dark);
expect(theme.canvasColor, theme.colorScheme.background);
expect(theme.accentColor, theme.colorScheme.secondary);
expect(theme.accentColorBrightness, Brightness.dark);
expect(theme.scaffoldBackgroundColor, theme.colorScheme.background);
expect(theme.bottomAppBarColor, theme.colorScheme.surface);
expect(theme.cardColor, theme.colorScheme.surface);
Expand Down Expand Up @@ -388,7 +384,6 @@ void main() {
expect(theme.primaryColorBrightness, Brightness.dark);
expect(theme.canvasColor, theme.colorScheme.background);
expect(theme.accentColor, theme.colorScheme.secondary);
expect(theme.accentColorBrightness, Brightness.light);
expect(theme.scaffoldBackgroundColor, theme.colorScheme.background);
expect(theme.bottomAppBarColor, theme.colorScheme.surface);
expect(theme.cardColor, theme.colorScheme.surface);
Expand Down Expand Up @@ -814,7 +809,6 @@ void main() {
tooltipTheme: const TooltipThemeData(height: 100),
// DEPRECATED (newest deprecations at the bottom)
accentColor: Colors.black,
accentColorBrightness: Brightness.dark,
fixTextFieldOutlineLabel: false,
primaryColorBrightness: Brightness.dark,
androidOverscrollIndicator: AndroidOverscrollIndicator.glow,
Expand Down Expand Up @@ -934,7 +928,6 @@ void main() {

// DEPRECATED (newest deprecations at the bottom)
accentColor: Colors.white,
accentColorBrightness: Brightness.light,
fixTextFieldOutlineLabel: true,
primaryColorBrightness: Brightness.light,
androidOverscrollIndicator: AndroidOverscrollIndicator.stretch,
Expand Down Expand Up @@ -1037,7 +1030,6 @@ void main() {

// DEPRECATED (newest deprecations at the bottom)
accentColor: otherTheme.accentColor,
accentColorBrightness: otherTheme.accentColorBrightness,
fixTextFieldOutlineLabel: otherTheme.fixTextFieldOutlineLabel,
primaryColorBrightness: otherTheme.primaryColorBrightness,
androidOverscrollIndicator: otherTheme.androidOverscrollIndicator,
Expand Down Expand Up @@ -1141,7 +1133,6 @@ void main() {

// DEPRECATED (newest deprecations at the bottom)
expect(themeDataCopy.accentColor, equals(otherTheme.accentColor));
expect(themeDataCopy.accentColorBrightness, equals(otherTheme.accentColorBrightness));
expect(themeDataCopy.fixTextFieldOutlineLabel, equals(otherTheme.fixTextFieldOutlineLabel));
expect(themeDataCopy.primaryColorBrightness, equals(otherTheme.primaryColorBrightness));
expect(themeDataCopy.androidOverscrollIndicator, equals(otherTheme.androidOverscrollIndicator));
Expand Down Expand Up @@ -1277,7 +1268,6 @@ void main() {
'tooltipTheme',
// DEPRECATED (newest deprecations at the bottom)
'accentColor',
'accentColorBrightness',
'fixTextFieldOutlineLabel',
'primaryColorBrightness',
'androidOverscrollIndicator',
Expand Down

0 comments on commit 7bacc25

Please sign in to comment.