Unverified Commit e1a96b81 authored by Pierre-Louis's avatar Pierre-Louis Committed by GitHub

Deprecate `primaryColorBrightness` (#93396)

parent 8612f80a
...@@ -14,6 +14,38 @@ ...@@ -14,6 +14,38 @@
version: 1 version: 1
transforms: transforms:
# Changes made in https://github.com/flutter/flutter/pull/93396
- title: "Remove 'primaryColorBrightness'"
date: 2021-11-11
element:
uris: [ 'material.dart' ]
method: 'copyWith'
inClass: 'ThemeData'
changes:
- kind: 'removeParameter'
name: 'primaryColorBrightness'
# Changes made in https://github.com/flutter/flutter/pull/93396
- title: "Remove 'primaryColorBrightness'"
date: 2021-11-11
element:
uris: [ 'material.dart' ]
constructor: 'raw'
inClass: 'ThemeData'
changes:
- kind: 'removeParameter'
name: 'primaryColorBrightness'
# Changes made in https://github.com/flutter/flutter/pull/93396
- title: "Remove 'primaryColorBrightness'"
date: 2021-11-11
element:
uris: [ 'material.dart' ]
constructor: ''
inClass: 'ThemeData'
changes:
- kind: 'removeParameter'
name: 'primaryColorBrightness'
# Changes made in https://github.com/flutter/flutter/pull/86198 # Changes made in https://github.com/flutter/flutter/pull/86198
- title: "Migrate to 'backgroundColor'" - title: "Migrate to 'backgroundColor'"
......
...@@ -1047,7 +1047,7 @@ class _AppBarState extends State<AppBar> { ...@@ -1047,7 +1047,7 @@ class _AppBarState extends State<AppBar> {
? _systemOverlayStyleForBrightness( ? _systemOverlayStyleForBrightness(
widget.brightness widget.brightness
?? appBarTheme.brightness ?? appBarTheme.brightness
?? theme.primaryColorBrightness, ?? ThemeData.estimateBrightnessForColor(backgroundColor),
) )
: widget.systemOverlayStyle : widget.systemOverlayStyle
?? appBarTheme.systemOverlayStyle ?? appBarTheme.systemOverlayStyle
......
...@@ -662,7 +662,7 @@ class TextField extends StatefulWidget { ...@@ -662,7 +662,7 @@ class TextField extends StatefulWidget {
/// ///
/// This setting is only honored on iOS devices. /// This setting is only honored on iOS devices.
/// ///
/// If unset, defaults to the brightness of [ThemeData.primaryColorBrightness]. /// If unset, defaults to [ThemeData.brightness].
final Brightness? keyboardAppearance; final Brightness? keyboardAppearance;
/// {@macro flutter.widgets.editableText.scrollPadding} /// {@macro flutter.widgets.editableText.scrollPadding}
...@@ -1143,7 +1143,7 @@ class _TextFieldState extends State<TextField> with RestorationMixin implements ...@@ -1143,7 +1143,7 @@ class _TextFieldState extends State<TextField> with RestorationMixin implements
final ThemeData theme = Theme.of(context); final ThemeData theme = Theme.of(context);
final TextSelectionThemeData selectionTheme = TextSelectionTheme.of(context); final TextSelectionThemeData selectionTheme = TextSelectionTheme.of(context);
final TextStyle style = theme.textTheme.subtitle1!.merge(widget.style); final TextStyle style = theme.textTheme.subtitle1!.merge(widget.style);
final Brightness keyboardAppearance = widget.keyboardAppearance ?? theme.primaryColorBrightness; final Brightness keyboardAppearance = widget.keyboardAppearance ?? theme.brightness;
final TextEditingController controller = _effectiveController; final TextEditingController controller = _effectiveController;
final FocusNode focusNode = _effectiveFocusNode; final FocusNode focusNode = _effectiveFocusNode;
final List<TextInputFormatter> formatters = <TextInputFormatter>[ final List<TextInputFormatter> formatters = <TextInputFormatter>[
......
...@@ -239,7 +239,6 @@ class ThemeData with Diagnosticable { ...@@ -239,7 +239,6 @@ class ThemeData with Diagnosticable {
Brightness? brightness, Brightness? brightness,
MaterialColor? primarySwatch, MaterialColor? primarySwatch,
Color? primaryColor, Color? primaryColor,
Brightness? primaryColorBrightness,
Color? primaryColorLight, Color? primaryColorLight,
Color? primaryColorDark, Color? primaryColorDark,
Color? focusColor, Color? focusColor,
...@@ -361,6 +360,11 @@ class ThemeData with Diagnosticable { ...@@ -361,6 +360,11 @@ class ThemeData with Diagnosticable {
'This feature was deprecated after v2.5.0-1.0.pre.', 'This feature was deprecated after v2.5.0-1.0.pre.',
) )
bool? fixTextFieldOutlineLabel, bool? fixTextFieldOutlineLabel,
@Deprecated(
'No longer used by the framework, please remove any reference to it. '
'This feature was deprecated after v2.6.0-11.0.pre.',
)
Brightness? primaryColorBrightness,
}) { }) {
// GENERAL CONFIGURATION // GENERAL CONFIGURATION
applyElevationOverlayColor ??= false; applyElevationOverlayColor ??= false;
...@@ -390,10 +394,10 @@ class ThemeData with Diagnosticable { ...@@ -390,10 +394,10 @@ class ThemeData with Diagnosticable {
final bool isDark = _brightness == Brightness.dark; final bool isDark = _brightness == Brightness.dark;
primarySwatch ??= Colors.blue; primarySwatch ??= Colors.blue;
primaryColor ??= isDark ? Colors.grey[900]! : primarySwatch; primaryColor ??= isDark ? Colors.grey[900]! : primarySwatch;
primaryColorBrightness ??= estimateBrightnessForColor(primaryColor); final Brightness _primaryColorBrightness = estimateBrightnessForColor(primaryColor);
primaryColorLight ??= isDark ? Colors.grey[500]! : primarySwatch[100]!; primaryColorLight ??= isDark ? Colors.grey[500]! : primarySwatch[100]!;
primaryColorDark ??= isDark ? Colors.black : primarySwatch[700]!; primaryColorDark ??= isDark ? Colors.black : primarySwatch[700]!;
final bool primaryIsDark = primaryColorBrightness == Brightness.dark; final bool primaryIsDark = _primaryColorBrightness == Brightness.dark;
toggleableActiveColor ??= isDark ? Colors.tealAccent[200]! : (accentColor ?? primarySwatch[600]!); toggleableActiveColor ??= isDark ? Colors.tealAccent[200]! : (accentColor ?? primarySwatch[600]!);
accentColor ??= isDark ? Colors.tealAccent[200]! : primarySwatch[500]!; accentColor ??= isDark ? Colors.tealAccent[200]! : primarySwatch[500]!;
accentColorBrightness ??= estimateBrightnessForColor(accentColor); accentColorBrightness ??= estimateBrightnessForColor(accentColor);
...@@ -500,6 +504,7 @@ class ThemeData with Diagnosticable { ...@@ -500,6 +504,7 @@ class ThemeData with Diagnosticable {
accentIconTheme ??= accentIsDark ? const IconThemeData(color: Colors.white) : const IconThemeData(color: Colors.black); accentIconTheme ??= accentIsDark ? const IconThemeData(color: Colors.white) : const IconThemeData(color: Colors.black);
buttonColor ??= isDark ? primarySwatch[600]! : Colors.grey[300]!; buttonColor ??= isDark ? primarySwatch[600]! : Colors.grey[300]!;
fixTextFieldOutlineLabel ??= true; fixTextFieldOutlineLabel ??= true;
primaryColorBrightness = _primaryColorBrightness;
return ThemeData.raw( return ThemeData.raw(
// GENERAL CONFIGURATION // GENERAL CONFIGURATION
...@@ -516,7 +521,6 @@ class ThemeData with Diagnosticable { ...@@ -516,7 +521,6 @@ class ThemeData with Diagnosticable {
// COLOR // COLOR
colorScheme: colorScheme, colorScheme: colorScheme,
primaryColor: primaryColor, primaryColor: primaryColor,
primaryColorBrightness: primaryColorBrightness,
primaryColorLight: primaryColorLight, primaryColorLight: primaryColorLight,
primaryColorDark: primaryColorDark, primaryColorDark: primaryColorDark,
focusColor: focusColor, focusColor: focusColor,
...@@ -589,6 +593,7 @@ class ThemeData with Diagnosticable { ...@@ -589,6 +593,7 @@ class ThemeData with Diagnosticable {
accentIconTheme: accentIconTheme, accentIconTheme: accentIconTheme,
buttonColor: buttonColor, buttonColor: buttonColor,
fixTextFieldOutlineLabel: fixTextFieldOutlineLabel, fixTextFieldOutlineLabel: fixTextFieldOutlineLabel,
primaryColorBrightness: primaryColorBrightness,
); );
} }
...@@ -620,7 +625,6 @@ class ThemeData with Diagnosticable { ...@@ -620,7 +625,6 @@ class ThemeData with Diagnosticable {
// https://github.com/flutter/flutter/issues/91772. // https://github.com/flutter/flutter/issues/91772.
required this.colorScheme, required this.colorScheme,
required this.primaryColor, required this.primaryColor,
required this.primaryColorBrightness,
required this.primaryColorLight, required this.primaryColorLight,
required this.primaryColorDark, required this.primaryColorDark,
required this.focusColor, required this.focusColor,
...@@ -741,6 +745,11 @@ class ThemeData with Diagnosticable { ...@@ -741,6 +745,11 @@ class ThemeData with Diagnosticable {
'This feature was deprecated after v2.5.0-1.0.pre.', 'This feature was deprecated after v2.5.0-1.0.pre.',
) )
required this.fixTextFieldOutlineLabel, required this.fixTextFieldOutlineLabel,
@Deprecated(
'No longer used by the framework, please remove any reference to it. '
'This feature was deprecated after v2.6.0-11.0.pre.',
)
required this.primaryColorBrightness,
}) : // GENERAL CONFIGURATION }) : // GENERAL CONFIGURATION
assert(applyElevationOverlayColor != null), assert(applyElevationOverlayColor != null),
assert(inputDecorationTheme != null), assert(inputDecorationTheme != null),
...@@ -753,7 +762,6 @@ class ThemeData with Diagnosticable { ...@@ -753,7 +762,6 @@ class ThemeData with Diagnosticable {
// COLOR // COLOR
assert(colorScheme != null), assert(colorScheme != null),
assert(primaryColor != null), assert(primaryColor != null),
assert(primaryColorBrightness != null),
assert(primaryColorLight != null), assert(primaryColorLight != null),
assert(primaryColorDark != null), assert(primaryColorDark != null),
assert(focusColor != null), assert(focusColor != null),
...@@ -825,7 +833,8 @@ class ThemeData with Diagnosticable { ...@@ -825,7 +833,8 @@ class ThemeData with Diagnosticable {
assert(accentTextTheme != null), assert(accentTextTheme != null),
assert(accentIconTheme != null), assert(accentIconTheme != null),
assert(buttonColor != null), assert(buttonColor != null),
assert(fixTextFieldOutlineLabel != null); assert(fixTextFieldOutlineLabel != null),
assert(primaryColorBrightness != null);
/// Create a [ThemeData] based on the colors in the given [colorScheme] and /// Create a [ThemeData] based on the colors in the given [colorScheme] and
/// text styles of the optional [textTheme]. /// text styles of the optional [textTheme].
...@@ -1089,10 +1098,6 @@ class ThemeData with Diagnosticable { ...@@ -1089,10 +1098,6 @@ class ThemeData with Diagnosticable {
/// visuals in terms of the theme's [colorScheme]. /// visuals in terms of the theme's [colorScheme].
final Color primaryColor; final Color primaryColor;
/// The brightness of the [primaryColor]. Used to determine the color of text and
/// icons placed on top of the primary color (e.g. toolbar text).
final Brightness primaryColorBrightness;
/// A lighter version of the [primaryColor]. /// A lighter version of the [primaryColor].
final Color primaryColorLight; final Color primaryColorLight;
...@@ -1451,6 +1456,21 @@ class ThemeData with Diagnosticable { ...@@ -1451,6 +1456,21 @@ class ThemeData with Diagnosticable {
) )
final bool fixTextFieldOutlineLabel; final bool fixTextFieldOutlineLabel;
/// Obsolete property that was originally used to determine the color
/// of text and icons placed on top of the primary color (e.g. toolbar text).
///
/// The material library no longer uses this property. The [appBarTheme] can
/// be used to configure the appearance of [AppBar]s. The appearance of
/// Keyboards for [TextField]s now uses the overall theme's
/// [ThemeData.brightness] and can also be customized with
/// [TextField.keyboardAppearance]. The brightness of any color can be found
/// with [ThemeData.estimateBrightnessForColor].
@Deprecated(
'No longer used by the framework, please remove any reference to it. '
'This feature was deprecated after v2.6.0-11.0.pre.',
)
final Brightness primaryColorBrightness;
/// Creates a copy of this theme but with the given fields replaced with the new values. /// Creates a copy of this theme but with the given fields replaced with the new values.
/// ///
/// The [brightness] value is applied to the [colorScheme]. /// The [brightness] value is applied to the [colorScheme].
...@@ -1473,7 +1493,6 @@ class ThemeData with Diagnosticable { ...@@ -1473,7 +1493,6 @@ class ThemeData with Diagnosticable {
ColorScheme? colorScheme, ColorScheme? colorScheme,
Brightness? brightness, Brightness? brightness,
Color? primaryColor, Color? primaryColor,
Brightness? primaryColorBrightness,
Color? primaryColorLight, Color? primaryColorLight,
Color? primaryColorDark, Color? primaryColorDark,
Color? focusColor, Color? focusColor,
...@@ -1594,6 +1613,11 @@ class ThemeData with Diagnosticable { ...@@ -1594,6 +1613,11 @@ class ThemeData with Diagnosticable {
'This feature was deprecated after v2.5.0-1.0.pre.', 'This feature was deprecated after v2.5.0-1.0.pre.',
) )
bool? fixTextFieldOutlineLabel, bool? fixTextFieldOutlineLabel,
@Deprecated(
'No longer used by the framework, please remove any reference to it. '
'This feature was deprecated after v2.6.0-11.0.pre.',
)
Brightness? primaryColorBrightness,
}) { }) {
cupertinoOverrideTheme = cupertinoOverrideTheme?.noDefault(); cupertinoOverrideTheme = cupertinoOverrideTheme?.noDefault();
return ThemeData.raw( return ThemeData.raw(
...@@ -1611,7 +1635,6 @@ class ThemeData with Diagnosticable { ...@@ -1611,7 +1635,6 @@ class ThemeData with Diagnosticable {
// COLOR // COLOR
colorScheme: (colorScheme ?? this.colorScheme).copyWith(brightness: brightness), colorScheme: (colorScheme ?? this.colorScheme).copyWith(brightness: brightness),
primaryColor: primaryColor ?? this.primaryColor, primaryColor: primaryColor ?? this.primaryColor,
primaryColorBrightness: primaryColorBrightness ?? this.primaryColorBrightness,
primaryColorLight: primaryColorLight ?? this.primaryColorLight, primaryColorLight: primaryColorLight ?? this.primaryColorLight,
primaryColorDark: primaryColorDark ?? this.primaryColorDark, primaryColorDark: primaryColorDark ?? this.primaryColorDark,
focusColor: focusColor ?? this.focusColor, focusColor: focusColor ?? this.focusColor,
...@@ -1684,6 +1707,7 @@ class ThemeData with Diagnosticable { ...@@ -1684,6 +1707,7 @@ class ThemeData with Diagnosticable {
accentIconTheme: accentIconTheme ?? this.accentIconTheme, accentIconTheme: accentIconTheme ?? this.accentIconTheme,
buttonColor: buttonColor ?? this.buttonColor, buttonColor: buttonColor ?? this.buttonColor,
fixTextFieldOutlineLabel: fixTextFieldOutlineLabel ?? this.fixTextFieldOutlineLabel, fixTextFieldOutlineLabel: fixTextFieldOutlineLabel ?? this.fixTextFieldOutlineLabel,
primaryColorBrightness: primaryColorBrightness ?? this.primaryColorBrightness,
); );
} }
...@@ -1779,7 +1803,6 @@ class ThemeData with Diagnosticable { ...@@ -1779,7 +1803,6 @@ class ThemeData with Diagnosticable {
// COLOR // COLOR
colorScheme: ColorScheme.lerp(a.colorScheme, b.colorScheme, t), colorScheme: ColorScheme.lerp(a.colorScheme, b.colorScheme, t),
primaryColor: Color.lerp(a.primaryColor, b.primaryColor, t)!, primaryColor: Color.lerp(a.primaryColor, b.primaryColor, t)!,
primaryColorBrightness: t < 0.5 ? a.primaryColorBrightness : b.primaryColorBrightness,
primaryColorLight: Color.lerp(a.primaryColorLight, b.primaryColorLight, t)!, primaryColorLight: Color.lerp(a.primaryColorLight, b.primaryColorLight, t)!,
primaryColorDark: Color.lerp(a.primaryColorDark, b.primaryColorDark, t)!, primaryColorDark: Color.lerp(a.primaryColorDark, b.primaryColorDark, t)!,
focusColor: Color.lerp(a.focusColor, b.focusColor, t)!, focusColor: Color.lerp(a.focusColor, b.focusColor, t)!,
...@@ -1852,6 +1875,7 @@ class ThemeData with Diagnosticable { ...@@ -1852,6 +1875,7 @@ class ThemeData with Diagnosticable {
accentIconTheme: IconThemeData.lerp(a.accentIconTheme, b.accentIconTheme, t), accentIconTheme: IconThemeData.lerp(a.accentIconTheme, b.accentIconTheme, t),
buttonColor: Color.lerp(a.buttonColor, b.buttonColor, t)!, buttonColor: Color.lerp(a.buttonColor, b.buttonColor, t)!,
fixTextFieldOutlineLabel: t < 0.5 ? a.fixTextFieldOutlineLabel : b.fixTextFieldOutlineLabel, fixTextFieldOutlineLabel: t < 0.5 ? a.fixTextFieldOutlineLabel : b.fixTextFieldOutlineLabel,
primaryColorBrightness: t < 0.5 ? a.primaryColorBrightness : b.primaryColorBrightness,
); );
} }
...@@ -1877,7 +1901,6 @@ class ThemeData with Diagnosticable { ...@@ -1877,7 +1901,6 @@ class ThemeData with Diagnosticable {
// COLOR // COLOR
other.colorScheme == colorScheme && other.colorScheme == colorScheme &&
other.primaryColor == primaryColor && other.primaryColor == primaryColor &&
other.primaryColorBrightness == primaryColorBrightness &&
other.primaryColorLight == primaryColorLight && other.primaryColorLight == primaryColorLight &&
other.primaryColorDark == primaryColorDark && other.primaryColorDark == primaryColorDark &&
other.focusColor == focusColor && other.focusColor == focusColor &&
...@@ -1949,7 +1972,8 @@ class ThemeData with Diagnosticable { ...@@ -1949,7 +1972,8 @@ class ThemeData with Diagnosticable {
other.accentTextTheme == accentTextTheme && other.accentTextTheme == accentTextTheme &&
other.accentIconTheme == accentIconTheme && other.accentIconTheme == accentIconTheme &&
other.buttonColor == buttonColor && other.buttonColor == buttonColor &&
other.fixTextFieldOutlineLabel == fixTextFieldOutlineLabel; other.fixTextFieldOutlineLabel == fixTextFieldOutlineLabel &&
other.primaryColorBrightness == primaryColorBrightness;
} }
@override @override
...@@ -1972,7 +1996,6 @@ class ThemeData with Diagnosticable { ...@@ -1972,7 +1996,6 @@ class ThemeData with Diagnosticable {
// COLOR // COLOR
colorScheme, colorScheme,
primaryColor, primaryColor,
primaryColorBrightness,
primaryColorLight, primaryColorLight,
primaryColorDark, primaryColorDark,
focusColor, focusColor,
...@@ -2045,6 +2068,7 @@ class ThemeData with Diagnosticable { ...@@ -2045,6 +2068,7 @@ class ThemeData with Diagnosticable {
accentIconTheme, accentIconTheme,
buttonColor, buttonColor,
fixTextFieldOutlineLabel, fixTextFieldOutlineLabel,
primaryColorBrightness,
]; ];
return hashList(values); return hashList(values);
} }
...@@ -2067,7 +2091,6 @@ class ThemeData with Diagnosticable { ...@@ -2067,7 +2091,6 @@ class ThemeData with Diagnosticable {
// COLORS // COLORS
properties.add(DiagnosticsProperty<ColorScheme>('colorScheme', colorScheme, defaultValue: defaultData.colorScheme, level: DiagnosticLevel.debug)); properties.add(DiagnosticsProperty<ColorScheme>('colorScheme', colorScheme, defaultValue: defaultData.colorScheme, level: DiagnosticLevel.debug));
properties.add(ColorProperty('primaryColor', primaryColor, defaultValue: defaultData.primaryColor, level: DiagnosticLevel.debug)); properties.add(ColorProperty('primaryColor', primaryColor, defaultValue: defaultData.primaryColor, level: DiagnosticLevel.debug));
properties.add(EnumProperty<Brightness>('primaryColorBrightness', primaryColorBrightness, defaultValue: defaultData.primaryColorBrightness, level: DiagnosticLevel.debug));
properties.add(ColorProperty('primaryColorLight', primaryColorLight, defaultValue: defaultData.primaryColorLight, level: DiagnosticLevel.debug)); properties.add(ColorProperty('primaryColorLight', primaryColorLight, defaultValue: defaultData.primaryColorLight, level: DiagnosticLevel.debug));
properties.add(ColorProperty('primaryColorDark', primaryColorDark, defaultValue: defaultData.primaryColorDark, level: DiagnosticLevel.debug)); properties.add(ColorProperty('primaryColorDark', primaryColorDark, defaultValue: defaultData.primaryColorDark, level: DiagnosticLevel.debug));
properties.add(ColorProperty('focusColor', focusColor, defaultValue: defaultData.focusColor, level: DiagnosticLevel.debug)); properties.add(ColorProperty('focusColor', focusColor, defaultValue: defaultData.focusColor, level: DiagnosticLevel.debug));
...@@ -2140,6 +2163,7 @@ class ThemeData with Diagnosticable { ...@@ -2140,6 +2163,7 @@ class ThemeData with Diagnosticable {
properties.add(DiagnosticsProperty<IconThemeData>('accentIconTheme', accentIconTheme, 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(ColorProperty('buttonColor', buttonColor, defaultValue: defaultData.buttonColor, level: DiagnosticLevel.debug));
properties.add(DiagnosticsProperty<bool>('fixTextFieldOutlineLabel', fixTextFieldOutlineLabel, level: DiagnosticLevel.debug)); properties.add(DiagnosticsProperty<bool>('fixTextFieldOutlineLabel', fixTextFieldOutlineLabel, level: DiagnosticLevel.debug));
properties.add(EnumProperty<Brightness>('primaryColorBrightness', primaryColorBrightness, defaultValue: defaultData.primaryColorBrightness, level: DiagnosticLevel.debug));
} }
} }
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
// This file is run as part of a reduced test set in CI on Mac and Windows // This file is run as part of a reduced test set in CI on Mac and Windows
// machines. // machines.
@Tags(<String>['reduced-test-set']) @Tags(<String>['reduced-test-set'])
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
......
...@@ -43,8 +43,8 @@ void main() { ...@@ -43,8 +43,8 @@ void main() {
}); });
test('Default primary text theme contrasts with primary brightness', () { test('Default primary text theme contrasts with primary brightness', () {
final ThemeData lightTheme = ThemeData(primaryColorBrightness: Brightness.light); final ThemeData lightTheme = ThemeData(primaryColor: Colors.white);
final ThemeData darkTheme = ThemeData(primaryColorBrightness: Brightness.dark); final ThemeData darkTheme = ThemeData(primaryColor: Colors.black);
final Typography typography = Typography.material2018(platform: lightTheme.platform); final Typography typography = Typography.material2018(platform: lightTheme.platform);
expect(lightTheme.primaryTextTheme.headline6!.color, typography.black.headline6!.color); expect(lightTheme.primaryTextTheme.headline6!.color, typography.black.headline6!.color);
...@@ -61,8 +61,8 @@ void main() { ...@@ -61,8 +61,8 @@ void main() {
}); });
test('Default primary icon theme contrasts with primary brightness', () { test('Default primary icon theme contrasts with primary brightness', () {
final ThemeData lightTheme = ThemeData(primaryColorBrightness: Brightness.light); final ThemeData lightTheme = ThemeData(primaryColor: Colors.white);
final ThemeData darkTheme = ThemeData(primaryColorBrightness: Brightness.dark); final ThemeData darkTheme = ThemeData(primaryColor: Colors.black);
final Typography typography = Typography.material2018(platform: lightTheme.platform); final Typography typography = Typography.material2018(platform: lightTheme.platform);
expect(lightTheme.primaryTextTheme.headline6!.color, typography.black.headline6!.color); expect(lightTheme.primaryTextTheme.headline6!.color, typography.black.headline6!.color);
...@@ -670,7 +670,6 @@ void main() { ...@@ -670,7 +670,6 @@ void main() {
// COLOR // COLOR
'colorScheme', 'colorScheme',
'primaryColor', 'primaryColor',
'primaryColorBrightness',
'primaryColorLight', 'primaryColorLight',
'primaryColorDark', 'primaryColorDark',
'focusColor', 'focusColor',
...@@ -743,6 +742,7 @@ void main() { ...@@ -743,6 +742,7 @@ void main() {
'accentIconTheme', 'accentIconTheme',
'buttonColor', 'buttonColor',
'fixTextFieldOutlineLabel', 'fixTextFieldOutlineLabel',
'primaryColorBrightness',
}; };
final DiagnosticPropertiesBuilder properties = DiagnosticPropertiesBuilder(); final DiagnosticPropertiesBuilder properties = DiagnosticPropertiesBuilder();
......
...@@ -500,4 +500,11 @@ void main() { ...@@ -500,4 +500,11 @@ void main() {
AppBarTheme appBarTheme = AppBarTheme(); AppBarTheme appBarTheme = AppBarTheme();
appBarTheme.color; appBarTheme.color;
// Changes made in https://github.com/flutter/flutter/pull/93396
ThemeData themeData = ThemeData();
themeData = ThemeData(primaryColorBrightness: Brightness.dark);
themeData = ThemeData.raw(primaryColorBrightness: Brightness.dark);
themeData = themeData.copyWith(primaryColorBrightness: Brightness.dark);
themeData.primaryColorBrightness; // Removing field reference not supported.
} }
...@@ -473,4 +473,11 @@ void main() { ...@@ -473,4 +473,11 @@ void main() {
AppBarTheme appBarTheme = AppBarTheme(); AppBarTheme appBarTheme = AppBarTheme();
appBarTheme.backgroundColor; appBarTheme.backgroundColor;
// Changes made in https://github.com/flutter/flutter/pull/93396
ThemeData themeData = ThemeData();
themeData = ThemeData();
themeData = ThemeData.raw();
themeData = themeData.copyWith();
themeData.primaryColorBrightness; // Removing field reference not supported.
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment