@@ -11,11 +11,11 @@ void main() {
11
11
await tester.pumpWidget (const example.IndexedStackApp ());
12
12
13
13
final Finder gesture2 = find.byKey (const Key ('gesture2' ));
14
- final Element containerFinder = find.byKey (const Key ('Dash' )).evaluate ().first;
14
+ final Element containerFinder = find.byKey (const Key ('Dash' ), skipOffstage : false ).evaluate ().first;
15
15
expect (containerFinder.renderObject! .debugNeedsPaint, false );
16
- final Element containerFinder1 = find.byKey (const Key ('John' )).evaluate ().first;
16
+ final Element containerFinder1 = find.byKey (const Key ('John' ), skipOffstage : false ).evaluate ().first;
17
17
expect (containerFinder1.renderObject! .debugNeedsPaint, true );
18
- final Element containerFinder2 = find.byKey (const Key ('Mary' )).evaluate ().first;
18
+ final Element containerFinder2 = find.byKey (const Key ('Mary' ), skipOffstage : false ).evaluate ().first;
19
19
expect (containerFinder2.renderObject! .debugNeedsPaint, true );
20
20
21
21
await tester.tap (gesture2);
@@ -34,9 +34,9 @@ void main() {
34
34
await tester.pumpWidget (const example.IndexedStackApp ());
35
35
36
36
final Finder gesture1 = find.byKey (const Key ('gesture1' ));
37
- final Element containerFinder = find.byKey (const Key ('Dash' )).evaluate ().first;
38
- final Element containerFinder1 = find.byKey (const Key ('John' )).evaluate ().first;
39
- final Element containerFinder2 = find.byKey (const Key ('Mary' )).evaluate ().first;
37
+ final Element containerFinder = find.byKey (const Key ('Dash' ), skipOffstage : false ).evaluate ().first;
38
+ final Element containerFinder1 = find.byKey (const Key ('John' ), skipOffstage : false ).evaluate ().first;
39
+ final Element containerFinder2 = find.byKey (const Key ('Mary' ), skipOffstage : false ).evaluate ().first;
40
40
41
41
await tester.tap (gesture1);
42
42
await tester.pump ();
@@ -53,17 +53,18 @@ void main() {
53
53
testWidgets ('has correct element addition handling' , (WidgetTester tester) async {
54
54
await tester.pumpWidget (const example.IndexedStackApp ());
55
55
56
- expect (find.byType (example.PersonTracker ), findsNWidgets (3 ));
56
+ expect (find.byType (example.PersonTracker ), findsOneWidget);
57
+ expect (find.byType (example.PersonTracker , skipOffstage: false ), findsNWidgets (3 ));
57
58
final Finder textField = find.byType (TextField );
58
59
await tester.enterText (textField, 'hello' );
59
60
await tester.testTextInput.receiveAction (TextInputAction .done);
60
61
await tester.pump ();
61
- expect (find.byType (example.PersonTracker ), findsNWidgets (4 ));
62
+ expect (find.byType (example.PersonTracker , skipOffstage : false ), findsNWidgets (4 ));
62
63
63
64
await tester.enterText (textField, 'hello1' );
64
65
await tester.testTextInput.receiveAction (TextInputAction .done);
65
66
await tester.pump ();
66
- expect (find.byType (example.PersonTracker ), findsNWidgets (5 ));
67
+ expect (find.byType (example.PersonTracker , skipOffstage : false ), findsNWidgets (5 ));
67
68
});
68
69
testWidgets ('has state preservation' , (WidgetTester tester) async {
69
70
await tester.pumpWidget (const example.IndexedStackApp ());
0 commit comments