consts.dart 20 KB

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