consts.dart 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. import 'package:flutter/gestures.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_hbb/common.dart';
  4. import 'package:flutter_hbb/models/state_model.dart';
  5. import 'package:get/get.dart';
  6. const int kMaxVirtualDisplayCount = 4;
  7. const int kAllVirtualDisplay = -1;
  8. const double kDesktopRemoteTabBarHeight = 28.0;
  9. const int kInvalidWindowId = -1;
  10. const int kMainWindowId = 0;
  11. const kAllDisplayValue = -1;
  12. const kKeyLegacyMode = 'legacy';
  13. const kKeyMapMode = 'map';
  14. const kKeyTranslateMode = 'translate';
  15. const String kPlatformAdditionsIsWayland = "is_wayland";
  16. const String kPlatformAdditionsHeadless = "headless";
  17. const String kPlatformAdditionsIsInstalled = "is_installed";
  18. const String kPlatformAdditionsIddImpl = "idd_impl";
  19. const String kPlatformAdditionsRustDeskVirtualDisplays =
  20. "rustdesk_virtual_displays";
  21. const String kPlatformAdditionsAmyuniVirtualDisplays =
  22. "amyuni_virtual_displays";
  23. const String kPlatformAdditionsHasFileClipboard = "has_file_clipboard";
  24. const String kPlatformAdditionsSupportedPrivacyModeImpl =
  25. "supported_privacy_mode_impl";
  26. const String kPeerPlatformWindows = "Windows";
  27. const String kPeerPlatformLinux = "Linux";
  28. const String kPeerPlatformMacOS = "Mac OS";
  29. const String kPeerPlatformAndroid = "Android";
  30. const String kPeerPlatformWebDesktop = "WebDesktop";
  31. const double kScrollbarThickness = 12.0;
  32. /// [kAppTypeMain] used by 'Desktop Main Page' , 'Mobile (Client and Server)', "Install Page"
  33. const String kAppTypeMain = "main";
  34. /// [kAppTypeConnectionManager] only for 'Desktop CM Page'
  35. const String kAppTypeConnectionManager = "cm";
  36. const String kAppTypeDesktopRemote = "remote";
  37. const String kAppTypeDesktopFileTransfer = "file transfer";
  38. const String kAppTypeDesktopViewCamera = "view camera";
  39. const String kAppTypeDesktopPortForward = "port forward";
  40. const String kAppTypeDesktopTerminal = "terminal";
  41. const String kWindowMainWindowOnTop = "main_window_on_top";
  42. const String kWindowGetWindowInfo = "get_window_info";
  43. const String kWindowGetScreenList = "get_screen_list";
  44. // This method is not used, maybe it can be removed.
  45. const String kWindowDisableGrabKeyboard = "disable_grab_keyboard";
  46. const String kWindowActionRebuild = "rebuild";
  47. const String kWindowEventHide = "hide";
  48. const String kWindowEventShow = "show";
  49. const String kWindowConnect = "connect";
  50. const String kWindowEventNewRemoteDesktop = "new_remote_desktop";
  51. const String kWindowEventNewFileTransfer = "new_file_transfer";
  52. const String kWindowEventNewViewCamera = "new_view_camera";
  53. const String kWindowEventNewPortForward = "new_port_forward";
  54. const String kWindowEventNewTerminal = "new_terminal";
  55. const String kWindowEventActiveSession = "active_session";
  56. const String kWindowEventActiveDisplaySession = "active_display_session";
  57. const String kWindowEventGetRemoteList = "get_remote_list";
  58. const String kWindowEventGetSessionIdList = "get_session_id_list";
  59. const String kWindowEventRemoteWindowCoords = "remote_window_coords";
  60. const String kWindowEventSetFullscreen = "set_fullscreen";
  61. const String kWindowEventMoveTabToNewWindow = "move_tab_to_new_window";
  62. const String kWindowEventGetCachedSessionData = "get_cached_session_data";
  63. const String kWindowEventOpenMonitorSession = "open_monitor_session";
  64. const String kOptionViewStyle = "view_style";
  65. const String kOptionScrollStyle = "scroll_style";
  66. const String kOptionImageQuality = "image_quality";
  67. const String kOptionOpenNewConnInTabs = "enable-open-new-connections-in-tabs";
  68. const String kOptionTextureRender = "use-texture-render";
  69. const String kOptionD3DRender = "allow-d3d-render";
  70. const String kOptionOpenInTabs = "allow-open-in-tabs";
  71. const String kOptionOpenInWindows = "allow-open-in-windows";
  72. const String kOptionForceAlwaysRelay = "force-always-relay";
  73. const String kOptionViewOnly = "view_only";
  74. const String kOptionEnableLanDiscovery = "enable-lan-discovery";
  75. const String kOptionWhitelist = "whitelist";
  76. const String kOptionEnableAbr = "enable-abr";
  77. const String kOptionEnableRecordSession = "enable-record-session";
  78. const String kOptionDirectServer = "direct-server";
  79. const String kOptionDirectAccessPort = "direct-access-port";
  80. const String kOptionAllowAutoDisconnect = "allow-auto-disconnect";
  81. const String kOptionAutoDisconnectTimeout = "auto-disconnect-timeout";
  82. const String kOptionEnableHwcodec = "enable-hwcodec";
  83. const String kOptionAllowAutoRecordIncoming = "allow-auto-record-incoming";
  84. const String kOptionAllowAutoRecordOutgoing = "allow-auto-record-outgoing";
  85. const String kOptionVideoSaveDirectory = "video-save-directory";
  86. const String kOptionAccessMode = "access-mode";
  87. const String kOptionEnableKeyboard = "enable-keyboard";
  88. // "Settings -> Security -> Permissions"
  89. const String kOptionEnableRemotePrinter = "enable-remote-printer";
  90. const String kOptionEnableClipboard = "enable-clipboard";
  91. const String kOptionEnableFileTransfer = "enable-file-transfer";
  92. const String kOptionEnableAudio = "enable-audio";
  93. const String kOptionEnableCamera = "enable-camera";
  94. const String kOptionEnableTerminal = "enable-terminal";
  95. const String kOptionTerminalPersistent = "terminal-persistent";
  96. const String kOptionEnableTunnel = "enable-tunnel";
  97. const String kOptionEnableRemoteRestart = "enable-remote-restart";
  98. const String kOptionEnableBlockInput = "enable-block-input";
  99. const String kOptionAllowRemoteConfigModification =
  100. "allow-remote-config-modification";
  101. const String kOptionVerificationMethod = "verification-method";
  102. const String kOptionApproveMode = "approve-mode";
  103. const String kOptionAllowNumericOneTimePassword =
  104. "allow-numeric-one-time-password";
  105. const String kOptionCollapseToolbar = "collapse_toolbar";
  106. const String kOptionShowRemoteCursor = "show_remote_cursor";
  107. const String kOptionFollowRemoteCursor = "follow_remote_cursor";
  108. const String kOptionFollowRemoteWindow = "follow_remote_window";
  109. const String kOptionZoomCursor = "zoom-cursor";
  110. const String kOptionShowQualityMonitor = "show_quality_monitor";
  111. const String kOptionDisableAudio = "disable_audio";
  112. const String kOptionEnableFileCopyPaste = "enable-file-copy-paste";
  113. // "Settings -> Display -> Other default options"
  114. const String kOptionDisableClipboard = "disable_clipboard";
  115. const String kOptionLockAfterSessionEnd = "lock_after_session_end";
  116. const String kOptionPrivacyMode = "privacy_mode";
  117. const String kOptionTouchMode = "touch-mode";
  118. const String kOptionI444 = "i444";
  119. const String kOptionSwapLeftRightMouse = "swap-left-right-mouse";
  120. const String kOptionCodecPreference = "codec-preference";
  121. const String kOptionRemoteMenubarDragLeft = "remote-menubar-drag-left";
  122. const String kOptionRemoteMenubarDragRight = "remote-menubar-drag-right";
  123. const String kOptionHideAbTagsPanel = "hideAbTagsPanel";
  124. const String kOptionRemoteMenubarState = "remoteMenubarState";
  125. const String kOptionPeerSorting = "peer-sorting";
  126. const String kOptionPeerTabIndex = "peer-tab-index";
  127. const String kOptionPeerTabOrder = "peer-tab-order";
  128. const String kOptionPeerTabVisible = "peer-tab-visible";
  129. const String kOptionPeerCardUiType = "peer-card-ui-type";
  130. const String kOptionCurrentAbName = "current-ab-name";
  131. const String kOptionEnableConfirmClosingTabs = "enable-confirm-closing-tabs";
  132. const String kOptionAllowAlwaysSoftwareRender = "allow-always-software-render";
  133. const String kOptionEnableCheckUpdate = "enable-check-update";
  134. const String kOptionAllowAutoUpdate = "allow-auto-update";
  135. const String kOptionAllowLinuxHeadless = "allow-linux-headless";
  136. const String kOptionAllowRemoveWallpaper = "allow-remove-wallpaper";
  137. const String kOptionStopService = "stop-service";
  138. const String kOptionDirectxCapture = "enable-directx-capture";
  139. const String kOptionAllowRemoteCmModification = "allow-remote-cm-modification";
  140. const String kOptionEnableUdpPunch = "enable-udp-punch";
  141. const String kOptionEnableIpv6Punch = "enable-ipv6-punch";
  142. const String kOptionEnableTrustedDevices = "enable-trusted-devices";
  143. // network options
  144. const String kOptionAllowWebSocket = "allow-websocket";
  145. // buildin opitons
  146. const String kOptionHideServerSetting = "hide-server-settings";
  147. const String kOptionHideProxySetting = "hide-proxy-settings";
  148. const String kOptionHideWebSocketSetting = "hide-websocket-settings";
  149. const String kOptionHideRemotePrinterSetting = "hide-remote-printer-settings";
  150. const String kOptionHideSecuritySetting = "hide-security-settings";
  151. const String kOptionHideNetworkSetting = "hide-network-settings";
  152. const String kOptionRemovePresetPasswordWarning =
  153. "remove-preset-password-warning";
  154. const kHideUsernameOnCard = "hide-username-on-card";
  155. const String kOptionHideHelpCards = "hide-help-cards";
  156. const String kOptionToggleViewOnly = "view-only";
  157. const String kOptionDisableFloatingWindow = "disable-floating-window";
  158. const String kOptionKeepScreenOn = "keep-screen-on";
  159. const String kOptionShowMobileAction = "showMobileActions";
  160. const String kUrlActionClose = "close";
  161. const String kTabLabelHomePage = "Home";
  162. const String kTabLabelSettingPage = "Settings";
  163. const String kWindowPrefix = "wm_";
  164. const int kWindowMainId = 0;
  165. const String kPointerEventKindTouch = "touch";
  166. const String kPointerEventKindMouse = "mouse";
  167. const String kMouseEventTypeDefault = "";
  168. const String kMouseEventTypePanStart = "pan_start";
  169. const String kMouseEventTypePanUpdate = "pan_update";
  170. const String kMouseEventTypePanEnd = "pan_end";
  171. const String kMouseEventTypeDown = "down";
  172. const String kMouseEventTypeUp = "up";
  173. const String kKeyFlutterKey = "flutter_key";
  174. const String kKeyShowDisplaysAsIndividualWindows =
  175. 'displays_as_individual_windows';
  176. const String kKeyUseAllMyDisplaysForTheRemoteSession =
  177. 'use_all_my_displays_for_the_remote_session';
  178. const String kKeyShowMonitorsToolbar = 'show_monitors_toolbar';
  179. const String kKeyReverseMouseWheel = "reverse_mouse_wheel";
  180. const String kMsgboxTextWaitingForImage = 'Connected, waiting for image...';
  181. // the executable name of the portable version
  182. const String kEnvPortableExecutable = "RUSTDESK_APPNAME";
  183. const Color kColorWarn = Color.fromARGB(255, 245, 133, 59);
  184. const Color kColorCanvas = Colors.black;
  185. const int kMobileDefaultDisplayWidth = 720;
  186. const int kMobileDefaultDisplayHeight = 1280;
  187. const int kDesktopDefaultDisplayWidth = 1080;
  188. const int kDesktopDefaultDisplayHeight = 720;
  189. const int kMobileMaxDisplaySize = 1280;
  190. const int kDesktopMaxDisplaySize = 3840;
  191. const double kDesktopFileTransferRowHeight = 30.0;
  192. const double kDesktopFileTransferHeaderHeight = 25.0;
  193. const double kMinFps = 5;
  194. const double kDefaultFps = 30;
  195. const double kMaxFps = 120;
  196. const double kMinQuality = 10;
  197. const double kDefaultQuality = 50;
  198. const double kMaxQuality = 100;
  199. const double kMaxMoreQuality = 2000;
  200. // trackpad speed
  201. const String kKeyTrackpadSpeed = 'trackpad-speed';
  202. const int kMinTrackpadSpeed = 10;
  203. const int kDefaultTrackpadSpeed = 100;
  204. const int kMaxTrackpadSpeed = 1000;
  205. // incomming (should be incoming) is kept, because change it will break the previous setting.
  206. const String kKeyPrinterIncomingJobAction = 'printer-incomming-job-action';
  207. const String kValuePrinterIncomingJobDismiss = 'dismiss';
  208. const String kValuePrinterIncomingJobDefault = '';
  209. const String kValuePrinterIncomingJobSelected = 'selected';
  210. const String kKeyPrinterSelected = 'printer-selected-name';
  211. const String kKeyPrinterSave = 'allow-printer-dialog-save';
  212. const String kKeyPrinterAllowAutoPrint = 'allow-printer-auto-print';
  213. double kNewWindowOffset = isWindows
  214. ? 56.0
  215. : isLinux
  216. ? 50.0
  217. : isMacOS
  218. ? 30.0
  219. : 50.0;
  220. EdgeInsets get kDragToResizeAreaPadding => !kUseCompatibleUiMode && isLinux
  221. ? stateGlobal.fullscreen.isTrue || stateGlobal.isMaximized.value
  222. ? EdgeInsets.zero
  223. : EdgeInsets.all(5.0)
  224. : EdgeInsets.zero;
  225. // https://en.wikipedia.org/wiki/Non-breaking_space
  226. const int $nbsp = 0x00A0;
  227. extension StringExtension on String {
  228. String get nonBreaking => replaceAll(' ', String.fromCharCode($nbsp));
  229. }
  230. const Size kConnectionManagerWindowSizeClosedChat = Size(300, 490);
  231. const Size kConnectionManagerWindowSizeOpenChat = Size(700, 490);
  232. // Tabbar transition duration, now we remove the duration
  233. const Duration kTabTransitionDuration = Duration.zero;
  234. const double kEmptyMarginTop = 50;
  235. const double kDesktopIconButtonSplashRadius = 20;
  236. /// [kMinCursorSize] indicates min cursor (w, h)
  237. const int kMinCursorSize = 12;
  238. const kFullScreenEdgeSize = 0.0;
  239. const kMaximizeEdgeSize = 0.0;
  240. // Do not use kWindowResizeEdgeSize directly. Use `windowResizeEdgeSize` in `common.dart` instead.
  241. const kWindowResizeEdgeSize = 5.0;
  242. final kWindowBorderWidth = isWindows ? 0.0 : 1.0;
  243. const kDesktopMenuPadding = EdgeInsets.only(left: 12.0, right: 3.0);
  244. const kFrameBorderRadius = 12.0;
  245. const kFrameClipRRectBorderRadius = 12.0;
  246. const kFrameBoxShadowBlurRadius = 32.0;
  247. const kFrameBoxShadowOffsetFocused = 4.0;
  248. const kFrameBoxShadowOffsetUnfocused = 2.0;
  249. const kInvalidValueStr = 'InvalidValueStr';
  250. // Config key shared by flutter and other ui.
  251. const kCommConfKeyTheme = 'theme';
  252. const kCommConfKeyLang = 'lang';
  253. const kMobilePageConstraints = BoxConstraints(maxWidth: 600);
  254. /// [kMouseControlDistance] indicates the distance that self-side move to get control of mouse.
  255. const kMouseControlDistance = 12;
  256. /// [kMouseControlTimeoutMSec] indicates the timeout (in milliseconds) that self-side can get control of mouse.
  257. const kMouseControlTimeoutMSec = 1000;
  258. /// [kRemoteViewStyleOriginal] Show remote image without scaling.
  259. const kRemoteViewStyleOriginal = 'original';
  260. /// [kRemoteViewStyleAdaptive] Show remote image scaling by ratio factor.
  261. const kRemoteViewStyleAdaptive = 'adaptive';
  262. /// [kRemoteScrollStyleAuto] Scroll image auto by position.
  263. const kRemoteScrollStyleAuto = 'scrollauto';
  264. /// [kRemoteScrollStyleBar] Scroll image with scroll bar.
  265. const kRemoteScrollStyleBar = 'scrollbar';
  266. /// [kScrollModeDefault] Mouse or touchpad, the default scroll mode.
  267. const kScrollModeDefault = 'default';
  268. /// [kScrollModeReverse] Mouse or touchpad, the reverse scroll mode.
  269. const kScrollModeReverse = 'reverse';
  270. /// [kRemoteImageQualityBest] Best image quality.
  271. const kRemoteImageQualityBest = 'best';
  272. /// [kRemoteImageQualityBalanced] Balanced image quality, mid performance.
  273. const kRemoteImageQualityBalanced = 'balanced';
  274. /// [kRemoteImageQualityLow] Low image quality, better performance.
  275. const kRemoteImageQualityLow = 'low';
  276. /// [kRemoteImageQualityCustom] Custom image quality.
  277. const kRemoteImageQualityCustom = 'custom';
  278. const kIgnoreDpi = true;
  279. const Set<PointerDeviceKind> kTouchBasedDeviceKinds = {
  280. PointerDeviceKind.touch,
  281. PointerDeviceKind.stylus,
  282. PointerDeviceKind.invertedStylus,
  283. };
  284. // ================================ mobile ================================
  285. // Magic numbers, maybe need to avoid it or use a better way to get them.
  286. const kMobileDelaySoftKeyboard = Duration(milliseconds: 30);
  287. const kMobileDelaySoftKeyboardFocus = Duration(milliseconds: 30);
  288. /// Android constants
  289. const kActionApplicationDetailsSettings =
  290. "android.settings.APPLICATION_DETAILS_SETTINGS";
  291. const kActionAccessibilitySettings = "android.settings.ACCESSIBILITY_SETTINGS";
  292. const kRecordAudio = "android.permission.RECORD_AUDIO";
  293. const kManageExternalStorage = "android.permission.MANAGE_EXTERNAL_STORAGE";
  294. const kRequestIgnoreBatteryOptimizations =
  295. "android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS";
  296. const kSystemAlertWindow = "android.permission.SYSTEM_ALERT_WINDOW";
  297. const kAndroid13Notification = "android.permission.POST_NOTIFICATIONS";
  298. /// Android channel invoke type key
  299. class AndroidChannel {
  300. static final kStartAction = "start_action";
  301. static final kGetStartOnBootOpt = "get_start_on_boot_opt";
  302. static final kSetStartOnBootOpt = "set_start_on_boot_opt";
  303. static final kSyncAppDirConfigPath = "sync_app_dir";
  304. }
  305. /// flutter/packages/flutter/lib/src/services/keyboard_key.dart -> _keyLabels
  306. /// see [LogicalKeyboardKey.keyLabel]
  307. const Map<int, String> logicalKeyMap = <int, String>{
  308. 0x00000000020: 'VK_SPACE',
  309. 0x00000000022: 'VK_QUOTE',
  310. 0x0000000002c: 'VK_COMMA',
  311. 0x0000000002d: 'VK_MINUS',
  312. 0x0000000002f: 'VK_SLASH',
  313. 0x00000000030: 'VK_0',
  314. 0x00000000031: 'VK_1',
  315. 0x00000000032: 'VK_2',
  316. 0x00000000033: 'VK_3',
  317. 0x00000000034: 'VK_4',
  318. 0x00000000035: 'VK_5',
  319. 0x00000000036: 'VK_6',
  320. 0x00000000037: 'VK_7',
  321. 0x00000000038: 'VK_8',
  322. 0x00000000039: 'VK_9',
  323. 0x0000000003b: 'VK_SEMICOLON',
  324. 0x0000000003d: 'VK_PLUS', // it is =
  325. 0x0000000005b: 'VK_LBRACKET',
  326. 0x0000000005c: 'VK_BACKSLASH',
  327. 0x0000000005d: 'VK_RBRACKET',
  328. 0x00000000061: 'VK_A',
  329. 0x00000000062: 'VK_B',
  330. 0x00000000063: 'VK_C',
  331. 0x00000000064: 'VK_D',
  332. 0x00000000065: 'VK_E',
  333. 0x00000000066: 'VK_F',
  334. 0x00000000067: 'VK_G',
  335. 0x00000000068: 'VK_H',
  336. 0x00000000069: 'VK_I',
  337. 0x0000000006a: 'VK_J',
  338. 0x0000000006b: 'VK_K',
  339. 0x0000000006c: 'VK_L',
  340. 0x0000000006d: 'VK_M',
  341. 0x0000000006e: 'VK_N',
  342. 0x0000000006f: 'VK_O',
  343. 0x00000000070: 'VK_P',
  344. 0x00000000071: 'VK_Q',
  345. 0x00000000072: 'VK_R',
  346. 0x00000000073: 'VK_S',
  347. 0x00000000074: 'VK_T',
  348. 0x00000000075: 'VK_U',
  349. 0x00000000076: 'VK_V',
  350. 0x00000000077: 'VK_W',
  351. 0x00000000078: 'VK_X',
  352. 0x00000000079: 'VK_Y',
  353. 0x0000000007a: 'VK_Z',
  354. 0x00100000008: 'VK_BACK',
  355. 0x00100000009: 'VK_TAB',
  356. 0x0010000000d: 'VK_ENTER',
  357. 0x0010000001b: 'VK_ESCAPE',
  358. 0x0010000007f: 'VK_DELETE',
  359. 0x00100000104: 'VK_CAPITAL',
  360. 0x00100000301: 'VK_DOWN',
  361. 0x00100000302: 'VK_LEFT',
  362. 0x00100000303: 'VK_RIGHT',
  363. 0x00100000304: 'VK_UP',
  364. 0x00100000305: 'VK_END',
  365. 0x00100000306: 'VK_HOME',
  366. 0x00100000307: 'VK_NEXT',
  367. 0x00100000308: 'VK_PRIOR',
  368. 0x00100000401: 'VK_CLEAR',
  369. 0x00100000407: 'VK_INSERT',
  370. 0x00100000504: 'VK_CANCEL',
  371. 0x00100000506: 'VK_EXECUTE',
  372. 0x00100000508: 'VK_HELP',
  373. 0x00100000509: 'VK_PAUSE',
  374. 0x0010000050c: 'VK_SELECT',
  375. 0x00100000608: 'VK_PRINT',
  376. 0x00100000705: 'VK_CONVERT',
  377. 0x00100000706: 'VK_FINAL',
  378. 0x00100000711: 'VK_HANGUL',
  379. 0x00100000712: 'VK_HANJA',
  380. 0x00100000713: 'VK_JUNJA',
  381. 0x00100000718: 'VK_KANA',
  382. 0x00100000719: 'VK_KANJI',
  383. 0x00100000801: 'VK_F1',
  384. 0x00100000802: 'VK_F2',
  385. 0x00100000803: 'VK_F3',
  386. 0x00100000804: 'VK_F4',
  387. 0x00100000805: 'VK_F5',
  388. 0x00100000806: 'VK_F6',
  389. 0x00100000807: 'VK_F7',
  390. 0x00100000808: 'VK_F8',
  391. 0x00100000809: 'VK_F9',
  392. 0x0010000080a: 'VK_F10',
  393. 0x0010000080b: 'VK_F11',
  394. 0x0010000080c: 'VK_F12',
  395. 0x00100000d2b: 'Apps',
  396. 0x00200000002: 'VK_SLEEP',
  397. 0x00200000100: 'VK_CONTROL',
  398. 0x00200000101: 'RControl',
  399. 0x00200000102: 'VK_SHIFT',
  400. 0x00200000103: 'RShift',
  401. 0x00200000104: 'VK_MENU',
  402. 0x00200000105: 'RAlt',
  403. 0x002000001f0: 'VK_CONTROL',
  404. 0x002000001f2: 'VK_SHIFT',
  405. 0x002000001f4: 'VK_MENU',
  406. 0x002000001f6: 'Meta',
  407. 0x0020000022a: 'VK_MULTIPLY',
  408. 0x0020000022b: 'VK_ADD',
  409. 0x0020000022d: 'VK_SUBTRACT',
  410. 0x0020000022e: 'VK_DECIMAL',
  411. 0x0020000022f: 'VK_DIVIDE',
  412. 0x00200000230: 'VK_NUMPAD0',
  413. 0x00200000231: 'VK_NUMPAD1',
  414. 0x00200000232: 'VK_NUMPAD2',
  415. 0x00200000233: 'VK_NUMPAD3',
  416. 0x00200000234: 'VK_NUMPAD4',
  417. 0x00200000235: 'VK_NUMPAD5',
  418. 0x00200000236: 'VK_NUMPAD6',
  419. 0x00200000237: 'VK_NUMPAD7',
  420. 0x00200000238: 'VK_NUMPAD8',
  421. 0x00200000239: 'VK_NUMPAD9',
  422. };
  423. /// flutter/packages/flutter/lib/src/services/keyboard_key.dart -> _debugName
  424. /// see [PhysicalKeyboardKey.debugName] -> _debugName
  425. const Map<int, String> physicalKeyMap = <int, String>{
  426. 0x00010082: 'VK_SLEEP',
  427. 0x00070004: 'VK_A',
  428. 0x00070005: 'VK_B',
  429. 0x00070006: 'VK_C',
  430. 0x00070007: 'VK_D',
  431. 0x00070008: 'VK_E',
  432. 0x00070009: 'VK_F',
  433. 0x0007000a: 'VK_G',
  434. 0x0007000b: 'VK_H',
  435. 0x0007000c: 'VK_I',
  436. 0x0007000d: 'VK_J',
  437. 0x0007000e: 'VK_K',
  438. 0x0007000f: 'VK_L',
  439. 0x00070010: 'VK_M',
  440. 0x00070011: 'VK_N',
  441. 0x00070012: 'VK_O',
  442. 0x00070013: 'VK_P',
  443. 0x00070014: 'VK_Q',
  444. 0x00070015: 'VK_R',
  445. 0x00070016: 'VK_S',
  446. 0x00070017: 'VK_T',
  447. 0x00070018: 'VK_U',
  448. 0x00070019: 'VK_V',
  449. 0x0007001a: 'VK_W',
  450. 0x0007001b: 'VK_X',
  451. 0x0007001c: 'VK_Y',
  452. 0x0007001d: 'VK_Z',
  453. 0x0007001e: 'VK_1',
  454. 0x0007001f: 'VK_2',
  455. 0x00070020: 'VK_3',
  456. 0x00070021: 'VK_4',
  457. 0x00070022: 'VK_5',
  458. 0x00070023: 'VK_6',
  459. 0x00070024: 'VK_7',
  460. 0x00070025: 'VK_8',
  461. 0x00070026: 'VK_9',
  462. 0x00070027: 'VK_0',
  463. 0x00070028: 'VK_ENTER',
  464. 0x00070029: 'VK_ESCAPE',
  465. 0x0007002a: 'VK_BACK',
  466. 0x0007002b: 'VK_TAB',
  467. 0x0007002c: 'VK_SPACE',
  468. 0x0007002d: 'VK_MINUS',
  469. 0x0007002e: 'VK_PLUS', // it is =
  470. 0x0007002f: 'VK_LBRACKET',
  471. 0x00070030: 'VK_RBRACKET',
  472. 0x00070033: 'VK_SEMICOLON',
  473. 0x00070034: 'VK_QUOTE',
  474. 0x00070036: 'VK_COMMA',
  475. 0x00070038: 'VK_SLASH',
  476. 0x00070039: 'VK_CAPITAL',
  477. 0x0007003a: 'VK_F1',
  478. 0x0007003b: 'VK_F2',
  479. 0x0007003c: 'VK_F3',
  480. 0x0007003d: 'VK_F4',
  481. 0x0007003e: 'VK_F5',
  482. 0x0007003f: 'VK_F6',
  483. 0x00070040: 'VK_F7',
  484. 0x00070041: 'VK_F8',
  485. 0x00070042: 'VK_F9',
  486. 0x00070043: 'VK_F10',
  487. 0x00070044: 'VK_F11',
  488. 0x00070045: 'VK_F12',
  489. 0x00070049: 'VK_INSERT',
  490. 0x0007004a: 'VK_HOME',
  491. 0x0007004b: 'VK_PRIOR', // Page Up
  492. 0x0007004c: 'VK_DELETE',
  493. 0x0007004d: 'VK_END',
  494. 0x0007004e: 'VK_NEXT', // Page Down
  495. 0x0007004f: 'VK_RIGHT',
  496. 0x00070050: 'VK_LEFT',
  497. 0x00070051: 'VK_DOWN',
  498. 0x00070052: 'VK_UP',
  499. 0x00070053: 'Num Lock', // TODO rust not impl
  500. 0x00070054: 'VK_DIVIDE', // numpad
  501. 0x00070055: 'VK_MULTIPLY',
  502. 0x00070056: 'VK_SUBTRACT',
  503. 0x00070057: 'VK_ADD',
  504. 0x00070058: 'VK_ENTER', // num enter
  505. 0x00070059: 'VK_NUMPAD1',
  506. 0x0007005a: 'VK_NUMPAD2',
  507. 0x0007005b: 'VK_NUMPAD3',
  508. 0x0007005c: 'VK_NUMPAD4',
  509. 0x0007005d: 'VK_NUMPAD5',
  510. 0x0007005e: 'VK_NUMPAD6',
  511. 0x0007005f: 'VK_NUMPAD7',
  512. 0x00070060: 'VK_NUMPAD8',
  513. 0x00070061: 'VK_NUMPAD9',
  514. 0x00070062: 'VK_NUMPAD0',
  515. 0x00070063: 'VK_DECIMAL',
  516. 0x00070075: 'VK_HELP',
  517. 0x00070077: 'VK_SELECT',
  518. 0x00070088: 'VK_KANA',
  519. 0x0007008a: 'VK_CONVERT',
  520. 0x000700e0: 'VK_CONTROL',
  521. 0x000700e1: 'VK_SHIFT',
  522. 0x000700e2: 'VK_MENU',
  523. 0x000700e3: 'Meta',
  524. 0x000700e4: 'RControl',
  525. 0x000700e5: 'RShift',
  526. 0x000700e6: 'RAlt',
  527. 0x000700e7: 'RWin',
  528. 0x000c00b1: 'VK_PAUSE',
  529. 0x000c00cd: 'VK_PAUSE',
  530. 0x000c019e: 'LOCK_SCREEN',
  531. 0x000c0208: 'VK_PRINT',
  532. };
  533. /// The windows targets in the publish time order.
  534. enum WindowsTarget {
  535. naw, // not a windows target
  536. xp,
  537. vista,
  538. w7,
  539. w8,
  540. w8_1,
  541. w10,
  542. w11
  543. }
  544. /// A convenient method to transform a build number to the corresponding windows version.
  545. extension WindowsTargetExt on int {
  546. WindowsTarget get windowsVersion => getWindowsTarget(this);
  547. }
  548. const kCheckSoftwareUpdateFinish = 'check_software_update_finish';