@@ -33,6 +33,7 @@ void main() {
33
33
expect (SystemChrome .latestStyle.statusBarBrightness, Brightness .dark);
34
34
expect (widget.color, Colors .blue);
35
35
expect (widget.elevation, 4.0 );
36
+ expect (widget.shadowColor, Colors .black);
36
37
expect (iconTheme.data, const IconThemeData (color: Colors .white));
37
38
expect (actionsIconTheme.data, const IconThemeData (color: Colors .white));
38
39
expect (actionIconText.text.style.color, Colors .white);
@@ -61,6 +62,7 @@ void main() {
61
62
expect (SystemChrome .latestStyle.statusBarBrightness, appBarTheme.brightness);
62
63
expect (widget.color, appBarTheme.color);
63
64
expect (widget.elevation, appBarTheme.elevation);
65
+ expect (widget.shadowColor, appBarTheme.shadowColor);
64
66
expect (iconTheme.data, appBarTheme.iconTheme);
65
67
expect (actionsIconTheme.data, appBarTheme.actionsIconTheme);
66
68
expect (actionIconText.text.style.color, appBarTheme.actionsIconTheme.color);
@@ -71,6 +73,7 @@ void main() {
71
73
const Brightness brightness = Brightness .dark;
72
74
const Color color = Colors .orange;
73
75
const double elevation = 3.0 ;
76
+ const Color shadowColor = Colors .red;
74
77
const IconThemeData iconThemeData = IconThemeData (color: Colors .green);
75
78
const IconThemeData actionsIconThemeData = IconThemeData (color: Colors .lightBlue);
76
79
const TextTheme textTheme = TextTheme (headline6: TextStyle (color: Colors .orange), bodyText2: TextStyle (color: Colors .pink));
@@ -83,6 +86,7 @@ void main() {
83
86
backgroundColor: color,
84
87
brightness: brightness,
85
88
elevation: elevation,
89
+ shadowColor: shadowColor,
86
90
iconTheme: iconThemeData,
87
91
actionsIconTheme: actionsIconThemeData,
88
92
textTheme: textTheme,
@@ -101,6 +105,7 @@ void main() {
101
105
expect (SystemChrome .latestStyle.statusBarBrightness, brightness);
102
106
expect (widget.color, color);
103
107
expect (widget.elevation, elevation);
108
+ expect (widget.shadowColor, shadowColor);
104
109
expect (iconTheme.data, iconThemeData);
105
110
expect (actionsIconTheme.data, actionsIconThemeData);
106
111
expect (actionIconText.text.style.color, actionsIconThemeData.color);
@@ -151,6 +156,7 @@ void main() {
151
156
expect (SystemChrome .latestStyle.statusBarBrightness, appBarTheme.brightness);
152
157
expect (widget.color, appBarTheme.color);
153
158
expect (widget.elevation, appBarTheme.elevation);
159
+ expect (widget.shadowColor, appBarTheme.shadowColor);
154
160
expect (iconTheme.data, appBarTheme.iconTheme);
155
161
expect (actionsIconTheme.data, appBarTheme.actionsIconTheme);
156
162
expect (actionIconText.text.style.color, appBarTheme.actionsIconTheme.color);
@@ -178,6 +184,7 @@ void main() {
178
184
expect (SystemChrome .latestStyle.statusBarBrightness, themeData.brightness);
179
185
expect (widget.color, themeData.primaryColor);
180
186
expect (widget.elevation, 4.0 );
187
+ expect (widget.shadowColor, Colors .black);
181
188
expect (iconTheme.data, themeData.primaryIconTheme);
182
189
expect (actionsIconTheme.data, themeData.primaryIconTheme);
183
190
expect (actionIconText.text.style.color, themeData.primaryIconTheme.color);
@@ -199,10 +206,11 @@ void main() {
199
206
await tester.pumpWidget (MaterialApp (
200
207
theme: ThemeData (appBarTheme: const AppBarTheme (centerTitle: true )),
201
208
home: Scaffold (
202
- appBar: AppBar (
203
- title: const Text ('Title' ),
204
- centerTitle: false ,
205
- )),
209
+ appBar: AppBar (
210
+ title: const Text ('Title' ),
211
+ centerTitle: false ,
212
+ ),
213
+ ),
206
214
));
207
215
208
216
final NavigationToolbar navToolBar = tester.widget (find.byType (NavigationToolbar ));
@@ -221,12 +229,29 @@ void main() {
221
229
// the value of NavigationToolBar.centerMiddle should be true.
222
230
expect (navToolBar.centerMiddle, true );
223
231
});
232
+
233
+ testWidgets ('AppBar.shadowColor takes priority over AppBarTheme.shadowColor' , (WidgetTester tester) async {
234
+ await tester.pumpWidget (MaterialApp (
235
+ theme: ThemeData (appBarTheme: const AppBarTheme (shadowColor: Colors .red)),
236
+ home: Scaffold (
237
+ appBar: AppBar (
238
+ title: const Text ('Title' ),
239
+ shadowColor: Colors .yellow,
240
+ ),
241
+ ),
242
+ ));
243
+
244
+ final AppBar appBar = tester.widget (find.byType (AppBar ));
245
+ // The AppBar.shadowColor should be used instead of AppBarTheme.shadowColor.
246
+ expect (appBar.shadowColor, Colors .yellow);
247
+ });
224
248
}
225
249
226
250
AppBarTheme _appBarTheme () {
227
251
const Brightness brightness = Brightness .light;
228
252
const Color color = Colors .lightBlue;
229
253
const double elevation = 6.0 ;
254
+ const Color shadowColor = Colors .red;
230
255
const IconThemeData iconThemeData = IconThemeData (color: Colors .black);
231
256
const IconThemeData actionsIconThemeData = IconThemeData (color: Colors .pink);
232
257
const TextTheme textTheme = TextTheme (bodyText2: TextStyle (color: Colors .yellow));
@@ -235,6 +260,7 @@ AppBarTheme _appBarTheme() {
235
260
brightness: brightness,
236
261
color: color,
237
262
elevation: elevation,
263
+ shadowColor: shadowColor,
238
264
iconTheme: iconThemeData,
239
265
textTheme: textTheme,
240
266
);
@@ -284,6 +310,7 @@ RichText _getAppBarIconRichText(WidgetTester tester) {
284
310
).first,
285
311
);
286
312
}
313
+
287
314
DefaultTextStyle _getAppBarText (WidgetTester tester) {
288
315
return tester.widget <DefaultTextStyle >(
289
316
find.descendant (
0 commit comments