Skip to content

Commit f16ba32

Browse files
[flutter_markdown] Change the way tests get screen size (flutter#4514)
As of flutter#125003 the current method these tests use to get the screen width throws an exception, since it assumes that the first widget in the tree has certain properties. To make the test more robust, this get the width of the outmost Column, which is part of the test setup, rather than whatever the first widget is. Unblocks the flutter->packgaes roller.
1 parent 7f07f66 commit f16ba32

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/flutter_markdown/test/list_test.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ void defineTests() {
202202
),
203203
);
204204

205-
final double screenWidth = tester.allElements.first.size!.width;
205+
final double screenWidth =
206+
find.byType(Column).evaluate().first.size!.width;
206207
final double markdownBodyWidth =
207208
find.byType(MarkdownBody).evaluate().single.size!.width;
208209

@@ -225,7 +226,8 @@ void defineTests() {
225226
),
226227
);
227228

228-
final double screenWidth = tester.allElements.first.size!.width;
229+
final double screenWidth =
230+
find.byType(Column).evaluate().first.size!.width;
229231
final double markdownBodyWidth =
230232
find.byType(MarkdownBody).evaluate().single.size!.width;
231233

0 commit comments

Comments
 (0)