mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt. proj struct
This commit is contained in:
29
lib/data/provider/virtual_keyboard.dart
Normal file
29
lib/data/provider/virtual_keyboard.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:xterm/core.dart';
|
||||
|
||||
class VirtualKeyboard extends TerminalInputHandler with ChangeNotifier {
|
||||
VirtualKeyboard();
|
||||
|
||||
bool ctrl = false;
|
||||
bool alt = false;
|
||||
|
||||
void reset(TerminalKeyboardEvent e) {
|
||||
if (e.ctrl) {
|
||||
ctrl = false;
|
||||
}
|
||||
if (e.alt) {
|
||||
alt = false;
|
||||
}
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
@override
|
||||
String? call(TerminalKeyboardEvent event) {
|
||||
final e = event.copyWith(
|
||||
ctrl: event.ctrl || ctrl,
|
||||
alt: event.alt || alt,
|
||||
);
|
||||
reset(e);
|
||||
return defaultInputHandler.call(e);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user