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>[
......
...@@ -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