Skip to content

Commit e707f0d

Browse files
authored
Remove bottomAppBarColor from ThemeData (flutter#144080)
This PR is to remove deprecated ThemeData.bottomAppBarColor. These parameters are made obsolete in flutter#110162. Part of flutter#111080
1 parent d0fb292 commit e707f0d

File tree

7 files changed

+10
-66
lines changed

7 files changed

+10
-66
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,10 @@ class BottomAppBar extends StatefulWidget {
9494
/// The bottom app bar's background color.
9595
///
9696
/// If this property is null then [BottomAppBarTheme.color] of
97-
/// [ThemeData.bottomAppBarTheme] is used. If that's null then
98-
/// [ThemeData.bottomAppBarColor] is used.
97+
/// [ThemeData.bottomAppBarTheme] is used. If that's null and [ThemeData.useMaterial3]
98+
/// is true, the default value is [ColorScheme.surface]; if [ThemeData.useMaterial3]
99+
/// is false, then the default value is `Color(0xFF424242)` in dark theme and
100+
/// [Colors.white] in light theme.
99101
final Color? color;
100102

101103
/// The z-coordinate at which to place this bottom app bar relative to its
@@ -280,7 +282,7 @@ class _BottomAppBarDefaultsM2 extends BottomAppBarTheme {
280282
final BuildContext context;
281283

282284
@override
283-
Color? get color => Theme.of(context).bottomAppBarColor;
285+
Color? get color => Theme.of(context).brightness == Brightness.dark ? Colors.grey[800]! : Colors.white;
284286

285287
@override
286288
Color? get surfaceTintColor => Theme.of(context).colorScheme.surfaceTint;

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ class BottomAppBarTheme with Diagnosticable {
3939
});
4040

4141
/// Overrides the default value for [BottomAppBar.color].
42-
///
43-
/// If null, [BottomAppBar] uses [ThemeData.bottomAppBarColor].
4442
final Color? color;
4543

4644
/// Overrides the default value for [BottomAppBar.elevation].

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

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,6 @@ class ThemeData with Diagnosticable {
384384
'This feature was deprecated after v3.3.0-0.5.pre.',
385385
)
386386
Color? backgroundColor,
387-
@Deprecated(
388-
'Use BottomAppBarTheme.color instead. '
389-
'This feature was deprecated after v3.3.0-0.6.pre.',
390-
)
391-
Color? bottomAppBarColor,
392387
}) {
393388
// GENERAL CONFIGURATION
394389
cupertinoOverrideTheme = cupertinoOverrideTheme?.noDefault();
@@ -441,7 +436,6 @@ class ThemeData with Diagnosticable {
441436
primaryColor ??= primarySurfaceColor;
442437
canvasColor ??= colorScheme.background;
443438
scaffoldBackgroundColor ??= colorScheme.background;
444-
bottomAppBarColor ??= colorScheme.surface;
445439
cardColor ??= colorScheme.surface;
446440
dividerColor ??= colorScheme.outline;
447441
backgroundColor ??= colorScheme.background;
@@ -569,7 +563,6 @@ class ThemeData with Diagnosticable {
569563
// DEPRECATED (newest deprecations at the bottom)
570564
errorColor ??= Colors.red[700]!;
571565
backgroundColor ??= isDark ? Colors.grey[700]! : primarySwatch[200]!;
572-
bottomAppBarColor ??= colorSchemeSeed != null ? colorScheme.surface : isDark ? Colors.grey[800]! : Colors.white;
573566

574567
return ThemeData.raw(
575568
// For the sanity of the reader, make sure these properties are in the same
@@ -667,7 +660,6 @@ class ThemeData with Diagnosticable {
667660
toggleableActiveColor: toggleableActiveColor,
668661
errorColor: errorColor,
669662
backgroundColor: backgroundColor,
670-
bottomAppBarColor: bottomAppBarColor,
671663
);
672664
}
673665

@@ -791,18 +783,12 @@ class ThemeData with Diagnosticable {
791783
'This feature was deprecated after v3.3.0-0.5.pre.',
792784
)
793785
Color? backgroundColor,
794-
@Deprecated(
795-
'Use BottomAppBarTheme.color instead. '
796-
'This feature was deprecated after v3.3.0-0.6.pre.',
797-
)
798-
Color? bottomAppBarColor,
799786

800787
}) : // DEPRECATED (newest deprecations at the bottom)
801788
// should not be `required`, use getter pattern to avoid breakages.
802789
_toggleableActiveColor = toggleableActiveColor,
803790
_errorColor = errorColor,
804791
_backgroundColor = backgroundColor,
805-
_bottomAppBarColor = bottomAppBarColor,
806792
assert(toggleableActiveColor != null),
807793
// DEPRECATED (newest deprecations at the bottom)
808794
assert(errorColor != null),
@@ -851,7 +837,6 @@ class ThemeData with Diagnosticable {
851837
primaryColor: primarySurfaceColor,
852838
canvasColor: colorScheme.background,
853839
scaffoldBackgroundColor: colorScheme.background,
854-
bottomAppBarColor: colorScheme.surface,
855840
cardColor: colorScheme.surface,
856841
dividerColor: colorScheme.onSurface.withOpacity(0.12),
857842
backgroundColor: colorScheme.background,
@@ -1184,14 +1169,6 @@ class ThemeData with Diagnosticable {
11841169

11851170
// COLOR
11861171

1187-
/// The default color of the [BottomAppBar].
1188-
@Deprecated(
1189-
'Use BottomAppBarTheme.color instead. '
1190-
'This feature was deprecated after v3.3.0-0.6.pre.',
1191-
)
1192-
Color get bottomAppBarColor => _bottomAppBarColor!;
1193-
final Color? _bottomAppBarColor;
1194-
11951172
/// The default color of [MaterialType.canvas] [Material].
11961173
final Color canvasColor;
11971174

@@ -1619,11 +1596,6 @@ class ThemeData with Diagnosticable {
16191596
'This feature was deprecated after v3.3.0-0.5.pre.',
16201597
)
16211598
Color? backgroundColor,
1622-
@Deprecated(
1623-
'Use BottomAppBarTheme.color instead. '
1624-
'This feature was deprecated after v3.3.0-0.6.pre.',
1625-
)
1626-
Color? bottomAppBarColor,
16271599
@Deprecated(
16281600
'Use a ThemeData constructor (.from, .light, or .dark) instead. '
16291601
'These constructors all have a useMaterial3 argument, '
@@ -1732,7 +1704,6 @@ class ThemeData with Diagnosticable {
17321704
toggleableActiveColor: toggleableActiveColor ?? _toggleableActiveColor,
17331705
errorColor: errorColor ?? _errorColor,
17341706
backgroundColor: backgroundColor ?? _backgroundColor,
1735-
bottomAppBarColor: bottomAppBarColor ?? _bottomAppBarColor,
17361707
);
17371708
}
17381709

@@ -1930,7 +1901,6 @@ class ThemeData with Diagnosticable {
19301901
toggleableActiveColor: Color.lerp(a.toggleableActiveColor, b.toggleableActiveColor, t),
19311902
errorColor: Color.lerp(a.errorColor, b.errorColor, t),
19321903
backgroundColor: Color.lerp(a.backgroundColor, b.backgroundColor, t),
1933-
bottomAppBarColor: Color.lerp(a.bottomAppBarColor, b.bottomAppBarColor, t),
19341904
);
19351905
}
19361906

@@ -2034,8 +2004,7 @@ class ThemeData with Diagnosticable {
20342004
// DEPRECATED (newest deprecations at the bottom)
20352005
other.toggleableActiveColor == toggleableActiveColor &&
20362006
other.errorColor == errorColor &&
2037-
other.backgroundColor == backgroundColor &&
2038-
other.bottomAppBarColor == bottomAppBarColor;
2007+
other.backgroundColor == backgroundColor;
20392008
}
20402009

20412010
@override
@@ -2138,7 +2107,6 @@ class ThemeData with Diagnosticable {
21382107
toggleableActiveColor,
21392108
errorColor,
21402109
backgroundColor,
2141-
bottomAppBarColor,
21422110
];
21432111
return Object.hashAll(values);
21442112
}
@@ -2242,7 +2210,6 @@ class ThemeData with Diagnosticable {
22422210
properties.add(ColorProperty('toggleableActiveColor', toggleableActiveColor, defaultValue: defaultData.toggleableActiveColor, level: DiagnosticLevel.debug));
22432211
properties.add(ColorProperty('errorColor', errorColor, defaultValue: defaultData.errorColor, level: DiagnosticLevel.debug));
22442212
properties.add(ColorProperty('backgroundColor', backgroundColor, defaultValue: defaultData.backgroundColor, level: DiagnosticLevel.debug));
2245-
properties.add(ColorProperty('bottomAppBarColor', bottomAppBarColor, defaultValue: defaultData.bottomAppBarColor, level: DiagnosticLevel.debug));
22462213
}
22472214
}
22482215

