Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/flutter/test/widgets/two_dimensional_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ Widget simpleListTest({
Clip? clipBehavior,
}) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
body: SimpleListTableView(
mainAxis: mainAxis,
Expand Down
21 changes: 19 additions & 2 deletions packages/flutter/test/widgets/two_dimensional_viewport_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,27 @@ void main() {
));
await tester.pumpAndSettle();

// In the tests below the number of RepaintBoundary widgets depends on:
// ModalRoute - builds 2
// GlowingOverscrollIndicator - builds 2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If useMaterial 3 is true, then there is no glowing overscroll indicator, it is the stretching one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is correct.

// TwoDimensionalChildListDelegate - builds 1 unless addRepaintBoundaries is false

void expectModalRoute() {
expect(ModalRoute.of(tester.element(find.byType(SimpleListTableViewport))), isA<MaterialPageRoute<void>>());
}

switch (defaultTargetPlatform) {
case TargetPlatform.android:
case TargetPlatform.fuchsia:
expectModalRoute();
expect(find.byType(GlowingOverscrollIndicator), findsNWidgets(2));
expect(find.byType(RepaintBoundary), findsNWidgets(7));

case TargetPlatform.android:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What makes the difference when switching to material 3 on Android here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Material3 a StretchingOverscrollIndicator is used and it does not create a RepaintBoundary.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, that accounts for 2 of them, what about the other 2? since it is going from 7 to 3 on android for material 3. Just want to make sure we know what is changing here with material 3.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7 repaint boundaries:
4 - 2 GlowingOverscrollIndicators (not included in M3)
2 - 1 ModalRoute
1 - the table's cell

3 repaint boundaries:
2 - 1 ModalRoute
1 - the table's cell

case TargetPlatform.iOS:
case TargetPlatform.linux:
case TargetPlatform.macOS:
case TargetPlatform.windows:
expectModalRoute();
expect(find.byType(RepaintBoundary), findsNWidgets(3));
}

Expand All @@ -183,13 +196,17 @@ void main() {
await tester.pumpAndSettle();

switch (defaultTargetPlatform) {
case TargetPlatform.android:
case TargetPlatform.fuchsia:
expectModalRoute();
expect(find.byType(GlowingOverscrollIndicator), findsNWidgets(2));
expect(find.byType(RepaintBoundary), findsNWidgets(6));

case TargetPlatform.android:
case TargetPlatform.iOS:
case TargetPlatform.linux:
case TargetPlatform.macOS:
case TargetPlatform.windows:
expectModalRoute();
expect(find.byType(RepaintBoundary), findsNWidgets(2));
}
}, variant: TargetPlatformVariant.all());
Expand Down