Unverified Commit 7bacc25e authored by Qun Cheng's avatar Qun Cheng Committed by GitHub

Remove accentColorBrightness usage (#120577)

parent 0792c279
...@@ -388,13 +388,6 @@ class ThemeData with Diagnosticable { ...@@ -388,13 +388,6 @@ class ThemeData with Diagnosticable {
'This feature was deprecated after v2.3.0-0.1.pre.', 'This feature was deprecated after v2.3.0-0.1.pre.',
) )
Color? accentColor, 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( @Deprecated(
'This "fix" is now enabled by default. ' 'This "fix" is now enabled by default. '
'This feature was deprecated after v2.5.0-1.0.pre.', 'This feature was deprecated after v2.5.0-1.0.pre.',
...@@ -486,7 +479,6 @@ class ThemeData with Diagnosticable { ...@@ -486,7 +479,6 @@ class ThemeData with Diagnosticable {
primaryColorBrightness = ThemeData.estimateBrightnessForColor(primarySurfaceColor); primaryColorBrightness = ThemeData.estimateBrightnessForColor(primarySurfaceColor);
canvasColor ??= colorScheme.background; canvasColor ??= colorScheme.background;
accentColor ??= colorScheme.secondary; accentColor ??= colorScheme.secondary;
accentColorBrightness ??= ThemeData.estimateBrightnessForColor(colorScheme.secondary);
scaffoldBackgroundColor ??= colorScheme.background; scaffoldBackgroundColor ??= colorScheme.background;
bottomAppBarColor ??= colorScheme.surface; bottomAppBarColor ??= colorScheme.surface;
cardColor ??= colorScheme.surface; cardColor ??= colorScheme.surface;
...@@ -506,7 +498,6 @@ class ThemeData with Diagnosticable { ...@@ -506,7 +498,6 @@ class ThemeData with Diagnosticable {
final bool primaryIsDark = estimatedPrimaryColorBrightness == Brightness.dark; final bool primaryIsDark = estimatedPrimaryColorBrightness == Brightness.dark;
toggleableActiveColor ??= isDark ? Colors.tealAccent[200]! : (accentColor ?? primarySwatch[600]!); toggleableActiveColor ??= isDark ? Colors.tealAccent[200]! : (accentColor ?? primarySwatch[600]!);
accentColor ??= isDark ? Colors.tealAccent[200]! : primarySwatch[500]!; accentColor ??= isDark ? Colors.tealAccent[200]! : primarySwatch[500]!;
accentColorBrightness ??= estimateBrightnessForColor(accentColor);
focusColor ??= isDark ? Colors.white.withOpacity(0.12) : Colors.black.withOpacity(0.12); focusColor ??= isDark ? Colors.white.withOpacity(0.12) : Colors.black.withOpacity(0.12);
hoverColor ??= isDark ? Colors.white.withOpacity(0.04) : Colors.black.withOpacity(0.04); hoverColor ??= isDark ? Colors.white.withOpacity(0.04) : Colors.black.withOpacity(0.04);
shadowColor ??= Colors.black; shadowColor ??= Colors.black;
...@@ -712,7 +703,6 @@ class ThemeData with Diagnosticable { ...@@ -712,7 +703,6 @@ class ThemeData with Diagnosticable {
tooltipTheme: tooltipTheme, tooltipTheme: tooltipTheme,
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
accentColor: accentColor, accentColor: accentColor,
accentColorBrightness: accentColorBrightness,
fixTextFieldOutlineLabel: fixTextFieldOutlineLabel, fixTextFieldOutlineLabel: fixTextFieldOutlineLabel,
primaryColorBrightness: primaryColorBrightness, primaryColorBrightness: primaryColorBrightness,
androidOverscrollIndicator: androidOverscrollIndicator, androidOverscrollIndicator: androidOverscrollIndicator,
...@@ -830,13 +820,6 @@ class ThemeData with Diagnosticable { ...@@ -830,13 +820,6 @@ class ThemeData with Diagnosticable {
'This feature was deprecated after v2.3.0-0.1.pre.', 'This feature was deprecated after v2.3.0-0.1.pre.',
) )
Color? accentColor, 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( @Deprecated(
'This "fix" is now enabled by default. ' 'This "fix" is now enabled by default. '
'This feature was deprecated after v2.5.0-1.0.pre.', 'This feature was deprecated after v2.5.0-1.0.pre.',
...@@ -883,7 +866,6 @@ class ThemeData with Diagnosticable { ...@@ -883,7 +866,6 @@ class ThemeData with Diagnosticable {
}) : // DEPRECATED (newest deprecations at the bottom) }) : // DEPRECATED (newest deprecations at the bottom)
// should not be `required`, use getter pattern to avoid breakages. // should not be `required`, use getter pattern to avoid breakages.
_accentColor = accentColor, _accentColor = accentColor,
_accentColorBrightness = accentColorBrightness,
_fixTextFieldOutlineLabel = fixTextFieldOutlineLabel, _fixTextFieldOutlineLabel = fixTextFieldOutlineLabel,
_primaryColorBrightness = primaryColorBrightness, _primaryColorBrightness = primaryColorBrightness,
_toggleableActiveColor = toggleableActiveColor, _toggleableActiveColor = toggleableActiveColor,
...@@ -894,7 +876,6 @@ class ThemeData with Diagnosticable { ...@@ -894,7 +876,6 @@ class ThemeData with Diagnosticable {
assert(toggleableActiveColor != null), assert(toggleableActiveColor != null),
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
assert(accentColor != null), assert(accentColor != null),
assert(accentColorBrightness != null),
assert(fixTextFieldOutlineLabel != null), assert(fixTextFieldOutlineLabel != null),
assert(primaryColorBrightness != null), assert(primaryColorBrightness != null),
assert(errorColor != null), assert(errorColor != null),
...@@ -946,7 +927,6 @@ class ThemeData with Diagnosticable { ...@@ -946,7 +927,6 @@ class ThemeData with Diagnosticable {
primaryColorBrightness: ThemeData.estimateBrightnessForColor(primarySurfaceColor), primaryColorBrightness: ThemeData.estimateBrightnessForColor(primarySurfaceColor),
canvasColor: colorScheme.background, canvasColor: colorScheme.background,
accentColor: colorScheme.secondary, accentColor: colorScheme.secondary,
accentColorBrightness: ThemeData.estimateBrightnessForColor(colorScheme.secondary),
scaffoldBackgroundColor: colorScheme.background, scaffoldBackgroundColor: colorScheme.background,
bottomAppBarColor: colorScheme.surface, bottomAppBarColor: colorScheme.surface,
cardColor: colorScheme.surface, cardColor: colorScheme.surface,
...@@ -1572,23 +1552,6 @@ class ThemeData with Diagnosticable { ...@@ -1572,23 +1552,6 @@ class ThemeData with Diagnosticable {
Color get accentColor => _accentColor!; Color get accentColor => _accentColor!;
final Color? _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 /// An obsolete flag to allow apps to opt-out of a
/// [small fix](https://github.com/flutter/flutter/issues/54028) for the Y /// [small fix](https://github.com/flutter/flutter/issues/54028) for the Y
/// coordinate of the floating label in a [TextField] [OutlineInputBorder]. /// coordinate of the floating label in a [TextField] [OutlineInputBorder].
...@@ -1780,13 +1743,6 @@ class ThemeData with Diagnosticable { ...@@ -1780,13 +1743,6 @@ class ThemeData with Diagnosticable {
'This feature was deprecated after v2.3.0-0.1.pre.', 'This feature was deprecated after v2.3.0-0.1.pre.',
) )
Color? accentColor, 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( @Deprecated(
'This "fix" is now enabled by default. ' 'This "fix" is now enabled by default. '
'This feature was deprecated after v2.5.0-1.0.pre.', 'This feature was deprecated after v2.5.0-1.0.pre.',
...@@ -1921,7 +1877,6 @@ class ThemeData with Diagnosticable { ...@@ -1921,7 +1877,6 @@ class ThemeData with Diagnosticable {
tooltipTheme: tooltipTheme ?? this.tooltipTheme, tooltipTheme: tooltipTheme ?? this.tooltipTheme,
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
accentColor: accentColor ?? _accentColor, accentColor: accentColor ?? _accentColor,
accentColorBrightness: accentColorBrightness ?? _accentColorBrightness,
fixTextFieldOutlineLabel: fixTextFieldOutlineLabel ?? _fixTextFieldOutlineLabel, fixTextFieldOutlineLabel: fixTextFieldOutlineLabel ?? _fixTextFieldOutlineLabel,
primaryColorBrightness: primaryColorBrightness ?? _primaryColorBrightness, primaryColorBrightness: primaryColorBrightness ?? _primaryColorBrightness,
androidOverscrollIndicator: androidOverscrollIndicator ?? this.androidOverscrollIndicator, androidOverscrollIndicator: androidOverscrollIndicator ?? this.androidOverscrollIndicator,
...@@ -2113,7 +2068,6 @@ class ThemeData with Diagnosticable { ...@@ -2113,7 +2068,6 @@ class ThemeData with Diagnosticable {
tooltipTheme: TooltipThemeData.lerp(a.tooltipTheme, b.tooltipTheme, t)!, tooltipTheme: TooltipThemeData.lerp(a.tooltipTheme, b.tooltipTheme, t)!,
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
accentColor: Color.lerp(a.accentColor, b.accentColor, t), accentColor: Color.lerp(a.accentColor, b.accentColor, t),
accentColorBrightness: t < 0.5 ? a.accentColorBrightness : b.accentColorBrightness,
fixTextFieldOutlineLabel: t < 0.5 ? a.fixTextFieldOutlineLabel : b.fixTextFieldOutlineLabel, fixTextFieldOutlineLabel: t < 0.5 ? a.fixTextFieldOutlineLabel : b.fixTextFieldOutlineLabel,
primaryColorBrightness: t < 0.5 ? a.primaryColorBrightness : b.primaryColorBrightness, primaryColorBrightness: t < 0.5 ? a.primaryColorBrightness : b.primaryColorBrightness,
androidOverscrollIndicator:t < 0.5 ? a.androidOverscrollIndicator : b.androidOverscrollIndicator, androidOverscrollIndicator:t < 0.5 ? a.androidOverscrollIndicator : b.androidOverscrollIndicator,
...@@ -2220,7 +2174,6 @@ class ThemeData with Diagnosticable { ...@@ -2220,7 +2174,6 @@ class ThemeData with Diagnosticable {
other.tooltipTheme == tooltipTheme && other.tooltipTheme == tooltipTheme &&
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
other.accentColor == accentColor && other.accentColor == accentColor &&
other.accentColorBrightness == accentColorBrightness &&
other.fixTextFieldOutlineLabel == fixTextFieldOutlineLabel && other.fixTextFieldOutlineLabel == fixTextFieldOutlineLabel &&
other.primaryColorBrightness == primaryColorBrightness && other.primaryColorBrightness == primaryColorBrightness &&
other.androidOverscrollIndicator == androidOverscrollIndicator && other.androidOverscrollIndicator == androidOverscrollIndicator &&
...@@ -2324,7 +2277,6 @@ class ThemeData with Diagnosticable { ...@@ -2324,7 +2277,6 @@ class ThemeData with Diagnosticable {
tooltipTheme, tooltipTheme,
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
accentColor, accentColor,
accentColorBrightness,
fixTextFieldOutlineLabel, fixTextFieldOutlineLabel,
primaryColorBrightness, primaryColorBrightness,
androidOverscrollIndicator, androidOverscrollIndicator,
...@@ -2430,7 +2382,6 @@ class ThemeData with Diagnosticable { ...@@ -2430,7 +2382,6 @@ class ThemeData with Diagnosticable {
properties.add(DiagnosticsProperty<TooltipThemeData>('tooltipTheme', tooltipTheme, level: DiagnosticLevel.debug)); properties.add(DiagnosticsProperty<TooltipThemeData>('tooltipTheme', tooltipTheme, level: DiagnosticLevel.debug));
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
properties.add(ColorProperty('accentColor', accentColor, defaultValue: defaultData.accentColor, level: DiagnosticLevel.debug)); 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(DiagnosticsProperty<bool>('fixTextFieldOutlineLabel', fixTextFieldOutlineLabel, level: DiagnosticLevel.debug));
properties.add(EnumProperty<Brightness>('primaryColorBrightness', primaryColorBrightness, defaultValue: defaultData.primaryColorBrightness, 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)); properties.add(EnumProperty<AndroidOverscrollIndicator>('androidOverscrollIndicator', androidOverscrollIndicator, defaultValue: null, level: DiagnosticLevel.debug));
......
...@@ -187,7 +187,6 @@ void main() { ...@@ -187,7 +187,6 @@ void main() {
expect(theme.primaryColorBrightness, Brightness.dark); expect(theme.primaryColorBrightness, Brightness.dark);
expect(theme.canvasColor, theme.colorScheme.background); expect(theme.canvasColor, theme.colorScheme.background);
expect(theme.accentColor, theme.colorScheme.secondary); expect(theme.accentColor, theme.colorScheme.secondary);
expect(theme.accentColorBrightness, Brightness.dark);
expect(theme.scaffoldBackgroundColor, theme.colorScheme.background); expect(theme.scaffoldBackgroundColor, theme.colorScheme.background);
expect(theme.bottomAppBarColor, theme.colorScheme.surface); expect(theme.bottomAppBarColor, theme.colorScheme.surface);
expect(theme.cardColor, theme.colorScheme.surface); expect(theme.cardColor, theme.colorScheme.surface);
...@@ -239,7 +238,6 @@ void main() { ...@@ -239,7 +238,6 @@ void main() {
expect(theme.primaryColorBrightness, Brightness.dark); expect(theme.primaryColorBrightness, Brightness.dark);
expect(theme.canvasColor, theme.colorScheme.background); expect(theme.canvasColor, theme.colorScheme.background);
expect(theme.accentColor, theme.colorScheme.secondary); expect(theme.accentColor, theme.colorScheme.secondary);
expect(theme.accentColorBrightness, Brightness.light);
expect(theme.scaffoldBackgroundColor, theme.colorScheme.background); expect(theme.scaffoldBackgroundColor, theme.colorScheme.background);
expect(theme.bottomAppBarColor, theme.colorScheme.surface); expect(theme.bottomAppBarColor, theme.colorScheme.surface);
expect(theme.cardColor, theme.colorScheme.surface); expect(theme.cardColor, theme.colorScheme.surface);
...@@ -288,7 +286,6 @@ void main() { ...@@ -288,7 +286,6 @@ void main() {
expect(theme.primaryColorBrightness, Brightness.dark); expect(theme.primaryColorBrightness, Brightness.dark);
expect(theme.canvasColor, theme.colorScheme.background); expect(theme.canvasColor, theme.colorScheme.background);
expect(theme.accentColor, theme.colorScheme.secondary); expect(theme.accentColor, theme.colorScheme.secondary);
expect(theme.accentColorBrightness, Brightness.dark);
expect(theme.scaffoldBackgroundColor, theme.colorScheme.background); expect(theme.scaffoldBackgroundColor, theme.colorScheme.background);
expect(theme.bottomAppBarColor, theme.colorScheme.surface); expect(theme.bottomAppBarColor, theme.colorScheme.surface);
expect(theme.cardColor, theme.colorScheme.surface); expect(theme.cardColor, theme.colorScheme.surface);
...@@ -338,7 +335,6 @@ void main() { ...@@ -338,7 +335,6 @@ void main() {
expect(theme.primaryColorBrightness, Brightness.dark); expect(theme.primaryColorBrightness, Brightness.dark);
expect(theme.canvasColor, theme.colorScheme.background); expect(theme.canvasColor, theme.colorScheme.background);
expect(theme.accentColor, theme.colorScheme.secondary); expect(theme.accentColor, theme.colorScheme.secondary);
expect(theme.accentColorBrightness, Brightness.dark);
expect(theme.scaffoldBackgroundColor, theme.colorScheme.background); expect(theme.scaffoldBackgroundColor, theme.colorScheme.background);
expect(theme.bottomAppBarColor, theme.colorScheme.surface); expect(theme.bottomAppBarColor, theme.colorScheme.surface);
expect(theme.cardColor, theme.colorScheme.surface); expect(theme.cardColor, theme.colorScheme.surface);
...@@ -388,7 +384,6 @@ void main() { ...@@ -388,7 +384,6 @@ void main() {
expect(theme.primaryColorBrightness, Brightness.dark); expect(theme.primaryColorBrightness, Brightness.dark);
expect(theme.canvasColor, theme.colorScheme.background); expect(theme.canvasColor, theme.colorScheme.background);
expect(theme.accentColor, theme.colorScheme.secondary); expect(theme.accentColor, theme.colorScheme.secondary);
expect(theme.accentColorBrightness, Brightness.light);
expect(theme.scaffoldBackgroundColor, theme.colorScheme.background); expect(theme.scaffoldBackgroundColor, theme.colorScheme.background);
expect(theme.bottomAppBarColor, theme.colorScheme.surface); expect(theme.bottomAppBarColor, theme.colorScheme.surface);
expect(theme.cardColor, theme.colorScheme.surface); expect(theme.cardColor, theme.colorScheme.surface);
...@@ -814,7 +809,6 @@ void main() { ...@@ -814,7 +809,6 @@ void main() {
tooltipTheme: const TooltipThemeData(height: 100), tooltipTheme: const TooltipThemeData(height: 100),
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
accentColor: Colors.black, accentColor: Colors.black,
accentColorBrightness: Brightness.dark,
fixTextFieldOutlineLabel: false, fixTextFieldOutlineLabel: false,
primaryColorBrightness: Brightness.dark, primaryColorBrightness: Brightness.dark,
androidOverscrollIndicator: AndroidOverscrollIndicator.glow, androidOverscrollIndicator: AndroidOverscrollIndicator.glow,
...@@ -934,7 +928,6 @@ void main() { ...@@ -934,7 +928,6 @@ void main() {
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
accentColor: Colors.white, accentColor: Colors.white,
accentColorBrightness: Brightness.light,
fixTextFieldOutlineLabel: true, fixTextFieldOutlineLabel: true,
primaryColorBrightness: Brightness.light, primaryColorBrightness: Brightness.light,
androidOverscrollIndicator: AndroidOverscrollIndicator.stretch, androidOverscrollIndicator: AndroidOverscrollIndicator.stretch,
...@@ -1037,7 +1030,6 @@ void main() { ...@@ -1037,7 +1030,6 @@ void main() {
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
accentColor: otherTheme.accentColor, accentColor: otherTheme.accentColor,
accentColorBrightness: otherTheme.accentColorBrightness,
fixTextFieldOutlineLabel: otherTheme.fixTextFieldOutlineLabel, fixTextFieldOutlineLabel: otherTheme.fixTextFieldOutlineLabel,
primaryColorBrightness: otherTheme.primaryColorBrightness, primaryColorBrightness: otherTheme.primaryColorBrightness,
androidOverscrollIndicator: otherTheme.androidOverscrollIndicator, androidOverscrollIndicator: otherTheme.androidOverscrollIndicator,
...@@ -1141,7 +1133,6 @@ void main() { ...@@ -1141,7 +1133,6 @@ void main() {
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
expect(themeDataCopy.accentColor, equals(otherTheme.accentColor)); expect(themeDataCopy.accentColor, equals(otherTheme.accentColor));
expect(themeDataCopy.accentColorBrightness, equals(otherTheme.accentColorBrightness));
expect(themeDataCopy.fixTextFieldOutlineLabel, equals(otherTheme.fixTextFieldOutlineLabel)); expect(themeDataCopy.fixTextFieldOutlineLabel, equals(otherTheme.fixTextFieldOutlineLabel));
expect(themeDataCopy.primaryColorBrightness, equals(otherTheme.primaryColorBrightness)); expect(themeDataCopy.primaryColorBrightness, equals(otherTheme.primaryColorBrightness));
expect(themeDataCopy.androidOverscrollIndicator, equals(otherTheme.androidOverscrollIndicator)); expect(themeDataCopy.androidOverscrollIndicator, equals(otherTheme.androidOverscrollIndicator));
...@@ -1277,7 +1268,6 @@ void main() { ...@@ -1277,7 +1268,6 @@ void main() {
'tooltipTheme', 'tooltipTheme',
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
'accentColor', 'accentColor',
'accentColorBrightness',
'fixTextFieldOutlineLabel', 'fixTextFieldOutlineLabel',
'primaryColorBrightness', 'primaryColorBrightness',
'androidOverscrollIndicator', 'androidOverscrollIndicator',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment