Skip to content

Commit da7b832

Browse files
authored
Bottom App Bar M3 background color fix (#117082)
* Bottom App Bar M3 background color fix * update test * test update * remove whitespace
1 parent 80e1008 commit da7b832

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

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

+1
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ class _BottomAppBarState extends State<BottomAppBar> {
196196
key: materialKey,
197197
type: isMaterial3 ? MaterialType.canvas : MaterialType.transparency,
198198
elevation: elevation,
199+
color: isMaterial3 ? effectiveColor : null,
199200
surfaceTintColor: surfaceTintColor,
200201
child: child == null
201202
? null

packages/flutter/test/material/bottom_app_bar_test.dart

+31
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,39 @@ void main() {
197197

198198
final PhysicalShape physicalShape =
199199
tester.widget(find.byType(PhysicalShape).at(0));
200+
final Material material = tester.widget(find.byType(Material).at(1));
200201

201202
expect(physicalShape.color, const Color(0xff0000ff));
203+
expect(material.color, null); /* no value in Material 2. */
204+
});
205+
206+
207+
testWidgets('color overrides theme color with Material 3', (WidgetTester tester) async {
208+
await tester.pumpWidget(
209+
MaterialApp(
210+
theme: ThemeData.light(useMaterial3: true).copyWith(
211+
bottomAppBarColor: const Color(0xffffff00)),
212+
home: Builder(
213+
builder: (BuildContext context) {
214+
return const Scaffold(
215+
floatingActionButton: FloatingActionButton(
216+
onPressed: null,
217+
),
218+
bottomNavigationBar: BottomAppBar(
219+
color: Color(0xff0000ff),
220+
),
221+
);
222+
},
223+
),
224+
),
225+
);
226+
227+
final PhysicalShape physicalShape =
228+
tester.widget(find.byType(PhysicalShape).at(0));
229+
final Material material = tester.widget(find.byType(Material).at(1));
230+
231+
expect(physicalShape.color, const Color(0xff0000ff));
232+
expect(material.color, const Color(0xff0000ff));
202233
});
203234

204235
testWidgets('dark theme applies an elevation overlay color', (WidgetTester tester) async {

0 commit comments

Comments
 (0)