Optimize Overlay sample to avoid overflow (#155861)

Fixes [Optimize official `Overlay` sample to avoid overflowing.](https://github.com/flutter/flutter/issues/155860)

When checking https://main-api.flutter.dev/flutter/widgets/Overlay-class.html on a laptop screen it overflows as the layout uses Row instead of more robust widget for spacing `Wrap`

Quick Friday night fix. :) 

| Before | After |
| --------------- | --------------- |
| <img src="https://github.com/user-attachments/assets/eea6f1d9-e860-4ebd-8d16-2d8f4141e1ec" /> | <img src="https://github.com/user-attachments/assets/9f8426ba-d541-44a6-8ea6-2e34636b7e82"  /> |
This commit is contained in:
Taha Tesser
2024-09-28 12:20:32 +03:00
committed by GitHub
parent 71fd800e7e
commit 9f88de930b
2 changed files with 75 additions and 55 deletions

View File

@@ -38,4 +38,19 @@ void main() {
expect(find.text(commutePage), findsNothing);
expect(find.text(savedPage), findsNothing);
});
testWidgets('Narrow layout does not overflow', (WidgetTester tester) async {
// Set a narrow screen size.
tester.view
..physicalSize = const Size(320, 480)
..devicePixelRatio = 1;
addTearDown(tester.view.reset);
await tester.pumpWidget(
const example.OverlayApp(),
);
// Verify that no overflow errors occur.
expect(tester.takeException(), isNull);
});
}