-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: routesNavigator, Router, and related APIs.Navigator, Router, and related APIs.team-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
Run the test
Expected results
test passes.
Actual results
The test fails, which means willHandlePopInternally return true but didPop also return true. According to the doc https://api.flutter.dev/flutter/widgets/Route/willHandlePopInternally.html, the willHandlePopInternally should return the inverse of didpop.
Code sample
Code sample
testWidgets('ModalRoute must comply with willHandlePopInternally when there is a PopScope', (WidgetTester tester) async {
const List<Page<void>> myPages = <Page<void>>[
MaterialPage<void>(child: Text('page1')),
MaterialPage<void>(
child: PopScope(
canPop: false,
child: Text('page2'),
),
),
];
await tester.pumpWidget(
MediaQuery(
data: MediaQueryData.fromView(tester.view),
child: Localizations(
locale: const Locale('en', 'US'),
delegates: const <LocalizationsDelegate<dynamic>>[
DefaultMaterialLocalizations.delegate,
DefaultWidgetsLocalizations.delegate,
],
child: Navigator(
pages: myPages,
onPopPage: (_, __) => false,
),
),
),
);
final ModalRoute<void> route = ModalRoute.of(tester.element(find.text('page2')))!;
expect(route.willHandlePopInternally, true);
expect(route.didPop(null), false);
});Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[Paste your output here]Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: routesNavigator, Router, and related APIs.Navigator, Router, and related APIs.team-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team