Migration guide for moving from BottomNavigationBar to NavigationBar (#128263)

Fixes https://github.com/flutter/flutter/issues/127213
This commit is contained in:
Leigha Jarett
2023-06-05 23:52:07 -04:00
committed by GitHub
parent d87656559c
commit 6c8cf3a9d0
3 changed files with 50 additions and 20 deletions

View File

@@ -16,20 +16,20 @@ void main() {
final NavigationBar navigationBarWidget = tester.firstWidget(find.byType(NavigationBar));
/// NavigationDestinations must be rendered
expect(find.text('Explore'), findsOneWidget);
expect(find.text('Commute'), findsOneWidget);
expect(find.text('Saved'), findsOneWidget);
expect(find.text('Home'), findsOneWidget);
expect(find.text('Business'), findsOneWidget);
expect(find.text('School'), findsOneWidget);
/// initial index must be zero
expect(navigationBarWidget.selectedIndex, 0);
/// switch to second tab
await tester.tap(find.text('Commute'));
await tester.tap(find.text('Business'));
await tester.pumpAndSettle();
expect(find.text('Page 2'), findsOneWidget);
/// switch to third tab
await tester.tap(find.text('Saved'));
await tester.tap(find.text('School'));
await tester.pumpAndSettle();
expect(find.text('Page 3'), findsOneWidget);
});