@@ -173,6 +173,32 @@ void main() {
173173 expect (tester.getCenter (find.text ('Title' )).dx, 400.0 );
174174 });
175175
176+ // Assert that two SystemUiOverlayStyle instances have the same values for
177+ // status bar properties and that the first instance has no system navigation
178+ // bar properties set.
179+ void expectSameStatusBarStyle (SystemUiOverlayStyle style, SystemUiOverlayStyle expectedStyle) {
180+ expect (style.statusBarColor, expectedStyle.statusBarColor);
181+ expect (style.statusBarBrightness, expectedStyle.statusBarBrightness);
182+ expect (style.statusBarIconBrightness, expectedStyle.statusBarIconBrightness);
183+ expect (style.systemStatusBarContrastEnforced, expectedStyle.systemStatusBarContrastEnforced);
184+ expect (style.systemNavigationBarColor, isNull);
185+ expect (style.systemNavigationBarContrastEnforced, isNull);
186+ expect (style.systemNavigationBarDividerColor, isNull);
187+ expect (style.systemNavigationBarIconBrightness, isNull);
188+ }
189+
190+ // Regression test for https://github.com/flutter/flutter/issues/119270
191+ testWidgets ('System navigation bar properties are not overriden' , (WidgetTester tester) async {
192+ await tester.pumpWidget (
193+ const CupertinoApp (
194+ home: CupertinoNavigationBar (
195+ backgroundColor: Color (0xF0F9F9F9 ),
196+ ),
197+ ),
198+ );
199+ expectSameStatusBarStyle (SystemChrome .latestStyle! , SystemUiOverlayStyle .dark);
200+ });
201+
176202 testWidgets ('Can specify custom brightness' , (WidgetTester tester) async {
177203 await tester.pumpWidget (
178204 const CupertinoApp (
@@ -182,11 +208,7 @@ void main() {
182208 ),
183209 ),
184210 );
185-
186- final AnnotatedRegion <SystemUiOverlayStyle > region1 = tester.allWidgets
187- .whereType <AnnotatedRegion <SystemUiOverlayStyle >>()
188- .single;
189- expect (region1.value, SystemUiOverlayStyle .light);
211+ expectSameStatusBarStyle (SystemChrome .latestStyle! , SystemUiOverlayStyle .light);
190212
191213 await tester.pumpWidget (
192214 const CupertinoApp (
@@ -196,11 +218,7 @@ void main() {
196218 ),
197219 ),
198220 );
199-
200- final AnnotatedRegion <SystemUiOverlayStyle > region2 = tester.allWidgets
201- .whereType <AnnotatedRegion <SystemUiOverlayStyle >>()
202- .single;
203- expect (region2.value, SystemUiOverlayStyle .dark);
221+ expectSameStatusBarStyle (SystemChrome .latestStyle! , SystemUiOverlayStyle .dark);
204222
205223 await tester.pumpWidget (
206224 const CupertinoApp (
@@ -215,11 +233,7 @@ void main() {
215233 ),
216234 ),
217235 );
218-
219- final AnnotatedRegion <SystemUiOverlayStyle > region3 = tester.allWidgets
220- .whereType <AnnotatedRegion <SystemUiOverlayStyle >>()
221- .single;
222- expect (region3.value, SystemUiOverlayStyle .light);
236+ expectSameStatusBarStyle (SystemChrome .latestStyle! , SystemUiOverlayStyle .light);
223237
224238 await tester.pumpWidget (
225239 const CupertinoApp (
@@ -234,11 +248,7 @@ void main() {
234248 ),
235249 ),
236250 );
237-
238- final AnnotatedRegion <SystemUiOverlayStyle > region4 = tester.allWidgets
239- .whereType <AnnotatedRegion <SystemUiOverlayStyle >>()
240- .single;
241- expect (region4.value, SystemUiOverlayStyle .dark);
251+ expectSameStatusBarStyle (SystemChrome .latestStyle! , SystemUiOverlayStyle .dark);
242252 });
243253
244254 testWidgets ('Padding works in RTL' , (WidgetTester tester) async {
@@ -1021,7 +1031,7 @@ void main() {
10211031 },
10221032 ),
10231033 );
1024- expect (SystemChrome .latestStyle, SystemUiOverlayStyle .light);
1034+ expectSameStatusBarStyle (SystemChrome .latestStyle! , SystemUiOverlayStyle .light);
10251035 });
10261036
10271037 testWidgets ('NavBar draws a dark system bar for a light background' , (WidgetTester tester) async {
@@ -1041,7 +1051,7 @@ void main() {
10411051 },
10421052 ),
10431053 );
1044- expect (SystemChrome .latestStyle, SystemUiOverlayStyle .dark);
1054+ expectSameStatusBarStyle (SystemChrome .latestStyle! , SystemUiOverlayStyle .dark);
10451055 });
10461056
10471057 testWidgets ('CupertinoNavigationBarBackButton shows an error when manually added outside a route' , (WidgetTester tester) async {
0 commit comments