mirror of
https://github.com/flutter/flutter
synced 2024-09-13 21:32:11 +00:00
Remove ThemeData.buttonColor references (#118658)
* Remove ThemeData.buttonColor references * Fix test * Remove more buttonColors * Macro the definition of color scheme * remove doc reference
This commit is contained in:
parent
e8b7f4b201
commit
df4420835d
|
@ -382,13 +382,12 @@ class ButtonThemeData with Diagnosticable {
|
|||
/// A set of thirteen colors that can be used to derive the button theme's
|
||||
/// colors.
|
||||
///
|
||||
/// This property was added much later than the theme's set of highly
|
||||
/// specific colors, like [ThemeData.buttonColor], [ThemeData.highlightColor],
|
||||
/// [ThemeData.splashColor] etc.
|
||||
/// This property was added much later than the theme's set of highly specific
|
||||
/// colors, like [ThemeData.highlightColor] and [ThemeData.splashColor] etc.
|
||||
///
|
||||
/// The colors for new button classes can be defined exclusively in terms
|
||||
/// of [colorScheme]. When it's possible, the existing buttons will
|
||||
/// (continue to) gradually migrate to it.
|
||||
/// The colors for new button classes can be defined exclusively in terms of
|
||||
/// [colorScheme]. When it's possible, the existing buttons will (continue to)
|
||||
/// gradually migrate to it.
|
||||
final ColorScheme? colorScheme;
|
||||
|
||||
// The minimum size of a button's tap target.
|
||||
|
|
|
@ -9,9 +9,11 @@ import 'package:material_color_utilities/material_color_utilities.dart';
|
|||
import 'colors.dart';
|
||||
import 'theme_data.dart';
|
||||
|
||||
/// {@template flutter.material.color_scheme.ColorScheme}
|
||||
/// A set of 30 colors based on the
|
||||
/// [Material spec](https://m3.material.io/styles/color/the-color-system/color-roles)
|
||||
/// that can be used to configure the color properties of most components.
|
||||
/// {@endtemplate}
|
||||
///
|
||||
/// The main accent color groups in the scheme are [primary], [secondary],
|
||||
/// and [tertiary].
|
||||
|
|
|
@ -405,11 +405,6 @@ class ThemeData with Diagnosticable {
|
|||
'This feature was deprecated after v2.3.0-0.1.pre.',
|
||||
)
|
||||
IconThemeData? accentIconTheme,
|
||||
@Deprecated(
|
||||
'No longer used by the framework, please remove any reference to it. '
|
||||
'This feature was deprecated after v2.3.0-0.2.pre.',
|
||||
)
|
||||
Color? buttonColor,
|
||||
@Deprecated(
|
||||
'This "fix" is now enabled by default. '
|
||||
'This feature was deprecated after v2.5.0-1.0.pre.',
|
||||
|
@ -552,7 +547,7 @@ class ThemeData with Diagnosticable {
|
|||
// [disabledColor], [highlightColor], and [splashColor].
|
||||
buttonTheme ??= ButtonThemeData(
|
||||
colorScheme: colorScheme,
|
||||
buttonColor: buttonColor ?? (isDark ? primarySwatch[600]! : Colors.grey[300]!),
|
||||
buttonColor: isDark ? primarySwatch[600]! : Colors.grey[300]!,
|
||||
disabledColor: disabledColor,
|
||||
focusColor: focusColor,
|
||||
hoverColor: hoverColor,
|
||||
|
@ -637,7 +632,6 @@ class ThemeData with Diagnosticable {
|
|||
// DEPRECATED (newest deprecations at the bottom)
|
||||
accentTextTheme = defaultAccentTextTheme.merge(accentTextTheme);
|
||||
accentIconTheme ??= accentIsDark ? const IconThemeData(color: Colors.white) : const IconThemeData(color: Colors.black);
|
||||
buttonColor ??= isDark ? primarySwatch[600]! : Colors.grey[300]!;
|
||||
fixTextFieldOutlineLabel ??= true;
|
||||
primaryColorBrightness = estimatedPrimaryColorBrightness;
|
||||
errorColor ??= Colors.red[700]!;
|
||||
|
@ -736,7 +730,6 @@ class ThemeData with Diagnosticable {
|
|||
accentColorBrightness: accentColorBrightness,
|
||||
accentTextTheme: accentTextTheme,
|
||||
accentIconTheme: accentIconTheme,
|
||||
buttonColor: buttonColor,
|
||||
fixTextFieldOutlineLabel: fixTextFieldOutlineLabel,
|
||||
primaryColorBrightness: primaryColorBrightness,
|
||||
androidOverscrollIndicator: androidOverscrollIndicator,
|
||||
|
@ -874,11 +867,6 @@ class ThemeData with Diagnosticable {
|
|||
'This feature was deprecated after v2.3.0-0.1.pre.',
|
||||
)
|
||||
IconThemeData? accentIconTheme,
|
||||
@Deprecated(
|
||||
'No longer used by the framework, please remove any reference to it. '
|
||||
'This feature was deprecated after v2.3.0-0.2.pre.',
|
||||
)
|
||||
Color? buttonColor,
|
||||
@Deprecated(
|
||||
'This "fix" is now enabled by default. '
|
||||
'This feature was deprecated after v2.5.0-1.0.pre.',
|
||||
|
@ -928,7 +916,6 @@ class ThemeData with Diagnosticable {
|
|||
_accentColorBrightness = accentColorBrightness,
|
||||
_accentTextTheme = accentTextTheme,
|
||||
_accentIconTheme = accentIconTheme,
|
||||
_buttonColor = buttonColor,
|
||||
_fixTextFieldOutlineLabel = fixTextFieldOutlineLabel,
|
||||
_primaryColorBrightness = primaryColorBrightness,
|
||||
_toggleableActiveColor = toggleableActiveColor,
|
||||
|
@ -1022,7 +1009,6 @@ class ThemeData with Diagnosticable {
|
|||
assert(accentColorBrightness != null),
|
||||
assert(accentTextTheme != null),
|
||||
assert(accentIconTheme != null),
|
||||
assert(buttonColor != null),
|
||||
assert(fixTextFieldOutlineLabel != null),
|
||||
assert(primaryColorBrightness != null),
|
||||
assert(errorColor != null),
|
||||
|
@ -1405,14 +1391,13 @@ class ThemeData with Diagnosticable {
|
|||
/// The color of [Material] when it is used as a [Card].
|
||||
final Color cardColor;
|
||||
|
||||
/// A set of twelve colors that can be used to configure the
|
||||
/// color properties of most components.
|
||||
/// {@macro flutter.material.color_scheme.ColorScheme}
|
||||
///
|
||||
/// This property was added much later than the theme's set of highly
|
||||
/// specific colors, like [cardColor], [buttonColor], [canvasColor] etc.
|
||||
/// New components can be defined exclusively in terms of [colorScheme].
|
||||
/// Existing components will gradually migrate to it, to the extent
|
||||
/// that is possible without significant backwards compatibility breaks.
|
||||
/// This property was added much later than the theme's set of highly specific
|
||||
/// colors, like [cardColor], [canvasColor] etc. New components can be defined
|
||||
/// exclusively in terms of [colorScheme]. Existing components will gradually
|
||||
/// migrate to it, to the extent that is possible without significant
|
||||
/// backwards compatibility breaks.
|
||||
final ColorScheme colorScheme;
|
||||
|
||||
/// The background color of [Dialog] elements.
|
||||
|
@ -1752,14 +1737,6 @@ class ThemeData with Diagnosticable {
|
|||
IconThemeData get accentIconTheme => _accentIconTheme!;
|
||||
final IconThemeData? _accentIconTheme;
|
||||
|
||||
/// The default fill color of the [Material].
|
||||
@Deprecated(
|
||||
'No longer used by the framework, please remove any reference to it. '
|
||||
'This feature was deprecated after v2.3.0-0.2.pre.',
|
||||
)
|
||||
Color get buttonColor => _buttonColor!;
|
||||
final Color? _buttonColor;
|
||||
|
||||
/// 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].
|
||||
|
@ -1971,11 +1948,6 @@ class ThemeData with Diagnosticable {
|
|||
'This feature was deprecated after v2.3.0-0.1.pre.',
|
||||
)
|
||||
IconThemeData? accentIconTheme,
|
||||
@Deprecated(
|
||||
'No longer used by the framework, please remove any reference to it. '
|
||||
'This feature was deprecated after v2.3.0-0.2.pre.',
|
||||
)
|
||||
Color? buttonColor,
|
||||
@Deprecated(
|
||||
'This "fix" is now enabled by default. '
|
||||
'This feature was deprecated after v2.5.0-1.0.pre.',
|
||||
|
@ -2112,7 +2084,6 @@ class ThemeData with Diagnosticable {
|
|||
accentColorBrightness: accentColorBrightness ?? _accentColorBrightness,
|
||||
accentTextTheme: accentTextTheme ?? _accentTextTheme,
|
||||
accentIconTheme: accentIconTheme ?? _accentIconTheme,
|
||||
buttonColor: buttonColor ?? _buttonColor,
|
||||
fixTextFieldOutlineLabel: fixTextFieldOutlineLabel ?? _fixTextFieldOutlineLabel,
|
||||
primaryColorBrightness: primaryColorBrightness ?? _primaryColorBrightness,
|
||||
androidOverscrollIndicator: androidOverscrollIndicator ?? this.androidOverscrollIndicator,
|
||||
|
@ -2312,7 +2283,6 @@ class ThemeData with Diagnosticable {
|
|||
accentColorBrightness: t < 0.5 ? a.accentColorBrightness : b.accentColorBrightness,
|
||||
accentTextTheme: TextTheme.lerp(a.accentTextTheme, b.accentTextTheme, t),
|
||||
accentIconTheme: IconThemeData.lerp(a.accentIconTheme, b.accentIconTheme, t),
|
||||
buttonColor: Color.lerp(a.buttonColor, b.buttonColor, t),
|
||||
fixTextFieldOutlineLabel: t < 0.5 ? a.fixTextFieldOutlineLabel : b.fixTextFieldOutlineLabel,
|
||||
primaryColorBrightness: t < 0.5 ? a.primaryColorBrightness : b.primaryColorBrightness,
|
||||
androidOverscrollIndicator:t < 0.5 ? a.androidOverscrollIndicator : b.androidOverscrollIndicator,
|
||||
|
@ -2421,7 +2391,6 @@ class ThemeData with Diagnosticable {
|
|||
other.accentColorBrightness == accentColorBrightness &&
|
||||
other.accentTextTheme == accentTextTheme &&
|
||||
other.accentIconTheme == accentIconTheme &&
|
||||
other.buttonColor == buttonColor &&
|
||||
other.fixTextFieldOutlineLabel == fixTextFieldOutlineLabel &&
|
||||
other.primaryColorBrightness == primaryColorBrightness &&
|
||||
other.androidOverscrollIndicator == androidOverscrollIndicator &&
|
||||
|
@ -2527,7 +2496,6 @@ class ThemeData with Diagnosticable {
|
|||
accentColorBrightness,
|
||||
accentTextTheme,
|
||||
accentIconTheme,
|
||||
buttonColor,
|
||||
fixTextFieldOutlineLabel,
|
||||
primaryColorBrightness,
|
||||
androidOverscrollIndicator,
|
||||
|
@ -2635,7 +2603,6 @@ class ThemeData with Diagnosticable {
|
|||
properties.add(EnumProperty<Brightness>('accentColorBrightness', accentColorBrightness, defaultValue: defaultData.accentColorBrightness, level: DiagnosticLevel.debug));
|
||||
properties.add(DiagnosticsProperty<TextTheme>('accentTextTheme', accentTextTheme, level: DiagnosticLevel.debug));
|
||||
properties.add(DiagnosticsProperty<IconThemeData>('accentIconTheme', accentIconTheme, level: DiagnosticLevel.debug));
|
||||
properties.add(ColorProperty('buttonColor', buttonColor, defaultValue: defaultData.buttonColor, 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));
|
||||
|
|
|
@ -611,7 +611,7 @@ void main() {
|
|||
textStyle: TextStyle(fontSize: 100),
|
||||
);
|
||||
|
||||
// Both ThemeDatas include both extensions
|
||||
// Both ThemeData arguments include both extensions.
|
||||
ThemeData lerped = ThemeData.lerp(
|
||||
ThemeData(
|
||||
extensions: const <ThemeExtension<dynamic>>[
|
||||
|
@ -816,7 +816,6 @@ void main() {
|
|||
accentColorBrightness: Brightness.dark,
|
||||
accentTextTheme: ThemeData.dark().textTheme,
|
||||
accentIconTheme: ThemeData.dark().iconTheme,
|
||||
buttonColor: Colors.black,
|
||||
fixTextFieldOutlineLabel: false,
|
||||
primaryColorBrightness: Brightness.dark,
|
||||
androidOverscrollIndicator: AndroidOverscrollIndicator.glow,
|
||||
|
@ -938,7 +937,6 @@ void main() {
|
|||
accentColorBrightness: Brightness.light,
|
||||
accentIconTheme: ThemeData.light().iconTheme,
|
||||
accentTextTheme: ThemeData.light().textTheme,
|
||||
buttonColor: Colors.white,
|
||||
fixTextFieldOutlineLabel: true,
|
||||
primaryColorBrightness: Brightness.light,
|
||||
androidOverscrollIndicator: AndroidOverscrollIndicator.stretch,
|
||||
|
@ -1043,7 +1041,6 @@ void main() {
|
|||
accentColorBrightness: otherTheme.accentColorBrightness,
|
||||
accentIconTheme: otherTheme.accentIconTheme,
|
||||
accentTextTheme: otherTheme.accentTextTheme,
|
||||
buttonColor: otherTheme.buttonColor,
|
||||
fixTextFieldOutlineLabel: otherTheme.fixTextFieldOutlineLabel,
|
||||
primaryColorBrightness: otherTheme.primaryColorBrightness,
|
||||
androidOverscrollIndicator: otherTheme.androidOverscrollIndicator,
|
||||
|
@ -1149,7 +1146,6 @@ void main() {
|
|||
expect(themeDataCopy.accentColorBrightness, equals(otherTheme.accentColorBrightness));
|
||||
expect(themeDataCopy.accentIconTheme, equals(otherTheme.accentIconTheme));
|
||||
expect(themeDataCopy.accentTextTheme, equals(otherTheme.accentTextTheme));
|
||||
expect(themeDataCopy.buttonColor, equals(otherTheme.buttonColor));
|
||||
expect(themeDataCopy.fixTextFieldOutlineLabel, equals(otherTheme.fixTextFieldOutlineLabel));
|
||||
expect(themeDataCopy.primaryColorBrightness, equals(otherTheme.primaryColorBrightness));
|
||||
expect(themeDataCopy.androidOverscrollIndicator, equals(otherTheme.androidOverscrollIndicator));
|
||||
|
@ -1287,7 +1283,6 @@ void main() {
|
|||
'accentColorBrightness',
|
||||
'accentTextTheme',
|
||||
'accentIconTheme',
|
||||
'buttonColor',
|
||||
'fixTextFieldOutlineLabel',
|
||||
'primaryColorBrightness',
|
||||
'androidOverscrollIndicator',
|
||||
|
|
Loading…
Reference in a new issue