Files
flutter_opencode_client/lib/view/page/ssh/page/keyboard.dart
2025-05-15 20:35:45 +08:00

20 lines
550 B
Dart

part of 'page.dart';
extension _Keyboard on SSHPageState {
void _handleEscKeyOrBackButton() {
_terminal.keyInput(TerminalKey.escape);
HapticFeedback.lightImpact();
}
bool _handleKeyEvent(KeyEvent event) {
if (event is KeyDownEvent) {
if (event.logicalKey == LogicalKeyboardKey.escape) {
// Prevent default behavior and send to terminal
_handleEscKeyOrBackButton();
return true; // Mark as handled so it doesn't propagate
}
}
return false; // Let other handlers process this event
}
}