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

Deprecate `primaryColorBrightness` (#93396)

parent 8612f80a
......@@ -14,6 +14,38 @@
version: 1
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
- title: "Migrate to 'backgroundColor'"
......
......@@ -1047,7 +1047,7 @@ class _AppBarState extends State<AppBar> {
? _systemOverlayStyleForBrightness(
widget.brightness
?? appBarTheme.brightness
?? theme.primaryColorBrightness,
?? ThemeData.estimateBrightnessForColor(backgroundColor),
)
: widget.systemOverlayStyle
?? appBarTheme.systemOverlayStyle
......
......@@ -662,7 +662,7 @@ class TextField extends StatefulWidget {
///
/// 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;
/// {@macro flutter.widgets.editableText.scrollPadding}
......@@ -1143,7 +1143,7 @@ class _TextFieldState extends State<TextField> with RestorationMixin implements
final ThemeData theme = Theme.of(context);
final TextSelectionThemeData selectionTheme = TextSelectionTheme.of(context);
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 FocusNode focusNode = _effectiveFocusNode;
final List<TextInputFormatter> formatters = <TextInputFormatter>[
......
......@@ -5,7 +5,6 @@
// This file is run as part of a reduced test set in CI on Mac and Windows
// machines.
@Tags(<String>['reduced-test-set'])
import 'dart:typed_data';
import 'package:flutter/material.dart';
......
......@@ -43,8 +43,8 @@ void main() {
});
test('Default primary text theme contrasts with primary brightness', () {
final ThemeData lightTheme = ThemeData(primaryColorBrightness: Brightness.light);
final ThemeData darkTheme = ThemeData(primaryColorBrightness: Brightness.dark);
final ThemeData lightTheme = ThemeData(primaryColor: Colors.white);
final ThemeData darkTheme = ThemeData(primaryColor: Colors.black);
final Typography typography = Typography.material2018(platform: lightTheme.platform);
expect(lightTheme.primaryTextTheme.headline6!.color, typography.black.headline6!.color);
......@@ -61,8 +61,8 @@ void main() {
});
test('Default primary icon theme contrasts with primary brightness', () {
final ThemeData lightTheme = ThemeData(primaryColorBrightness: Brightness.light);
final ThemeData darkTheme = ThemeData(primaryColorBrightness: Brightness.dark);
final ThemeData lightTheme = ThemeData(primaryColor: Colors.white);
final ThemeData darkTheme = ThemeData(primaryColor: Colors.black);
final Typography typography = Typography.material2018(platform: lightTheme.platform);
expect(lightTheme.primaryTextTheme.headline6!.color, typography.black.headline6!.color);
......@@ -670,7 +670,6 @@ void main() {
// COLOR
'colorScheme',
'primaryColor',
'primaryColorBrightness',
'primaryColorLight',
'primaryColorDark',
'focusColor',
......@@ -743,6 +742,7 @@ void main() {
'accentIconTheme',
'buttonColor',
'fixTextFieldOutlineLabel',
'primaryColorBrightness',
};
final DiagnosticPropertiesBuilder properties = DiagnosticPropertiesBuilder();
......
......@@ -500,4 +500,11 @@ void main() {
AppBarTheme appBarTheme = AppBarTheme();
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() {
AppBarTheme appBarTheme = AppBarTheme();
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