diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index 93e8a0be1..a5edbcee1 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -817,8 +817,10 @@ class PermissionManager { } RadioListTile getRadio( - String name, T toValue, T curValue, void Function(T?) onChange) { + String name, T toValue, T curValue, void Function(T?) onChange, + {EdgeInsetsGeometry? contentPadding}) { return RadioListTile( + contentPadding: contentPadding, controlAffinity: ListTileControlAffinity.trailing, title: Text(translate(name)), value: toValue, diff --git a/flutter/lib/mobile/pages/remote_page.dart b/flutter/lib/mobile/pages/remote_page.dart index 30b52b141..021c3fd6a 100644 --- a/flutter/lib/mobile/pages/remote_page.dart +++ b/flutter/lib/mobile/pages/remote_page.dart @@ -584,6 +584,9 @@ class _RemotePageState extends State { child: Text(translate('Reset canvas')), value: 'reset_canvas')); } if (perms['keyboard'] != false) { + more.add(PopupMenuItem( + child: Text(translate('Physical Keyboard Input Mode')), + value: 'input-mode')); if (pi.platform == 'Linux' || pi.sasEnabled) { more.add(PopupMenuItem( child: Text('${translate('Insert')} Ctrl + Alt + Del'), @@ -616,6 +619,8 @@ class _RemotePageState extends State { ); if (value == 'cad') { bind.sessionCtrlAltDel(id: widget.id); + } else if (value == 'input-mode') { + changePhysicalKeyboardInputMode(); } else if (value == 'lock') { bind.sessionLockScreen(id: widget.id); } else if (value == 'block-input') { @@ -675,6 +680,26 @@ class _RemotePageState extends State { })); } + void changePhysicalKeyboardInputMode() async { + var current = await bind.sessionGetKeyboardName(id: widget.id); + gFFI.dialogManager.show((setState, close) { + void setMode(String? v) async { + await bind.sessionSetKeyboardMode(id: widget.id, keyboardMode: v ?? ''); + setState(() => current = v ?? ''); + Future.delayed(Duration(milliseconds: 300), close); + } + + return CustomAlertDialog( + title: Text(translate('Physical Keyboard Input Mode')), + content: Column(mainAxisSize: MainAxisSize.min, children: [ + getRadio('Legacy mode', 'legacy', current, setMode, + contentPadding: EdgeInsets.zero), + getRadio('Map mode', 'map', current, setMode, + contentPadding: EdgeInsets.zero), + ])); + }, clickMaskDismiss: true); + } + Widget getHelpTools() { final keyboard = isKeyboardShown(); if (!keyboard) {