Skip to content

Commit 8c44c16

Browse files
authored
Deprecate ThemeData.selectedRowColor (#109070)
1 parent 543dac2 commit 8c44c16

File tree

6 files changed

+89
-26
lines changed

6 files changed

+89
-26
lines changed

packages/flutter/lib/fix_data.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,39 @@
1717

1818
version: 1
1919
transforms:
20+
# Changes made in https://github.com/flutter/flutter/pull/109070
21+
- title: "Remove 'selectedRowColor'"
22+
date: 2022-08-05
23+
element:
24+
uris: [ 'material.dart' ]
25+
method: 'copyWith'
26+
inClass: 'ThemeData'
27+
changes:
28+
- kind: 'removeParameter'
29+
name: 'selectedRowColor'
30+
31+
# Changes made in https://github.com/flutter/flutter/pull/109070
32+
- title: "Remove 'selectedRowColor'"
33+
date: 2022-08-05
34+
element:
35+
uris: [ 'material.dart' ]
36+
constructor: 'raw'
37+
inClass: 'ThemeData'
38+
changes:
39+
- kind: 'removeParameter'
40+
name: 'selectedRowColor'
41+
42+
# Changes made in https://github.com/flutter/flutter/pull/109070
43+
- title: "Remove 'selectedRowColor'"
44+
date: 2022-08-05
45+
element:
46+
uris: [ 'material.dart' ]
47+
constructor: ''
48+
inClass: 'ThemeData'
49+
changes:
50+
- kind: 'removeParameter'
51+
name: 'selectedRowColor'
52+
2053
# Changes made in https://github.com/flutter/flutter/pull/97972/
2154
- title: "Migrate 'ThemeData.toggleableActiveColor' to individual themes"
2255
date: 2022-05-18

packages/flutter/lib/src/material/theme_data.dart

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ class ThemeData with Diagnosticable {
313313
MaterialColor? primarySwatch,
314314
Color? scaffoldBackgroundColor,
315315
Color? secondaryHeaderColor,
316-
Color? selectedRowColor,
317316
Color? shadowColor,
318317
Color? splashColor,
319318
Color? unselectedWidgetColor,
@@ -415,6 +414,11 @@ class ThemeData with Diagnosticable {
415414
'This feature was deprecated after v2.13.0-0.4.pre.',
416415
)
417416
Color? toggleableActiveColor,
417+
@Deprecated(
418+
'No longer used by the framework, please remove any reference to it. '
419+
'This feature was deprecated after v3.1.0-0.0.pre.',
420+
)
421+
Color? selectedRowColor,
418422
}) {
419423
// GENERAL CONFIGURATION
420424
cupertinoOverrideTheme = cupertinoOverrideTheme?.noDefault();
@@ -622,7 +626,6 @@ class ThemeData with Diagnosticable {
622626
primaryColorLight: primaryColorLight,
623627
scaffoldBackgroundColor: scaffoldBackgroundColor,
624628
secondaryHeaderColor: secondaryHeaderColor,
625-
selectedRowColor: selectedRowColor,
626629
shadowColor: shadowColor,
627630
splashColor: splashColor,
628631
unselectedWidgetColor: unselectedWidgetColor,
@@ -677,6 +680,7 @@ class ThemeData with Diagnosticable {
677680
primaryColorBrightness: primaryColorBrightness,
678681
androidOverscrollIndicator: androidOverscrollIndicator,
679682
toggleableActiveColor: toggleableActiveColor,
683+
selectedRowColor: selectedRowColor,
680684
);
681685
}
682686

@@ -728,7 +732,6 @@ class ThemeData with Diagnosticable {
728732
required this.primaryColorLight,
729733
required this.scaffoldBackgroundColor,
730734
required this.secondaryHeaderColor,
731-
required this.selectedRowColor,
732735
required this.shadowColor,
733736
required this.splashColor,
734737
required this.unselectedWidgetColor,
@@ -829,6 +832,11 @@ class ThemeData with Diagnosticable {
829832
'This feature was deprecated after v2.13.0-0.4.pre.',
830833
)
831834
Color? toggleableActiveColor,
835+
@Deprecated(
836+
'No longer used by the framework, please remove any reference to it. '
837+
'This feature was deprecated after v3.1.0-0.0.pre.',
838+
)
839+
Color? selectedRowColor,
832840
}) : // DEPRECATED (newest deprecations at the bottom)
833841
// should not be `required`, use getter pattern to avoid breakages.
834842
_accentColor = accentColor,
@@ -839,6 +847,7 @@ class ThemeData with Diagnosticable {
839847
_fixTextFieldOutlineLabel = fixTextFieldOutlineLabel,
840848
_primaryColorBrightness = primaryColorBrightness,
841849
_toggleableActiveColor = toggleableActiveColor,
850+
_selectedRowColor = selectedRowColor,
842851
// GENERAL CONFIGURATION
843852
assert(applyElevationOverlayColor != null),
844853
assert(extensions != null),
@@ -870,7 +879,6 @@ class ThemeData with Diagnosticable {
870879
assert(primaryColorLight != null),
871880
assert(scaffoldBackgroundColor != null),
872881
assert(secondaryHeaderColor != null),
873-
assert(selectedRowColor != null),
874882
assert(shadowColor != null),
875883
assert(splashColor != null),
876884
assert(toggleableActiveColor != null),
@@ -1341,7 +1349,12 @@ class ThemeData with Diagnosticable {
13411349
final Color secondaryHeaderColor;
13421350

13431351
/// The color used to highlight selected rows.
1344-
final Color selectedRowColor;
1352+
@Deprecated(
1353+
'No longer used by the framework, please remove any reference to it. '
1354+
'This feature was deprecated after v3.1.0-0.0.pre.',
1355+
)
1356+
Color get selectedRowColor => _selectedRowColor!;
1357+
final Color? _selectedRowColor;
13451358

13461359
/// The color that the [Material] widget uses to draw elevation shadows.
13471360
///
@@ -1696,7 +1709,6 @@ class ThemeData with Diagnosticable {
16961709
Color? primaryColorLight,
16971710
Color? scaffoldBackgroundColor,
16981711
Color? secondaryHeaderColor,
1699-
Color? selectedRowColor,
17001712
Color? shadowColor,
17011713
Color? splashColor,
17021714
Color? unselectedWidgetColor,
@@ -1797,6 +1809,11 @@ class ThemeData with Diagnosticable {
17971809
'This feature was deprecated after v2.13.0-0.4.pre.',
17981810
)
17991811
Color? toggleableActiveColor,
1812+
@Deprecated(
1813+
'No longer used by the framework, please remove any reference to it. '
1814+
'This feature was deprecated after v3.1.0-0.0.pre.',
1815+
)
1816+
Color? selectedRowColor,
18001817
}) {
18011818
cupertinoOverrideTheme = cupertinoOverrideTheme?.noDefault();
18021819
return ThemeData.raw(
@@ -1837,7 +1854,6 @@ class ThemeData with Diagnosticable {
18371854
primaryColorLight: primaryColorLight ?? this.primaryColorLight,
18381855
scaffoldBackgroundColor: scaffoldBackgroundColor ?? this.scaffoldBackgroundColor,
18391856
secondaryHeaderColor: secondaryHeaderColor ?? this.secondaryHeaderColor,
1840-
selectedRowColor: selectedRowColor ?? this.selectedRowColor,
18411857
shadowColor: shadowColor ?? this.shadowColor,
18421858
splashColor: splashColor ?? this.splashColor,
18431859
unselectedWidgetColor: unselectedWidgetColor ?? this.unselectedWidgetColor,
@@ -1883,15 +1899,16 @@ class ThemeData with Diagnosticable {
18831899
toggleButtonsTheme: toggleButtonsTheme ?? this.toggleButtonsTheme,
18841900
tooltipTheme: tooltipTheme ?? this.tooltipTheme,
18851901
// DEPRECATED (newest deprecations at the bottom)
1886-
accentColor: accentColor ?? this.accentColor,
1887-
accentColorBrightness: accentColorBrightness ?? this.accentColorBrightness,
1888-
accentTextTheme: accentTextTheme ?? this.accentTextTheme,
1889-
accentIconTheme: accentIconTheme ?? this.accentIconTheme,
1890-
buttonColor: buttonColor ?? this.buttonColor,
1891-
fixTextFieldOutlineLabel: fixTextFieldOutlineLabel ?? this.fixTextFieldOutlineLabel,
1892-
primaryColorBrightness: primaryColorBrightness ?? this.primaryColorBrightness,
1902+
accentColor: accentColor ?? _accentColor,
1903+
accentColorBrightness: accentColorBrightness ?? _accentColorBrightness,
1904+
accentTextTheme: accentTextTheme ?? _accentTextTheme,
1905+
accentIconTheme: accentIconTheme ?? _accentIconTheme,
1906+
buttonColor: buttonColor ?? _buttonColor,
1907+
fixTextFieldOutlineLabel: fixTextFieldOutlineLabel ?? _fixTextFieldOutlineLabel,
1908+
primaryColorBrightness: primaryColorBrightness ?? _primaryColorBrightness,
18931909
androidOverscrollIndicator: androidOverscrollIndicator ?? this.androidOverscrollIndicator,
1894-
toggleableActiveColor: toggleableActiveColor ?? this.toggleableActiveColor,
1910+
toggleableActiveColor: toggleableActiveColor ?? _toggleableActiveColor,
1911+
selectedRowColor: selectedRowColor ?? _selectedRowColor,
18951912
);
18961913
}
18971914

@@ -2036,7 +2053,6 @@ class ThemeData with Diagnosticable {
20362053
primaryColorLight: Color.lerp(a.primaryColorLight, b.primaryColorLight, t)!,
20372054
scaffoldBackgroundColor: Color.lerp(a.scaffoldBackgroundColor, b.scaffoldBackgroundColor, t)!,
20382055
secondaryHeaderColor: Color.lerp(a.secondaryHeaderColor, b.secondaryHeaderColor, t)!,
2039-
selectedRowColor: Color.lerp(a.selectedRowColor, b.selectedRowColor, t)!,
20402056
shadowColor: Color.lerp(a.shadowColor, b.shadowColor, t)!,
20412057
splashColor: Color.lerp(a.splashColor, b.splashColor, t)!,
20422058
unselectedWidgetColor: Color.lerp(a.unselectedWidgetColor, b.unselectedWidgetColor, t)!,
@@ -2091,6 +2107,7 @@ class ThemeData with Diagnosticable {
20912107
primaryColorBrightness: t < 0.5 ? a.primaryColorBrightness : b.primaryColorBrightness,
20922108
androidOverscrollIndicator:t < 0.5 ? a.androidOverscrollIndicator : b.androidOverscrollIndicator,
20932109
toggleableActiveColor: Color.lerp(a.toggleableActiveColor, b.toggleableActiveColor, t),
2110+
selectedRowColor: Color.lerp(a.selectedRowColor, b.selectedRowColor, t),
20942111
);
20952112
}
20962113

@@ -2137,7 +2154,6 @@ class ThemeData with Diagnosticable {
21372154
other.primaryColorLight == primaryColorLight &&
21382155
other.scaffoldBackgroundColor == scaffoldBackgroundColor &&
21392156
other.secondaryHeaderColor == secondaryHeaderColor &&
2140-
other.selectedRowColor == selectedRowColor &&
21412157
other.shadowColor == shadowColor &&
21422158
other.splashColor == splashColor &&
21432159
other.unselectedWidgetColor == unselectedWidgetColor &&
@@ -2191,7 +2207,8 @@ class ThemeData with Diagnosticable {
21912207
other.fixTextFieldOutlineLabel == fixTextFieldOutlineLabel &&
21922208
other.primaryColorBrightness == primaryColorBrightness &&
21932209
other.androidOverscrollIndicator == androidOverscrollIndicator &&
2194-
other.toggleableActiveColor == toggleableActiveColor;
2210+
other.toggleableActiveColor == toggleableActiveColor &&
2211+
other.selectedRowColor == selectedRowColor;
21952212
}
21962213

21972214
@override
@@ -2235,7 +2252,6 @@ class ThemeData with Diagnosticable {
22352252
primaryColorLight,
22362253
scaffoldBackgroundColor,
22372254
secondaryHeaderColor,
2238-
selectedRowColor,
22392255
shadowColor,
22402256
splashColor,
22412257
unselectedWidgetColor,
@@ -2290,6 +2306,7 @@ class ThemeData with Diagnosticable {
22902306
primaryColorBrightness,
22912307
androidOverscrollIndicator,
22922308
toggleableActiveColor,
2309+
selectedRowColor,
22932310
];
22942311
return Object.hashAll(values);
22952312
}
@@ -2335,7 +2352,6 @@ class ThemeData with Diagnosticable {
23352352
properties.add(ColorProperty('primaryColor', primaryColor, defaultValue: defaultData.primaryColor, level: DiagnosticLevel.debug));
23362353
properties.add(ColorProperty('scaffoldBackgroundColor', scaffoldBackgroundColor, defaultValue: defaultData.scaffoldBackgroundColor, level: DiagnosticLevel.debug));
23372354
properties.add(ColorProperty('secondaryHeaderColor', secondaryHeaderColor, defaultValue: defaultData.secondaryHeaderColor, level: DiagnosticLevel.debug));
2338-
properties.add(ColorProperty('selectedRowColor', selectedRowColor, defaultValue: defaultData.selectedRowColor, level: DiagnosticLevel.debug));
23392355
properties.add(ColorProperty('shadowColor', shadowColor, defaultValue: defaultData.shadowColor, level: DiagnosticLevel.debug));
23402356
properties.add(ColorProperty('splashColor', splashColor, defaultValue: defaultData.splashColor, level: DiagnosticLevel.debug));
23412357
properties.add(ColorProperty('unselectedWidgetColor', unselectedWidgetColor, defaultValue: defaultData.unselectedWidgetColor, level: DiagnosticLevel.debug));
@@ -2390,6 +2406,7 @@ class ThemeData with Diagnosticable {
23902406
properties.add(EnumProperty<Brightness>('primaryColorBrightness', primaryColorBrightness, defaultValue: defaultData.primaryColorBrightness, level: DiagnosticLevel.debug));
23912407
properties.add(EnumProperty<AndroidOverscrollIndicator>('androidOverscrollIndicator', androidOverscrollIndicator, defaultValue: null, level: DiagnosticLevel.debug));
23922408
properties.add(ColorProperty('toggleableActiveColor', toggleableActiveColor, defaultValue: defaultData.toggleableActiveColor, level: DiagnosticLevel.debug));
2409+
properties.add(ColorProperty('selectedRowColor', selectedRowColor, defaultValue: defaultData.selectedRowColor, level: DiagnosticLevel.debug));
23932410
}
23942411
}
23952412

packages/flutter/test/material/snack_bar_test.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,6 @@ void main() {
458458
highlightColor: Colors.black,
459459
splashColor: Colors.black,
460460
splashFactory: InkRipple.splashFactory,
461-
selectedRowColor: Colors.black,
462461
unselectedWidgetColor: Colors.black,
463462
disabledColor: Colors.black,
464463
buttonTheme: const ButtonThemeData(colorScheme: ColorScheme.dark()),

packages/flutter/test/material/theme_data_test.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,6 @@ void main() {
669669
primaryColorLight: Colors.black,
670670
scaffoldBackgroundColor: Colors.black,
671671
secondaryHeaderColor: Colors.black,
672-
selectedRowColor: Colors.black,
673672
shadowColor: Colors.black,
674673
splashColor: Colors.black,
675674
unselectedWidgetColor: Colors.black,
@@ -724,6 +723,7 @@ void main() {
724723
primaryColorBrightness: Brightness.dark,
725724
androidOverscrollIndicator: AndroidOverscrollIndicator.glow,
726725
toggleableActiveColor: Colors.black,
726+
selectedRowColor: Colors.black,
727727
);
728728

729729
final SliderThemeData otherSliderTheme = SliderThemeData.fromPrimaryColors(
@@ -780,7 +780,6 @@ void main() {
780780
primaryColorLight: Colors.white,
781781
scaffoldBackgroundColor: Colors.white,
782782
secondaryHeaderColor: Colors.white,
783-
selectedRowColor: Colors.white,
784783
shadowColor: Colors.white,
785784
splashColor: Colors.white,
786785
unselectedWidgetColor: Colors.white,
@@ -838,6 +837,7 @@ void main() {
838837
primaryColorBrightness: Brightness.light,
839838
androidOverscrollIndicator: AndroidOverscrollIndicator.stretch,
840839
toggleableActiveColor: Colors.white,
840+
selectedRowColor: Colors.white,
841841
);
842842

843843
final ThemeData themeDataCopy = theme.copyWith(
@@ -879,7 +879,6 @@ void main() {
879879
primaryColorLight: otherTheme.primaryColorLight,
880880
scaffoldBackgroundColor: otherTheme.scaffoldBackgroundColor,
881881
secondaryHeaderColor: otherTheme.secondaryHeaderColor,
882-
selectedRowColor: otherTheme.selectedRowColor,
883882
shadowColor: otherTheme.shadowColor,
884883
splashColor: otherTheme.splashColor,
885884
unselectedWidgetColor: otherTheme.unselectedWidgetColor,
@@ -937,6 +936,7 @@ void main() {
937936
primaryColorBrightness: otherTheme.primaryColorBrightness,
938937
androidOverscrollIndicator: otherTheme.androidOverscrollIndicator,
939938
toggleableActiveColor: otherTheme.toggleableActiveColor,
939+
selectedRowColor: otherTheme.selectedRowColor,
940940
);
941941

942942
// For the sanity of the reader, make sure these properties are in the same
@@ -977,7 +977,6 @@ void main() {
977977
expect(themeDataCopy.primaryColorLight, equals(otherTheme.primaryColorLight));
978978
expect(themeDataCopy.scaffoldBackgroundColor, equals(otherTheme.scaffoldBackgroundColor));
979979
expect(themeDataCopy.secondaryHeaderColor, equals(otherTheme.secondaryHeaderColor));
980-
expect(themeDataCopy.selectedRowColor, equals(otherTheme.selectedRowColor));
981980
expect(themeDataCopy.shadowColor, equals(otherTheme.shadowColor));
982981
expect(themeDataCopy.splashColor, equals(otherTheme.splashColor));
983982
expect(themeDataCopy.unselectedWidgetColor, equals(otherTheme.unselectedWidgetColor));
@@ -1040,6 +1039,7 @@ void main() {
10401039
expect(themeDataCopy.primaryColorBrightness, equals(otherTheme.primaryColorBrightness));
10411040
expect(themeDataCopy.androidOverscrollIndicator, equals(otherTheme.androidOverscrollIndicator));
10421041
expect(themeDataCopy.toggleableActiveColor, equals(otherTheme.toggleableActiveColor));
1042+
expect(themeDataCopy.selectedRowColor, equals(otherTheme.selectedRowColor));
10431043
});
10441044

10451045
testWidgets('ThemeData.toString has less than 200 characters output', (WidgetTester tester) async {
@@ -1110,7 +1110,6 @@ void main() {
11101110
'dividerColor',
11111111
'highlightColor',
11121112
'splashColor',
1113-
'selectedRowColor',
11141113
'unselectedWidgetColor',
11151114
'disabledColor',
11161115
'secondaryHeaderColor',
@@ -1170,6 +1169,7 @@ void main() {
11701169
'primaryColorBrightness',
11711170
'androidOverscrollIndicator',
11721171
'toggleableActiveColor',
1172+
'selectedRowColor',
11731173
};
11741174

11751175
final DiagnosticPropertiesBuilder properties = DiagnosticPropertiesBuilder();

packages/flutter/test_fixes/material.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,4 +585,11 @@ void main() {
585585
toggleableActiveColor: Colors.black,
586586
);
587587
themeData.toggleableActiveColor; // Removing field reference not supported.
588+
589+
// Changes made in https://github.com/flutter/flutter/pull/109070
590+
ThemeData themeData = ThemeData();
591+
themeData = ThemeData(selectedRowColor: Brightness.dark);
592+
themeData = ThemeData.raw(selectedRowColor: Brightness.dark);
593+
themeData = themeData.copyWith(selectedRowColor: Brightness.dark);
594+
themeData.selectedRowColor; // Removing field reference not supported.
588595
}

packages/flutter/test_fixes/material.dart.expect

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,4 +788,11 @@ void main() {
788788
),
789789
);
790790
themeData.toggleableActiveColor; // Removing field reference not supported.
791+
792+
// Changes made in https://github.com/flutter/flutter/pull/109070
793+
ThemeData themeData = ThemeData();
794+
themeData = ThemeData();
795+
themeData = ThemeData.raw();
796+
themeData = themeData.copyWith();
797+
themeData.selectedRowColor; // Removing field reference not supported.
791798
}

0 commit comments

Comments
 (0)