mirror of
https://github.com/flutter/flutter
synced 2024-08-25 02:46:31 +00:00
Remove toggleableActiveColor
from ThemeData
(#144178)
This PR is to remove deprecated ThemeData.toggleableActiveColor. These parameters are made obsolete in https://github.com/flutter/flutter/pull/97972. Part of https://github.com/flutter/flutter/pull/111080
This commit is contained in:
parent
726e5d28c0
commit
1349c591cc
|
@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
|
|||
import 'package:gallery/themes/material_demo_theme_data.dart';
|
||||
|
||||
void main() {
|
||||
test('verify former toggleableActiveColor themes are set', () async {
|
||||
test('verify the activeColors of toggleable widget themes are set', () async {
|
||||
const Color primaryColor = Color(0xFF6200EE);
|
||||
final ThemeData themeData = MaterialDemoThemeData.themeData;
|
||||
|
||||
|
|
|
@ -260,10 +260,12 @@ class Radio<T> extends StatefulWidget {
|
|||
///
|
||||
/// If null, then the value of [activeColor] is used in the selected state. If
|
||||
/// that is also null, then the value of [RadioThemeData.fillColor] is used.
|
||||
/// If that is also null, then [ThemeData.disabledColor] is used in
|
||||
/// the disabled state, [ColorScheme.secondary] is used in the
|
||||
/// selected state, and [ThemeData.unselectedWidgetColor] is used in the
|
||||
/// default state.
|
||||
/// If that is also null and [ThemeData.useMaterial3] is false, then
|
||||
/// [ThemeData.disabledColor] is used in the disabled state, [ColorScheme.secondary]
|
||||
/// is used in the selected state, and [ThemeData.unselectedWidgetColor] is used in the
|
||||
/// default state; if [ThemeData.useMaterial3] is true, then [ColorScheme.onSurface]
|
||||
/// is used in the disabled state, [ColorScheme.primary] is used in the
|
||||
/// selected state and [ColorScheme.onSurfaceVariant] is used in the default state.
|
||||
final MaterialStateProperty<Color?>? fillColor;
|
||||
|
||||
/// {@template flutter.material.radio.materialTapTargetSize}
|
||||
|
|
|
@ -34,8 +34,8 @@ enum _RadioType { material, adaptive }
|
|||
/// those of the same name on [ListTile].
|
||||
///
|
||||
/// The [selected] property on this widget is similar to the [ListTile.selected]
|
||||
/// property. This tile's [activeColor] is used for the selected item's text color, or
|
||||
/// the theme's [ThemeData.toggleableActiveColor] if [activeColor] is null.
|
||||
/// property. The [fillColor] in the selected state is used for the selected item's
|
||||
/// text color. It it is null, the [activeColor] is used.
|
||||
///
|
||||
/// This widget does not coordinate the [selected] state and the
|
||||
/// [checked] state; to have the list tile appear selected when the
|
||||
|
|
|
@ -55,18 +55,12 @@ class RadioThemeData with Diagnosticable {
|
|||
|
||||
/// {@macro flutter.material.radio.fillColor}
|
||||
///
|
||||
/// If specified, overrides the default value of [Radio.fillColor]. The
|
||||
/// default value is the value of [ThemeData.disabledColor] in the disabled
|
||||
/// state, [ThemeData.toggleableActiveColor] in the selected state, and
|
||||
/// [ThemeData.unselectedWidgetColor] in the default state.
|
||||
/// If specified, overrides the default value of [Radio.fillColor].
|
||||
final MaterialStateProperty<Color?>? fillColor;
|
||||
|
||||
/// {@macro flutter.material.radio.overlayColor}
|
||||
///
|
||||
/// If specified, overrides the default value of [Radio.overlayColor]. The
|
||||
/// default value is [ThemeData.toggleableActiveColor] with alpha
|
||||
/// [kRadialReactionAlpha], [ThemeData.focusColor] and [ThemeData.hoverColor]
|
||||
/// in the pressed, focused, and hovered state.
|
||||
/// If specified, overrides the default value of [Radio.overlayColor].
|
||||
final MaterialStateProperty<Color?>? overlayColor;
|
||||
|
||||
/// {@macro flutter.material.radio.splashRadius}
|
||||
|
|
|
@ -297,7 +297,7 @@ class SwitchListTile extends StatelessWidget {
|
|||
|
||||
/// {@macro flutter.material.switch.activeTrackColor}
|
||||
///
|
||||
/// Defaults to [ThemeData.toggleableActiveColor] with the opacity set at 50%.
|
||||
/// Defaults to [ColorScheme.secondary] with the opacity set at 50%.
|
||||
///
|
||||
/// Ignored if created with [SwitchListTile.adaptive].
|
||||
final Color? activeTrackColor;
|
||||
|
|
|
@ -367,13 +367,6 @@ class ThemeData with Diagnosticable {
|
|||
ToggleButtonsThemeData? toggleButtonsTheme,
|
||||
TooltipThemeData? tooltipTheme,
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
@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/toggleable-active-color#migration-guide. '
|
||||
'This feature was deprecated after v3.4.0-19.0.pre.',
|
||||
)
|
||||
Color? toggleableActiveColor,
|
||||
@Deprecated(
|
||||
'Use colorScheme.error instead. '
|
||||
'This feature was deprecated after v3.3.0-0.5.pre.',
|
||||
|
@ -451,7 +444,6 @@ class ThemeData with Diagnosticable {
|
|||
primaryColorLight ??= isDark ? Colors.grey[500]! : primarySwatch[100]!;
|
||||
primaryColorDark ??= isDark ? Colors.black : primarySwatch[700]!;
|
||||
final bool primaryIsDark = estimatedPrimaryColorBrightness == Brightness.dark;
|
||||
toggleableActiveColor ??= isDark ? Colors.tealAccent[200]! : (colorScheme?.secondary ?? primarySwatch[600]!);
|
||||
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;
|
||||
|
@ -657,7 +649,6 @@ class ThemeData with Diagnosticable {
|
|||
toggleButtonsTheme: toggleButtonsTheme,
|
||||
tooltipTheme: tooltipTheme,
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
toggleableActiveColor: toggleableActiveColor,
|
||||
errorColor: errorColor,
|
||||
backgroundColor: backgroundColor,
|
||||
);
|
||||
|
@ -766,13 +757,6 @@ class ThemeData with Diagnosticable {
|
|||
required this.toggleButtonsTheme,
|
||||
required this.tooltipTheme,
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
@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/toggleable-active-color#migration-guide. '
|
||||
'This feature was deprecated after v3.4.0-19.0.pre.',
|
||||
)
|
||||
Color? toggleableActiveColor,
|
||||
@Deprecated(
|
||||
'Use colorScheme.error instead. '
|
||||
'This feature was deprecated after v3.3.0-0.5.pre.',
|
||||
|
@ -786,10 +770,8 @@ class ThemeData with Diagnosticable {
|
|||
|
||||
}) : // DEPRECATED (newest deprecations at the bottom)
|
||||
// should not be `required`, use getter pattern to avoid breakages.
|
||||
_toggleableActiveColor = toggleableActiveColor,
|
||||
_errorColor = errorColor,
|
||||
_backgroundColor = backgroundColor,
|
||||
assert(toggleableActiveColor != null),
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
assert(errorColor != null),
|
||||
assert(backgroundColor != null);
|
||||
|
@ -1469,17 +1451,6 @@ class ThemeData with Diagnosticable {
|
|||
Color get backgroundColor => _backgroundColor!;
|
||||
final Color? _backgroundColor;
|
||||
|
||||
/// The color used to highlight the active states of toggleable widgets like
|
||||
/// [Switch], [Radio], and [Checkbox].
|
||||
@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/toggleable-active-color#migration-guide. '
|
||||
'This feature was deprecated after v3.4.0-19.0.pre.',
|
||||
)
|
||||
Color get toggleableActiveColor => _toggleableActiveColor!;
|
||||
final Color? _toggleableActiveColor;
|
||||
|
||||
/// Creates a copy of this theme but with the given fields replaced with the new values.
|
||||
///
|
||||
/// The [brightness] value is applied to the [colorScheme].
|
||||
|
@ -1579,13 +1550,6 @@ class ThemeData with Diagnosticable {
|
|||
ToggleButtonsThemeData? toggleButtonsTheme,
|
||||
TooltipThemeData? tooltipTheme,
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
@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/toggleable-active-color#migration-guide. '
|
||||
'This feature was deprecated after v3.4.0-19.0.pre.',
|
||||
)
|
||||
Color? toggleableActiveColor,
|
||||
@Deprecated(
|
||||
'Use colorScheme.error instead. '
|
||||
'This feature was deprecated after v3.3.0-0.5.pre.',
|
||||
|
@ -1701,7 +1665,6 @@ class ThemeData with Diagnosticable {
|
|||
toggleButtonsTheme: toggleButtonsTheme ?? this.toggleButtonsTheme,
|
||||
tooltipTheme: tooltipTheme ?? this.tooltipTheme,
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
toggleableActiveColor: toggleableActiveColor ?? _toggleableActiveColor,
|
||||
errorColor: errorColor ?? _errorColor,
|
||||
backgroundColor: backgroundColor ?? _backgroundColor,
|
||||
);
|
||||
|
@ -1898,7 +1861,6 @@ class ThemeData with Diagnosticable {
|
|||
toggleButtonsTheme: ToggleButtonsThemeData.lerp(a.toggleButtonsTheme, b.toggleButtonsTheme, t)!,
|
||||
tooltipTheme: TooltipThemeData.lerp(a.tooltipTheme, b.tooltipTheme, t)!,
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
toggleableActiveColor: Color.lerp(a.toggleableActiveColor, b.toggleableActiveColor, t),
|
||||
errorColor: Color.lerp(a.errorColor, b.errorColor, t),
|
||||
backgroundColor: Color.lerp(a.backgroundColor, b.backgroundColor, t),
|
||||
);
|
||||
|
@ -2002,7 +1964,6 @@ class ThemeData with Diagnosticable {
|
|||
other.toggleButtonsTheme == toggleButtonsTheme &&
|
||||
other.tooltipTheme == tooltipTheme &&
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
other.toggleableActiveColor == toggleableActiveColor &&
|
||||
other.errorColor == errorColor &&
|
||||
other.backgroundColor == backgroundColor;
|
||||
}
|
||||
|
@ -2104,7 +2065,6 @@ class ThemeData with Diagnosticable {
|
|||
toggleButtonsTheme,
|
||||
tooltipTheme,
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
toggleableActiveColor,
|
||||
errorColor,
|
||||
backgroundColor,
|
||||
];
|
||||
|
@ -2207,7 +2167,6 @@ class ThemeData with Diagnosticable {
|
|||
properties.add(DiagnosticsProperty<ToggleButtonsThemeData>('toggleButtonsTheme', toggleButtonsTheme, level: DiagnosticLevel.debug));
|
||||
properties.add(DiagnosticsProperty<TooltipThemeData>('tooltipTheme', tooltipTheme, level: DiagnosticLevel.debug));
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
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));
|
||||
}
|
||||
|
|
|
@ -642,7 +642,6 @@ void main() {
|
|||
indicatorColor: Colors.black,
|
||||
hintColor: Colors.black,
|
||||
errorColor: Colors.black,
|
||||
toggleableActiveColor: Colors.black,
|
||||
textTheme: ThemeData.dark().textTheme,
|
||||
primaryTextTheme: ThemeData.dark().textTheme,
|
||||
inputDecorationTheme: ThemeData.dark().inputDecorationTheme.copyWith(border: const OutlineInputBorder()),
|
||||
|
|
|
@ -902,7 +902,6 @@ void main() {
|
|||
toggleButtonsTheme: const ToggleButtonsThemeData(textStyle: TextStyle(color: Colors.black)),
|
||||
tooltipTheme: const TooltipThemeData(height: 100),
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
toggleableActiveColor: Colors.black,
|
||||
errorColor: Colors.black,
|
||||
backgroundColor: Colors.black,
|
||||
);
|
||||
|
@ -1021,7 +1020,6 @@ void main() {
|
|||
tooltipTheme: const TooltipThemeData(height: 100),
|
||||
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
toggleableActiveColor: Colors.white,
|
||||
errorColor: Colors.white,
|
||||
backgroundColor: Colors.white,
|
||||
);
|
||||
|
@ -1121,7 +1119,6 @@ void main() {
|
|||
tooltipTheme: otherTheme.tooltipTheme,
|
||||
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
toggleableActiveColor: otherTheme.toggleableActiveColor,
|
||||
errorColor: otherTheme.errorColor,
|
||||
backgroundColor: otherTheme.backgroundColor,
|
||||
);
|
||||
|
@ -1222,7 +1219,6 @@ void main() {
|
|||
expect(themeDataCopy.tooltipTheme, equals(otherTheme.tooltipTheme));
|
||||
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
expect(themeDataCopy.toggleableActiveColor, equals(otherTheme.toggleableActiveColor));
|
||||
expect(themeDataCopy.errorColor, equals(otherTheme.errorColor));
|
||||
expect(themeDataCopy.backgroundColor, equals(otherTheme.backgroundColor));
|
||||
});
|
||||
|
@ -1354,7 +1350,6 @@ void main() {
|
|||
'toggleButtonsTheme',
|
||||
'tooltipTheme',
|
||||
// DEPRECATED (newest deprecations at the bottom)
|
||||
'toggleableActiveColor',
|
||||
'errorColor',
|
||||
'backgroundColor',
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue