[flutter_markdown] Change the way tests get screen size (#4514)

As of https://github.com/flutter/flutter/pull/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.
This commit is contained in:
stuartmorgan
2023-07-18 20:06:06 -07:00
committed by GitHub
parent 7f07f6655a
commit f16ba3291c

View File

@ -202,7 +202,8 @@ void defineTests() {
),
);
final double screenWidth = tester.allElements.first.size!.width;
final double screenWidth =
find.byType(Column).evaluate().first.size!.width;
final double markdownBodyWidth =
find.byType(MarkdownBody).evaluate().single.size!.width;
@ -225,7 +226,8 @@ void defineTests() {
),
);
final double screenWidth = tester.allElements.first.size!.width;
final double screenWidth =
find.byType(Column).evaluate().first.size!.width;
final double markdownBodyWidth =
find.byType(MarkdownBody).evaluate().single.size!.width;