diff --git a/dev/integration_tests/new_gallery/test/theme_test.dart b/dev/integration_tests/new_gallery/test/theme_test.dart index 390e3c2a4679..473f3a755ffa 100644 --- a/dev/integration_tests/new_gallery/test/theme_test.dart +++ b/dev/integration_tests/new_gallery/test/theme_test.dart @@ -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; diff --git a/packages/flutter/lib/src/material/radio.dart b/packages/flutter/lib/src/material/radio.dart index d0c97e3b4081..f15260c2e7a6 100644 --- a/packages/flutter/lib/src/material/radio.dart +++ b/packages/flutter/lib/src/material/radio.dart @@ -260,10 +260,12 @@ class Radio 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? fillColor; /// {@template flutter.material.radio.materialTapTargetSize} diff --git a/packages/flutter/lib/src/material/radio_list_tile.dart b/packages/flutter/lib/src/material/radio_list_tile.dart index 5f43789b5e04..cc25b42e4af6 100644 --- a/packages/flutter/lib/src/material/radio_list_tile.dart +++ b/packages/flutter/lib/src/material/radio_list_tile.dart @@ -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 diff --git a/packages/flutter/lib/src/material/radio_theme.dart b/packages/flutter/lib/src/material/radio_theme.dart index f474103ceca8..b84e7c70ee7d 100644 --- a/packages/flutter/lib/src/material/radio_theme.dart +++ b/packages/flutter/lib/src/material/radio_theme.dart @@ -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? 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? overlayColor; /// {@macro flutter.material.radio.splashRadius} diff --git a/packages/flutter/lib/src/material/switch_list_tile.dart b/packages/flutter/lib/src/material/switch_list_tile.dart index c8f05016faec..2a8f15087e40 100644 --- a/packages/flutter/lib/src/material/switch_list_tile.dart +++ b/packages/flutter/lib/src/material/switch_list_tile.dart @@ -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; diff --git a/packages/flutter/lib/src/material/theme_data.dart b/packages/flutter/lib/src/material/theme_data.dart index 096a08d6cd4c..d9cc795b1031 100644 --- a/packages/flutter/lib/src/material/theme_data.dart +++ b/packages/flutter/lib/src/material/theme_data.dart @@ -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('toggleButtonsTheme', toggleButtonsTheme, level: DiagnosticLevel.debug)); properties.add(DiagnosticsProperty('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)); } diff --git a/packages/flutter/test/material/snack_bar_test.dart b/packages/flutter/test/material/snack_bar_test.dart index f6bfc6ec046b..549ff9627ed0 100644 --- a/packages/flutter/test/material/snack_bar_test.dart +++ b/packages/flutter/test/material/snack_bar_test.dart @@ -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()), diff --git a/packages/flutter/test/material/theme_data_test.dart b/packages/flutter/test/material/theme_data_test.dart index 65d10371e4dc..8eb91b83680e 100644 --- a/packages/flutter/test/material/theme_data_test.dart +++ b/packages/flutter/test/material/theme_data_test.dart @@ -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', };