From f16ba3291c11566b5e714296e348a0fa2f959f0c Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Tue, 18 Jul 2023 20:06:06 -0700 Subject: [PATCH] [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. --- packages/flutter_markdown/test/list_test.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/flutter_markdown/test/list_test.dart b/packages/flutter_markdown/test/list_test.dart index 4a587c50a93f5..9e2b1fcab4489 100644 --- a/packages/flutter_markdown/test/list_test.dart +++ b/packages/flutter_markdown/test/list_test.dart @@ -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;