@@ -111,7 +111,7 @@ void main() {
111
111
expect (materialWidget.color, customColor);
112
112
});
113
113
114
- testWidgetsWithLeakTracking ('Dialog Defaults' , (WidgetTester tester) async {
114
+ testWidgetsWithLeakTracking ('Material2 - Dialog Defaults' , (WidgetTester tester) async {
115
115
const AlertDialog dialog = AlertDialog (
116
116
title: Text ('Title' ),
117
117
content: Text ('Y' ),
@@ -131,10 +131,14 @@ void main() {
131
131
find.descendant (of: find.byType (Dialog ), matching: find.byType (Material )),
132
132
);
133
133
expect (bottomLeft.dy, 360.0 );
134
+ });
134
135
135
- await tester.tapAt (const Offset (10.0 , 10.0 ));
136
- await tester.pumpAndSettle ();
137
-
136
+ testWidgetsWithLeakTracking ('Material3 - Dialog Defaults' , (WidgetTester tester) async {
137
+ const AlertDialog dialog = AlertDialog (
138
+ title: Text ('Title' ),
139
+ content: Text ('Y' ),
140
+ actions: < Widget > [ ],
141
+ );
138
142
await tester.pumpWidget (_buildAppWithDialog (dialog, theme: material3Theme));
139
143
140
144
await tester.tap (find.text ('X' ));
@@ -146,9 +150,8 @@ void main() {
146
150
expect (material3Widget.elevation, 6.0 );
147
151
});
148
152
149
- testWidgetsWithLeakTracking ('Dialog.fullscreen Defaults' , (WidgetTester tester) async {
153
+ testWidgetsWithLeakTracking ('Material2 - Dialog.fullscreen Defaults' , (WidgetTester tester) async {
150
154
const String dialogTextM2 = 'Fullscreen Dialog - M2' ;
151
- const String dialogTextM3 = 'Fullscreen Dialog - M3' ;
152
155
153
156
await tester.pumpWidget (_buildAppWithDialog (
154
157
theme: material2Theme,
@@ -162,14 +165,18 @@ void main() {
162
165
163
166
expect (find.text (dialogTextM2), findsOneWidget);
164
167
165
- Material materialWidget = _getMaterialFromDialog (tester);
168
+ final Material materialWidget = _getMaterialFromDialog (tester);
166
169
expect (materialWidget.color, Colors .grey[800 ]);
167
170
168
171
// Try to dismiss the fullscreen dialog with the escape key.
169
172
await tester.sendKeyEvent (LogicalKeyboardKey .escape);
170
173
await tester.pumpAndSettle ();
171
174
172
175
expect (find.text (dialogTextM2), findsNothing);
176
+ });
177
+
178
+ testWidgetsWithLeakTracking ('Material3 - Dialog.fullscreen Defaults' , (WidgetTester tester) async {
179
+ const String dialogTextM3 = 'Fullscreen Dialog - M3' ;
173
180
174
181
await tester.pumpWidget (_buildAppWithDialog (
175
182
theme: material3Theme,
@@ -183,7 +190,7 @@ void main() {
183
190
184
191
expect (find.text (dialogTextM3), findsOneWidget);
185
192
186
- materialWidget = _getMaterialFromDialog (tester);
193
+ final Material materialWidget = _getMaterialFromDialog (tester);
187
194
expect (materialWidget.color, material3Theme.colorScheme.surface);
188
195
189
196
// Try to dismiss the fullscreen dialog with the escape key.
@@ -644,7 +651,7 @@ void main() {
644
651
expect (actionsSize.width, dialogSize.width - (30.0 * 2 ));
645
652
});
646
653
647
- testWidgetsWithLeakTracking ('AlertDialog.buttonPadding defaults' , (WidgetTester tester) async {
654
+ testWidgetsWithLeakTracking ('Material2 - AlertDialog.buttonPadding defaults' , (WidgetTester tester) async {
648
655
final GlobalKey key1 = GlobalKey ();
649
656
final GlobalKey key2 = GlobalKey ();
650
657
@@ -700,10 +707,28 @@ void main() {
700
707
tester.getBottomRight (find.byKey (key2)).dx,
701
708
tester.getBottomRight (_findButtonBar ()).dx - 8.0 ,
702
709
); // right
710
+ });
703
711
704
- // Dismiss it and test material 3 dialog
705
- await tester.tapAt (const Offset (10.0 , 10.0 ));
706
- await tester.pumpAndSettle ();
712
+ testWidgetsWithLeakTracking ('Material3 - AlertDialog.buttonPadding defaults' , (WidgetTester tester) async {
713
+ final GlobalKey key1 = GlobalKey ();
714
+ final GlobalKey key2 = GlobalKey ();
715
+
716
+ final AlertDialog dialog = AlertDialog (
717
+ title: const Text ('title' ),
718
+ content: const Text ('content' ),
719
+ actions: < Widget > [
720
+ ElevatedButton (
721
+ key: key1,
722
+ onPressed: () {},
723
+ child: const Text ('button 1' ),
724
+ ),
725
+ ElevatedButton (
726
+ key: key2,
727
+ onPressed: () {},
728
+ child: const Text ('button 2' ),
729
+ ),
730
+ ],
731
+ );
707
732
708
733
await tester.pumpWidget (_buildAppWithDialog (dialog, theme: material3Theme));
709
734
0 commit comments