refactor(ui): share android keyboard-mode system-back guard

This commit is contained in:
edde746
2026-06-12 13:48:06 +02:00
parent b2e5e02204
commit 18e47d2327
2 changed files with 12 additions and 3 deletions
+9
View File
@@ -1,3 +1,5 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -40,6 +42,13 @@ class InputModeTracker extends StatefulWidget {
return of(context) == InputMode.keyboard;
}
/// Whether system back must be blocked because the dpad key handler owns
/// back navigation: on Android in keyboard mode (TV/gamepad), letting the
/// system back through as well double-pops the route.
static bool shouldBlockSystemBack(BuildContext context) {
return Platform.isAndroid && isKeyboardMode(context);
}
@override
State<InputModeTracker> createState() => _InputModeTrackerState();
}