opt.: only display virt keys on mobile devices

This commit is contained in:
lollipopkit
2023-08-17 18:43:41 +08:00
parent 1be87d0ec0
commit b78949cf0c

View File

@@ -47,8 +47,8 @@ class _SSHPageState extends State<SSHPage> {
late TerminalStyle _terminalStyle; late TerminalStyle _terminalStyle;
late TerminalTheme _terminalTheme; late TerminalTheme _terminalTheme;
late TextInputType _keyboardType; late TextInputType _keyboardType;
late double _virtKeyWidth; double _virtKeyWidth = 0;
late double _virtKeysHeight; double _virtKeysHeight = 0;
bool _isDark = false; bool _isDark = false;
Timer? _virtKeyLongPressTimer; Timer? _virtKeyLongPressTimer;
@@ -85,9 +85,12 @@ class _SSHPageState extends State<SSHPage> {
_media = MediaQuery.of(context); _media = MediaQuery.of(context);
_s = S.of(context)!; _s = S.of(context)!;
_terminalTheme = _isDark ? termDarkTheme : termLightTheme; _terminalTheme = _isDark ? termDarkTheme : termLightTheme;
// Calculate virtkey width / height
_virtKeyWidth = _media.size.width / 7; // Because the virtual keyboard only displayed on mobile devices
_virtKeysHeight = _media.size.height * 0.043 * _virtKeysList.length; if (isMobile) {
_virtKeyWidth = _media.size.width / 7;
_virtKeysHeight = _media.size.height * 0.043 * _virtKeysList.length;
}
} }
@override @override