@@ -20,33 +20,27 @@ void main() {
20
20
home: Scaffold (
21
21
appBar: AppBar (
22
22
backwardsCompatibility: false ,
23
- title: TextButton (onPressed: () { }, child: const Text ('TitleButton' )),
24
23
actions: < Widget > [
25
- IconButton (onPressed: () { }, icon: const Icon (Icons .share)),
26
- TextButton (onPressed: () { }, child: const Text ('ActionButton' )),
24
+ IconButton (icon: const Icon (Icons .share), onPressed: () { }),
27
25
],
28
26
),
29
27
),
30
28
),
31
29
);
32
30
33
31
final Material widget = _getAppBarMaterial (tester);
34
- final RichText titleButtonText = _getAppBarButtonRichText (tester, 'TitleButton' );
35
32
final IconTheme iconTheme = _getAppBarIconTheme (tester);
36
33
final IconTheme actionsIconTheme = _getAppBarActionsIconTheme (tester);
37
34
final RichText actionIconText = _getAppBarIconRichText (tester);
38
- final RichText actionButtonText = _getAppBarButtonRichText (tester, 'ActionButton' );
39
35
final DefaultTextStyle text = _getAppBarText (tester);
40
36
41
37
expect (SystemChrome .latestStyle! .statusBarBrightness, SystemUiOverlayStyle .light.statusBarBrightness);
42
- expect (titleButtonText.text.style! .color, Colors .white);
43
38
expect (widget.color, Colors .blue);
44
39
expect (widget.elevation, 4.0 );
45
40
expect (widget.shadowColor, Colors .black);
46
41
expect (iconTheme.data, const IconThemeData (color: Colors .white));
47
42
expect (actionsIconTheme.data, const IconThemeData (color: Colors .white));
48
43
expect (actionIconText.text.style! .color, Colors .white);
49
- expect (actionButtonText.text.style! .color, Colors .white);
50
44
expect (text.style, Typography .material2014 ().englishLike.bodyText2! .merge (Typography .material2014 ().white.bodyText2));
51
45
expect (tester.getSize (find.byType (AppBar )).height, kToolbarHeight);
52
46
expect (tester.getSize (find.byType (AppBar )).width, 800 );
@@ -63,8 +57,7 @@ void main() {
63
57
backwardsCompatibility: false ,
64
58
title: const Text ('App Bar Title' ),
65
59
actions: < Widget > [
66
- IconButton (onPressed: () { }, icon: const Icon (Icons .share)),
67
- TextButton (onPressed: () { }, child: const Text ('ActionButton' )),
60
+ IconButton (icon: const Icon (Icons .share), onPressed: () { }),
68
61
],
69
62
),
70
63
),
@@ -75,7 +68,6 @@ void main() {
75
68
final IconTheme iconTheme = _getAppBarIconTheme (tester);
76
69
final IconTheme actionsIconTheme = _getAppBarActionsIconTheme (tester);
77
70
final RichText actionIconText = _getAppBarIconRichText (tester);
78
- final RichText actionButtonText = _getAppBarButtonRichText (tester, 'ActionButton' );
79
71
final DefaultTextStyle text = _getAppBarText (tester);
80
72
81
73
expect (SystemChrome .latestStyle! .statusBarBrightness, appBarTheme.brightness);
@@ -85,7 +77,6 @@ void main() {
85
77
expect (iconTheme.data, appBarTheme.iconTheme);
86
78
expect (actionsIconTheme.data, appBarTheme.actionsIconTheme);
87
79
expect (actionIconText.text.style! .color, appBarTheme.actionsIconTheme! .color);
88
- expect (actionButtonText.text.style! .color, Colors .pink);
89
80
expect (text.style, appBarTheme.toolbarTextStyle);
90
81
expect (tester.getSize (find.byType (AppBar )).height, appBarTheme.toolbarHeight);
91
82
expect (tester.getSize (find.byType (AppBar )).width, 800 );
@@ -144,7 +135,6 @@ void main() {
144
135
const Color shadowColor = Colors .red;
145
136
const IconThemeData iconThemeData = IconThemeData (color: Colors .green);
146
137
const IconThemeData actionsIconThemeData = IconThemeData (color: Colors .lightBlue);
147
- const TextButtonThemeData textButtonTheme = TextButtonThemeData ();
148
138
const TextStyle toolbarTextStyle = TextStyle (color: Colors .pink);
149
139
const TextStyle titleTextStyle = TextStyle (color: Colors .orange);
150
140
@@ -161,7 +151,6 @@ void main() {
161
151
shadowColor: shadowColor,
162
152
iconTheme: iconThemeData,
163
153
actionsIconTheme: actionsIconThemeData,
164
- textButtonTheme: textButtonTheme,
165
154
toolbarTextStyle: toolbarTextStyle,
166
155
titleTextStyle: titleTextStyle,
167
156
actions: < Widget > [
@@ -186,7 +175,6 @@ void main() {
186
175
expect (actionsIconTheme.data, actionsIconThemeData);
187
176
expect (actionIconText.text.style! .color, actionsIconThemeData.color);
188
177
expect (text.style, toolbarTextStyle);
189
- expect (_getAppBarTextButtonTheme (tester).data, textButtonTheme);
190
178
});
191
179
192
180
testWidgets ('AppBar icon color takes priority over everything' , (WidgetTester tester) async {
@@ -548,22 +536,16 @@ AppBarTheme _appBarTheme() {
548
536
const Color shadowColor = Colors .red;
549
537
const IconThemeData iconThemeData = IconThemeData (color: Colors .black);
550
538
const IconThemeData actionsIconThemeData = IconThemeData (color: Colors .pink);
551
- final TextButtonThemeData textButtonThemeData = TextButtonThemeData (
552
- style: TextButton .styleFrom (
553
- primary: Colors .pink,
554
- ),
555
- );
556
- return AppBarTheme (
539
+ return const AppBarTheme (
557
540
actionsIconTheme: actionsIconThemeData,
558
541
brightness: brightness,
559
542
backgroundColor: backgroundColor,
560
543
elevation: elevation,
561
544
shadowColor: shadowColor,
562
545
iconTheme: iconThemeData,
563
- textButtonTheme: textButtonThemeData,
564
546
toolbarHeight: 96 ,
565
- toolbarTextStyle: const TextStyle (color: Colors .yellow),
566
- titleTextStyle: const TextStyle (color: Colors .pink),
547
+ toolbarTextStyle: TextStyle (color: Colors .yellow),
548
+ titleTextStyle: TextStyle (color: Colors .pink),
567
549
);
568
550
}
569
551
@@ -572,7 +554,7 @@ Material _getAppBarMaterial(WidgetTester tester) {
572
554
find.descendant (
573
555
of: find.byType (AppBar ),
574
556
matching: find.byType (Material ),
575
- ).first ,
557
+ ),
576
558
);
577
559
}
578
560
@@ -594,15 +576,6 @@ IconTheme _getAppBarActionsIconTheme(WidgetTester tester) {
594
576
);
595
577
}
596
578
597
- TextButtonTheme _getAppBarTextButtonTheme (WidgetTester tester) {
598
- return tester.widget <TextButtonTheme >(
599
- find.descendant (
600
- of: find.byType (AppBar ),
601
- matching: find.byType (TextButtonTheme ),
602
- ).first,
603
- );
604
- }
605
-
606
579
RichText _getAppBarIconRichText (WidgetTester tester) {
607
580
return tester.widget <RichText >(
608
581
find.descendant (
@@ -612,15 +585,6 @@ RichText _getAppBarIconRichText(WidgetTester tester) {
612
585
);
613
586
}
614
587
615
- RichText _getAppBarButtonRichText (WidgetTester tester, String text) {
616
- return tester.widget <RichText >(
617
- find.descendant (
618
- of: find.text (text),
619
- matching: find.byType (RichText ),
620
- ).first,
621
- );
622
- }
623
-
624
588
DefaultTextStyle _getAppBarText (WidgetTester tester) {
625
589
return tester.widget <DefaultTextStyle >(
626
590
find.descendant (
0 commit comments