packages/flutter/test/material/bottom_app_bar_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ void main() {
233233
home: Builder(
234234
builder: (BuildContext context) {
235235
return Theme(
236-
data: Theme.of(context).copyWith(bottomAppBarColor: const Color(0xffffff00)),
236+
data: Theme.of(context).copyWith(bottomAppBarTheme: const BottomAppBarTheme(color: Color(0xffffff00))),
237237
child: const Scaffold(
238238
floatingActionButton: FloatingActionButton(
239239
onPressed: null,
@@ -259,7 +259,7 @@ void main() {
259259
home: Builder(
260260
builder: (BuildContext context) {
261261
return Theme(
262-
data: Theme.of(context).copyWith(bottomAppBarColor: const Color(0xffffff00)),
262+
data: Theme.of(context).copyWith(bottomAppBarTheme: const BottomAppBarTheme(color: Color(0xffffff00))),
263263
child: const Scaffold(
264264
floatingActionButton: FloatingActionButton(
265265
onPressed: null,
@@ -287,7 +287,7 @@ void main() {
287287
await tester.pumpWidget(
288288
MaterialApp(
289289
theme: ThemeData.light(useMaterial3: true).copyWith(
290-
bottomAppBarColor: const Color(0xffffff00),
290+
bottomAppBarTheme: const BottomAppBarTheme(color: Color(0xffffff00)),
291291
),
292292
home: Builder(
293293
builder: (BuildContext context) {

packages/flutter/test/material/bottom_app_bar_theme_test.dart

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ void main() {
2929
});
3030

3131
testWidgets('Material2 - BAB color - Widget', (WidgetTester tester) async {
32-
const Color themeColor = Colors.white10;
3332
const Color babThemeColor = Colors.black87;
3433
const Color babColor = Colors.pink;
3534
const BottomAppBarTheme theme = BottomAppBarTheme(color: babThemeColor);
@@ -38,7 +37,6 @@ void main() {
3837
theme: ThemeData(
3938
useMaterial3: false,
4039
bottomAppBarTheme: theme,
41-
bottomAppBarColor: themeColor
4240
),
4341
home: const Scaffold(body: BottomAppBar(color: babColor)),
4442
));
@@ -48,15 +46,13 @@ void main() {
4846
});
4947

5048
testWidgets('Material2 - BAB color - BabTheme', (WidgetTester tester) async {
51-
const Color themeColor = Colors.white10;
5249
const Color babThemeColor = Colors.black87;
5350
const BottomAppBarTheme theme = BottomAppBarTheme(color: babThemeColor);
5451

5552
await tester.pumpWidget(MaterialApp(
5653
theme: ThemeData(
5754
useMaterial3: false,
5855
bottomAppBarTheme: theme,
59-
bottomAppBarColor: themeColor
6056
),
6157
home: const Scaffold(body: BottomAppBar()),
6258
));
@@ -69,7 +65,7 @@ void main() {
6965
const Color themeColor = Colors.white10;
7066

7167
await tester.pumpWidget(MaterialApp(
72-
theme: ThemeData(useMaterial3: false, bottomAppBarColor: themeColor),
68+
theme: ThemeData(useMaterial3: false, bottomAppBarTheme: const BottomAppBarTheme(color: themeColor)),
7369
home: const Scaffold(body: BottomAppBar()),
7470
));
7571

@@ -130,7 +126,6 @@ void main() {
130126
});
131127

132128
testWidgets('Material3 - BAB color - Widget', (WidgetTester tester) async {
133-
const Color themeColor = Colors.white10;
134129
const Color babThemeColor = Colors.black87;
135130
const Color babColor = Colors.pink;
136131
const BottomAppBarTheme theme = BottomAppBarTheme(color: babThemeColor);
@@ -139,7 +134,6 @@ void main() {
139134
theme: ThemeData(
140135
useMaterial3: true,
141136
bottomAppBarTheme: theme,
142-
bottomAppBarColor: themeColor
143137
),
144138
home: const Scaffold(body: BottomAppBar(color: babColor, surfaceTintColor: Colors.transparent)),
145139
));
@@ -149,15 +143,13 @@ void main() {
149143
});
150144

151145
testWidgets('Material3 - BAB color - BabTheme', (WidgetTester tester) async {
152-
const Color themeColor = Colors.white10;
153146
const Color babThemeColor = Colors.black87;
154147
const BottomAppBarTheme theme = BottomAppBarTheme(color: babThemeColor);
155148

156149
await tester.pumpWidget(MaterialApp(
157150
theme: ThemeData(
158151
useMaterial3: true,
159152
bottomAppBarTheme: theme,
160-
bottomAppBarColor: themeColor
161153
),
162154
home: const Scaffold(body: BottomAppBar(surfaceTintColor: Colors.transparent)),
163155
));
@@ -204,7 +196,6 @@ void main() {
204196

205197
testWidgets('Material3 - BAB surfaceTintColor - Widget', (WidgetTester tester) async {
206198
const Color color = Colors.white10; // base color that the surface tint will be applied to
207-
const Color themeSurfaceTintColor = Colors.white10;
208199
const Color babThemeSurfaceTintColor = Colors.black87;
209200
const Color babSurfaceTintColor = Colors.pink;
210201
const BottomAppBarTheme theme = BottomAppBarTheme(
@@ -214,7 +205,6 @@ void main() {
214205
theme: ThemeData(
215206
useMaterial3: true,
216207
bottomAppBarTheme: theme,
217-
bottomAppBarColor: themeSurfaceTintColor
218208
),
219209
home: const Scaffold(
220210
body: BottomAppBar(color: color, surfaceTintColor: babSurfaceTintColor)
@@ -227,7 +217,6 @@ void main() {
227217

228218
testWidgets('Material3 - BAB surfaceTintColor - BabTheme', (WidgetTester tester) async {
229219
const Color color = Colors.blue; // base color that the surface tint will be applied to
230-
const Color themeColor = Colors.white10;
231220
const Color babThemeColor = Colors.black87;
232221
const BottomAppBarTheme theme = BottomAppBarTheme(
233222
surfaceTintColor: babThemeColor
@@ -237,7 +226,6 @@ void main() {
237226
theme: ThemeData(
238227
useMaterial3: true,
239228
bottomAppBarTheme: theme,
240-
bottomAppBarColor: themeColor
241229
),
242230
home: const Scaffold(body: BottomAppBar(color: color)),
243231
));

packages/flutter/test/material/snack_bar_test.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,6 @@ void main() {
625625
canvasColor: Colors.black,
626626
shadowColor: Colors.black,
627627
scaffoldBackgroundColor: Colors.black,
628-
bottomAppBarColor: Colors.black,
629628
cardColor: Colors.black,
630629
dividerColor: Colors.black,
631630
focusColor: Colors.black,

packages/flutter/test/material/theme_data_test.dart

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ void main() {
171171
expect(theme.primaryColor, theme.colorScheme.primary);
172172
expect(theme.canvasColor, theme.colorScheme.background);
173173
expect(theme.scaffoldBackgroundColor, theme.colorScheme.background);
174-
expect(theme.bottomAppBarColor, theme.colorScheme.surface);
175174
expect(theme.cardColor, theme.colorScheme.surface);
176175
expect(theme.dividerColor, theme.colorScheme.outline);
177176
expect(theme.backgroundColor, theme.colorScheme.background);
@@ -220,7 +219,6 @@ void main() {
220219
expect(theme.primaryColor, theme.colorScheme.surface);
221220
expect(theme.canvasColor, theme.colorScheme.background);
222221
expect(theme.scaffoldBackgroundColor, theme.colorScheme.background);
223-
expect(theme.bottomAppBarColor, theme.colorScheme.surface);
224222
expect(theme.cardColor, theme.colorScheme.surface);
225223
expect(theme.dividerColor, theme.colorScheme.outline);
226224
expect(theme.backgroundColor, theme.colorScheme.background);
@@ -266,7 +264,6 @@ void main() {
266264
expect(theme.primaryColor, theme.colorScheme.primary);
267265
expect(theme.canvasColor, theme.colorScheme.background);
268266
expect(theme.scaffoldBackgroundColor, theme.colorScheme.background);
269-
expect(theme.bottomAppBarColor, theme.colorScheme.surface);
270267
expect(theme.cardColor, theme.colorScheme.surface);
271268
expect(theme.dividerColor, theme.colorScheme.outline);
272269
expect(theme.backgroundColor, theme.colorScheme.background);
@@ -313,7 +310,6 @@ void main() {
313310
expect(theme.primaryColor, theme.colorScheme.primary);
314311
expect(theme.canvasColor, theme.colorScheme.background);
315312
expect(theme.scaffoldBackgroundColor, theme.colorScheme.background);
316-
expect(theme.bottomAppBarColor, theme.colorScheme.surface);
317313
expect(theme.cardColor, theme.colorScheme.surface);
318314
expect(theme.dividerColor, theme.colorScheme.outline);
319315
expect(theme.backgroundColor, theme.colorScheme.background);
@@ -360,7 +356,6 @@ void main() {
360356
expect(theme.primaryColor, theme.colorScheme.surface);
361357
expect(theme.canvasColor, theme.colorScheme.background);
362358
expect(theme.scaffoldBackgroundColor, theme.colorScheme.background);
363-
expect(theme.bottomAppBarColor, theme.colorScheme.surface);
364359
expect(theme.cardColor, theme.colorScheme.surface);
365360
expect(theme.dividerColor, theme.colorScheme.outline);
366361
expect(theme.backgroundColor, theme.colorScheme.background);
@@ -812,7 +807,6 @@ void main() {
812807
toggleableActiveColor: Colors.black,
813808
errorColor: Colors.black,
814809
backgroundColor: Colors.black,
815-
bottomAppBarColor: Colors.black,
816810
);
817811

818812
final SliderThemeData otherSliderTheme = SliderThemeData.fromPrimaryColors(
@@ -932,7 +926,6 @@ void main() {
932926
toggleableActiveColor: Colors.white,
933927
errorColor: Colors.white,
934928
backgroundColor: Colors.white,
935-
bottomAppBarColor: Colors.white,
936929
);
937930

938931
final ThemeData themeDataCopy = theme.copyWith(
@@ -1033,7 +1026,6 @@ void main() {
10331026
toggleableActiveColor: otherTheme.toggleableActiveColor,
10341027
errorColor: otherTheme.errorColor,
10351028
backgroundColor: otherTheme.backgroundColor,
1036-
bottomAppBarColor: otherTheme.bottomAppBarColor,
10371029
);
10381030

10391031
// For the sanity of the reader, make sure these properties are in the same
@@ -1135,7 +1127,6 @@ void main() {
11351127
expect(themeDataCopy.toggleableActiveColor, equals(otherTheme.toggleableActiveColor));
11361128
expect(themeDataCopy.errorColor, equals(otherTheme.errorColor));
11371129
expect(themeDataCopy.backgroundColor, equals(otherTheme.backgroundColor));
1138-
expect(themeDataCopy.bottomAppBarColor, equals(otherTheme.bottomAppBarColor));
11391130
});
11401131

11411132
testWidgets('ThemeData.toString has less than 200 characters output', (WidgetTester tester) async {
@@ -1268,7 +1259,6 @@ void main() {
12681259
'toggleableActiveColor',
12691260
'errorColor',
12701261
'backgroundColor',
1271-
'bottomAppBarColor',
12721262
};
12731263

12741264
final DiagnosticPropertiesBuilder properties = DiagnosticPropertiesBuilder();

0 commit comments

Comments
 (0)