Require double back to exit Android tab roots

This commit is contained in:
2026-10-24 02:23:15 +01:00
parent 54f74ade33
commit 4e6771aa24
6 changed files with 233 additions and 11 deletions
@@ -34,7 +34,7 @@ void main() {
for (final predictive in [false, true]) {
for (final destination in ['pipelines', 'runs', 'chat']) {
testWidgets(
'$destination: ${predictive ? 'gesture' : 'button'} Back pops dialog, detail, then app',
'$destination: ${predictive ? 'gesture' : 'button'} Back pops dialog, detail, then double-back exits',
(tester) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1;
@@ -136,7 +136,20 @@ void main() {
expect(navigator.canPop(), isFalse);
expect(exits, isEmpty);
// No confirmation, double-back requirement, or hidden detail route.
// A detail pop never arms root exit. The first root Back only hints.
if (predictive) {
await backGesture(tester, 'startBackGesture');
await backGesture(tester, 'cancelBackGesture');
await tester.pumpAndSettle();
expect(find.text('Press back again to close'), findsNothing);
await backGesture(tester, 'startBackGesture');
await backGesture(tester, 'commitBackGesture');
} else {
await tester.binding.handlePopRoute();
}
await tester.pumpAndSettle();
expect(exits, isEmpty);
expect(find.text('Press back again to close'), findsOneWidget);
await tester.binding.handlePopRoute();
await tester.pumpAndSettle();
expect(exits, ['SystemNavigator.pop']);