Make sure that a NavigationRail doesn't crash in 0x0 environment (#177022)

This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the NavigationRail
widget.
This commit is contained in:
Ahmed Mohamed Sameh 2025-10-17 01:07:52 +03:00 committed by GitHub
parent 4f7d2652c5
commit fd2b1bc720
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6127,6 +6127,24 @@ void main() {
expect(updatedWidthRTL, defaultWidth + safeAreaPadding);
});
}); // End Material 2 group
testWidgets('NavigationRail does not crash at zero area', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: Center(
child: SizedBox.shrink(
child: NavigationRail(
destinations: const <NavigationRailDestination>[
NavigationRailDestination(icon: Icon(Icons.abc), label: Text('X')),
],
selectedIndex: 0,
),
),
),
),
);
expect(tester.getSize(find.byType(NavigationRail)), Size.zero);
});
}
TestSemantics _expectedSemantics({bool scrollable = false}) {