Remove double MaterialApp wrap from api samples (#150055)

The widget under test already contains a MaterialApp, so there's no need to wrap it again with one in the test. In fact, the additional MaterialApp could hide problems in the widget under test.
This commit is contained in:
Michael Goderbauer
2024-06-11 22:22:23 -07:00
committed by GitHub
parent 1f93809ad2
commit 962ae8a334
27 changed files with 30 additions and 136 deletions

View File

@@ -13,11 +13,7 @@ void main() {
return tester.widget<TextButton>(find.widgetWithText(TextButton, text));
}
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: example.ToggleButtonsExampleApp(),
),
),
const example.ToggleButtonsExampleApp(),
);
TextButton firstButton = findButton('Apple');
@@ -51,11 +47,7 @@ void main() {
return tester.widget<TextButton>(find.widgetWithText(TextButton, text));
}
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: example.ToggleButtonsExampleApp(),
),
),
const example.ToggleButtonsExampleApp(),
);
TextButton firstButton = findButton('Tomatoes');
@@ -90,11 +82,7 @@ void main() {
return tester.widget<TextButton>(find.widgetWithIcon(TextButton, iconData));
}
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: example.ToggleButtonsExampleApp(),
),
),
const example.ToggleButtonsExampleApp(),
);
TextButton firstButton = findButton(Icons.sunny);