Skip to content

Commit 92b1c87

Browse files
authored
Make sure that a NavigationDrawer doesn't crash in 0x0 environment (flutter#176951)
This is my attempt to handle flutter#6537 for the NavigationDrawer widget.
1 parent bd0e203 commit 92b1c87

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

packages/flutter/test/material/navigation_drawer_test.dart

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,23 @@ void main() {
527527
expect(find.text('Footer'), findsOneWidget);
528528
expect(find.byIcon(Icons.settings), findsOneWidget);
529529
});
530+
531+
testWidgets('NavigationDrawer does not crash at zero area', (WidgetTester tester) async {
532+
await tester.pumpWidget(
533+
const MaterialApp(
534+
home: Center(
535+
child: SizedBox.shrink(
536+
child: NavigationDrawer(
537+
children: <Widget>[
538+
NavigationDrawerDestination(icon: Icon(Icons.inbox), label: Text('Inbox')),
539+
],
540+
),
541+
),
542+
),
543+
),
544+
);
545+
expect(tester.getSize(find.byType(NavigationDrawer)), Size.zero);
546+
});
530547
}
531548

532549
Widget _buildWidget(GlobalKey<ScaffoldState> scaffoldKey, Widget child, {bool? useMaterial3}) {

0 commit comments

Comments
 (0)