Remove bottomAppBarColor from ThemeData (#144080)

This PR is to remove deprecated ThemeData.bottomAppBarColor.

These parameters are made obsolete in https://github.com/flutter/flutter/pull/110162.
Part of https://github.com/flutter/flutter/pull/111080
This commit is contained in:
Qun Cheng
2024-02-28 00:07:51 +00:00
committed by GitHub
parent d0fb2929df
commit e707f0de69
7 changed files with 10 additions and 66 deletions

View File

@@ -94,8 +94,10 @@ class BottomAppBar extends StatefulWidget {
/// The bottom app bar's background color.
///
/// If this property is null then [BottomAppBarTheme.color] of
/// [ThemeData.bottomAppBarTheme] is used. If that's null then
/// [ThemeData.bottomAppBarColor] is used.
/// [ThemeData.bottomAppBarTheme] is used. If that's null and [ThemeData.useMaterial3]
/// is true, the default value is [ColorScheme.surface]; if [ThemeData.useMaterial3]
/// is false, then the default value is `Color(0xFF424242)` in dark theme and
/// [Colors.white] in light theme.
final Color? color;
/// The z-coordinate at which to place this bottom app bar relative to its
@@ -280,7 +282,7 @@ class _BottomAppBarDefaultsM2 extends BottomAppBarTheme {
final BuildContext context;
@override
Color? get color => Theme.of(context).bottomAppBarColor;
Color? get color => Theme.of(context).brightness == Brightness.dark ? Colors.grey[800]! : Colors.white;
@override
Color? get surfaceTintColor => Theme.of(context).colorScheme.surfaceTint;

View File

@@ -39,8 +39,6 @@ class BottomAppBarTheme with Diagnosticable {
});
/// Overrides the default value for [BottomAppBar.color].
///
/// If null, [BottomAppBar] uses [ThemeData.bottomAppBarColor].
final Color? color;
/// Overrides the default value for [BottomAppBar.elevation].

View File

@@ -384,11 +384,6 @@ class ThemeData with Diagnosticable {
'This feature was deprecated after v3.3.0-0.5.pre.',
)
Color? backgroundColor,
@Deprecated(
'Use BottomAppBarTheme.color instead. '
'This feature was deprecated after v3.3.0-0.6.pre.',
)
Color? bottomAppBarColor,
}) {
// GENERAL CONFIGURATION
cupertinoOverrideTheme = cupertinoOverrideTheme?.noDefault();
@@ -441,7 +436,6 @@ class ThemeData with Diagnosticable {
primaryColor ??= primarySurfaceColor;
canvasColor ??= colorScheme.background;
scaffoldBackgroundColor ??= colorScheme.background;
bottomAppBarColor ??= colorScheme.surface;
cardColor ??= colorScheme.surface;
dividerColor ??= colorScheme.outline;
backgroundColor ??= colorScheme.background;
@@ -569,7 +563,6 @@ class ThemeData with Diagnosticable {
// DEPRECATED (newest deprecations at the bottom)
errorColor ??= Colors.red[700]!;
backgroundColor ??= isDark ? Colors.grey[700]! : primarySwatch[200]!;
bottomAppBarColor ??= colorSchemeSeed != null ? colorScheme.surface : isDark ? Colors.grey[800]! : Colors.white;
return ThemeData.raw(
// For the sanity of the reader, make sure these properties are in the same
@@ -667,7 +660,6 @@ class ThemeData with Diagnosticable {
toggleableActiveColor: toggleableActiveColor,
errorColor: errorColor,
backgroundColor: backgroundColor,
bottomAppBarColor: bottomAppBarColor,
);
}
@@ -791,18 +783,12 @@ class ThemeData with Diagnosticable {
'This feature was deprecated after v3.3.0-0.5.pre.',
)
Color? backgroundColor,
@Deprecated(
'Use BottomAppBarTheme.color instead. '
'This feature was deprecated after v3.3.0-0.6.pre.',
)
Color? bottomAppBarColor,
}) : // DEPRECATED (newest deprecations at the bottom)
// should not be `required`, use getter pattern to avoid breakages.
_toggleableActiveColor = toggleableActiveColor,
_errorColor = errorColor,
_backgroundColor = backgroundColor,
_bottomAppBarColor = bottomAppBarColor,
assert(toggleableActiveColor != null),
// DEPRECATED (newest deprecations at the bottom)
assert(errorColor != null),
@@ -851,7 +837,6 @@ class ThemeData with Diagnosticable {
primaryColor: primarySurfaceColor,
canvasColor: colorScheme.background,
scaffoldBackgroundColor: colorScheme.background,
bottomAppBarColor: colorScheme.surface,
cardColor: colorScheme.surface,
dividerColor: colorScheme.onSurface.withOpacity(0.12),
backgroundColor: colorScheme.background,
@@ -1184,14 +1169,6 @@ class ThemeData with Diagnosticable {
// COLOR
/// The default color of the [BottomAppBar].
@Deprecated(
'Use BottomAppBarTheme.color instead. '
'This feature was deprecated after v3.3.0-0.6.pre.',
)
Color get bottomAppBarColor => _bottomAppBarColor!;
final Color? _bottomAppBarColor;
/// The default color of [MaterialType.canvas] [Material].
final Color canvasColor;
@@ -1619,11 +1596,6 @@ class ThemeData with Diagnosticable {
'This feature was deprecated after v3.3.0-0.5.pre.',
)
Color? backgroundColor,
@Deprecated(
'Use BottomAppBarTheme.color instead. '
'This feature was deprecated after v3.3.0-0.6.pre.',
)
Color? bottomAppBarColor,
@Deprecated(
'Use a ThemeData constructor (.from, .light, or .dark) instead. '
'These constructors all have a useMaterial3 argument, '
@@ -1732,7 +1704,6 @@ class ThemeData with Diagnosticable {
toggleableActiveColor: toggleableActiveColor ?? _toggleableActiveColor,
errorColor: errorColor ?? _errorColor,
backgroundColor: backgroundColor ?? _backgroundColor,
bottomAppBarColor: bottomAppBarColor ?? _bottomAppBarColor,
);
}
@@ -1930,7 +1901,6 @@ class ThemeData with Diagnosticable {
toggleableActiveColor: Color.lerp(a.toggleableActiveColor, b.toggleableActiveColor, t),
errorColor: Color.lerp(a.errorColor, b.errorColor, t),
backgroundColor: Color.lerp(a.backgroundColor, b.backgroundColor, t),
bottomAppBarColor: Color.lerp(a.bottomAppBarColor, b.bottomAppBarColor, t),
);
}
@@ -2034,8 +2004,7 @@ class ThemeData with Diagnosticable {
// DEPRECATED (newest deprecations at the bottom)
other.toggleableActiveColor == toggleableActiveColor &&
other.errorColor == errorColor &&
other.backgroundColor == backgroundColor &&
other.bottomAppBarColor == bottomAppBarColor;
other.backgroundColor == backgroundColor;
}
@override
@@ -2138,7 +2107,6 @@ class ThemeData with Diagnosticable {
toggleableActiveColor,
errorColor,
backgroundColor,
bottomAppBarColor,
];
return Object.hashAll(values);
}
@@ -2242,7 +2210,6 @@ class ThemeData with Diagnosticable {
properties.add(ColorProperty('toggleableActiveColor', toggleableActiveColor, defaultValue: defaultData.toggleableActiveColor, level: DiagnosticLevel.debug));
properties.add(ColorProperty('errorColor', errorColor, defaultValue: defaultData.errorColor, level: DiagnosticLevel.debug));
properties.add(ColorProperty('backgroundColor', backgroundColor, defaultValue: defaultData.backgroundColor, level: DiagnosticLevel.debug));
properties.add(ColorProperty('bottomAppBarColor', bottomAppBarColor, defaultValue: defaultData.bottomAppBarColor, level: DiagnosticLevel.debug));
}
}