diff --git a/packages/flutter/lib/src/material/theme_data.dart b/packages/flutter/lib/src/material/theme_data.dart index 26646e42a4..1c41c63b31 100644 --- a/packages/flutter/lib/src/material/theme_data.dart +++ b/packages/flutter/lib/src/material/theme_data.dart @@ -136,23 +136,6 @@ abstract class ThemeExtension> { ThemeExtension lerp(covariant ThemeExtension? other, double t); } -// Deriving these values is black magic. The spec claims that pressed buttons -// have a highlight of 0x66999999, but that's clearly wrong. The videos in the -// spec show that buttons have a composited highlight of #E1E1E1 on a background -// of #FAFAFA. Assuming that the highlight really has an opacity of 0x66, we can -// solve for the actual color of the highlight: -const Color _kLightThemeHighlightColor = Color(0x66BCBCBC); - -// The same video shows the splash compositing to #D7D7D7 on a background of -// #E1E1E1. Again, assuming the splash has an opacity of 0x66, we can solve for -// the actual color of the splash: -const Color _kLightThemeSplashColor = Color(0x66C8C8C8); - -// Unfortunately, a similar video isn't available for the dark theme, which -// means we assume the values in the spec are actually correct. -const Color _kDarkThemeHighlightColor = Color(0x40CCCCCC); -const Color _kDarkThemeSplashColor = Color(0x40CCCCCC); - /// Configures the tap target and layout size of certain Material widgets. /// /// Changing the value in [ThemeData.materialTapTargetSize] will affect the @@ -262,8 +245,8 @@ class ThemeData with Diagnosticable { /// See also: /// /// * [ThemeData.from], which creates a ThemeData from a [ColorScheme]. - /// * [ThemeData.light], which creates a light blue theme. - /// * [ThemeData.dark], which creates dark theme with a teal secondary [ColorScheme] color. + /// * [ThemeData.light], which creates the default light theme. + /// * [ThemeData.dark], which creates the deafult dark theme. /// * [ColorScheme.fromSeed], which is used to create a [ColorScheme] from a seed color. factory ThemeData({ // For the sanity of the reader, make sure these properties are in the same @@ -285,14 +268,14 @@ class ThemeData with Diagnosticable { bool? useMaterial3, VisualDensity? visualDensity, // COLOR - // [colorScheme] is the preferred way to configure colors. The other color - // properties (as well as primarySwatch) will gradually be phased out, see - // https://github.com/flutter/flutter/issues/91772. + ColorScheme? colorScheme, Brightness? brightness, + Color? colorSchemeSeed, + // [colorScheme] is the preferred way to configure colors. The [Color] properties + // listed below (as well as primarySwatch) will gradually be phased out, see + // https://github.com/flutter/flutter/issues/91772. Color? canvasColor, Color? cardColor, - ColorScheme? colorScheme, - Color? colorSchemeSeed, Color? dialogBackgroundColor, Color? disabledColor, Color? dividerColor, @@ -365,6 +348,7 @@ class ThemeData with Diagnosticable { TimePickerThemeData? timePickerTheme, ToggleButtonsThemeData? toggleButtonsTheme, TooltipThemeData? tooltipTheme, + // DEPRECATED (newest deprecations at the bottom) @Deprecated( 'Use OverflowBar instead. ' 'This feature was deprecated after v3.21.0-10.0.pre.', @@ -471,8 +455,8 @@ class ThemeData with Diagnosticable { materialTapTargetSize: materialTapTargetSize, ); disabledColor ??= isDark ? Colors.white38 : Colors.black38; - highlightColor ??= isDark ? _kDarkThemeHighlightColor : _kLightThemeHighlightColor; - splashColor ??= isDark ? _kDarkThemeSplashColor : _kLightThemeSplashColor; + highlightColor ??= isDark ? const Color(0x40CCCCCC) : const Color(0x66BCBCBC); + splashColor ??= isDark ? const Color(0x40CCCCCC) : const Color(0x66C8C8C8); // TYPOGRAPHY & ICONOGRAPHY typography ??= useMaterial3 @@ -666,12 +650,12 @@ class ThemeData with Diagnosticable { required this.useMaterial3, required this.visualDensity, // COLOR - // [colorScheme] is the preferred way to configure colors. The other color - // properties will gradually be phased out, see + required this.colorScheme, + // [colorScheme] is the preferred way to configure colors. The [Color] properties + // listed below (as well as primarySwatch) will gradually be phased out, see // https://github.com/flutter/flutter/issues/91772. required this.canvasColor, required this.cardColor, - required this.colorScheme, required this.dialogBackgroundColor, required this.disabledColor, required this.dividerColor, @@ -749,7 +733,6 @@ class ThemeData with Diagnosticable { }) : // DEPRECATED (newest deprecations at the bottom) // should not be `required`, use getter pattern to avoid breakages. _buttonBarTheme = buttonBarTheme, - // DEPRECATED (newest deprecations at the bottom) assert(buttonBarTheme != null); /// Create a [ThemeData] based on the colors in the given [colorScheme] and @@ -1432,13 +1415,13 @@ class ThemeData with Diagnosticable { InteractiveInkFeatureFactory? splashFactory, VisualDensity? visualDensity, // COLOR - // [colorScheme] is the preferred way to configure colors. The other color - // properties will gradually be phased out, see - // https://github.com/flutter/flutter/issues/91772. + ColorScheme? colorScheme, Brightness? brightness, + // [colorScheme] is the preferred way to configure colors. The [Color] properties + // listed below (as well as primarySwatch) will gradually be phased out, see + // https://github.com/flutter/flutter/issues/91772. Color? canvasColor, Color? cardColor, - ColorScheme? colorScheme, Color? dialogBackgroundColor, Color? disabledColor, Color? dividerColor,