From 431cfdafd9dd7fa7d0b34b6b914b9c017235a68b Mon Sep 17 00:00:00 2001 From: Greg Spencer Date: Fri, 8 Feb 2019 12:42:34 -0800 Subject: [PATCH] Adding support for logical and physical key events (#27627) This adds support for logical and physical key information inside of RawKeyEvent. This allows developers to differentiate keys in a platform-agnostic way. They are able to tell the physical location of a key (PhysicalKeyboardKey) and a logical meaning of the key (LogicalKeyboardKey), as well as get notified of the character generated by the keypress. All of which is useful for handling keyboard shortcuts. This PR builds on the previous PR (#27620) which generated the key code mappings and definitions. --- dev/manual_tests/lib/raw_keyboard.dart | 2 + dev/tools/gen_keycodes/data/keyboard_key.tmpl | 239 +- .../gen_keycodes/data/keyboard_maps.tmpl | 2 +- dev/tools/gen_keycodes/data/printable.json | 52 +- dev/tools/gen_keycodes/lib/code_gen.dart | 22 +- dev/tools/gen_keycodes/lib/key_data.dart | 2 +- packages/flutter/lib/services.dart | 1 + packages/flutter/lib/src/material/chip.dart | 1 + .../lib/src/services/keyboard_key.dart | 3255 +++++++++++++++++ .../lib/src/services/keyboard_maps.dart | 844 +++++ .../lib/src/services/raw_keyboard.dart | 191 +- .../src/services/raw_keyboard_android.dart | 68 +- .../src/services/raw_keyboard_fuschia.dart | 39 + .../test/services/keyboard_key_test.dart | 54 + .../test/services/raw_keyboard_test.dart | 84 + 15 files changed, 4771 insertions(+), 85 deletions(-) create mode 100644 packages/flutter/lib/src/services/keyboard_key.dart create mode 100644 packages/flutter/lib/src/services/keyboard_maps.dart create mode 100644 packages/flutter/test/services/keyboard_key_test.dart diff --git a/dev/manual_tests/lib/raw_keyboard.dart b/dev/manual_tests/lib/raw_keyboard.dart index a916b80a6d..c0d4f7a75a 100644 --- a/dev/manual_tests/lib/raw_keyboard.dart +++ b/dev/manual_tests/lib/raw_keyboard.dart @@ -89,6 +89,8 @@ class _HardwareKeyDemoState extends State { dataText.add(Text('hidUsage: ${data.hidUsage} (${_asHex(data.hidUsage)})')); dataText.add(Text('modifiers: ${data.modifiers} (${_asHex(data.modifiers)})')); } + dataText.add(Text('logical: ${_event.logicalKey}')); + dataText.add(Text('physical: ${_event.physicalKey}')); for (ModifierKey modifier in data.modifiersPressed.keys) { for (KeyboardSide side in KeyboardSide.values) { if (data.isModifierPressed(modifier, side: side)) { diff --git a/dev/tools/gen_keycodes/data/keyboard_key.tmpl b/dev/tools/gen_keycodes/data/keyboard_key.tmpl index 69590955bd..cf85979897 100644 --- a/dev/tools/gen_keycodes/data/keyboard_key.tmpl +++ b/dev/tools/gen_keycodes/data/keyboard_key.tmpl @@ -21,6 +21,87 @@ import 'package:flutter/foundation.dart'; /// in a particular location on the keyboard, without regard for the modifier /// state, mode, or keyboard layout. /// +/// As an example, if you wanted to implement an app where the "Q" key "quit" +/// something, you'd want to look at the logical key to detect this, since you +/// would like to have it match the key with "Q" on it, instead of always +/// looking for "the key next next to the TAB key", since on a French keyboard, +/// the key next to the TAB key has an "A" on it. +/// +/// Conversely, if you wanted a game where the key next to the CAPS LOCK (the +/// "A" key on a QWERTY keyboard) moved the player to the left, you'd want to +/// look at the physical key to make sure that regardless of the character the +/// key produces, you got the key that is in that location on the keyboard. +/// +/// {@tool snippet --template=stateful_widget} +/// This example shows how to detect if the user has selected the logical "Q" +/// key. +/// +/// ```dart imports +/// import 'package:flutter/foundation.dart'; +/// import 'package:flutter/services.dart'; +/// ``` +/// +/// ```dart +/// // The node used to request the keyboard focus. +/// final FocusNode _focusNode = FocusNode(); +/// // The message to display. +/// String _message; +/// +/// // Focus nodes need to be disposed. +/// @override +/// void dispose() { +/// _focusNode.dispose(); +/// super.dispose(); +/// } +/// +/// // Handles the key events from the RawKeyboardListener and update the +/// // _message. +/// void _handleKeyEvent(RawKeyEvent event) { +/// setState(() { +/// if (event.logicalKey == LogicalKeyboardKey.keyQ) { +/// _message = 'Pressed the "Q" key!'; +/// } else { +/// if (kReleaseMode) { +/// _message = 'Not a Q: Key label is "${event.logicalKey.keyLabel ?? ''}"'; +/// } else { +/// // This will only print useful information in debug mode. +/// _message = 'Not a Q: Pressed ${event.logicalKey.debugName}'; +/// } +/// } +/// }); +/// } +/// +/// @override +/// Widget build(BuildContext context) { +/// final TextTheme textTheme = Theme.of(context).textTheme; +/// return Container( +/// color: Colors.white, +/// alignment: Alignment.center, +/// child: DefaultTextStyle( +/// style: textTheme.display1, +/// child: RawKeyboardListener( +/// focusNode: _focusNode, +/// onKey: _handleKeyEvent, +/// child: AnimatedBuilder( +/// animation: _focusNode, +/// builder: (BuildContext context, Widget child) { +/// if (!_focusNode.hasFocus) { +/// return GestureDetector( +/// onTap: () { +/// FocusScope.of(context).requestFocus(_focusNode); +/// }, +/// child: Text('Tap to focus'), +/// ); +/// } +/// return Text(_message ?? 'Press a key'); +/// }, +/// ), +/// ), +/// ), +/// ); +/// } +/// ``` +/// {@end-tool} /// See also: /// /// * [RawKeyEvent], the keyboard event object received by widgets that listen @@ -28,24 +109,26 @@ import 'package:flutter/foundation.dart'; /// * [RawKeyboardListener], a widget used to listen to and supply handlers for /// keyboard events. class LogicalKeyboardKey extends Diagnosticable { - /// Defines a KeyboardKey value and optional debug name. + /// Creates a LogicalKeyboardKey object with an optional key label and debug + /// name. /// - /// To save executable size, it is recommended that the [debugName] be null in - /// release mode. You can do this using the [kReleaseMode] constant: + /// [keyId] must not be null. /// /// {@tool sample} - /// const LogicalKeyboardKey mySpecialKey = LogicalKeyboardKey( - /// 0x0010000000a, - /// debugName: kReleaseMode ? null : 'Special Key', - /// ); + /// To save executable size, it is recommended that the [debugName] be null in + /// release mode. You can do this by using the [kReleaseMode] constant. + /// + /// ```dart + /// const LogicalKeyboardKey(0x0010000000a, debugName: kReleaseMode ? null : 'Special Key') + /// ``` /// {@end-tool} - const LogicalKeyboardKey(this.keyId, {this.debugName, this.keyLabel}); + const LogicalKeyboardKey(this.keyId, {this.debugName, this.keyLabel}) + : assert(keyId != null); /// A unique code representing this key. /// - /// This is an opaque identifier, and should not be unpacked to derive - /// information from it, as the representation of the code could change at any - /// time. + /// This is an opaque code. It should not be unpacked to derive information + /// from it, as the representation of the code could change at any time. final int keyId; /// The debug string to print for this keyboard key, which will be null in @@ -79,7 +162,8 @@ class LogicalKeyboardKey extends Diagnosticable { return keyId == typedOther.keyId; } - /// Finds the [LogicalKeyboardKey] that matches the given ID. + /// Returns the [LogicalKeyboardKey] constant that matches the given ID, or + /// null, if not found. static LogicalKeyboardKey findKeyByKeyId(int keyId) => _knownLogicalKeys[keyId]; @override @@ -131,30 +215,36 @@ class LogicalKeyboardKey extends Diagnosticable { /// that had a "do what I mean" key from then on. bool get isAutogenerated => (keyId & autogeneratedMask) != 0; - /// Mask for the 32-bit value portion of the key code. This is used by + /// Mask for the 32-bit value portion of the key code. + /// + /// This is used by /// platform-specific code to generate Flutter key codes. static const int valueMask = 0x000FFFFFFFF; - /// Mask for the platform prefix portion of the key code. This is used by - /// platform-specific code to generate Flutter key codes. + /// Mask for the platform prefix portion of the key code. + /// + /// This is used by platform-specific code to generate Flutter key codes. static const int platformMask = 0x0FF00000000; - /// Mask for the autogenerated bit portion of the key code. This is used by - /// platform-specific code to generate new Flutter key codes for keys which - /// are not recognized. + /// Mask for the autogenerated bit portion of the key code. + /// + /// This is used by platform-specific code to generate new Flutter key codes + /// for keys which are not recognized. static const int autogeneratedMask = 0x10000000000; - /// The code prefix for keys which have a Unicode representation. This is used - /// by platform-specific code to generate Flutter key codes. + /// The code prefix for keys which have a Unicode representation. + /// + /// This is used by platform-specific code to generate Flutter key codes. static const int unicodePlane = 0x00000000000; - /// The code prefix for keys which do not have a Unicode representation. This - /// is used by platform-specific code to generate Flutter key codes using HID - /// Usage codes. + /// The code prefix for keys which do not have a Unicode representation. + /// + /// This is used by platform-specific code to generate Flutter key codes using + /// HID Usage codes. static const int hidPlane = 0x00100000000; @@@LOGICAL_KEY_DEFINITIONS@@@ // A list of all predefined constant LogicalKeyboardKeys so they can be - // searched.. + // searched. static const Map _knownLogicalKeys = { @@@LOGICAL_KEY_MAP@@@ }; @@ -163,12 +253,88 @@ class LogicalKeyboardKey extends Diagnosticable { /// A class with static values that describe the keys that are returned from /// [RawKeyEvent.physicalKey]. /// -/// These represent *physical* keys, which are keys which represent a -/// particular key location on the keyboard. It ignores any modifiers, modes, -/// or keyboard layouts which may be in effect. This is contrast to +/// These represent *physical* keys, which are keys which represent a particular +/// key location on a QWERTY keyboard. It ignores any modifiers, modes, or +/// keyboard layouts which may be in effect. This is contrast to /// [LogicalKeyboardKey], which represents a logical key interpreted in the /// context of modifiers, modes, and/or keyboard layouts. /// +/// As an example, if you wanted a game where the key next to the CAPS LOCK (the +/// "A" key on a QWERTY keyboard) moved the player to the left, you'd want to +/// look at the physical key to make sure that regardless of the character the +/// key produces, you got the key that is in that location on the keyboard. +/// +/// Conversely, if you wanted to implement an app where the "Q" key "quit" +/// something, you'd want to look at the logical key to detect this, since you +/// would like to have it match the key with "Q" on it, instead of always +/// looking for "the key next next to the TAB key", since on a French keyboard, +/// the key next to the TAB key has an "A" on it. +/// +/// {@tool snippet --template=stateful_widget} +/// This example shows how to detect if the user has selected the physical key +/// to the right of the CAPS LOCK key. +/// +/// ```dart imports +/// import 'package:flutter/services.dart'; +/// ``` +/// +/// ```dart +/// // The node used to request the keyboard focus. +/// final FocusNode _focusNode = FocusNode(); +/// // The message to display. +/// String _message; +/// +/// // Focus nodes need to be disposed. +/// @override +/// void dispose() { +/// _focusNode.dispose(); +/// super.dispose(); +/// } +/// +/// // Handles the key events from the RawKeyboardListener and update the +/// // _message. +/// void _handleKeyEvent(RawKeyEvent event) { +/// setState(() { +/// if (event.physicalKey == PhysicalKeyboardKey.keyA) { +/// _message = 'Pressed the key next to CAPS LOCK!'; +/// } else { +/// _message = 'Wrong key.'; +/// } +/// }); +/// } +/// +/// @override +/// Widget build(BuildContext context) { +/// final TextTheme textTheme = Theme.of(context).textTheme; +/// return Container( +/// color: Colors.white, +/// alignment: Alignment.center, +/// child: DefaultTextStyle( +/// style: textTheme.display1, +/// child: RawKeyboardListener( +/// focusNode: _focusNode, +/// onKey: _handleKeyEvent, +/// child: AnimatedBuilder( +/// animation: _focusNode, +/// builder: (BuildContext context, Widget child) { +/// if (!_focusNode.hasFocus) { +/// return GestureDetector( +/// onTap: () { +/// FocusScope.of(context).requestFocus(_focusNode); +/// }, +/// child: Text('Tap to focus'), +/// ); +/// } +/// return Text(_message ?? 'Press a key'); +/// }, +/// ), +/// ), +/// ), +/// ); +/// } +/// ``` +/// {@end-tool} +/// /// See also: /// /// * [RawKeyEvent], the keyboard event object received by widgets that listen @@ -176,19 +342,20 @@ class LogicalKeyboardKey extends Diagnosticable { /// * [RawKeyboardListener], a widget used to listen to and supply handlers for /// keyboard events. class PhysicalKeyboardKey extends Diagnosticable { - /// Defines a KeyboardKey value and optional debug name. The debug name must - /// be null in release mode. + /// Creates a PhysicalKeyboardKey object with an optional debug name. /// - /// To save executable size, it is recommended that the [debugName] be null in - /// release mode. You can do this using the [kReleaseMode] constant: + /// The [usbHidUsage] must not be null. /// /// {@tool sample} - /// const PhysicalKeyboardKey mySpecialPhysicalKey = PhysicalKeyboardKey( - /// 0x0010000000a, - /// debugName: kReleaseMode ? null : 'Special Key', - /// ); + /// To save executable size, it is recommended that the [debugName] be null in + /// release mode. You can do this using the [kReleaseMode] constant. + /// + /// ```dart + /// const PhysicalKeyboardKey(0x0000ffff, debugName: kReleaseMode ? null : 'Special Key') + /// ``` /// {@end-tool} - const PhysicalKeyboardKey(this.usbHidUsage, {this.debugName}); + const PhysicalKeyboardKey(this.usbHidUsage, {this.debugName}) + : assert(usbHidUsage != null); /// The unique USB HID usage ID of this physical key on the keyboard. /// diff --git a/dev/tools/gen_keycodes/data/keyboard_maps.tmpl b/dev/tools/gen_keycodes/data/keyboard_maps.tmpl index a52371b428..cdd18a7ffe 100644 --- a/dev/tools/gen_keycodes/data/keyboard_maps.tmpl +++ b/dev/tools/gen_keycodes/data/keyboard_maps.tmpl @@ -6,7 +6,7 @@ // This file is generated by dev/tools/gen_keycodes/bin/gen_keycodes.dart and // should not be edited directly. // -// Edit dev/tools/gen_keycodes/data/keyboard_maps.tmpl instead. +// Edit the template dev/tools/gen_keycodes/data/keyboard_maps.tmpl instead. // See dev/tools/gen_keycodes/README.md for more information. import 'keyboard_key.dart'; diff --git a/dev/tools/gen_keycodes/data/printable.json b/dev/tools/gen_keycodes/data/printable.json index ae2ef3a8a0..ccf667f605 100644 --- a/dev/tools/gen_keycodes/data/printable.json +++ b/dev/tools/gen_keycodes/data/printable.json @@ -15,32 +15,32 @@ "digit8": "8", "digit9": "9", "equal": "=", - "keyA": "A", - "keyB": "B", - "keyC": "C", - "keyD": "D", - "keyE": "E", - "keyF": "F", - "keyG": "G", - "keyH": "H", - "keyI": "I", - "keyJ": "J", - "keyK": "K", - "keyL": "L", - "keyM": "M", - "keyN": "N", - "keyO": "O", - "keyP": "P", - "keyQ": "Q", - "keyR": "R", - "keyS": "S", - "keyT": "T", - "keyU": "U", - "keyV": "V", - "keyW": "W", - "keyX": "X", - "keyY": "Y", - "keyZ": "Z", + "keyA": "a", + "keyB": "b", + "keyC": "c", + "keyD": "d", + "keyE": "e", + "keyF": "f", + "keyG": "g", + "keyH": "h", + "keyI": "i", + "keyJ": "j", + "keyK": "k", + "keyL": "l", + "keyM": "m", + "keyN": "n", + "keyO": "o", + "keyP": "p", + "keyQ": "q", + "keyR": "r", + "keyS": "s", + "keyT": "t", + "keyU": "u", + "keyV": "v", + "keyW": "w", + "keyX": "x", + "keyY": "y", + "keyZ": "z", "minus": "-", "numpad0": "0", "numpad1": "1", diff --git a/dev/tools/gen_keycodes/lib/code_gen.dart b/dev/tools/gen_keycodes/lib/code_gen.dart index f2a86ceaeb..3a8be0f82c 100644 --- a/dev/tools/gen_keycodes/lib/code_gen.dart +++ b/dev/tools/gen_keycodes/lib/code_gen.dart @@ -15,7 +15,7 @@ class CodeGenerator { /// Given an [input] string, wraps the text at 80 characters and prepends each /// line with the [prefix] string. Use for generated comments. - String wrapString(String input, String prefix) { + String wrapString(String input, {String prefix = ' /// '}) { final int wrapWidth = 80 - prefix.length; final StringBuffer result = StringBuffer(); final List words = input.split(RegExp(r'\s+')); @@ -38,12 +38,14 @@ class CodeGenerator { String get physicalDefinitions { final StringBuffer definitions = StringBuffer(); for (Key entry in keyData.data) { - final String comment = wrapString('Represents the location of a ' - '"${entry.commentName}" key on a generalized keyboard. See the function ' - '[RawKeyEvent.physicalKey] for more information.', ' /// '); + final String firstComment = wrapString('Represents the location of the ' + '"${entry.commentName}" key on a generalized keyboard.'); + final String otherComments = wrapString('See the function ' + '[RawKeyEvent.physicalKey] for more information.'); definitions.write(''' -$comment static const PhysicalKeyboardKey ${entry.constantName} = PhysicalKeyboardKey(${toHex(entry.usbHidCode, digits: 8)}, debugName: kReleaseMode ? null : '${entry.commentName}'); +$firstComment /// +$otherComments static const PhysicalKeyboardKey ${entry.constantName} = PhysicalKeyboardKey(${toHex(entry.usbHidCode, digits: 8)}, debugName: kReleaseMode ? null : '${entry.commentName}'); '''); } return definitions.toString(); @@ -54,17 +56,19 @@ $comment static const PhysicalKeyboardKey ${entry.constantName} = PhysicalKeybo String escapeLabel(String label) => label.contains("'") ? 'r"$label"' : "r'$label'"; final StringBuffer definitions = StringBuffer(); for (Key entry in keyData.data) { - final String comment = wrapString('Represents a logical "${entry.commentName}" key on the ' - 'keyboard. See the function [RawKeyEvent.logicalKey] for more information.', ' /// '); + final String firstComment = wrapString('Represents the logical "${entry.commentName}" key on the keyboard.'); + final String otherComments = wrapString('See the function [RawKeyEvent.logicalKey] for more information.'); if (entry.keyLabel == null) { definitions.write(''' -$comment static const LogicalKeyboardKey ${entry.constantName} = LogicalKeyboardKey(${toHex(entry.flutterId, digits: 11)}, debugName: kReleaseMode ? null : '${entry.commentName}'); +$firstComment /// +$otherComments static const LogicalKeyboardKey ${entry.constantName} = LogicalKeyboardKey(${toHex(entry.flutterId, digits: 11)}, debugName: kReleaseMode ? null : '${entry.commentName}'); '''); } else { definitions.write(''' -$comment static const LogicalKeyboardKey ${entry.constantName} = LogicalKeyboardKey(${toHex(entry.flutterId, digits: 11)}, keyLabel: ${escapeLabel(entry.keyLabel)}, debugName: kReleaseMode ? null : '${entry.commentName}'); +$firstComment /// +$otherComments static const LogicalKeyboardKey ${entry.constantName} = LogicalKeyboardKey(${toHex(entry.flutterId, digits: 11)}, keyLabel: ${escapeLabel(entry.keyLabel)}, debugName: kReleaseMode ? null : '${entry.commentName}'); '''); } } diff --git a/dev/tools/gen_keycodes/lib/key_data.dart b/dev/tools/gen_keycodes/lib/key_data.dart index d2e66fe0f5..21fa94ffca 100644 --- a/dev/tools/gen_keycodes/lib/key_data.dart +++ b/dev/tools/gen_keycodes/lib/key_data.dart @@ -193,7 +193,7 @@ class KeyData { /// A single entry in the key data structure. /// -/// Can be read from JSON with the [Key..fromJsonMapEntry] constructor, or +/// Can be read from JSON with the [Key.fromJsonMapEntry] constructor, or /// written with the [toJson] method. class Key { /// Creates a single key entry from available data. diff --git a/packages/flutter/lib/services.dart b/packages/flutter/lib/services.dart index 6c2ca8120d..1603e5671b 100644 --- a/packages/flutter/lib/services.dart +++ b/packages/flutter/lib/services.dart @@ -15,6 +15,7 @@ export 'src/services/binding.dart'; export 'src/services/clipboard.dart'; export 'src/services/font_loader.dart'; export 'src/services/haptic_feedback.dart'; +export 'src/services/keyboard_key.dart'; export 'src/services/message_codec.dart'; export 'src/services/message_codecs.dart'; export 'src/services/platform_channel.dart'; diff --git a/packages/flutter/lib/src/material/chip.dart b/packages/flutter/lib/src/material/chip.dart index 62ff74725e..136a8497a5 100644 --- a/packages/flutter/lib/src/material/chip.dart +++ b/packages/flutter/lib/src/material/chip.dart @@ -152,6 +152,7 @@ abstract class DeletableChipAttributes { /// have to do something similar to the following sample: /// /// {@tool snippet --template=stateful_widget} + /// /// This sample shows how to use [onDeleted] to remove an entry when the /// delete button is tapped. /// diff --git a/packages/flutter/lib/src/services/keyboard_key.dart b/packages/flutter/lib/src/services/keyboard_key.dart new file mode 100644 index 0000000000..85891ac550 --- /dev/null +++ b/packages/flutter/lib/src/services/keyboard_key.dart @@ -0,0 +1,3255 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// DO NOT EDIT -- DO NOT EDIT -- DO NOT EDIT +// This file is generated by dev/tools/gen_keycodes/bin/gen_keycodes.dart and +// should not be edited directly. +// +// Edit the template dev/tools/gen_keycodes/data/keyboard_key.tmpl instead. +// See dev/tools/gen_keycodes/README.md for more information. + +import 'package:flutter/foundation.dart'; + +/// A class with static values that describe the keys that are returned from +/// [RawKeyEvent.logicalKey]. +/// +/// These represent *logical* keys, which are keys which are interpreted in the +/// context of any modifiers, modes, or keyboard layouts which may be in effect. +/// +/// This is contrast to [PhysicalKeyboardKey], which represents a physical key +/// in a particular location on the keyboard, without regard for the modifier +/// state, mode, or keyboard layout. +/// +/// As an example, if you wanted to implement an app where the "Q" key "quit" +/// something, you'd want to look at the logical key to detect this, since you +/// would like to have it match the key with "Q" on it, instead of always +/// looking for "the key next next to the TAB key", since on a French keyboard, +/// the key next to the TAB key has an "A" on it. +/// +/// Conversely, if you wanted a game where the key next to the CAPS LOCK (the +/// "A" key on a QWERTY keyboard) moved the player to the left, you'd want to +/// look at the physical key to make sure that regardless of the character the +/// key produces, you got the key that is in that location on the keyboard. +/// +/// {@tool snippet --template=stateful_widget} +/// This example shows how to detect if the user has selected the logical "Q" +/// key. +/// +/// ```dart imports +/// import 'package:flutter/foundation.dart'; +/// import 'package:flutter/services.dart'; +/// ``` +/// +/// ```dart +/// // The node used to request the keyboard focus. +/// final FocusNode _focusNode = FocusNode(); +/// // The message to display. +/// String _message; +/// +/// // Focus nodes need to be disposed. +/// @override +/// void dispose() { +/// _focusNode.dispose(); +/// super.dispose(); +/// } +/// +/// // Handles the key events from the RawKeyboardListener and update the +/// // _message. +/// void _handleKeyEvent(RawKeyEvent event) { +/// setState(() { +/// if (event.logicalKey == LogicalKeyboardKey.keyQ) { +/// _message = 'Pressed the "Q" key!'; +/// } else { +/// if (kReleaseMode) { +/// _message = 'Not a Q: Key label is "${event.logicalKey.keyLabel ?? ''}"'; +/// } else { +/// // This will only print useful information in debug mode. +/// _message = 'Not a Q: Pressed ${event.logicalKey.debugName}'; +/// } +/// } +/// }); +/// } +/// +/// @override +/// Widget build(BuildContext context) { +/// final TextTheme textTheme = Theme.of(context).textTheme; +/// return Container( +/// color: Colors.white, +/// alignment: Alignment.center, +/// child: DefaultTextStyle( +/// style: textTheme.display1, +/// child: RawKeyboardListener( +/// focusNode: _focusNode, +/// onKey: _handleKeyEvent, +/// child: AnimatedBuilder( +/// animation: _focusNode, +/// builder: (BuildContext context, Widget child) { +/// if (!_focusNode.hasFocus) { +/// return GestureDetector( +/// onTap: () { +/// FocusScope.of(context).requestFocus(_focusNode); +/// }, +/// child: Text('Tap to focus'), +/// ); +/// } +/// return Text(_message ?? 'Press a key'); +/// }, +/// ), +/// ), +/// ), +/// ); +/// } +/// ``` +/// {@end-tool} +/// See also: +/// +/// * [RawKeyEvent], the keyboard event object received by widgets that listen +/// to keyboard events. +/// * [RawKeyboardListener], a widget used to listen to and supply handlers for +/// keyboard events. +class LogicalKeyboardKey extends Diagnosticable { + /// Creates a LogicalKeyboardKey object with an optional key label and debug + /// name. + /// + /// [keyId] must not be null. + /// + /// {@tool sample} + /// To save executable size, it is recommended that the [debugName] be null in + /// release mode. You can do this by using the [kReleaseMode] constant. + /// + /// ```dart + /// const LogicalKeyboardKey(0x0010000000a, debugName: kReleaseMode ? null : 'Special Key') + /// ``` + /// {@end-tool} + const LogicalKeyboardKey(this.keyId, {this.debugName, this.keyLabel}) + : assert(keyId != null); + + /// A unique code representing this key. + /// + /// This is an opaque code. It should not be unpacked to derive information + /// from it, as the representation of the code could change at any time. + final int keyId; + + /// The debug string to print for this keyboard key, which will be null in + /// release mode. + final String debugName; + + /// The Unicode string representing the character produced by a [RawKeyEvent]. + /// + /// This value is useful for describing or matching mnemonic keyboard + /// shortcuts. + /// + /// On most platforms this is a single code point, but it could contain any + /// Unicode string. The `keyLabel` differs from [RawKeyEvent.character] + /// because `keyLabel` only takes into account the key being pressed, not any + /// combining keys pressed before it, so, for example, an “o” that follows a + /// combining dieresis (“¨”, COMBINING DIAERESIS (U+0308)) would just return + /// “o” for [keyLabel], but would return “ö” for [RawKeyEvent.character]. + /// + /// {@macro flutter.services.RawKeyEventData.keyLabel} + final String keyLabel; + + @override + int get hashCode => keyId.hashCode; + + @override + bool operator ==(dynamic other) { + if (other.runtimeType != runtimeType) { + return false; + } + final LogicalKeyboardKey typedOther = other; + return keyId == typedOther.keyId; + } + + /// Returns the [LogicalKeyboardKey] constant that matches the given ID, or + /// null, if not found. + static LogicalKeyboardKey findKeyByKeyId(int keyId) => _knownLogicalKeys[keyId]; + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties.add(StringProperty('keyId', '0x${keyId.toRadixString(16).padLeft(8, '0')}', showName: true)); + properties.add(StringProperty('keyLabel', keyLabel, showName: true)); + properties.add(StringProperty('debugName', debugName, showName: true, defaultValue: null)); + } + + /// Returns true if the given label represents a Unicode control character. + /// + /// Examples of control characters are characters like "U+000A LINE FEED (LF)" + /// or "U+001B ESCAPE (ESC)". + /// + /// See for more + /// information. + /// + /// Used by [RawKeyEvent] subclasses to help construct IDs. + static bool isControlCharacter(String label) { + if (label.length > 1) { + return false; + } + final int codeUnit = label.codeUnitAt(0); + return (codeUnit <= 0x1f && codeUnit >= 0x00) || (codeUnit >= 0x7f && codeUnit <= 0x9f); + } + + /// Returns true if the [keyId] of this object is one that is autogenerated by + /// Flutter. + /// + /// Autogenerated key IDs are generated in response to platform key codes + /// which Flutter doesn't recognize, and their IDs shouldn't be used in a + /// persistent way. + /// + /// Autogenerated IDs should be a rare occurrence: Flutter supports most keys. + /// + /// Keys that generate Unicode characters (even if unknown to Flutter) will + /// not return true for `isAutogenerated`, since they will be assigned a + /// Unicode-based code that will remain stable. + /// + /// If Flutter adds support for a previously unsupported key code, the ID it + /// reports will change, but the ID will remain stable on the platform it is + /// produced on until Flutter adds support for recognizing it. + /// + /// So, hypothetically, if Android added a new key code of 0xffff, + /// representing a new "do what I mean" key, then the autogenerated code would + /// be 0x1020000ffff, but once Flutter added the "doWhatIMean" key to the + /// definitions below, the new code would be 0x0020000ffff for all platforms + /// that had a "do what I mean" key from then on. + bool get isAutogenerated => (keyId & autogeneratedMask) != 0; + + /// Mask for the 32-bit value portion of the key code. + /// + /// This is used by + /// platform-specific code to generate Flutter key codes. + static const int valueMask = 0x000FFFFFFFF; + + /// Mask for the platform prefix portion of the key code. + /// + /// This is used by platform-specific code to generate Flutter key codes. + static const int platformMask = 0x0FF00000000; + + /// Mask for the autogenerated bit portion of the key code. + /// + /// This is used by platform-specific code to generate new Flutter key codes + /// for keys which are not recognized. + static const int autogeneratedMask = 0x10000000000; + + /// The code prefix for keys which have a Unicode representation. + /// + /// This is used by platform-specific code to generate Flutter key codes. + static const int unicodePlane = 0x00000000000; + + /// The code prefix for keys which do not have a Unicode representation. + /// + /// This is used by platform-specific code to generate Flutter key codes using + /// HID Usage codes. + static const int hidPlane = 0x00100000000; + + /// Represents the logical "None" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey none = LogicalKeyboardKey(0x00100000000, debugName: kReleaseMode ? null : 'None'); + + /// Represents the logical "Hyper" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey hyper = LogicalKeyboardKey(0x00100000010, debugName: kReleaseMode ? null : 'Hyper'); + + /// Represents the logical "Super Key" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey superKey = LogicalKeyboardKey(0x00100000011, debugName: kReleaseMode ? null : 'Super Key'); + + /// Represents the logical "Fn" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey fn = LogicalKeyboardKey(0x00100000012, debugName: kReleaseMode ? null : 'Fn'); + + /// Represents the logical "Fn Lock" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey fnLock = LogicalKeyboardKey(0x00100000013, debugName: kReleaseMode ? null : 'Fn Lock'); + + /// Represents the logical "Suspend" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey suspend = LogicalKeyboardKey(0x00100000014, debugName: kReleaseMode ? null : 'Suspend'); + + /// Represents the logical "Resume" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey resume = LogicalKeyboardKey(0x00100000015, debugName: kReleaseMode ? null : 'Resume'); + + /// Represents the logical "Turbo" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey turbo = LogicalKeyboardKey(0x00100000016, debugName: kReleaseMode ? null : 'Turbo'); + + /// Represents the logical "Launch Assistant" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey launchAssistant = LogicalKeyboardKey(0x00100000017, debugName: kReleaseMode ? null : 'Launch Assistant'); + + /// Represents the logical "Sleep" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey sleep = LogicalKeyboardKey(0x00100010082, debugName: kReleaseMode ? null : 'Sleep'); + + /// Represents the logical "Wake Up" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey wakeUp = LogicalKeyboardKey(0x00100010083, debugName: kReleaseMode ? null : 'Wake Up'); + + /// Represents the logical "Usb Reserved" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey usbReserved = LogicalKeyboardKey(0x00100070000, debugName: kReleaseMode ? null : 'Usb Reserved'); + + /// Represents the logical "Usb Error Roll Over" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey usbErrorRollOver = LogicalKeyboardKey(0x00100070001, debugName: kReleaseMode ? null : 'Usb Error Roll Over'); + + /// Represents the logical "Usb Post Fail" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey usbPostFail = LogicalKeyboardKey(0x00100070002, debugName: kReleaseMode ? null : 'Usb Post Fail'); + + /// Represents the logical "Usb Error Undefined" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey usbErrorUndefined = LogicalKeyboardKey(0x00100070003, debugName: kReleaseMode ? null : 'Usb Error Undefined'); + + /// Represents the logical "Key A" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyA = LogicalKeyboardKey(0x00000000061, keyLabel: r'a', debugName: kReleaseMode ? null : 'Key A'); + + /// Represents the logical "Key B" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyB = LogicalKeyboardKey(0x00000000062, keyLabel: r'b', debugName: kReleaseMode ? null : 'Key B'); + + /// Represents the logical "Key C" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyC = LogicalKeyboardKey(0x00000000063, keyLabel: r'c', debugName: kReleaseMode ? null : 'Key C'); + + /// Represents the logical "Key D" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyD = LogicalKeyboardKey(0x00000000064, keyLabel: r'd', debugName: kReleaseMode ? null : 'Key D'); + + /// Represents the logical "Key E" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyE = LogicalKeyboardKey(0x00000000065, keyLabel: r'e', debugName: kReleaseMode ? null : 'Key E'); + + /// Represents the logical "Key F" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyF = LogicalKeyboardKey(0x00000000066, keyLabel: r'f', debugName: kReleaseMode ? null : 'Key F'); + + /// Represents the logical "Key G" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyG = LogicalKeyboardKey(0x00000000067, keyLabel: r'g', debugName: kReleaseMode ? null : 'Key G'); + + /// Represents the logical "Key H" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyH = LogicalKeyboardKey(0x00000000068, keyLabel: r'h', debugName: kReleaseMode ? null : 'Key H'); + + /// Represents the logical "Key I" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyI = LogicalKeyboardKey(0x00000000069, keyLabel: r'i', debugName: kReleaseMode ? null : 'Key I'); + + /// Represents the logical "Key J" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyJ = LogicalKeyboardKey(0x0000000006a, keyLabel: r'j', debugName: kReleaseMode ? null : 'Key J'); + + /// Represents the logical "Key K" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyK = LogicalKeyboardKey(0x0000000006b, keyLabel: r'k', debugName: kReleaseMode ? null : 'Key K'); + + /// Represents the logical "Key L" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyL = LogicalKeyboardKey(0x0000000006c, keyLabel: r'l', debugName: kReleaseMode ? null : 'Key L'); + + /// Represents the logical "Key M" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyM = LogicalKeyboardKey(0x0000000006d, keyLabel: r'm', debugName: kReleaseMode ? null : 'Key M'); + + /// Represents the logical "Key N" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyN = LogicalKeyboardKey(0x0000000006e, keyLabel: r'n', debugName: kReleaseMode ? null : 'Key N'); + + /// Represents the logical "Key O" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyO = LogicalKeyboardKey(0x0000000006f, keyLabel: r'o', debugName: kReleaseMode ? null : 'Key O'); + + /// Represents the logical "Key P" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyP = LogicalKeyboardKey(0x00000000070, keyLabel: r'p', debugName: kReleaseMode ? null : 'Key P'); + + /// Represents the logical "Key Q" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyQ = LogicalKeyboardKey(0x00000000071, keyLabel: r'q', debugName: kReleaseMode ? null : 'Key Q'); + + /// Represents the logical "Key R" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyR = LogicalKeyboardKey(0x00000000072, keyLabel: r'r', debugName: kReleaseMode ? null : 'Key R'); + + /// Represents the logical "Key S" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyS = LogicalKeyboardKey(0x00000000073, keyLabel: r's', debugName: kReleaseMode ? null : 'Key S'); + + /// Represents the logical "Key T" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyT = LogicalKeyboardKey(0x00000000074, keyLabel: r't', debugName: kReleaseMode ? null : 'Key T'); + + /// Represents the logical "Key U" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyU = LogicalKeyboardKey(0x00000000075, keyLabel: r'u', debugName: kReleaseMode ? null : 'Key U'); + + /// Represents the logical "Key V" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyV = LogicalKeyboardKey(0x00000000076, keyLabel: r'v', debugName: kReleaseMode ? null : 'Key V'); + + /// Represents the logical "Key W" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyW = LogicalKeyboardKey(0x00000000077, keyLabel: r'w', debugName: kReleaseMode ? null : 'Key W'); + + /// Represents the logical "Key X" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyX = LogicalKeyboardKey(0x00000000078, keyLabel: r'x', debugName: kReleaseMode ? null : 'Key X'); + + /// Represents the logical "Key Y" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyY = LogicalKeyboardKey(0x00000000079, keyLabel: r'y', debugName: kReleaseMode ? null : 'Key Y'); + + /// Represents the logical "Key Z" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey keyZ = LogicalKeyboardKey(0x0000000007a, keyLabel: r'z', debugName: kReleaseMode ? null : 'Key Z'); + + /// Represents the logical "Digit 1" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey digit1 = LogicalKeyboardKey(0x00000000031, keyLabel: r'1', debugName: kReleaseMode ? null : 'Digit 1'); + + /// Represents the logical "Digit 2" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey digit2 = LogicalKeyboardKey(0x00000000032, keyLabel: r'2', debugName: kReleaseMode ? null : 'Digit 2'); + + /// Represents the logical "Digit 3" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey digit3 = LogicalKeyboardKey(0x00000000033, keyLabel: r'3', debugName: kReleaseMode ? null : 'Digit 3'); + + /// Represents the logical "Digit 4" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey digit4 = LogicalKeyboardKey(0x00000000034, keyLabel: r'4', debugName: kReleaseMode ? null : 'Digit 4'); + + /// Represents the logical "Digit 5" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey digit5 = LogicalKeyboardKey(0x00000000035, keyLabel: r'5', debugName: kReleaseMode ? null : 'Digit 5'); + + /// Represents the logical "Digit 6" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey digit6 = LogicalKeyboardKey(0x00000000036, keyLabel: r'6', debugName: kReleaseMode ? null : 'Digit 6'); + + /// Represents the logical "Digit 7" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey digit7 = LogicalKeyboardKey(0x00000000037, keyLabel: r'7', debugName: kReleaseMode ? null : 'Digit 7'); + + /// Represents the logical "Digit 8" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey digit8 = LogicalKeyboardKey(0x00000000038, keyLabel: r'8', debugName: kReleaseMode ? null : 'Digit 8'); + + /// Represents the logical "Digit 9" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey digit9 = LogicalKeyboardKey(0x00000000039, keyLabel: r'9', debugName: kReleaseMode ? null : 'Digit 9'); + + /// Represents the logical "Digit 0" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey digit0 = LogicalKeyboardKey(0x00000000030, keyLabel: r'0', debugName: kReleaseMode ? null : 'Digit 0'); + + /// Represents the logical "Enter" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey enter = LogicalKeyboardKey(0x00100070028, debugName: kReleaseMode ? null : 'Enter'); + + /// Represents the logical "Escape" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey escape = LogicalKeyboardKey(0x00100070029, debugName: kReleaseMode ? null : 'Escape'); + + /// Represents the logical "Backspace" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey backspace = LogicalKeyboardKey(0x0010007002a, debugName: kReleaseMode ? null : 'Backspace'); + + /// Represents the logical "Tab" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey tab = LogicalKeyboardKey(0x0010007002b, debugName: kReleaseMode ? null : 'Tab'); + + /// Represents the logical "Space" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey space = LogicalKeyboardKey(0x00000000020, keyLabel: r' ', debugName: kReleaseMode ? null : 'Space'); + + /// Represents the logical "Minus" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey minus = LogicalKeyboardKey(0x0000000002d, keyLabel: r'-', debugName: kReleaseMode ? null : 'Minus'); + + /// Represents the logical "Equal" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey equal = LogicalKeyboardKey(0x0000000003d, keyLabel: r'=', debugName: kReleaseMode ? null : 'Equal'); + + /// Represents the logical "Bracket Left" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey bracketLeft = LogicalKeyboardKey(0x0000000005b, keyLabel: r'[', debugName: kReleaseMode ? null : 'Bracket Left'); + + /// Represents the logical "Bracket Right" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey bracketRight = LogicalKeyboardKey(0x0000000005d, keyLabel: r']', debugName: kReleaseMode ? null : 'Bracket Right'); + + /// Represents the logical "Backslash" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey backslash = LogicalKeyboardKey(0x0000000005c, keyLabel: r'\', debugName: kReleaseMode ? null : 'Backslash'); + + /// Represents the logical "Semicolon" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey semicolon = LogicalKeyboardKey(0x0000000003b, keyLabel: r';', debugName: kReleaseMode ? null : 'Semicolon'); + + /// Represents the logical "Quote" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey quote = LogicalKeyboardKey(0x00000000027, keyLabel: r"'", debugName: kReleaseMode ? null : 'Quote'); + + /// Represents the logical "Backquote" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey backquote = LogicalKeyboardKey(0x00000000060, keyLabel: r'`', debugName: kReleaseMode ? null : 'Backquote'); + + /// Represents the logical "Comma" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey comma = LogicalKeyboardKey(0x0000000002c, keyLabel: r',', debugName: kReleaseMode ? null : 'Comma'); + + /// Represents the logical "Period" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey period = LogicalKeyboardKey(0x0000000002e, keyLabel: r'.', debugName: kReleaseMode ? null : 'Period'); + + /// Represents the logical "Slash" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey slash = LogicalKeyboardKey(0x0000000002f, keyLabel: r'/', debugName: kReleaseMode ? null : 'Slash'); + + /// Represents the logical "Caps Lock" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey capsLock = LogicalKeyboardKey(0x00100070039, debugName: kReleaseMode ? null : 'Caps Lock'); + + /// Represents the logical "F1" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey f1 = LogicalKeyboardKey(0x0010007003a, debugName: kReleaseMode ? null : 'F1'); + + /// Represents the logical "F2" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey f2 = LogicalKeyboardKey(0x0010007003b, debugName: kReleaseMode ? null : 'F2'); + + /// Represents the logical "F3" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey f3 = LogicalKeyboardKey(0x0010007003c, debugName: kReleaseMode ? null : 'F3'); + + /// Represents the logical "F4" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey f4 = LogicalKeyboardKey(0x0010007003d, debugName: kReleaseMode ? null : 'F4'); + + /// Represents the logical "F5" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey f5 = LogicalKeyboardKey(0x0010007003e, debugName: kReleaseMode ? null : 'F5'); + + /// Represents the logical "F6" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey f6 = LogicalKeyboardKey(0x0010007003f, debugName: kReleaseMode ? null : 'F6'); + + /// Represents the logical "F7" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey f7 = LogicalKeyboardKey(0x00100070040, debugName: kReleaseMode ? null : 'F7'); + + /// Represents the logical "F8" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey f8 = LogicalKeyboardKey(0x00100070041, debugName: kReleaseMode ? null : 'F8'); + + /// Represents the logical "F9" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey f9 = LogicalKeyboardKey(0x00100070042, debugName: kReleaseMode ? null : 'F9'); + + /// Represents the logical "F10" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey f10 = LogicalKeyboardKey(0x00100070043, debugName: kReleaseMode ? null : 'F10'); + + /// Represents the logical "F11" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey f11 = LogicalKeyboardKey(0x00100070044, debugName: kReleaseMode ? null : 'F11'); + + /// Represents the logical "F12" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey f12 = LogicalKeyboardKey(0x00100070045, debugName: kReleaseMode ? null : 'F12'); + + /// Represents the logical "Print Screen" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey printScreen = LogicalKeyboardKey(0x00100070046, debugName: kReleaseMode ? null : 'Print Screen'); + + /// Represents the logical "Scroll Lock" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey scrollLock = LogicalKeyboardKey(0x00100070047, debugName: kReleaseMode ? null : 'Scroll Lock'); + + /// Represents the logical "Pause" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey pause = LogicalKeyboardKey(0x00100070048, debugName: kReleaseMode ? null : 'Pause'); + + /// Represents the logical "Insert" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey insert = LogicalKeyboardKey(0x00100070049, debugName: kReleaseMode ? null : 'Insert'); + + /// Represents the logical "Home" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey home = LogicalKeyboardKey(0x0010007004a, debugName: kReleaseMode ? null : 'Home'); + + /// Represents the logical "Page Up" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey pageUp = LogicalKeyboardKey(0x0010007004b, debugName: kReleaseMode ? null : 'Page Up'); + + /// Represents the logical "Delete" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey delete = LogicalKeyboardKey(0x0010007004c, debugName: kReleaseMode ? null : 'Delete'); + + /// Represents the logical "End" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey end = LogicalKeyboardKey(0x0010007004d, debugName: kReleaseMode ? null : 'End'); + + /// Represents the logical "Page Down" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey pageDown = LogicalKeyboardKey(0x0010007004e, debugName: kReleaseMode ? null : 'Page Down'); + + /// Represents the logical "Arrow Right" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey arrowRight = LogicalKeyboardKey(0x0010007004f, debugName: kReleaseMode ? null : 'Arrow Right'); + + /// Represents the logical "Arrow Left" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey arrowLeft = LogicalKeyboardKey(0x00100070050, debugName: kReleaseMode ? null : 'Arrow Left'); + + /// Represents the logical "Arrow Down" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey arrowDown = LogicalKeyboardKey(0x00100070051, debugName: kReleaseMode ? null : 'Arrow Down'); + + /// Represents the logical "Arrow Up" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey arrowUp = LogicalKeyboardKey(0x00100070052, debugName: kReleaseMode ? null : 'Arrow Up'); + + /// Represents the logical "Num Lock" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numLock = LogicalKeyboardKey(0x00100070053, debugName: kReleaseMode ? null : 'Num Lock'); + + /// Represents the logical "Numpad Divide" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpadDivide = LogicalKeyboardKey(0x00100070054, keyLabel: r'/', debugName: kReleaseMode ? null : 'Numpad Divide'); + + /// Represents the logical "Numpad Multiply" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpadMultiply = LogicalKeyboardKey(0x00100070055, keyLabel: r'*', debugName: kReleaseMode ? null : 'Numpad Multiply'); + + /// Represents the logical "Numpad Subtract" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpadSubtract = LogicalKeyboardKey(0x00100070056, keyLabel: r'-', debugName: kReleaseMode ? null : 'Numpad Subtract'); + + /// Represents the logical "Numpad Add" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpadAdd = LogicalKeyboardKey(0x00100070057, keyLabel: r'+', debugName: kReleaseMode ? null : 'Numpad Add'); + + /// Represents the logical "Numpad Enter" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpadEnter = LogicalKeyboardKey(0x00100070058, debugName: kReleaseMode ? null : 'Numpad Enter'); + + /// Represents the logical "Numpad 1" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpad1 = LogicalKeyboardKey(0x00100070059, keyLabel: r'1', debugName: kReleaseMode ? null : 'Numpad 1'); + + /// Represents the logical "Numpad 2" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpad2 = LogicalKeyboardKey(0x0010007005a, keyLabel: r'2', debugName: kReleaseMode ? null : 'Numpad 2'); + + /// Represents the logical "Numpad 3" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpad3 = LogicalKeyboardKey(0x0010007005b, keyLabel: r'3', debugName: kReleaseMode ? null : 'Numpad 3'); + + /// Represents the logical "Numpad 4" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpad4 = LogicalKeyboardKey(0x0010007005c, keyLabel: r'4', debugName: kReleaseMode ? null : 'Numpad 4'); + + /// Represents the logical "Numpad 5" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpad5 = LogicalKeyboardKey(0x0010007005d, keyLabel: r'5', debugName: kReleaseMode ? null : 'Numpad 5'); + + /// Represents the logical "Numpad 6" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpad6 = LogicalKeyboardKey(0x0010007005e, keyLabel: r'6', debugName: kReleaseMode ? null : 'Numpad 6'); + + /// Represents the logical "Numpad 7" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpad7 = LogicalKeyboardKey(0x0010007005f, keyLabel: r'7', debugName: kReleaseMode ? null : 'Numpad 7'); + + /// Represents the logical "Numpad 8" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpad8 = LogicalKeyboardKey(0x00100070060, keyLabel: r'8', debugName: kReleaseMode ? null : 'Numpad 8'); + + /// Represents the logical "Numpad 9" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpad9 = LogicalKeyboardKey(0x00100070061, keyLabel: r'9', debugName: kReleaseMode ? null : 'Numpad 9'); + + /// Represents the logical "Numpad 0" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpad0 = LogicalKeyboardKey(0x00100070062, keyLabel: r'0', debugName: kReleaseMode ? null : 'Numpad 0'); + + /// Represents the logical "Numpad Decimal" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpadDecimal = LogicalKeyboardKey(0x00100070063, keyLabel: r'.', debugName: kReleaseMode ? null : 'Numpad Decimal'); + + /// Represents the logical "Intl Backslash" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey intlBackslash = LogicalKeyboardKey(0x00100070064, debugName: kReleaseMode ? null : 'Intl Backslash'); + + /// Represents the logical "Context Menu" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey contextMenu = LogicalKeyboardKey(0x00100070065, debugName: kReleaseMode ? null : 'Context Menu'); + + /// Represents the logical "Power" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey power = LogicalKeyboardKey(0x00100070066, debugName: kReleaseMode ? null : 'Power'); + + /// Represents the logical "Numpad Equal" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpadEqual = LogicalKeyboardKey(0x00100070067, keyLabel: r'=', debugName: kReleaseMode ? null : 'Numpad Equal'); + + /// Represents the logical "F13" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey f13 = LogicalKeyboardKey(0x00100070068, debugName: kReleaseMode ? null : 'F13'); + + /// Represents the logical "F14" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey f14 = LogicalKeyboardKey(0x00100070069, debugName: kReleaseMode ? null : 'F14'); + + /// Represents the logical "F15" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey f15 = LogicalKeyboardKey(0x0010007006a, debugName: kReleaseMode ? null : 'F15'); + + /// Represents the logical "F16" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey f16 = LogicalKeyboardKey(0x0010007006b, debugName: kReleaseMode ? null : 'F16'); + + /// Represents the logical "F17" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey f17 = LogicalKeyboardKey(0x0010007006c, debugName: kReleaseMode ? null : 'F17'); + + /// Represents the logical "F18" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey f18 = LogicalKeyboardKey(0x0010007006d, debugName: kReleaseMode ? null : 'F18'); + + /// Represents the logical "F19" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey f19 = LogicalKeyboardKey(0x0010007006e, debugName: kReleaseMode ? null : 'F19'); + + /// Represents the logical "F20" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey f20 = LogicalKeyboardKey(0x0010007006f, debugName: kReleaseMode ? null : 'F20'); + + /// Represents the logical "F21" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey f21 = LogicalKeyboardKey(0x00100070070, debugName: kReleaseMode ? null : 'F21'); + + /// Represents the logical "F22" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey f22 = LogicalKeyboardKey(0x00100070071, debugName: kReleaseMode ? null : 'F22'); + + /// Represents the logical "F23" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey f23 = LogicalKeyboardKey(0x00100070072, debugName: kReleaseMode ? null : 'F23'); + + /// Represents the logical "F24" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey f24 = LogicalKeyboardKey(0x00100070073, debugName: kReleaseMode ? null : 'F24'); + + /// Represents the logical "Open" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey open = LogicalKeyboardKey(0x00100070074, debugName: kReleaseMode ? null : 'Open'); + + /// Represents the logical "Help" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey help = LogicalKeyboardKey(0x00100070075, debugName: kReleaseMode ? null : 'Help'); + + /// Represents the logical "Select" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey select = LogicalKeyboardKey(0x00100070077, debugName: kReleaseMode ? null : 'Select'); + + /// Represents the logical "Again" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey again = LogicalKeyboardKey(0x00100070079, debugName: kReleaseMode ? null : 'Again'); + + /// Represents the logical "Undo" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey undo = LogicalKeyboardKey(0x0010007007a, debugName: kReleaseMode ? null : 'Undo'); + + /// Represents the logical "Cut" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey cut = LogicalKeyboardKey(0x0010007007b, debugName: kReleaseMode ? null : 'Cut'); + + /// Represents the logical "Copy" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey copy = LogicalKeyboardKey(0x0010007007c, debugName: kReleaseMode ? null : 'Copy'); + + /// Represents the logical "Paste" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey paste = LogicalKeyboardKey(0x0010007007d, debugName: kReleaseMode ? null : 'Paste'); + + /// Represents the logical "Find" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey find = LogicalKeyboardKey(0x0010007007e, debugName: kReleaseMode ? null : 'Find'); + + /// Represents the logical "Audio Volume Mute" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey audioVolumeMute = LogicalKeyboardKey(0x0010007007f, debugName: kReleaseMode ? null : 'Audio Volume Mute'); + + /// Represents the logical "Audio Volume Up" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey audioVolumeUp = LogicalKeyboardKey(0x00100070080, debugName: kReleaseMode ? null : 'Audio Volume Up'); + + /// Represents the logical "Audio Volume Down" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey audioVolumeDown = LogicalKeyboardKey(0x00100070081, debugName: kReleaseMode ? null : 'Audio Volume Down'); + + /// Represents the logical "Numpad Comma" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpadComma = LogicalKeyboardKey(0x00100070085, keyLabel: r',', debugName: kReleaseMode ? null : 'Numpad Comma'); + + /// Represents the logical "Intl Ro" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey intlRo = LogicalKeyboardKey(0x00100070087, debugName: kReleaseMode ? null : 'Intl Ro'); + + /// Represents the logical "Kana Mode" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey kanaMode = LogicalKeyboardKey(0x00100070088, debugName: kReleaseMode ? null : 'Kana Mode'); + + /// Represents the logical "Intl Yen" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey intlYen = LogicalKeyboardKey(0x00100070089, debugName: kReleaseMode ? null : 'Intl Yen'); + + /// Represents the logical "Convert" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey convert = LogicalKeyboardKey(0x0010007008a, debugName: kReleaseMode ? null : 'Convert'); + + /// Represents the logical "Non Convert" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey nonConvert = LogicalKeyboardKey(0x0010007008b, debugName: kReleaseMode ? null : 'Non Convert'); + + /// Represents the logical "Lang 1" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey lang1 = LogicalKeyboardKey(0x00100070090, debugName: kReleaseMode ? null : 'Lang 1'); + + /// Represents the logical "Lang 2" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey lang2 = LogicalKeyboardKey(0x00100070091, debugName: kReleaseMode ? null : 'Lang 2'); + + /// Represents the logical "Lang 3" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey lang3 = LogicalKeyboardKey(0x00100070092, debugName: kReleaseMode ? null : 'Lang 3'); + + /// Represents the logical "Lang 4" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey lang4 = LogicalKeyboardKey(0x00100070093, debugName: kReleaseMode ? null : 'Lang 4'); + + /// Represents the logical "Lang 5" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey lang5 = LogicalKeyboardKey(0x00100070094, debugName: kReleaseMode ? null : 'Lang 5'); + + /// Represents the logical "Abort" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey abort = LogicalKeyboardKey(0x0010007009b, debugName: kReleaseMode ? null : 'Abort'); + + /// Represents the logical "Props" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey props = LogicalKeyboardKey(0x001000700a3, debugName: kReleaseMode ? null : 'Props'); + + /// Represents the logical "Numpad Paren Left" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpadParenLeft = LogicalKeyboardKey(0x001000700b6, keyLabel: r'(', debugName: kReleaseMode ? null : 'Numpad Paren Left'); + + /// Represents the logical "Numpad Paren Right" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpadParenRight = LogicalKeyboardKey(0x001000700b7, keyLabel: r')', debugName: kReleaseMode ? null : 'Numpad Paren Right'); + + /// Represents the logical "Numpad Backspace" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpadBackspace = LogicalKeyboardKey(0x001000700bb, debugName: kReleaseMode ? null : 'Numpad Backspace'); + + /// Represents the logical "Numpad Memory Store" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpadMemoryStore = LogicalKeyboardKey(0x001000700d0, debugName: kReleaseMode ? null : 'Numpad Memory Store'); + + /// Represents the logical "Numpad Memory Recall" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpadMemoryRecall = LogicalKeyboardKey(0x001000700d1, debugName: kReleaseMode ? null : 'Numpad Memory Recall'); + + /// Represents the logical "Numpad Memory Clear" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpadMemoryClear = LogicalKeyboardKey(0x001000700d2, debugName: kReleaseMode ? null : 'Numpad Memory Clear'); + + /// Represents the logical "Numpad Memory Add" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpadMemoryAdd = LogicalKeyboardKey(0x001000700d3, debugName: kReleaseMode ? null : 'Numpad Memory Add'); + + /// Represents the logical "Numpad Memory Subtract" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpadMemorySubtract = LogicalKeyboardKey(0x001000700d4, debugName: kReleaseMode ? null : 'Numpad Memory Subtract'); + + /// Represents the logical "Numpad Sign Change" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpadSignChange = LogicalKeyboardKey(0x001000700d7, debugName: kReleaseMode ? null : 'Numpad Sign Change'); + + /// Represents the logical "Numpad Clear" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpadClear = LogicalKeyboardKey(0x001000700d8, debugName: kReleaseMode ? null : 'Numpad Clear'); + + /// Represents the logical "Numpad Clear Entry" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey numpadClearEntry = LogicalKeyboardKey(0x001000700d9, debugName: kReleaseMode ? null : 'Numpad Clear Entry'); + + /// Represents the logical "Control Left" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey controlLeft = LogicalKeyboardKey(0x001000700e0, debugName: kReleaseMode ? null : 'Control Left'); + + /// Represents the logical "Shift Left" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey shiftLeft = LogicalKeyboardKey(0x001000700e1, debugName: kReleaseMode ? null : 'Shift Left'); + + /// Represents the logical "Alt Left" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey altLeft = LogicalKeyboardKey(0x001000700e2, debugName: kReleaseMode ? null : 'Alt Left'); + + /// Represents the logical "Meta Left" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey metaLeft = LogicalKeyboardKey(0x001000700e3, debugName: kReleaseMode ? null : 'Meta Left'); + + /// Represents the logical "Control Right" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey controlRight = LogicalKeyboardKey(0x001000700e4, debugName: kReleaseMode ? null : 'Control Right'); + + /// Represents the logical "Shift Right" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey shiftRight = LogicalKeyboardKey(0x001000700e5, debugName: kReleaseMode ? null : 'Shift Right'); + + /// Represents the logical "Alt Right" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey altRight = LogicalKeyboardKey(0x001000700e6, debugName: kReleaseMode ? null : 'Alt Right'); + + /// Represents the logical "Meta Right" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey metaRight = LogicalKeyboardKey(0x001000700e7, debugName: kReleaseMode ? null : 'Meta Right'); + + /// Represents the logical "Info" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey info = LogicalKeyboardKey(0x001000c0060, debugName: kReleaseMode ? null : 'Info'); + + /// Represents the logical "Closed Caption Toggle" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey closedCaptionToggle = LogicalKeyboardKey(0x001000c0061, debugName: kReleaseMode ? null : 'Closed Caption Toggle'); + + /// Represents the logical "Brightness Up" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey brightnessUp = LogicalKeyboardKey(0x001000c006f, debugName: kReleaseMode ? null : 'Brightness Up'); + + /// Represents the logical "Brightness Down" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey brightnessDown = LogicalKeyboardKey(0x001000c0070, debugName: kReleaseMode ? null : 'Brightness Down'); + + /// Represents the logical "Brightness Toggle" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey brightnessToggle = LogicalKeyboardKey(0x001000c0072, debugName: kReleaseMode ? null : 'Brightness Toggle'); + + /// Represents the logical "Brightness Minimum" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey brightnessMinimum = LogicalKeyboardKey(0x001000c0073, debugName: kReleaseMode ? null : 'Brightness Minimum'); + + /// Represents the logical "Brightness Maximum" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey brightnessMaximum = LogicalKeyboardKey(0x001000c0074, debugName: kReleaseMode ? null : 'Brightness Maximum'); + + /// Represents the logical "Brightness Auto" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey brightnessAuto = LogicalKeyboardKey(0x001000c0075, debugName: kReleaseMode ? null : 'Brightness Auto'); + + /// Represents the logical "Media Last" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey mediaLast = LogicalKeyboardKey(0x001000c0083, debugName: kReleaseMode ? null : 'Media Last'); + + /// Represents the logical "Launch Phone" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey launchPhone = LogicalKeyboardKey(0x001000c008c, debugName: kReleaseMode ? null : 'Launch Phone'); + + /// Represents the logical "Program Guide" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey programGuide = LogicalKeyboardKey(0x001000c008d, debugName: kReleaseMode ? null : 'Program Guide'); + + /// Represents the logical "Exit" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey exit = LogicalKeyboardKey(0x001000c0094, debugName: kReleaseMode ? null : 'Exit'); + + /// Represents the logical "Channel Up" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey channelUp = LogicalKeyboardKey(0x001000c009c, debugName: kReleaseMode ? null : 'Channel Up'); + + /// Represents the logical "Channel Down" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey channelDown = LogicalKeyboardKey(0x001000c009d, debugName: kReleaseMode ? null : 'Channel Down'); + + /// Represents the logical "Media Play" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey mediaPlay = LogicalKeyboardKey(0x001000c00b0, debugName: kReleaseMode ? null : 'Media Play'); + + /// Represents the logical "Media Record" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey mediaRecord = LogicalKeyboardKey(0x001000c00b2, debugName: kReleaseMode ? null : 'Media Record'); + + /// Represents the logical "Media Fast Forward" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey mediaFastForward = LogicalKeyboardKey(0x001000c00b3, debugName: kReleaseMode ? null : 'Media Fast Forward'); + + /// Represents the logical "Media Rewind" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey mediaRewind = LogicalKeyboardKey(0x001000c00b4, debugName: kReleaseMode ? null : 'Media Rewind'); + + /// Represents the logical "Media Track Next" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey mediaTrackNext = LogicalKeyboardKey(0x001000c00b5, debugName: kReleaseMode ? null : 'Media Track Next'); + + /// Represents the logical "Media Track Previous" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey mediaTrackPrevious = LogicalKeyboardKey(0x001000c00b6, debugName: kReleaseMode ? null : 'Media Track Previous'); + + /// Represents the logical "Media Stop" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey mediaStop = LogicalKeyboardKey(0x001000c00b7, debugName: kReleaseMode ? null : 'Media Stop'); + + /// Represents the logical "Eject" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey eject = LogicalKeyboardKey(0x001000c00b8, debugName: kReleaseMode ? null : 'Eject'); + + /// Represents the logical "Media Play Pause" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey mediaPlayPause = LogicalKeyboardKey(0x001000c00cd, debugName: kReleaseMode ? null : 'Media Play Pause'); + + /// Represents the logical "Speech Input Toggle" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey speechInputToggle = LogicalKeyboardKey(0x001000c00cf, debugName: kReleaseMode ? null : 'Speech Input Toggle'); + + /// Represents the logical "Bass Boost" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey bassBoost = LogicalKeyboardKey(0x001000c00e5, debugName: kReleaseMode ? null : 'Bass Boost'); + + /// Represents the logical "Media Select" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey mediaSelect = LogicalKeyboardKey(0x001000c0183, debugName: kReleaseMode ? null : 'Media Select'); + + /// Represents the logical "Launch Word Processor" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey launchWordProcessor = LogicalKeyboardKey(0x001000c0184, debugName: kReleaseMode ? null : 'Launch Word Processor'); + + /// Represents the logical "Launch Spreadsheet" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey launchSpreadsheet = LogicalKeyboardKey(0x001000c0186, debugName: kReleaseMode ? null : 'Launch Spreadsheet'); + + /// Represents the logical "Launch Mail" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey launchMail = LogicalKeyboardKey(0x001000c018a, debugName: kReleaseMode ? null : 'Launch Mail'); + + /// Represents the logical "Launch Contacts" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey launchContacts = LogicalKeyboardKey(0x001000c018d, debugName: kReleaseMode ? null : 'Launch Contacts'); + + /// Represents the logical "Launch Calendar" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey launchCalendar = LogicalKeyboardKey(0x001000c018e, debugName: kReleaseMode ? null : 'Launch Calendar'); + + /// Represents the logical "Launch App2" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey launchApp2 = LogicalKeyboardKey(0x001000c0192, debugName: kReleaseMode ? null : 'Launch App2'); + + /// Represents the logical "Launch App1" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey launchApp1 = LogicalKeyboardKey(0x001000c0194, debugName: kReleaseMode ? null : 'Launch App1'); + + /// Represents the logical "Launch Internet Browser" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey launchInternetBrowser = LogicalKeyboardKey(0x001000c0196, debugName: kReleaseMode ? null : 'Launch Internet Browser'); + + /// Represents the logical "Log Off" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey logOff = LogicalKeyboardKey(0x001000c019c, debugName: kReleaseMode ? null : 'Log Off'); + + /// Represents the logical "Lock Screen" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey lockScreen = LogicalKeyboardKey(0x001000c019e, debugName: kReleaseMode ? null : 'Lock Screen'); + + /// Represents the logical "Launch Control Panel" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey launchControlPanel = LogicalKeyboardKey(0x001000c019f, debugName: kReleaseMode ? null : 'Launch Control Panel'); + + /// Represents the logical "Select Task" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey selectTask = LogicalKeyboardKey(0x001000c01a2, debugName: kReleaseMode ? null : 'Select Task'); + + /// Represents the logical "Launch Documents" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey launchDocuments = LogicalKeyboardKey(0x001000c01a7, debugName: kReleaseMode ? null : 'Launch Documents'); + + /// Represents the logical "Spell Check" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey spellCheck = LogicalKeyboardKey(0x001000c01ab, debugName: kReleaseMode ? null : 'Spell Check'); + + /// Represents the logical "Launch Keyboard Layout" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey launchKeyboardLayout = LogicalKeyboardKey(0x001000c01ae, debugName: kReleaseMode ? null : 'Launch Keyboard Layout'); + + /// Represents the logical "Launch Screen Saver" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey launchScreenSaver = LogicalKeyboardKey(0x001000c01b1, debugName: kReleaseMode ? null : 'Launch Screen Saver'); + + /// Represents the logical "Launch Audio Browser" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey launchAudioBrowser = LogicalKeyboardKey(0x001000c01b7, debugName: kReleaseMode ? null : 'Launch Audio Browser'); + + /// Represents the logical "New Key" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey newKey = LogicalKeyboardKey(0x001000c0201, debugName: kReleaseMode ? null : 'New Key'); + + /// Represents the logical "Close" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey close = LogicalKeyboardKey(0x001000c0203, debugName: kReleaseMode ? null : 'Close'); + + /// Represents the logical "Save" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey save = LogicalKeyboardKey(0x001000c0207, debugName: kReleaseMode ? null : 'Save'); + + /// Represents the logical "Print" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey print = LogicalKeyboardKey(0x001000c0208, debugName: kReleaseMode ? null : 'Print'); + + /// Represents the logical "Browser Search" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey browserSearch = LogicalKeyboardKey(0x001000c0221, debugName: kReleaseMode ? null : 'Browser Search'); + + /// Represents the logical "Browser Home" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey browserHome = LogicalKeyboardKey(0x001000c0223, debugName: kReleaseMode ? null : 'Browser Home'); + + /// Represents the logical "Browser Back" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey browserBack = LogicalKeyboardKey(0x001000c0224, debugName: kReleaseMode ? null : 'Browser Back'); + + /// Represents the logical "Browser Forward" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey browserForward = LogicalKeyboardKey(0x001000c0225, debugName: kReleaseMode ? null : 'Browser Forward'); + + /// Represents the logical "Browser Stop" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey browserStop = LogicalKeyboardKey(0x001000c0226, debugName: kReleaseMode ? null : 'Browser Stop'); + + /// Represents the logical "Browser Refresh" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey browserRefresh = LogicalKeyboardKey(0x001000c0227, debugName: kReleaseMode ? null : 'Browser Refresh'); + + /// Represents the logical "Browser Favorites" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey browserFavorites = LogicalKeyboardKey(0x001000c022a, debugName: kReleaseMode ? null : 'Browser Favorites'); + + /// Represents the logical "Zoom In" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey zoomIn = LogicalKeyboardKey(0x001000c022d, debugName: kReleaseMode ? null : 'Zoom In'); + + /// Represents the logical "Zoom Out" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey zoomOut = LogicalKeyboardKey(0x001000c022e, debugName: kReleaseMode ? null : 'Zoom Out'); + + /// Represents the logical "Zoom Toggle" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey zoomToggle = LogicalKeyboardKey(0x001000c0232, debugName: kReleaseMode ? null : 'Zoom Toggle'); + + /// Represents the logical "Redo" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey redo = LogicalKeyboardKey(0x001000c0279, debugName: kReleaseMode ? null : 'Redo'); + + /// Represents the logical "Mail Reply" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey mailReply = LogicalKeyboardKey(0x001000c0289, debugName: kReleaseMode ? null : 'Mail Reply'); + + /// Represents the logical "Mail Forward" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey mailForward = LogicalKeyboardKey(0x001000c028b, debugName: kReleaseMode ? null : 'Mail Forward'); + + /// Represents the logical "Mail Send" key on the keyboard. + /// + /// See the function [RawKeyEvent.logicalKey] for more information. + static const LogicalKeyboardKey mailSend = LogicalKeyboardKey(0x001000c028c, debugName: kReleaseMode ? null : 'Mail Send'); + + // A list of all predefined constant LogicalKeyboardKeys so they can be + // searched. + static const Map _knownLogicalKeys = { + 0x0100000000: none, + 0x0100000010: hyper, + 0x0100000011: superKey, + 0x0100000012: fn, + 0x0100000013: fnLock, + 0x0100000014: suspend, + 0x0100000015: resume, + 0x0100000016: turbo, + 0x0100000017: launchAssistant, + 0x0100010082: sleep, + 0x0100010083: wakeUp, + 0x0100070000: usbReserved, + 0x0100070001: usbErrorRollOver, + 0x0100070002: usbPostFail, + 0x0100070003: usbErrorUndefined, + 0x0000000061: keyA, + 0x0000000062: keyB, + 0x0000000063: keyC, + 0x0000000064: keyD, + 0x0000000065: keyE, + 0x0000000066: keyF, + 0x0000000067: keyG, + 0x0000000068: keyH, + 0x0000000069: keyI, + 0x000000006a: keyJ, + 0x000000006b: keyK, + 0x000000006c: keyL, + 0x000000006d: keyM, + 0x000000006e: keyN, + 0x000000006f: keyO, + 0x0000000070: keyP, + 0x0000000071: keyQ, + 0x0000000072: keyR, + 0x0000000073: keyS, + 0x0000000074: keyT, + 0x0000000075: keyU, + 0x0000000076: keyV, + 0x0000000077: keyW, + 0x0000000078: keyX, + 0x0000000079: keyY, + 0x000000007a: keyZ, + 0x0000000031: digit1, + 0x0000000032: digit2, + 0x0000000033: digit3, + 0x0000000034: digit4, + 0x0000000035: digit5, + 0x0000000036: digit6, + 0x0000000037: digit7, + 0x0000000038: digit8, + 0x0000000039: digit9, + 0x0000000030: digit0, + 0x0100070028: enter, + 0x0100070029: escape, + 0x010007002a: backspace, + 0x010007002b: tab, + 0x0000000020: space, + 0x000000002d: minus, + 0x000000003d: equal, + 0x000000005b: bracketLeft, + 0x000000005d: bracketRight, + 0x000000005c: backslash, + 0x000000003b: semicolon, + 0x0000000027: quote, + 0x0000000060: backquote, + 0x000000002c: comma, + 0x000000002e: period, + 0x000000002f: slash, + 0x0100070039: capsLock, + 0x010007003a: f1, + 0x010007003b: f2, + 0x010007003c: f3, + 0x010007003d: f4, + 0x010007003e: f5, + 0x010007003f: f6, + 0x0100070040: f7, + 0x0100070041: f8, + 0x0100070042: f9, + 0x0100070043: f10, + 0x0100070044: f11, + 0x0100070045: f12, + 0x0100070046: printScreen, + 0x0100070047: scrollLock, + 0x0100070048: pause, + 0x0100070049: insert, + 0x010007004a: home, + 0x010007004b: pageUp, + 0x010007004c: delete, + 0x010007004d: end, + 0x010007004e: pageDown, + 0x010007004f: arrowRight, + 0x0100070050: arrowLeft, + 0x0100070051: arrowDown, + 0x0100070052: arrowUp, + 0x0100070053: numLock, + 0x0100070054: numpadDivide, + 0x0100070055: numpadMultiply, + 0x0100070056: numpadSubtract, + 0x0100070057: numpadAdd, + 0x0100070058: numpadEnter, + 0x0100070059: numpad1, + 0x010007005a: numpad2, + 0x010007005b: numpad3, + 0x010007005c: numpad4, + 0x010007005d: numpad5, + 0x010007005e: numpad6, + 0x010007005f: numpad7, + 0x0100070060: numpad8, + 0x0100070061: numpad9, + 0x0100070062: numpad0, + 0x0100070063: numpadDecimal, + 0x0100070064: intlBackslash, + 0x0100070065: contextMenu, + 0x0100070066: power, + 0x0100070067: numpadEqual, + 0x0100070068: f13, + 0x0100070069: f14, + 0x010007006a: f15, + 0x010007006b: f16, + 0x010007006c: f17, + 0x010007006d: f18, + 0x010007006e: f19, + 0x010007006f: f20, + 0x0100070070: f21, + 0x0100070071: f22, + 0x0100070072: f23, + 0x0100070073: f24, + 0x0100070074: open, + 0x0100070075: help, + 0x0100070077: select, + 0x0100070079: again, + 0x010007007a: undo, + 0x010007007b: cut, + 0x010007007c: copy, + 0x010007007d: paste, + 0x010007007e: find, + 0x010007007f: audioVolumeMute, + 0x0100070080: audioVolumeUp, + 0x0100070081: audioVolumeDown, + 0x0100070085: numpadComma, + 0x0100070087: intlRo, + 0x0100070088: kanaMode, + 0x0100070089: intlYen, + 0x010007008a: convert, + 0x010007008b: nonConvert, + 0x0100070090: lang1, + 0x0100070091: lang2, + 0x0100070092: lang3, + 0x0100070093: lang4, + 0x0100070094: lang5, + 0x010007009b: abort, + 0x01000700a3: props, + 0x01000700b6: numpadParenLeft, + 0x01000700b7: numpadParenRight, + 0x01000700bb: numpadBackspace, + 0x01000700d0: numpadMemoryStore, + 0x01000700d1: numpadMemoryRecall, + 0x01000700d2: numpadMemoryClear, + 0x01000700d3: numpadMemoryAdd, + 0x01000700d4: numpadMemorySubtract, + 0x01000700d7: numpadSignChange, + 0x01000700d8: numpadClear, + 0x01000700d9: numpadClearEntry, + 0x01000700e0: controlLeft, + 0x01000700e1: shiftLeft, + 0x01000700e2: altLeft, + 0x01000700e3: metaLeft, + 0x01000700e4: controlRight, + 0x01000700e5: shiftRight, + 0x01000700e6: altRight, + 0x01000700e7: metaRight, + 0x01000c0060: info, + 0x01000c0061: closedCaptionToggle, + 0x01000c006f: brightnessUp, + 0x01000c0070: brightnessDown, + 0x01000c0072: brightnessToggle, + 0x01000c0073: brightnessMinimum, + 0x01000c0074: brightnessMaximum, + 0x01000c0075: brightnessAuto, + 0x01000c0083: mediaLast, + 0x01000c008c: launchPhone, + 0x01000c008d: programGuide, + 0x01000c0094: exit, + 0x01000c009c: channelUp, + 0x01000c009d: channelDown, + 0x01000c00b0: mediaPlay, + 0x01000c00b2: mediaRecord, + 0x01000c00b3: mediaFastForward, + 0x01000c00b4: mediaRewind, + 0x01000c00b5: mediaTrackNext, + 0x01000c00b6: mediaTrackPrevious, + 0x01000c00b7: mediaStop, + 0x01000c00b8: eject, + 0x01000c00cd: mediaPlayPause, + 0x01000c00cf: speechInputToggle, + 0x01000c00e5: bassBoost, + 0x01000c0183: mediaSelect, + 0x01000c0184: launchWordProcessor, + 0x01000c0186: launchSpreadsheet, + 0x01000c018a: launchMail, + 0x01000c018d: launchContacts, + 0x01000c018e: launchCalendar, + 0x01000c0192: launchApp2, + 0x01000c0194: launchApp1, + 0x01000c0196: launchInternetBrowser, + 0x01000c019c: logOff, + 0x01000c019e: lockScreen, + 0x01000c019f: launchControlPanel, + 0x01000c01a2: selectTask, + 0x01000c01a7: launchDocuments, + 0x01000c01ab: spellCheck, + 0x01000c01ae: launchKeyboardLayout, + 0x01000c01b1: launchScreenSaver, + 0x01000c01b7: launchAudioBrowser, + 0x01000c0201: newKey, + 0x01000c0203: close, + 0x01000c0207: save, + 0x01000c0208: print, + 0x01000c0221: browserSearch, + 0x01000c0223: browserHome, + 0x01000c0224: browserBack, + 0x01000c0225: browserForward, + 0x01000c0226: browserStop, + 0x01000c0227: browserRefresh, + 0x01000c022a: browserFavorites, + 0x01000c022d: zoomIn, + 0x01000c022e: zoomOut, + 0x01000c0232: zoomToggle, + 0x01000c0279: redo, + 0x01000c0289: mailReply, + 0x01000c028b: mailForward, + 0x01000c028c: mailSend, + }; +} + +/// A class with static values that describe the keys that are returned from +/// [RawKeyEvent.physicalKey]. +/// +/// These represent *physical* keys, which are keys which represent a particular +/// key location on a QWERTY keyboard. It ignores any modifiers, modes, or +/// keyboard layouts which may be in effect. This is contrast to +/// [LogicalKeyboardKey], which represents a logical key interpreted in the +/// context of modifiers, modes, and/or keyboard layouts. +/// +/// As an example, if you wanted a game where the key next to the CAPS LOCK (the +/// "A" key on a QWERTY keyboard) moved the player to the left, you'd want to +/// look at the physical key to make sure that regardless of the character the +/// key produces, you got the key that is in that location on the keyboard. +/// +/// Conversely, if you wanted to implement an app where the "Q" key "quit" +/// something, you'd want to look at the logical key to detect this, since you +/// would like to have it match the key with "Q" on it, instead of always +/// looking for "the key next next to the TAB key", since on a French keyboard, +/// the key next to the TAB key has an "A" on it. +/// +/// {@tool snippet --template=stateful_widget} +/// This example shows how to detect if the user has selected the physical key +/// to the right of the CAPS LOCK key. +/// +/// ```dart imports +/// import 'package:flutter/services.dart'; +/// ``` +/// +/// ```dart +/// // The node used to request the keyboard focus. +/// final FocusNode _focusNode = FocusNode(); +/// // The message to display. +/// String _message; +/// +/// // Focus nodes need to be disposed. +/// @override +/// void dispose() { +/// _focusNode.dispose(); +/// super.dispose(); +/// } +/// +/// // Handles the key events from the RawKeyboardListener and update the +/// // _message. +/// void _handleKeyEvent(RawKeyEvent event) { +/// setState(() { +/// if (event.physicalKey == PhysicalKeyboardKey.keyA) { +/// _message = 'Pressed the key next to CAPS LOCK!'; +/// } else { +/// _message = 'Wrong key.'; +/// } +/// }); +/// } +/// +/// @override +/// Widget build(BuildContext context) { +/// final TextTheme textTheme = Theme.of(context).textTheme; +/// return Container( +/// color: Colors.white, +/// alignment: Alignment.center, +/// child: DefaultTextStyle( +/// style: textTheme.display1, +/// child: RawKeyboardListener( +/// focusNode: _focusNode, +/// onKey: _handleKeyEvent, +/// child: AnimatedBuilder( +/// animation: _focusNode, +/// builder: (BuildContext context, Widget child) { +/// if (!_focusNode.hasFocus) { +/// return GestureDetector( +/// onTap: () { +/// FocusScope.of(context).requestFocus(_focusNode); +/// }, +/// child: Text('Tap to focus'), +/// ); +/// } +/// return Text(_message ?? 'Press a key'); +/// }, +/// ), +/// ), +/// ), +/// ); +/// } +/// ``` +/// {@end-tool} +/// +/// See also: +/// +/// * [RawKeyEvent], the keyboard event object received by widgets that listen +/// to keyboard events. +/// * [RawKeyboardListener], a widget used to listen to and supply handlers for +/// keyboard events. +class PhysicalKeyboardKey extends Diagnosticable { + /// Creates a PhysicalKeyboardKey object with an optional debug name. + /// + /// The [usbHidUsage] must not be null. + /// + /// {@tool sample} + /// To save executable size, it is recommended that the [debugName] be null in + /// release mode. You can do this using the [kReleaseMode] constant. + /// + /// ```dart + /// const PhysicalKeyboardKey(0x0000ffff, debugName: kReleaseMode ? null : 'Special Key') + /// ``` + /// {@end-tool} + const PhysicalKeyboardKey(this.usbHidUsage, {this.debugName}) + : assert(usbHidUsage != null); + + /// The unique USB HID usage ID of this physical key on the keyboard. + /// + /// Due to the variations in platform APIs, this may not be the actual HID + /// usage code from the hardware, but a value derived from available + /// information on the platform. + /// + /// See + /// for the HID usage values and their meanings. + final int usbHidUsage; + + /// The debug string to print for this keyboard key, which will be null in + /// release mode. + final String debugName; + + /// Finds a known [PhysicalKeyboardKey] that matches the given USB HID usage + /// code. + static PhysicalKeyboardKey findKeyByCode(int usageCode) => _knownPhysicalKeys[usageCode]; + + @override + int get hashCode => usbHidUsage.hashCode; + + @override + bool operator ==(dynamic other) { + if (other.runtimeType != runtimeType) { + return false; + } + final PhysicalKeyboardKey typedOther = other; + return usbHidUsage == typedOther.usbHidUsage; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties.add(StringProperty('usbHidUsage', '0x${usbHidUsage.toRadixString(16).padLeft(8, '0')}', showName: true)); + properties.add(StringProperty('debugName', debugName, showName: true, defaultValue: null)); + } + + // Key constants for all keyboard keys in the USB HID specification at the + // time Flutter was built. + + /// Represents the location of the "None" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey none = PhysicalKeyboardKey(0x00000000, debugName: kReleaseMode ? null : 'None'); + + /// Represents the location of the "Hyper" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey hyper = PhysicalKeyboardKey(0x00000010, debugName: kReleaseMode ? null : 'Hyper'); + + /// Represents the location of the "Super Key" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey superKey = PhysicalKeyboardKey(0x00000011, debugName: kReleaseMode ? null : 'Super Key'); + + /// Represents the location of the "Fn" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey fn = PhysicalKeyboardKey(0x00000012, debugName: kReleaseMode ? null : 'Fn'); + + /// Represents the location of the "Fn Lock" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey fnLock = PhysicalKeyboardKey(0x00000013, debugName: kReleaseMode ? null : 'Fn Lock'); + + /// Represents the location of the "Suspend" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey suspend = PhysicalKeyboardKey(0x00000014, debugName: kReleaseMode ? null : 'Suspend'); + + /// Represents the location of the "Resume" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey resume = PhysicalKeyboardKey(0x00000015, debugName: kReleaseMode ? null : 'Resume'); + + /// Represents the location of the "Turbo" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey turbo = PhysicalKeyboardKey(0x00000016, debugName: kReleaseMode ? null : 'Turbo'); + + /// Represents the location of the "Launch Assistant" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey launchAssistant = PhysicalKeyboardKey(0x00000017, debugName: kReleaseMode ? null : 'Launch Assistant'); + + /// Represents the location of the "Sleep" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey sleep = PhysicalKeyboardKey(0x00010082, debugName: kReleaseMode ? null : 'Sleep'); + + /// Represents the location of the "Wake Up" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey wakeUp = PhysicalKeyboardKey(0x00010083, debugName: kReleaseMode ? null : 'Wake Up'); + + /// Represents the location of the "Usb Reserved" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey usbReserved = PhysicalKeyboardKey(0x00070000, debugName: kReleaseMode ? null : 'Usb Reserved'); + + /// Represents the location of the "Usb Error Roll Over" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey usbErrorRollOver = PhysicalKeyboardKey(0x00070001, debugName: kReleaseMode ? null : 'Usb Error Roll Over'); + + /// Represents the location of the "Usb Post Fail" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey usbPostFail = PhysicalKeyboardKey(0x00070002, debugName: kReleaseMode ? null : 'Usb Post Fail'); + + /// Represents the location of the "Usb Error Undefined" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey usbErrorUndefined = PhysicalKeyboardKey(0x00070003, debugName: kReleaseMode ? null : 'Usb Error Undefined'); + + /// Represents the location of the "Key A" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyA = PhysicalKeyboardKey(0x00070004, debugName: kReleaseMode ? null : 'Key A'); + + /// Represents the location of the "Key B" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyB = PhysicalKeyboardKey(0x00070005, debugName: kReleaseMode ? null : 'Key B'); + + /// Represents the location of the "Key C" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyC = PhysicalKeyboardKey(0x00070006, debugName: kReleaseMode ? null : 'Key C'); + + /// Represents the location of the "Key D" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyD = PhysicalKeyboardKey(0x00070007, debugName: kReleaseMode ? null : 'Key D'); + + /// Represents the location of the "Key E" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyE = PhysicalKeyboardKey(0x00070008, debugName: kReleaseMode ? null : 'Key E'); + + /// Represents the location of the "Key F" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyF = PhysicalKeyboardKey(0x00070009, debugName: kReleaseMode ? null : 'Key F'); + + /// Represents the location of the "Key G" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyG = PhysicalKeyboardKey(0x0007000a, debugName: kReleaseMode ? null : 'Key G'); + + /// Represents the location of the "Key H" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyH = PhysicalKeyboardKey(0x0007000b, debugName: kReleaseMode ? null : 'Key H'); + + /// Represents the location of the "Key I" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyI = PhysicalKeyboardKey(0x0007000c, debugName: kReleaseMode ? null : 'Key I'); + + /// Represents the location of the "Key J" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyJ = PhysicalKeyboardKey(0x0007000d, debugName: kReleaseMode ? null : 'Key J'); + + /// Represents the location of the "Key K" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyK = PhysicalKeyboardKey(0x0007000e, debugName: kReleaseMode ? null : 'Key K'); + + /// Represents the location of the "Key L" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyL = PhysicalKeyboardKey(0x0007000f, debugName: kReleaseMode ? null : 'Key L'); + + /// Represents the location of the "Key M" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyM = PhysicalKeyboardKey(0x00070010, debugName: kReleaseMode ? null : 'Key M'); + + /// Represents the location of the "Key N" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyN = PhysicalKeyboardKey(0x00070011, debugName: kReleaseMode ? null : 'Key N'); + + /// Represents the location of the "Key O" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyO = PhysicalKeyboardKey(0x00070012, debugName: kReleaseMode ? null : 'Key O'); + + /// Represents the location of the "Key P" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyP = PhysicalKeyboardKey(0x00070013, debugName: kReleaseMode ? null : 'Key P'); + + /// Represents the location of the "Key Q" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyQ = PhysicalKeyboardKey(0x00070014, debugName: kReleaseMode ? null : 'Key Q'); + + /// Represents the location of the "Key R" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyR = PhysicalKeyboardKey(0x00070015, debugName: kReleaseMode ? null : 'Key R'); + + /// Represents the location of the "Key S" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyS = PhysicalKeyboardKey(0x00070016, debugName: kReleaseMode ? null : 'Key S'); + + /// Represents the location of the "Key T" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyT = PhysicalKeyboardKey(0x00070017, debugName: kReleaseMode ? null : 'Key T'); + + /// Represents the location of the "Key U" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyU = PhysicalKeyboardKey(0x00070018, debugName: kReleaseMode ? null : 'Key U'); + + /// Represents the location of the "Key V" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyV = PhysicalKeyboardKey(0x00070019, debugName: kReleaseMode ? null : 'Key V'); + + /// Represents the location of the "Key W" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyW = PhysicalKeyboardKey(0x0007001a, debugName: kReleaseMode ? null : 'Key W'); + + /// Represents the location of the "Key X" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyX = PhysicalKeyboardKey(0x0007001b, debugName: kReleaseMode ? null : 'Key X'); + + /// Represents the location of the "Key Y" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyY = PhysicalKeyboardKey(0x0007001c, debugName: kReleaseMode ? null : 'Key Y'); + + /// Represents the location of the "Key Z" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey keyZ = PhysicalKeyboardKey(0x0007001d, debugName: kReleaseMode ? null : 'Key Z'); + + /// Represents the location of the "Digit 1" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey digit1 = PhysicalKeyboardKey(0x0007001e, debugName: kReleaseMode ? null : 'Digit 1'); + + /// Represents the location of the "Digit 2" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey digit2 = PhysicalKeyboardKey(0x0007001f, debugName: kReleaseMode ? null : 'Digit 2'); + + /// Represents the location of the "Digit 3" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey digit3 = PhysicalKeyboardKey(0x00070020, debugName: kReleaseMode ? null : 'Digit 3'); + + /// Represents the location of the "Digit 4" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey digit4 = PhysicalKeyboardKey(0x00070021, debugName: kReleaseMode ? null : 'Digit 4'); + + /// Represents the location of the "Digit 5" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey digit5 = PhysicalKeyboardKey(0x00070022, debugName: kReleaseMode ? null : 'Digit 5'); + + /// Represents the location of the "Digit 6" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey digit6 = PhysicalKeyboardKey(0x00070023, debugName: kReleaseMode ? null : 'Digit 6'); + + /// Represents the location of the "Digit 7" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey digit7 = PhysicalKeyboardKey(0x00070024, debugName: kReleaseMode ? null : 'Digit 7'); + + /// Represents the location of the "Digit 8" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey digit8 = PhysicalKeyboardKey(0x00070025, debugName: kReleaseMode ? null : 'Digit 8'); + + /// Represents the location of the "Digit 9" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey digit9 = PhysicalKeyboardKey(0x00070026, debugName: kReleaseMode ? null : 'Digit 9'); + + /// Represents the location of the "Digit 0" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey digit0 = PhysicalKeyboardKey(0x00070027, debugName: kReleaseMode ? null : 'Digit 0'); + + /// Represents the location of the "Enter" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey enter = PhysicalKeyboardKey(0x00070028, debugName: kReleaseMode ? null : 'Enter'); + + /// Represents the location of the "Escape" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey escape = PhysicalKeyboardKey(0x00070029, debugName: kReleaseMode ? null : 'Escape'); + + /// Represents the location of the "Backspace" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey backspace = PhysicalKeyboardKey(0x0007002a, debugName: kReleaseMode ? null : 'Backspace'); + + /// Represents the location of the "Tab" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey tab = PhysicalKeyboardKey(0x0007002b, debugName: kReleaseMode ? null : 'Tab'); + + /// Represents the location of the "Space" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey space = PhysicalKeyboardKey(0x0007002c, debugName: kReleaseMode ? null : 'Space'); + + /// Represents the location of the "Minus" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey minus = PhysicalKeyboardKey(0x0007002d, debugName: kReleaseMode ? null : 'Minus'); + + /// Represents the location of the "Equal" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey equal = PhysicalKeyboardKey(0x0007002e, debugName: kReleaseMode ? null : 'Equal'); + + /// Represents the location of the "Bracket Left" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey bracketLeft = PhysicalKeyboardKey(0x0007002f, debugName: kReleaseMode ? null : 'Bracket Left'); + + /// Represents the location of the "Bracket Right" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey bracketRight = PhysicalKeyboardKey(0x00070030, debugName: kReleaseMode ? null : 'Bracket Right'); + + /// Represents the location of the "Backslash" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey backslash = PhysicalKeyboardKey(0x00070031, debugName: kReleaseMode ? null : 'Backslash'); + + /// Represents the location of the "Semicolon" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey semicolon = PhysicalKeyboardKey(0x00070033, debugName: kReleaseMode ? null : 'Semicolon'); + + /// Represents the location of the "Quote" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey quote = PhysicalKeyboardKey(0x00070034, debugName: kReleaseMode ? null : 'Quote'); + + /// Represents the location of the "Backquote" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey backquote = PhysicalKeyboardKey(0x00070035, debugName: kReleaseMode ? null : 'Backquote'); + + /// Represents the location of the "Comma" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey comma = PhysicalKeyboardKey(0x00070036, debugName: kReleaseMode ? null : 'Comma'); + + /// Represents the location of the "Period" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey period = PhysicalKeyboardKey(0x00070037, debugName: kReleaseMode ? null : 'Period'); + + /// Represents the location of the "Slash" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey slash = PhysicalKeyboardKey(0x00070038, debugName: kReleaseMode ? null : 'Slash'); + + /// Represents the location of the "Caps Lock" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey capsLock = PhysicalKeyboardKey(0x00070039, debugName: kReleaseMode ? null : 'Caps Lock'); + + /// Represents the location of the "F1" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey f1 = PhysicalKeyboardKey(0x0007003a, debugName: kReleaseMode ? null : 'F1'); + + /// Represents the location of the "F2" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey f2 = PhysicalKeyboardKey(0x0007003b, debugName: kReleaseMode ? null : 'F2'); + + /// Represents the location of the "F3" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey f3 = PhysicalKeyboardKey(0x0007003c, debugName: kReleaseMode ? null : 'F3'); + + /// Represents the location of the "F4" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey f4 = PhysicalKeyboardKey(0x0007003d, debugName: kReleaseMode ? null : 'F4'); + + /// Represents the location of the "F5" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey f5 = PhysicalKeyboardKey(0x0007003e, debugName: kReleaseMode ? null : 'F5'); + + /// Represents the location of the "F6" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey f6 = PhysicalKeyboardKey(0x0007003f, debugName: kReleaseMode ? null : 'F6'); + + /// Represents the location of the "F7" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey f7 = PhysicalKeyboardKey(0x00070040, debugName: kReleaseMode ? null : 'F7'); + + /// Represents the location of the "F8" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey f8 = PhysicalKeyboardKey(0x00070041, debugName: kReleaseMode ? null : 'F8'); + + /// Represents the location of the "F9" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey f9 = PhysicalKeyboardKey(0x00070042, debugName: kReleaseMode ? null : 'F9'); + + /// Represents the location of the "F10" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey f10 = PhysicalKeyboardKey(0x00070043, debugName: kReleaseMode ? null : 'F10'); + + /// Represents the location of the "F11" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey f11 = PhysicalKeyboardKey(0x00070044, debugName: kReleaseMode ? null : 'F11'); + + /// Represents the location of the "F12" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey f12 = PhysicalKeyboardKey(0x00070045, debugName: kReleaseMode ? null : 'F12'); + + /// Represents the location of the "Print Screen" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey printScreen = PhysicalKeyboardKey(0x00070046, debugName: kReleaseMode ? null : 'Print Screen'); + + /// Represents the location of the "Scroll Lock" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey scrollLock = PhysicalKeyboardKey(0x00070047, debugName: kReleaseMode ? null : 'Scroll Lock'); + + /// Represents the location of the "Pause" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey pause = PhysicalKeyboardKey(0x00070048, debugName: kReleaseMode ? null : 'Pause'); + + /// Represents the location of the "Insert" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey insert = PhysicalKeyboardKey(0x00070049, debugName: kReleaseMode ? null : 'Insert'); + + /// Represents the location of the "Home" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey home = PhysicalKeyboardKey(0x0007004a, debugName: kReleaseMode ? null : 'Home'); + + /// Represents the location of the "Page Up" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey pageUp = PhysicalKeyboardKey(0x0007004b, debugName: kReleaseMode ? null : 'Page Up'); + + /// Represents the location of the "Delete" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey delete = PhysicalKeyboardKey(0x0007004c, debugName: kReleaseMode ? null : 'Delete'); + + /// Represents the location of the "End" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey end = PhysicalKeyboardKey(0x0007004d, debugName: kReleaseMode ? null : 'End'); + + /// Represents the location of the "Page Down" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey pageDown = PhysicalKeyboardKey(0x0007004e, debugName: kReleaseMode ? null : 'Page Down'); + + /// Represents the location of the "Arrow Right" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey arrowRight = PhysicalKeyboardKey(0x0007004f, debugName: kReleaseMode ? null : 'Arrow Right'); + + /// Represents the location of the "Arrow Left" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey arrowLeft = PhysicalKeyboardKey(0x00070050, debugName: kReleaseMode ? null : 'Arrow Left'); + + /// Represents the location of the "Arrow Down" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey arrowDown = PhysicalKeyboardKey(0x00070051, debugName: kReleaseMode ? null : 'Arrow Down'); + + /// Represents the location of the "Arrow Up" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey arrowUp = PhysicalKeyboardKey(0x00070052, debugName: kReleaseMode ? null : 'Arrow Up'); + + /// Represents the location of the "Num Lock" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numLock = PhysicalKeyboardKey(0x00070053, debugName: kReleaseMode ? null : 'Num Lock'); + + /// Represents the location of the "Numpad Divide" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpadDivide = PhysicalKeyboardKey(0x00070054, debugName: kReleaseMode ? null : 'Numpad Divide'); + + /// Represents the location of the "Numpad Multiply" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpadMultiply = PhysicalKeyboardKey(0x00070055, debugName: kReleaseMode ? null : 'Numpad Multiply'); + + /// Represents the location of the "Numpad Subtract" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpadSubtract = PhysicalKeyboardKey(0x00070056, debugName: kReleaseMode ? null : 'Numpad Subtract'); + + /// Represents the location of the "Numpad Add" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpadAdd = PhysicalKeyboardKey(0x00070057, debugName: kReleaseMode ? null : 'Numpad Add'); + + /// Represents the location of the "Numpad Enter" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpadEnter = PhysicalKeyboardKey(0x00070058, debugName: kReleaseMode ? null : 'Numpad Enter'); + + /// Represents the location of the "Numpad 1" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpad1 = PhysicalKeyboardKey(0x00070059, debugName: kReleaseMode ? null : 'Numpad 1'); + + /// Represents the location of the "Numpad 2" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpad2 = PhysicalKeyboardKey(0x0007005a, debugName: kReleaseMode ? null : 'Numpad 2'); + + /// Represents the location of the "Numpad 3" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpad3 = PhysicalKeyboardKey(0x0007005b, debugName: kReleaseMode ? null : 'Numpad 3'); + + /// Represents the location of the "Numpad 4" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpad4 = PhysicalKeyboardKey(0x0007005c, debugName: kReleaseMode ? null : 'Numpad 4'); + + /// Represents the location of the "Numpad 5" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpad5 = PhysicalKeyboardKey(0x0007005d, debugName: kReleaseMode ? null : 'Numpad 5'); + + /// Represents the location of the "Numpad 6" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpad6 = PhysicalKeyboardKey(0x0007005e, debugName: kReleaseMode ? null : 'Numpad 6'); + + /// Represents the location of the "Numpad 7" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpad7 = PhysicalKeyboardKey(0x0007005f, debugName: kReleaseMode ? null : 'Numpad 7'); + + /// Represents the location of the "Numpad 8" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpad8 = PhysicalKeyboardKey(0x00070060, debugName: kReleaseMode ? null : 'Numpad 8'); + + /// Represents the location of the "Numpad 9" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpad9 = PhysicalKeyboardKey(0x00070061, debugName: kReleaseMode ? null : 'Numpad 9'); + + /// Represents the location of the "Numpad 0" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpad0 = PhysicalKeyboardKey(0x00070062, debugName: kReleaseMode ? null : 'Numpad 0'); + + /// Represents the location of the "Numpad Decimal" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpadDecimal = PhysicalKeyboardKey(0x00070063, debugName: kReleaseMode ? null : 'Numpad Decimal'); + + /// Represents the location of the "Intl Backslash" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey intlBackslash = PhysicalKeyboardKey(0x00070064, debugName: kReleaseMode ? null : 'Intl Backslash'); + + /// Represents the location of the "Context Menu" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey contextMenu = PhysicalKeyboardKey(0x00070065, debugName: kReleaseMode ? null : 'Context Menu'); + + /// Represents the location of the "Power" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey power = PhysicalKeyboardKey(0x00070066, debugName: kReleaseMode ? null : 'Power'); + + /// Represents the location of the "Numpad Equal" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpadEqual = PhysicalKeyboardKey(0x00070067, debugName: kReleaseMode ? null : 'Numpad Equal'); + + /// Represents the location of the "F13" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey f13 = PhysicalKeyboardKey(0x00070068, debugName: kReleaseMode ? null : 'F13'); + + /// Represents the location of the "F14" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey f14 = PhysicalKeyboardKey(0x00070069, debugName: kReleaseMode ? null : 'F14'); + + /// Represents the location of the "F15" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey f15 = PhysicalKeyboardKey(0x0007006a, debugName: kReleaseMode ? null : 'F15'); + + /// Represents the location of the "F16" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey f16 = PhysicalKeyboardKey(0x0007006b, debugName: kReleaseMode ? null : 'F16'); + + /// Represents the location of the "F17" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey f17 = PhysicalKeyboardKey(0x0007006c, debugName: kReleaseMode ? null : 'F17'); + + /// Represents the location of the "F18" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey f18 = PhysicalKeyboardKey(0x0007006d, debugName: kReleaseMode ? null : 'F18'); + + /// Represents the location of the "F19" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey f19 = PhysicalKeyboardKey(0x0007006e, debugName: kReleaseMode ? null : 'F19'); + + /// Represents the location of the "F20" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey f20 = PhysicalKeyboardKey(0x0007006f, debugName: kReleaseMode ? null : 'F20'); + + /// Represents the location of the "F21" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey f21 = PhysicalKeyboardKey(0x00070070, debugName: kReleaseMode ? null : 'F21'); + + /// Represents the location of the "F22" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey f22 = PhysicalKeyboardKey(0x00070071, debugName: kReleaseMode ? null : 'F22'); + + /// Represents the location of the "F23" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey f23 = PhysicalKeyboardKey(0x00070072, debugName: kReleaseMode ? null : 'F23'); + + /// Represents the location of the "F24" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey f24 = PhysicalKeyboardKey(0x00070073, debugName: kReleaseMode ? null : 'F24'); + + /// Represents the location of the "Open" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey open = PhysicalKeyboardKey(0x00070074, debugName: kReleaseMode ? null : 'Open'); + + /// Represents the location of the "Help" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey help = PhysicalKeyboardKey(0x00070075, debugName: kReleaseMode ? null : 'Help'); + + /// Represents the location of the "Select" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey select = PhysicalKeyboardKey(0x00070077, debugName: kReleaseMode ? null : 'Select'); + + /// Represents the location of the "Again" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey again = PhysicalKeyboardKey(0x00070079, debugName: kReleaseMode ? null : 'Again'); + + /// Represents the location of the "Undo" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey undo = PhysicalKeyboardKey(0x0007007a, debugName: kReleaseMode ? null : 'Undo'); + + /// Represents the location of the "Cut" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey cut = PhysicalKeyboardKey(0x0007007b, debugName: kReleaseMode ? null : 'Cut'); + + /// Represents the location of the "Copy" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey copy = PhysicalKeyboardKey(0x0007007c, debugName: kReleaseMode ? null : 'Copy'); + + /// Represents the location of the "Paste" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey paste = PhysicalKeyboardKey(0x0007007d, debugName: kReleaseMode ? null : 'Paste'); + + /// Represents the location of the "Find" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey find = PhysicalKeyboardKey(0x0007007e, debugName: kReleaseMode ? null : 'Find'); + + /// Represents the location of the "Audio Volume Mute" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey audioVolumeMute = PhysicalKeyboardKey(0x0007007f, debugName: kReleaseMode ? null : 'Audio Volume Mute'); + + /// Represents the location of the "Audio Volume Up" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey audioVolumeUp = PhysicalKeyboardKey(0x00070080, debugName: kReleaseMode ? null : 'Audio Volume Up'); + + /// Represents the location of the "Audio Volume Down" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey audioVolumeDown = PhysicalKeyboardKey(0x00070081, debugName: kReleaseMode ? null : 'Audio Volume Down'); + + /// Represents the location of the "Numpad Comma" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpadComma = PhysicalKeyboardKey(0x00070085, debugName: kReleaseMode ? null : 'Numpad Comma'); + + /// Represents the location of the "Intl Ro" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey intlRo = PhysicalKeyboardKey(0x00070087, debugName: kReleaseMode ? null : 'Intl Ro'); + + /// Represents the location of the "Kana Mode" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey kanaMode = PhysicalKeyboardKey(0x00070088, debugName: kReleaseMode ? null : 'Kana Mode'); + + /// Represents the location of the "Intl Yen" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey intlYen = PhysicalKeyboardKey(0x00070089, debugName: kReleaseMode ? null : 'Intl Yen'); + + /// Represents the location of the "Convert" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey convert = PhysicalKeyboardKey(0x0007008a, debugName: kReleaseMode ? null : 'Convert'); + + /// Represents the location of the "Non Convert" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey nonConvert = PhysicalKeyboardKey(0x0007008b, debugName: kReleaseMode ? null : 'Non Convert'); + + /// Represents the location of the "Lang 1" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey lang1 = PhysicalKeyboardKey(0x00070090, debugName: kReleaseMode ? null : 'Lang 1'); + + /// Represents the location of the "Lang 2" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey lang2 = PhysicalKeyboardKey(0x00070091, debugName: kReleaseMode ? null : 'Lang 2'); + + /// Represents the location of the "Lang 3" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey lang3 = PhysicalKeyboardKey(0x00070092, debugName: kReleaseMode ? null : 'Lang 3'); + + /// Represents the location of the "Lang 4" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey lang4 = PhysicalKeyboardKey(0x00070093, debugName: kReleaseMode ? null : 'Lang 4'); + + /// Represents the location of the "Lang 5" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey lang5 = PhysicalKeyboardKey(0x00070094, debugName: kReleaseMode ? null : 'Lang 5'); + + /// Represents the location of the "Abort" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey abort = PhysicalKeyboardKey(0x0007009b, debugName: kReleaseMode ? null : 'Abort'); + + /// Represents the location of the "Props" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey props = PhysicalKeyboardKey(0x000700a3, debugName: kReleaseMode ? null : 'Props'); + + /// Represents the location of the "Numpad Paren Left" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpadParenLeft = PhysicalKeyboardKey(0x000700b6, debugName: kReleaseMode ? null : 'Numpad Paren Left'); + + /// Represents the location of the "Numpad Paren Right" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpadParenRight = PhysicalKeyboardKey(0x000700b7, debugName: kReleaseMode ? null : 'Numpad Paren Right'); + + /// Represents the location of the "Numpad Backspace" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpadBackspace = PhysicalKeyboardKey(0x000700bb, debugName: kReleaseMode ? null : 'Numpad Backspace'); + + /// Represents the location of the "Numpad Memory Store" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpadMemoryStore = PhysicalKeyboardKey(0x000700d0, debugName: kReleaseMode ? null : 'Numpad Memory Store'); + + /// Represents the location of the "Numpad Memory Recall" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpadMemoryRecall = PhysicalKeyboardKey(0x000700d1, debugName: kReleaseMode ? null : 'Numpad Memory Recall'); + + /// Represents the location of the "Numpad Memory Clear" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpadMemoryClear = PhysicalKeyboardKey(0x000700d2, debugName: kReleaseMode ? null : 'Numpad Memory Clear'); + + /// Represents the location of the "Numpad Memory Add" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpadMemoryAdd = PhysicalKeyboardKey(0x000700d3, debugName: kReleaseMode ? null : 'Numpad Memory Add'); + + /// Represents the location of the "Numpad Memory Subtract" key on a + /// generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpadMemorySubtract = PhysicalKeyboardKey(0x000700d4, debugName: kReleaseMode ? null : 'Numpad Memory Subtract'); + + /// Represents the location of the "Numpad Sign Change" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpadSignChange = PhysicalKeyboardKey(0x000700d7, debugName: kReleaseMode ? null : 'Numpad Sign Change'); + + /// Represents the location of the "Numpad Clear" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpadClear = PhysicalKeyboardKey(0x000700d8, debugName: kReleaseMode ? null : 'Numpad Clear'); + + /// Represents the location of the "Numpad Clear Entry" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey numpadClearEntry = PhysicalKeyboardKey(0x000700d9, debugName: kReleaseMode ? null : 'Numpad Clear Entry'); + + /// Represents the location of the "Control Left" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey controlLeft = PhysicalKeyboardKey(0x000700e0, debugName: kReleaseMode ? null : 'Control Left'); + + /// Represents the location of the "Shift Left" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey shiftLeft = PhysicalKeyboardKey(0x000700e1, debugName: kReleaseMode ? null : 'Shift Left'); + + /// Represents the location of the "Alt Left" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey altLeft = PhysicalKeyboardKey(0x000700e2, debugName: kReleaseMode ? null : 'Alt Left'); + + /// Represents the location of the "Meta Left" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey metaLeft = PhysicalKeyboardKey(0x000700e3, debugName: kReleaseMode ? null : 'Meta Left'); + + /// Represents the location of the "Control Right" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey controlRight = PhysicalKeyboardKey(0x000700e4, debugName: kReleaseMode ? null : 'Control Right'); + + /// Represents the location of the "Shift Right" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey shiftRight = PhysicalKeyboardKey(0x000700e5, debugName: kReleaseMode ? null : 'Shift Right'); + + /// Represents the location of the "Alt Right" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey altRight = PhysicalKeyboardKey(0x000700e6, debugName: kReleaseMode ? null : 'Alt Right'); + + /// Represents the location of the "Meta Right" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey metaRight = PhysicalKeyboardKey(0x000700e7, debugName: kReleaseMode ? null : 'Meta Right'); + + /// Represents the location of the "Info" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey info = PhysicalKeyboardKey(0x000c0060, debugName: kReleaseMode ? null : 'Info'); + + /// Represents the location of the "Closed Caption Toggle" key on a + /// generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey closedCaptionToggle = PhysicalKeyboardKey(0x000c0061, debugName: kReleaseMode ? null : 'Closed Caption Toggle'); + + /// Represents the location of the "Brightness Up" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey brightnessUp = PhysicalKeyboardKey(0x000c006f, debugName: kReleaseMode ? null : 'Brightness Up'); + + /// Represents the location of the "Brightness Down" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey brightnessDown = PhysicalKeyboardKey(0x000c0070, debugName: kReleaseMode ? null : 'Brightness Down'); + + /// Represents the location of the "Brightness Toggle" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey brightnessToggle = PhysicalKeyboardKey(0x000c0072, debugName: kReleaseMode ? null : 'Brightness Toggle'); + + /// Represents the location of the "Brightness Minimum" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey brightnessMinimum = PhysicalKeyboardKey(0x000c0073, debugName: kReleaseMode ? null : 'Brightness Minimum'); + + /// Represents the location of the "Brightness Maximum" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey brightnessMaximum = PhysicalKeyboardKey(0x000c0074, debugName: kReleaseMode ? null : 'Brightness Maximum'); + + /// Represents the location of the "Brightness Auto" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey brightnessAuto = PhysicalKeyboardKey(0x000c0075, debugName: kReleaseMode ? null : 'Brightness Auto'); + + /// Represents the location of the "Media Last" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey mediaLast = PhysicalKeyboardKey(0x000c0083, debugName: kReleaseMode ? null : 'Media Last'); + + /// Represents the location of the "Launch Phone" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey launchPhone = PhysicalKeyboardKey(0x000c008c, debugName: kReleaseMode ? null : 'Launch Phone'); + + /// Represents the location of the "Program Guide" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey programGuide = PhysicalKeyboardKey(0x000c008d, debugName: kReleaseMode ? null : 'Program Guide'); + + /// Represents the location of the "Exit" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey exit = PhysicalKeyboardKey(0x000c0094, debugName: kReleaseMode ? null : 'Exit'); + + /// Represents the location of the "Channel Up" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey channelUp = PhysicalKeyboardKey(0x000c009c, debugName: kReleaseMode ? null : 'Channel Up'); + + /// Represents the location of the "Channel Down" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey channelDown = PhysicalKeyboardKey(0x000c009d, debugName: kReleaseMode ? null : 'Channel Down'); + + /// Represents the location of the "Media Play" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey mediaPlay = PhysicalKeyboardKey(0x000c00b0, debugName: kReleaseMode ? null : 'Media Play'); + + /// Represents the location of the "Media Record" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey mediaRecord = PhysicalKeyboardKey(0x000c00b2, debugName: kReleaseMode ? null : 'Media Record'); + + /// Represents the location of the "Media Fast Forward" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey mediaFastForward = PhysicalKeyboardKey(0x000c00b3, debugName: kReleaseMode ? null : 'Media Fast Forward'); + + /// Represents the location of the "Media Rewind" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey mediaRewind = PhysicalKeyboardKey(0x000c00b4, debugName: kReleaseMode ? null : 'Media Rewind'); + + /// Represents the location of the "Media Track Next" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey mediaTrackNext = PhysicalKeyboardKey(0x000c00b5, debugName: kReleaseMode ? null : 'Media Track Next'); + + /// Represents the location of the "Media Track Previous" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey mediaTrackPrevious = PhysicalKeyboardKey(0x000c00b6, debugName: kReleaseMode ? null : 'Media Track Previous'); + + /// Represents the location of the "Media Stop" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey mediaStop = PhysicalKeyboardKey(0x000c00b7, debugName: kReleaseMode ? null : 'Media Stop'); + + /// Represents the location of the "Eject" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey eject = PhysicalKeyboardKey(0x000c00b8, debugName: kReleaseMode ? null : 'Eject'); + + /// Represents the location of the "Media Play Pause" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey mediaPlayPause = PhysicalKeyboardKey(0x000c00cd, debugName: kReleaseMode ? null : 'Media Play Pause'); + + /// Represents the location of the "Speech Input Toggle" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey speechInputToggle = PhysicalKeyboardKey(0x000c00cf, debugName: kReleaseMode ? null : 'Speech Input Toggle'); + + /// Represents the location of the "Bass Boost" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey bassBoost = PhysicalKeyboardKey(0x000c00e5, debugName: kReleaseMode ? null : 'Bass Boost'); + + /// Represents the location of the "Media Select" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey mediaSelect = PhysicalKeyboardKey(0x000c0183, debugName: kReleaseMode ? null : 'Media Select'); + + /// Represents the location of the "Launch Word Processor" key on a + /// generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey launchWordProcessor = PhysicalKeyboardKey(0x000c0184, debugName: kReleaseMode ? null : 'Launch Word Processor'); + + /// Represents the location of the "Launch Spreadsheet" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey launchSpreadsheet = PhysicalKeyboardKey(0x000c0186, debugName: kReleaseMode ? null : 'Launch Spreadsheet'); + + /// Represents the location of the "Launch Mail" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey launchMail = PhysicalKeyboardKey(0x000c018a, debugName: kReleaseMode ? null : 'Launch Mail'); + + /// Represents the location of the "Launch Contacts" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey launchContacts = PhysicalKeyboardKey(0x000c018d, debugName: kReleaseMode ? null : 'Launch Contacts'); + + /// Represents the location of the "Launch Calendar" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey launchCalendar = PhysicalKeyboardKey(0x000c018e, debugName: kReleaseMode ? null : 'Launch Calendar'); + + /// Represents the location of the "Launch App2" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey launchApp2 = PhysicalKeyboardKey(0x000c0192, debugName: kReleaseMode ? null : 'Launch App2'); + + /// Represents the location of the "Launch App1" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey launchApp1 = PhysicalKeyboardKey(0x000c0194, debugName: kReleaseMode ? null : 'Launch App1'); + + /// Represents the location of the "Launch Internet Browser" key on a + /// generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey launchInternetBrowser = PhysicalKeyboardKey(0x000c0196, debugName: kReleaseMode ? null : 'Launch Internet Browser'); + + /// Represents the location of the "Log Off" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey logOff = PhysicalKeyboardKey(0x000c019c, debugName: kReleaseMode ? null : 'Log Off'); + + /// Represents the location of the "Lock Screen" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey lockScreen = PhysicalKeyboardKey(0x000c019e, debugName: kReleaseMode ? null : 'Lock Screen'); + + /// Represents the location of the "Launch Control Panel" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey launchControlPanel = PhysicalKeyboardKey(0x000c019f, debugName: kReleaseMode ? null : 'Launch Control Panel'); + + /// Represents the location of the "Select Task" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey selectTask = PhysicalKeyboardKey(0x000c01a2, debugName: kReleaseMode ? null : 'Select Task'); + + /// Represents the location of the "Launch Documents" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey launchDocuments = PhysicalKeyboardKey(0x000c01a7, debugName: kReleaseMode ? null : 'Launch Documents'); + + /// Represents the location of the "Spell Check" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey spellCheck = PhysicalKeyboardKey(0x000c01ab, debugName: kReleaseMode ? null : 'Spell Check'); + + /// Represents the location of the "Launch Keyboard Layout" key on a + /// generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey launchKeyboardLayout = PhysicalKeyboardKey(0x000c01ae, debugName: kReleaseMode ? null : 'Launch Keyboard Layout'); + + /// Represents the location of the "Launch Screen Saver" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey launchScreenSaver = PhysicalKeyboardKey(0x000c01b1, debugName: kReleaseMode ? null : 'Launch Screen Saver'); + + /// Represents the location of the "Launch Audio Browser" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey launchAudioBrowser = PhysicalKeyboardKey(0x000c01b7, debugName: kReleaseMode ? null : 'Launch Audio Browser'); + + /// Represents the location of the "New Key" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey newKey = PhysicalKeyboardKey(0x000c0201, debugName: kReleaseMode ? null : 'New Key'); + + /// Represents the location of the "Close" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey close = PhysicalKeyboardKey(0x000c0203, debugName: kReleaseMode ? null : 'Close'); + + /// Represents the location of the "Save" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey save = PhysicalKeyboardKey(0x000c0207, debugName: kReleaseMode ? null : 'Save'); + + /// Represents the location of the "Print" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey print = PhysicalKeyboardKey(0x000c0208, debugName: kReleaseMode ? null : 'Print'); + + /// Represents the location of the "Browser Search" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey browserSearch = PhysicalKeyboardKey(0x000c0221, debugName: kReleaseMode ? null : 'Browser Search'); + + /// Represents the location of the "Browser Home" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey browserHome = PhysicalKeyboardKey(0x000c0223, debugName: kReleaseMode ? null : 'Browser Home'); + + /// Represents the location of the "Browser Back" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey browserBack = PhysicalKeyboardKey(0x000c0224, debugName: kReleaseMode ? null : 'Browser Back'); + + /// Represents the location of the "Browser Forward" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey browserForward = PhysicalKeyboardKey(0x000c0225, debugName: kReleaseMode ? null : 'Browser Forward'); + + /// Represents the location of the "Browser Stop" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey browserStop = PhysicalKeyboardKey(0x000c0226, debugName: kReleaseMode ? null : 'Browser Stop'); + + /// Represents the location of the "Browser Refresh" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey browserRefresh = PhysicalKeyboardKey(0x000c0227, debugName: kReleaseMode ? null : 'Browser Refresh'); + + /// Represents the location of the "Browser Favorites" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey browserFavorites = PhysicalKeyboardKey(0x000c022a, debugName: kReleaseMode ? null : 'Browser Favorites'); + + /// Represents the location of the "Zoom In" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey zoomIn = PhysicalKeyboardKey(0x000c022d, debugName: kReleaseMode ? null : 'Zoom In'); + + /// Represents the location of the "Zoom Out" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey zoomOut = PhysicalKeyboardKey(0x000c022e, debugName: kReleaseMode ? null : 'Zoom Out'); + + /// Represents the location of the "Zoom Toggle" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey zoomToggle = PhysicalKeyboardKey(0x000c0232, debugName: kReleaseMode ? null : 'Zoom Toggle'); + + /// Represents the location of the "Redo" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey redo = PhysicalKeyboardKey(0x000c0279, debugName: kReleaseMode ? null : 'Redo'); + + /// Represents the location of the "Mail Reply" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey mailReply = PhysicalKeyboardKey(0x000c0289, debugName: kReleaseMode ? null : 'Mail Reply'); + + /// Represents the location of the "Mail Forward" key on a generalized + /// keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey mailForward = PhysicalKeyboardKey(0x000c028b, debugName: kReleaseMode ? null : 'Mail Forward'); + + /// Represents the location of the "Mail Send" key on a generalized keyboard. + /// + /// See the function [RawKeyEvent.physicalKey] for more information. + static const PhysicalKeyboardKey mailSend = PhysicalKeyboardKey(0x000c028c, debugName: kReleaseMode ? null : 'Mail Send'); + + // A list of all the predefined constant PhysicalKeyboardKeys so that they + // can be searched. + static const Map _knownPhysicalKeys = { + 0x00000000: none, + 0x00000010: hyper, + 0x00000011: superKey, + 0x00000012: fn, + 0x00000013: fnLock, + 0x00000014: suspend, + 0x00000015: resume, + 0x00000016: turbo, + 0x00000017: launchAssistant, + 0x00010082: sleep, + 0x00010083: wakeUp, + 0x00070000: usbReserved, + 0x00070001: usbErrorRollOver, + 0x00070002: usbPostFail, + 0x00070003: usbErrorUndefined, + 0x00070004: keyA, + 0x00070005: keyB, + 0x00070006: keyC, + 0x00070007: keyD, + 0x00070008: keyE, + 0x00070009: keyF, + 0x0007000a: keyG, + 0x0007000b: keyH, + 0x0007000c: keyI, + 0x0007000d: keyJ, + 0x0007000e: keyK, + 0x0007000f: keyL, + 0x00070010: keyM, + 0x00070011: keyN, + 0x00070012: keyO, + 0x00070013: keyP, + 0x00070014: keyQ, + 0x00070015: keyR, + 0x00070016: keyS, + 0x00070017: keyT, + 0x00070018: keyU, + 0x00070019: keyV, + 0x0007001a: keyW, + 0x0007001b: keyX, + 0x0007001c: keyY, + 0x0007001d: keyZ, + 0x0007001e: digit1, + 0x0007001f: digit2, + 0x00070020: digit3, + 0x00070021: digit4, + 0x00070022: digit5, + 0x00070023: digit6, + 0x00070024: digit7, + 0x00070025: digit8, + 0x00070026: digit9, + 0x00070027: digit0, + 0x00070028: enter, + 0x00070029: escape, + 0x0007002a: backspace, + 0x0007002b: tab, + 0x0007002c: space, + 0x0007002d: minus, + 0x0007002e: equal, + 0x0007002f: bracketLeft, + 0x00070030: bracketRight, + 0x00070031: backslash, + 0x00070033: semicolon, + 0x00070034: quote, + 0x00070035: backquote, + 0x00070036: comma, + 0x00070037: period, + 0x00070038: slash, + 0x00070039: capsLock, + 0x0007003a: f1, + 0x0007003b: f2, + 0x0007003c: f3, + 0x0007003d: f4, + 0x0007003e: f5, + 0x0007003f: f6, + 0x00070040: f7, + 0x00070041: f8, + 0x00070042: f9, + 0x00070043: f10, + 0x00070044: f11, + 0x00070045: f12, + 0x00070046: printScreen, + 0x00070047: scrollLock, + 0x00070048: pause, + 0x00070049: insert, + 0x0007004a: home, + 0x0007004b: pageUp, + 0x0007004c: delete, + 0x0007004d: end, + 0x0007004e: pageDown, + 0x0007004f: arrowRight, + 0x00070050: arrowLeft, + 0x00070051: arrowDown, + 0x00070052: arrowUp, + 0x00070053: numLock, + 0x00070054: numpadDivide, + 0x00070055: numpadMultiply, + 0x00070056: numpadSubtract, + 0x00070057: numpadAdd, + 0x00070058: numpadEnter, + 0x00070059: numpad1, + 0x0007005a: numpad2, + 0x0007005b: numpad3, + 0x0007005c: numpad4, + 0x0007005d: numpad5, + 0x0007005e: numpad6, + 0x0007005f: numpad7, + 0x00070060: numpad8, + 0x00070061: numpad9, + 0x00070062: numpad0, + 0x00070063: numpadDecimal, + 0x00070064: intlBackslash, + 0x00070065: contextMenu, + 0x00070066: power, + 0x00070067: numpadEqual, + 0x00070068: f13, + 0x00070069: f14, + 0x0007006a: f15, + 0x0007006b: f16, + 0x0007006c: f17, + 0x0007006d: f18, + 0x0007006e: f19, + 0x0007006f: f20, + 0x00070070: f21, + 0x00070071: f22, + 0x00070072: f23, + 0x00070073: f24, + 0x00070074: open, + 0x00070075: help, + 0x00070077: select, + 0x00070079: again, + 0x0007007a: undo, + 0x0007007b: cut, + 0x0007007c: copy, + 0x0007007d: paste, + 0x0007007e: find, + 0x0007007f: audioVolumeMute, + 0x00070080: audioVolumeUp, + 0x00070081: audioVolumeDown, + 0x00070085: numpadComma, + 0x00070087: intlRo, + 0x00070088: kanaMode, + 0x00070089: intlYen, + 0x0007008a: convert, + 0x0007008b: nonConvert, + 0x00070090: lang1, + 0x00070091: lang2, + 0x00070092: lang3, + 0x00070093: lang4, + 0x00070094: lang5, + 0x0007009b: abort, + 0x000700a3: props, + 0x000700b6: numpadParenLeft, + 0x000700b7: numpadParenRight, + 0x000700bb: numpadBackspace, + 0x000700d0: numpadMemoryStore, + 0x000700d1: numpadMemoryRecall, + 0x000700d2: numpadMemoryClear, + 0x000700d3: numpadMemoryAdd, + 0x000700d4: numpadMemorySubtract, + 0x000700d7: numpadSignChange, + 0x000700d8: numpadClear, + 0x000700d9: numpadClearEntry, + 0x000700e0: controlLeft, + 0x000700e1: shiftLeft, + 0x000700e2: altLeft, + 0x000700e3: metaLeft, + 0x000700e4: controlRight, + 0x000700e5: shiftRight, + 0x000700e6: altRight, + 0x000700e7: metaRight, + 0x000c0060: info, + 0x000c0061: closedCaptionToggle, + 0x000c006f: brightnessUp, + 0x000c0070: brightnessDown, + 0x000c0072: brightnessToggle, + 0x000c0073: brightnessMinimum, + 0x000c0074: brightnessMaximum, + 0x000c0075: brightnessAuto, + 0x000c0083: mediaLast, + 0x000c008c: launchPhone, + 0x000c008d: programGuide, + 0x000c0094: exit, + 0x000c009c: channelUp, + 0x000c009d: channelDown, + 0x000c00b0: mediaPlay, + 0x000c00b2: mediaRecord, + 0x000c00b3: mediaFastForward, + 0x000c00b4: mediaRewind, + 0x000c00b5: mediaTrackNext, + 0x000c00b6: mediaTrackPrevious, + 0x000c00b7: mediaStop, + 0x000c00b8: eject, + 0x000c00cd: mediaPlayPause, + 0x000c00cf: speechInputToggle, + 0x000c00e5: bassBoost, + 0x000c0183: mediaSelect, + 0x000c0184: launchWordProcessor, + 0x000c0186: launchSpreadsheet, + 0x000c018a: launchMail, + 0x000c018d: launchContacts, + 0x000c018e: launchCalendar, + 0x000c0192: launchApp2, + 0x000c0194: launchApp1, + 0x000c0196: launchInternetBrowser, + 0x000c019c: logOff, + 0x000c019e: lockScreen, + 0x000c019f: launchControlPanel, + 0x000c01a2: selectTask, + 0x000c01a7: launchDocuments, + 0x000c01ab: spellCheck, + 0x000c01ae: launchKeyboardLayout, + 0x000c01b1: launchScreenSaver, + 0x000c01b7: launchAudioBrowser, + 0x000c0201: newKey, + 0x000c0203: close, + 0x000c0207: save, + 0x000c0208: print, + 0x000c0221: browserSearch, + 0x000c0223: browserHome, + 0x000c0224: browserBack, + 0x000c0225: browserForward, + 0x000c0226: browserStop, + 0x000c0227: browserRefresh, + 0x000c022a: browserFavorites, + 0x000c022d: zoomIn, + 0x000c022e: zoomOut, + 0x000c0232: zoomToggle, + 0x000c0279: redo, + 0x000c0289: mailReply, + 0x000c028b: mailForward, + 0x000c028c: mailSend, + }; +} diff --git a/packages/flutter/lib/src/services/keyboard_maps.dart b/packages/flutter/lib/src/services/keyboard_maps.dart new file mode 100644 index 0000000000..a718a3a242 --- /dev/null +++ b/packages/flutter/lib/src/services/keyboard_maps.dart @@ -0,0 +1,844 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// DO NOT EDIT -- DO NOT EDIT -- DO NOT EDIT +// This file is generated by dev/tools/gen_keycodes/bin/gen_keycodes.dart and +// should not be edited directly. +// +// Edit the template dev/tools/gen_keycodes/data/keyboard_maps.tmpl instead. +// See dev/tools/gen_keycodes/README.md for more information. + +import 'keyboard_key.dart'; + +/// Maps Android-specific key codes to the matching [LogicalKeyboardKey]. +const Map kAndroidToLogicalKey = { + 0: LogicalKeyboardKey.none, + 119: LogicalKeyboardKey.fn, + 219: LogicalKeyboardKey.launchAssistant, + 223: LogicalKeyboardKey.sleep, + 224: LogicalKeyboardKey.wakeUp, + 29: LogicalKeyboardKey.keyA, + 30: LogicalKeyboardKey.keyB, + 31: LogicalKeyboardKey.keyC, + 32: LogicalKeyboardKey.keyD, + 33: LogicalKeyboardKey.keyE, + 34: LogicalKeyboardKey.keyF, + 35: LogicalKeyboardKey.keyG, + 36: LogicalKeyboardKey.keyH, + 37: LogicalKeyboardKey.keyI, + 38: LogicalKeyboardKey.keyJ, + 39: LogicalKeyboardKey.keyK, + 40: LogicalKeyboardKey.keyL, + 41: LogicalKeyboardKey.keyM, + 42: LogicalKeyboardKey.keyN, + 43: LogicalKeyboardKey.keyO, + 44: LogicalKeyboardKey.keyP, + 45: LogicalKeyboardKey.keyQ, + 46: LogicalKeyboardKey.keyR, + 47: LogicalKeyboardKey.keyS, + 48: LogicalKeyboardKey.keyT, + 49: LogicalKeyboardKey.keyU, + 50: LogicalKeyboardKey.keyV, + 51: LogicalKeyboardKey.keyW, + 52: LogicalKeyboardKey.keyX, + 53: LogicalKeyboardKey.keyY, + 54: LogicalKeyboardKey.keyZ, + 8: LogicalKeyboardKey.digit1, + 9: LogicalKeyboardKey.digit2, + 10: LogicalKeyboardKey.digit3, + 11: LogicalKeyboardKey.digit4, + 12: LogicalKeyboardKey.digit5, + 13: LogicalKeyboardKey.digit6, + 14: LogicalKeyboardKey.digit7, + 15: LogicalKeyboardKey.digit8, + 16: LogicalKeyboardKey.digit9, + 7: LogicalKeyboardKey.digit0, + 66: LogicalKeyboardKey.enter, + 111: LogicalKeyboardKey.escape, + 67: LogicalKeyboardKey.backspace, + 61: LogicalKeyboardKey.tab, + 62: LogicalKeyboardKey.space, + 69: LogicalKeyboardKey.minus, + 70: LogicalKeyboardKey.equal, + 71: LogicalKeyboardKey.bracketLeft, + 72: LogicalKeyboardKey.bracketRight, + 73: LogicalKeyboardKey.backslash, + 74: LogicalKeyboardKey.semicolon, + 75: LogicalKeyboardKey.quote, + 68: LogicalKeyboardKey.backquote, + 55: LogicalKeyboardKey.comma, + 56: LogicalKeyboardKey.period, + 76: LogicalKeyboardKey.slash, + 115: LogicalKeyboardKey.capsLock, + 131: LogicalKeyboardKey.f1, + 132: LogicalKeyboardKey.f2, + 133: LogicalKeyboardKey.f3, + 134: LogicalKeyboardKey.f4, + 135: LogicalKeyboardKey.f5, + 136: LogicalKeyboardKey.f6, + 137: LogicalKeyboardKey.f7, + 138: LogicalKeyboardKey.f8, + 139: LogicalKeyboardKey.f9, + 140: LogicalKeyboardKey.f10, + 141: LogicalKeyboardKey.f11, + 142: LogicalKeyboardKey.f12, + 120: LogicalKeyboardKey.printScreen, + 116: LogicalKeyboardKey.scrollLock, + 121: LogicalKeyboardKey.pause, + 124: LogicalKeyboardKey.insert, + 122: LogicalKeyboardKey.home, + 92: LogicalKeyboardKey.pageUp, + 112: LogicalKeyboardKey.delete, + 123: LogicalKeyboardKey.end, + 93: LogicalKeyboardKey.pageDown, + 22: LogicalKeyboardKey.arrowRight, + 21: LogicalKeyboardKey.arrowLeft, + 20: LogicalKeyboardKey.arrowDown, + 19: LogicalKeyboardKey.arrowUp, + 143: LogicalKeyboardKey.numLock, + 154: LogicalKeyboardKey.numpadDivide, + 155: LogicalKeyboardKey.numpadMultiply, + 156: LogicalKeyboardKey.numpadSubtract, + 157: LogicalKeyboardKey.numpadAdd, + 160: LogicalKeyboardKey.numpadEnter, + 145: LogicalKeyboardKey.numpad1, + 146: LogicalKeyboardKey.numpad2, + 147: LogicalKeyboardKey.numpad3, + 148: LogicalKeyboardKey.numpad4, + 149: LogicalKeyboardKey.numpad5, + 150: LogicalKeyboardKey.numpad6, + 151: LogicalKeyboardKey.numpad7, + 152: LogicalKeyboardKey.numpad8, + 153: LogicalKeyboardKey.numpad9, + 144: LogicalKeyboardKey.numpad0, + 158: LogicalKeyboardKey.numpadDecimal, + 82: LogicalKeyboardKey.contextMenu, + 26: LogicalKeyboardKey.power, + 161: LogicalKeyboardKey.numpadEqual, + 259: LogicalKeyboardKey.help, + 277: LogicalKeyboardKey.cut, + 278: LogicalKeyboardKey.copy, + 279: LogicalKeyboardKey.paste, + 164: LogicalKeyboardKey.audioVolumeMute, + 24: LogicalKeyboardKey.audioVolumeUp, + 25: LogicalKeyboardKey.audioVolumeDown, + 159: LogicalKeyboardKey.numpadComma, + 214: LogicalKeyboardKey.convert, + 213: LogicalKeyboardKey.nonConvert, + 162: LogicalKeyboardKey.numpadParenLeft, + 163: LogicalKeyboardKey.numpadParenRight, + 113: LogicalKeyboardKey.controlLeft, + 59: LogicalKeyboardKey.shiftLeft, + 57: LogicalKeyboardKey.altLeft, + 117: LogicalKeyboardKey.metaLeft, + 114: LogicalKeyboardKey.controlRight, + 60: LogicalKeyboardKey.shiftRight, + 58: LogicalKeyboardKey.altRight, + 118: LogicalKeyboardKey.metaRight, + 165: LogicalKeyboardKey.info, + 175: LogicalKeyboardKey.closedCaptionToggle, + 221: LogicalKeyboardKey.brightnessUp, + 220: LogicalKeyboardKey.brightnessDown, + 229: LogicalKeyboardKey.mediaLast, + 166: LogicalKeyboardKey.channelUp, + 167: LogicalKeyboardKey.channelDown, + 126: LogicalKeyboardKey.mediaPlay, + 130: LogicalKeyboardKey.mediaRecord, + 90: LogicalKeyboardKey.mediaFastForward, + 89: LogicalKeyboardKey.mediaRewind, + 87: LogicalKeyboardKey.mediaTrackNext, + 88: LogicalKeyboardKey.mediaTrackPrevious, + 86: LogicalKeyboardKey.mediaStop, + 129: LogicalKeyboardKey.eject, + 85: LogicalKeyboardKey.mediaPlayPause, + 65: LogicalKeyboardKey.launchMail, + 207: LogicalKeyboardKey.launchContacts, + 208: LogicalKeyboardKey.launchCalendar, + 128: LogicalKeyboardKey.close, + 84: LogicalKeyboardKey.browserSearch, + 125: LogicalKeyboardKey.browserForward, + 174: LogicalKeyboardKey.browserFavorites, + 168: LogicalKeyboardKey.zoomIn, + 169: LogicalKeyboardKey.zoomOut, + 255: LogicalKeyboardKey.zoomToggle, +}; + +/// Maps Android-specific scan codes to the matching [PhysicalKeyboardKey]. +const Map kAndroidToPhysicalKey = { + 464: PhysicalKeyboardKey.fn, + 205: PhysicalKeyboardKey.suspend, + 142: PhysicalKeyboardKey.sleep, + 143: PhysicalKeyboardKey.wakeUp, + 30: PhysicalKeyboardKey.keyA, + 48: PhysicalKeyboardKey.keyB, + 46: PhysicalKeyboardKey.keyC, + 32: PhysicalKeyboardKey.keyD, + 18: PhysicalKeyboardKey.keyE, + 33: PhysicalKeyboardKey.keyF, + 34: PhysicalKeyboardKey.keyG, + 35: PhysicalKeyboardKey.keyH, + 23: PhysicalKeyboardKey.keyI, + 36: PhysicalKeyboardKey.keyJ, + 37: PhysicalKeyboardKey.keyK, + 38: PhysicalKeyboardKey.keyL, + 50: PhysicalKeyboardKey.keyM, + 49: PhysicalKeyboardKey.keyN, + 24: PhysicalKeyboardKey.keyO, + 25: PhysicalKeyboardKey.keyP, + 16: PhysicalKeyboardKey.keyQ, + 19: PhysicalKeyboardKey.keyR, + 31: PhysicalKeyboardKey.keyS, + 20: PhysicalKeyboardKey.keyT, + 22: PhysicalKeyboardKey.keyU, + 47: PhysicalKeyboardKey.keyV, + 17: PhysicalKeyboardKey.keyW, + 45: PhysicalKeyboardKey.keyX, + 21: PhysicalKeyboardKey.keyY, + 44: PhysicalKeyboardKey.keyZ, + 2: PhysicalKeyboardKey.digit1, + 3: PhysicalKeyboardKey.digit2, + 4: PhysicalKeyboardKey.digit3, + 5: PhysicalKeyboardKey.digit4, + 6: PhysicalKeyboardKey.digit5, + 7: PhysicalKeyboardKey.digit6, + 8: PhysicalKeyboardKey.digit7, + 9: PhysicalKeyboardKey.digit8, + 10: PhysicalKeyboardKey.digit9, + 11: PhysicalKeyboardKey.digit0, + 28: PhysicalKeyboardKey.enter, + 1: PhysicalKeyboardKey.escape, + 14: PhysicalKeyboardKey.backspace, + 15: PhysicalKeyboardKey.tab, + 57: PhysicalKeyboardKey.space, + 12: PhysicalKeyboardKey.minus, + 13: PhysicalKeyboardKey.equal, + 26: PhysicalKeyboardKey.bracketLeft, + 27: PhysicalKeyboardKey.bracketRight, + 43: PhysicalKeyboardKey.backslash, + 86: PhysicalKeyboardKey.backslash, + 39: PhysicalKeyboardKey.semicolon, + 40: PhysicalKeyboardKey.quote, + 41: PhysicalKeyboardKey.backquote, + 51: PhysicalKeyboardKey.comma, + 52: PhysicalKeyboardKey.period, + 53: PhysicalKeyboardKey.slash, + 58: PhysicalKeyboardKey.capsLock, + 59: PhysicalKeyboardKey.f1, + 60: PhysicalKeyboardKey.f2, + 61: PhysicalKeyboardKey.f3, + 62: PhysicalKeyboardKey.f4, + 63: PhysicalKeyboardKey.f5, + 64: PhysicalKeyboardKey.f6, + 65: PhysicalKeyboardKey.f7, + 66: PhysicalKeyboardKey.f8, + 67: PhysicalKeyboardKey.f9, + 68: PhysicalKeyboardKey.f10, + 87: PhysicalKeyboardKey.f11, + 88: PhysicalKeyboardKey.f12, + 99: PhysicalKeyboardKey.printScreen, + 70: PhysicalKeyboardKey.scrollLock, + 119: PhysicalKeyboardKey.pause, + 411: PhysicalKeyboardKey.pause, + 110: PhysicalKeyboardKey.insert, + 102: PhysicalKeyboardKey.home, + 104: PhysicalKeyboardKey.pageUp, + 177: PhysicalKeyboardKey.pageUp, + 111: PhysicalKeyboardKey.delete, + 107: PhysicalKeyboardKey.end, + 109: PhysicalKeyboardKey.pageDown, + 178: PhysicalKeyboardKey.pageDown, + 106: PhysicalKeyboardKey.arrowRight, + 105: PhysicalKeyboardKey.arrowLeft, + 108: PhysicalKeyboardKey.arrowDown, + 103: PhysicalKeyboardKey.arrowUp, + 69: PhysicalKeyboardKey.numLock, + 98: PhysicalKeyboardKey.numpadDivide, + 55: PhysicalKeyboardKey.numpadMultiply, + 74: PhysicalKeyboardKey.numpadSubtract, + 78: PhysicalKeyboardKey.numpadAdd, + 96: PhysicalKeyboardKey.numpadEnter, + 79: PhysicalKeyboardKey.numpad1, + 80: PhysicalKeyboardKey.numpad2, + 81: PhysicalKeyboardKey.numpad3, + 75: PhysicalKeyboardKey.numpad4, + 76: PhysicalKeyboardKey.numpad5, + 77: PhysicalKeyboardKey.numpad6, + 71: PhysicalKeyboardKey.numpad7, + 72: PhysicalKeyboardKey.numpad8, + 73: PhysicalKeyboardKey.numpad9, + 82: PhysicalKeyboardKey.numpad0, + 83: PhysicalKeyboardKey.numpadDecimal, + 127: PhysicalKeyboardKey.contextMenu, + 139: PhysicalKeyboardKey.contextMenu, + 116: PhysicalKeyboardKey.power, + 152: PhysicalKeyboardKey.power, + 117: PhysicalKeyboardKey.numpadEqual, + 183: PhysicalKeyboardKey.f13, + 184: PhysicalKeyboardKey.f14, + 185: PhysicalKeyboardKey.f15, + 186: PhysicalKeyboardKey.f16, + 187: PhysicalKeyboardKey.f17, + 188: PhysicalKeyboardKey.f18, + 189: PhysicalKeyboardKey.f19, + 190: PhysicalKeyboardKey.f20, + 191: PhysicalKeyboardKey.f21, + 192: PhysicalKeyboardKey.f22, + 193: PhysicalKeyboardKey.f23, + 194: PhysicalKeyboardKey.f24, + 134: PhysicalKeyboardKey.open, + 138: PhysicalKeyboardKey.help, + 129: PhysicalKeyboardKey.again, + 131: PhysicalKeyboardKey.undo, + 137: PhysicalKeyboardKey.cut, + 133: PhysicalKeyboardKey.copy, + 135: PhysicalKeyboardKey.paste, + 136: PhysicalKeyboardKey.find, + 113: PhysicalKeyboardKey.audioVolumeMute, + 115: PhysicalKeyboardKey.audioVolumeUp, + 114: PhysicalKeyboardKey.audioVolumeDown, + 95: PhysicalKeyboardKey.numpadComma, + 121: PhysicalKeyboardKey.numpadComma, + 92: PhysicalKeyboardKey.convert, + 94: PhysicalKeyboardKey.nonConvert, + 90: PhysicalKeyboardKey.lang3, + 91: PhysicalKeyboardKey.lang4, + 130: PhysicalKeyboardKey.props, + 179: PhysicalKeyboardKey.numpadParenLeft, + 180: PhysicalKeyboardKey.numpadParenRight, + 29: PhysicalKeyboardKey.controlLeft, + 42: PhysicalKeyboardKey.shiftLeft, + 56: PhysicalKeyboardKey.altLeft, + 125: PhysicalKeyboardKey.metaLeft, + 97: PhysicalKeyboardKey.controlRight, + 54: PhysicalKeyboardKey.shiftRight, + 100: PhysicalKeyboardKey.altRight, + 126: PhysicalKeyboardKey.metaRight, + 358: PhysicalKeyboardKey.info, + 225: PhysicalKeyboardKey.brightnessUp, + 224: PhysicalKeyboardKey.brightnessDown, + 174: PhysicalKeyboardKey.exit, + 402: PhysicalKeyboardKey.channelUp, + 403: PhysicalKeyboardKey.channelDown, + 200: PhysicalKeyboardKey.mediaPlay, + 207: PhysicalKeyboardKey.mediaPlay, + 167: PhysicalKeyboardKey.mediaRecord, + 208: PhysicalKeyboardKey.mediaFastForward, + 168: PhysicalKeyboardKey.mediaRewind, + 163: PhysicalKeyboardKey.mediaTrackNext, + 165: PhysicalKeyboardKey.mediaTrackPrevious, + 128: PhysicalKeyboardKey.mediaStop, + 166: PhysicalKeyboardKey.mediaStop, + 161: PhysicalKeyboardKey.eject, + 162: PhysicalKeyboardKey.eject, + 164: PhysicalKeyboardKey.mediaPlayPause, + 209: PhysicalKeyboardKey.bassBoost, + 155: PhysicalKeyboardKey.launchMail, + 215: PhysicalKeyboardKey.launchMail, + 429: PhysicalKeyboardKey.launchContacts, + 397: PhysicalKeyboardKey.launchCalendar, + 181: PhysicalKeyboardKey.newKey, + 160: PhysicalKeyboardKey.close, + 206: PhysicalKeyboardKey.close, + 210: PhysicalKeyboardKey.print, + 217: PhysicalKeyboardKey.browserSearch, + 159: PhysicalKeyboardKey.browserForward, + 156: PhysicalKeyboardKey.browserFavorites, + 182: PhysicalKeyboardKey.redo, +}; + +/// A map of Android key codes which have printable representations, but appear +/// on the number pad. Used to provide different key objects for keys like +/// KEY_EQUALS and NUMPAD_EQUALS. +const Map kAndroidNumPadMap = { + 154: LogicalKeyboardKey.numpadDivide, + 155: LogicalKeyboardKey.numpadMultiply, + 156: LogicalKeyboardKey.numpadSubtract, + 157: LogicalKeyboardKey.numpadAdd, + 145: LogicalKeyboardKey.numpad1, + 146: LogicalKeyboardKey.numpad2, + 147: LogicalKeyboardKey.numpad3, + 148: LogicalKeyboardKey.numpad4, + 149: LogicalKeyboardKey.numpad5, + 150: LogicalKeyboardKey.numpad6, + 151: LogicalKeyboardKey.numpad7, + 152: LogicalKeyboardKey.numpad8, + 153: LogicalKeyboardKey.numpad9, + 144: LogicalKeyboardKey.numpad0, + 158: LogicalKeyboardKey.numpadDecimal, + 161: LogicalKeyboardKey.numpadEqual, + 159: LogicalKeyboardKey.numpadComma, + 162: LogicalKeyboardKey.numpadParenLeft, + 163: LogicalKeyboardKey.numpadParenRight, +}; + +/// Maps Fuchsia-specific IDs to the matching [LogicalKeyboardKey]. +const Map kFuchsiaToLogicalKey = { + 0x100000000: LogicalKeyboardKey.none, + 0x100000010: LogicalKeyboardKey.hyper, + 0x100000011: LogicalKeyboardKey.superKey, + 0x100000012: LogicalKeyboardKey.fn, + 0x100000013: LogicalKeyboardKey.fnLock, + 0x100000014: LogicalKeyboardKey.suspend, + 0x100000015: LogicalKeyboardKey.resume, + 0x100000016: LogicalKeyboardKey.turbo, + 0x100000017: LogicalKeyboardKey.launchAssistant, + 0x100010082: LogicalKeyboardKey.sleep, + 0x100010083: LogicalKeyboardKey.wakeUp, + 0x100070000: LogicalKeyboardKey.usbReserved, + 0x100070001: LogicalKeyboardKey.usbErrorRollOver, + 0x100070002: LogicalKeyboardKey.usbPostFail, + 0x100070003: LogicalKeyboardKey.usbErrorUndefined, + 0x00000061: LogicalKeyboardKey.keyA, + 0x00000062: LogicalKeyboardKey.keyB, + 0x00000063: LogicalKeyboardKey.keyC, + 0x00000064: LogicalKeyboardKey.keyD, + 0x00000065: LogicalKeyboardKey.keyE, + 0x00000066: LogicalKeyboardKey.keyF, + 0x00000067: LogicalKeyboardKey.keyG, + 0x00000068: LogicalKeyboardKey.keyH, + 0x00000069: LogicalKeyboardKey.keyI, + 0x0000006a: LogicalKeyboardKey.keyJ, + 0x0000006b: LogicalKeyboardKey.keyK, + 0x0000006c: LogicalKeyboardKey.keyL, + 0x0000006d: LogicalKeyboardKey.keyM, + 0x0000006e: LogicalKeyboardKey.keyN, + 0x0000006f: LogicalKeyboardKey.keyO, + 0x00000070: LogicalKeyboardKey.keyP, + 0x00000071: LogicalKeyboardKey.keyQ, + 0x00000072: LogicalKeyboardKey.keyR, + 0x00000073: LogicalKeyboardKey.keyS, + 0x00000074: LogicalKeyboardKey.keyT, + 0x00000075: LogicalKeyboardKey.keyU, + 0x00000076: LogicalKeyboardKey.keyV, + 0x00000077: LogicalKeyboardKey.keyW, + 0x00000078: LogicalKeyboardKey.keyX, + 0x00000079: LogicalKeyboardKey.keyY, + 0x0000007a: LogicalKeyboardKey.keyZ, + 0x00000031: LogicalKeyboardKey.digit1, + 0x00000032: LogicalKeyboardKey.digit2, + 0x00000033: LogicalKeyboardKey.digit3, + 0x00000034: LogicalKeyboardKey.digit4, + 0x00000035: LogicalKeyboardKey.digit5, + 0x00000036: LogicalKeyboardKey.digit6, + 0x00000037: LogicalKeyboardKey.digit7, + 0x00000038: LogicalKeyboardKey.digit8, + 0x00000039: LogicalKeyboardKey.digit9, + 0x00000030: LogicalKeyboardKey.digit0, + 0x100070028: LogicalKeyboardKey.enter, + 0x100070029: LogicalKeyboardKey.escape, + 0x10007002a: LogicalKeyboardKey.backspace, + 0x10007002b: LogicalKeyboardKey.tab, + 0x00000020: LogicalKeyboardKey.space, + 0x0000002d: LogicalKeyboardKey.minus, + 0x0000003d: LogicalKeyboardKey.equal, + 0x0000005b: LogicalKeyboardKey.bracketLeft, + 0x0000005d: LogicalKeyboardKey.bracketRight, + 0x0000005c: LogicalKeyboardKey.backslash, + 0x0000003b: LogicalKeyboardKey.semicolon, + 0x00000027: LogicalKeyboardKey.quote, + 0x00000060: LogicalKeyboardKey.backquote, + 0x0000002c: LogicalKeyboardKey.comma, + 0x0000002e: LogicalKeyboardKey.period, + 0x0000002f: LogicalKeyboardKey.slash, + 0x100070039: LogicalKeyboardKey.capsLock, + 0x10007003a: LogicalKeyboardKey.f1, + 0x10007003b: LogicalKeyboardKey.f2, + 0x10007003c: LogicalKeyboardKey.f3, + 0x10007003d: LogicalKeyboardKey.f4, + 0x10007003e: LogicalKeyboardKey.f5, + 0x10007003f: LogicalKeyboardKey.f6, + 0x100070040: LogicalKeyboardKey.f7, + 0x100070041: LogicalKeyboardKey.f8, + 0x100070042: LogicalKeyboardKey.f9, + 0x100070043: LogicalKeyboardKey.f10, + 0x100070044: LogicalKeyboardKey.f11, + 0x100070045: LogicalKeyboardKey.f12, + 0x100070046: LogicalKeyboardKey.printScreen, + 0x100070047: LogicalKeyboardKey.scrollLock, + 0x100070048: LogicalKeyboardKey.pause, + 0x100070049: LogicalKeyboardKey.insert, + 0x10007004a: LogicalKeyboardKey.home, + 0x10007004b: LogicalKeyboardKey.pageUp, + 0x10007004c: LogicalKeyboardKey.delete, + 0x10007004d: LogicalKeyboardKey.end, + 0x10007004e: LogicalKeyboardKey.pageDown, + 0x10007004f: LogicalKeyboardKey.arrowRight, + 0x100070050: LogicalKeyboardKey.arrowLeft, + 0x100070051: LogicalKeyboardKey.arrowDown, + 0x100070052: LogicalKeyboardKey.arrowUp, + 0x100070053: LogicalKeyboardKey.numLock, + 0x100070054: LogicalKeyboardKey.numpadDivide, + 0x100070055: LogicalKeyboardKey.numpadMultiply, + 0x100070056: LogicalKeyboardKey.numpadSubtract, + 0x100070057: LogicalKeyboardKey.numpadAdd, + 0x100070058: LogicalKeyboardKey.numpadEnter, + 0x100070059: LogicalKeyboardKey.numpad1, + 0x10007005a: LogicalKeyboardKey.numpad2, + 0x10007005b: LogicalKeyboardKey.numpad3, + 0x10007005c: LogicalKeyboardKey.numpad4, + 0x10007005d: LogicalKeyboardKey.numpad5, + 0x10007005e: LogicalKeyboardKey.numpad6, + 0x10007005f: LogicalKeyboardKey.numpad7, + 0x100070060: LogicalKeyboardKey.numpad8, + 0x100070061: LogicalKeyboardKey.numpad9, + 0x100070062: LogicalKeyboardKey.numpad0, + 0x100070063: LogicalKeyboardKey.numpadDecimal, + 0x100070064: LogicalKeyboardKey.intlBackslash, + 0x100070065: LogicalKeyboardKey.contextMenu, + 0x100070066: LogicalKeyboardKey.power, + 0x100070067: LogicalKeyboardKey.numpadEqual, + 0x100070068: LogicalKeyboardKey.f13, + 0x100070069: LogicalKeyboardKey.f14, + 0x10007006a: LogicalKeyboardKey.f15, + 0x10007006b: LogicalKeyboardKey.f16, + 0x10007006c: LogicalKeyboardKey.f17, + 0x10007006d: LogicalKeyboardKey.f18, + 0x10007006e: LogicalKeyboardKey.f19, + 0x10007006f: LogicalKeyboardKey.f20, + 0x100070070: LogicalKeyboardKey.f21, + 0x100070071: LogicalKeyboardKey.f22, + 0x100070072: LogicalKeyboardKey.f23, + 0x100070073: LogicalKeyboardKey.f24, + 0x100070074: LogicalKeyboardKey.open, + 0x100070075: LogicalKeyboardKey.help, + 0x100070077: LogicalKeyboardKey.select, + 0x100070079: LogicalKeyboardKey.again, + 0x10007007a: LogicalKeyboardKey.undo, + 0x10007007b: LogicalKeyboardKey.cut, + 0x10007007c: LogicalKeyboardKey.copy, + 0x10007007d: LogicalKeyboardKey.paste, + 0x10007007e: LogicalKeyboardKey.find, + 0x10007007f: LogicalKeyboardKey.audioVolumeMute, + 0x100070080: LogicalKeyboardKey.audioVolumeUp, + 0x100070081: LogicalKeyboardKey.audioVolumeDown, + 0x100070085: LogicalKeyboardKey.numpadComma, + 0x100070087: LogicalKeyboardKey.intlRo, + 0x100070088: LogicalKeyboardKey.kanaMode, + 0x100070089: LogicalKeyboardKey.intlYen, + 0x10007008a: LogicalKeyboardKey.convert, + 0x10007008b: LogicalKeyboardKey.nonConvert, + 0x100070090: LogicalKeyboardKey.lang1, + 0x100070091: LogicalKeyboardKey.lang2, + 0x100070092: LogicalKeyboardKey.lang3, + 0x100070093: LogicalKeyboardKey.lang4, + 0x100070094: LogicalKeyboardKey.lang5, + 0x10007009b: LogicalKeyboardKey.abort, + 0x1000700a3: LogicalKeyboardKey.props, + 0x1000700b6: LogicalKeyboardKey.numpadParenLeft, + 0x1000700b7: LogicalKeyboardKey.numpadParenRight, + 0x1000700bb: LogicalKeyboardKey.numpadBackspace, + 0x1000700d0: LogicalKeyboardKey.numpadMemoryStore, + 0x1000700d1: LogicalKeyboardKey.numpadMemoryRecall, + 0x1000700d2: LogicalKeyboardKey.numpadMemoryClear, + 0x1000700d3: LogicalKeyboardKey.numpadMemoryAdd, + 0x1000700d4: LogicalKeyboardKey.numpadMemorySubtract, + 0x1000700d7: LogicalKeyboardKey.numpadSignChange, + 0x1000700d8: LogicalKeyboardKey.numpadClear, + 0x1000700d9: LogicalKeyboardKey.numpadClearEntry, + 0x1000700e0: LogicalKeyboardKey.controlLeft, + 0x1000700e1: LogicalKeyboardKey.shiftLeft, + 0x1000700e2: LogicalKeyboardKey.altLeft, + 0x1000700e3: LogicalKeyboardKey.metaLeft, + 0x1000700e4: LogicalKeyboardKey.controlRight, + 0x1000700e5: LogicalKeyboardKey.shiftRight, + 0x1000700e6: LogicalKeyboardKey.altRight, + 0x1000700e7: LogicalKeyboardKey.metaRight, + 0x1000c0060: LogicalKeyboardKey.info, + 0x1000c0061: LogicalKeyboardKey.closedCaptionToggle, + 0x1000c006f: LogicalKeyboardKey.brightnessUp, + 0x1000c0070: LogicalKeyboardKey.brightnessDown, + 0x1000c0072: LogicalKeyboardKey.brightnessToggle, + 0x1000c0073: LogicalKeyboardKey.brightnessMinimum, + 0x1000c0074: LogicalKeyboardKey.brightnessMaximum, + 0x1000c0075: LogicalKeyboardKey.brightnessAuto, + 0x1000c0083: LogicalKeyboardKey.mediaLast, + 0x1000c008c: LogicalKeyboardKey.launchPhone, + 0x1000c008d: LogicalKeyboardKey.programGuide, + 0x1000c0094: LogicalKeyboardKey.exit, + 0x1000c009c: LogicalKeyboardKey.channelUp, + 0x1000c009d: LogicalKeyboardKey.channelDown, + 0x1000c00b0: LogicalKeyboardKey.mediaPlay, + 0x1000c00b2: LogicalKeyboardKey.mediaRecord, + 0x1000c00b3: LogicalKeyboardKey.mediaFastForward, + 0x1000c00b4: LogicalKeyboardKey.mediaRewind, + 0x1000c00b5: LogicalKeyboardKey.mediaTrackNext, + 0x1000c00b6: LogicalKeyboardKey.mediaTrackPrevious, + 0x1000c00b7: LogicalKeyboardKey.mediaStop, + 0x1000c00b8: LogicalKeyboardKey.eject, + 0x1000c00cd: LogicalKeyboardKey.mediaPlayPause, + 0x1000c00cf: LogicalKeyboardKey.speechInputToggle, + 0x1000c00e5: LogicalKeyboardKey.bassBoost, + 0x1000c0183: LogicalKeyboardKey.mediaSelect, + 0x1000c0184: LogicalKeyboardKey.launchWordProcessor, + 0x1000c0186: LogicalKeyboardKey.launchSpreadsheet, + 0x1000c018a: LogicalKeyboardKey.launchMail, + 0x1000c018d: LogicalKeyboardKey.launchContacts, + 0x1000c018e: LogicalKeyboardKey.launchCalendar, + 0x1000c0192: LogicalKeyboardKey.launchApp2, + 0x1000c0194: LogicalKeyboardKey.launchApp1, + 0x1000c0196: LogicalKeyboardKey.launchInternetBrowser, + 0x1000c019c: LogicalKeyboardKey.logOff, + 0x1000c019e: LogicalKeyboardKey.lockScreen, + 0x1000c019f: LogicalKeyboardKey.launchControlPanel, + 0x1000c01a2: LogicalKeyboardKey.selectTask, + 0x1000c01a7: LogicalKeyboardKey.launchDocuments, + 0x1000c01ab: LogicalKeyboardKey.spellCheck, + 0x1000c01ae: LogicalKeyboardKey.launchKeyboardLayout, + 0x1000c01b1: LogicalKeyboardKey.launchScreenSaver, + 0x1000c01b7: LogicalKeyboardKey.launchAudioBrowser, + 0x1000c0201: LogicalKeyboardKey.newKey, + 0x1000c0203: LogicalKeyboardKey.close, + 0x1000c0207: LogicalKeyboardKey.save, + 0x1000c0208: LogicalKeyboardKey.print, + 0x1000c0221: LogicalKeyboardKey.browserSearch, + 0x1000c0223: LogicalKeyboardKey.browserHome, + 0x1000c0224: LogicalKeyboardKey.browserBack, + 0x1000c0225: LogicalKeyboardKey.browserForward, + 0x1000c0226: LogicalKeyboardKey.browserStop, + 0x1000c0227: LogicalKeyboardKey.browserRefresh, + 0x1000c022a: LogicalKeyboardKey.browserFavorites, + 0x1000c022d: LogicalKeyboardKey.zoomIn, + 0x1000c022e: LogicalKeyboardKey.zoomOut, + 0x1000c0232: LogicalKeyboardKey.zoomToggle, + 0x1000c0279: LogicalKeyboardKey.redo, + 0x1000c0289: LogicalKeyboardKey.mailReply, + 0x1000c028b: LogicalKeyboardKey.mailForward, + 0x1000c028c: LogicalKeyboardKey.mailSend, +}; + +/// Maps Fuchsia-specific USB HID Usage IDs to the matching +/// [PhysicalKeyboardKey]. +const Map kFuchsiaToPhysicalKey = { + 0x00000000: PhysicalKeyboardKey.none, + 0x00000010: PhysicalKeyboardKey.hyper, + 0x00000011: PhysicalKeyboardKey.superKey, + 0x00000012: PhysicalKeyboardKey.fn, + 0x00000013: PhysicalKeyboardKey.fnLock, + 0x00000014: PhysicalKeyboardKey.suspend, + 0x00000015: PhysicalKeyboardKey.resume, + 0x00000016: PhysicalKeyboardKey.turbo, + 0x00000017: PhysicalKeyboardKey.launchAssistant, + 0x00010082: PhysicalKeyboardKey.sleep, + 0x00010083: PhysicalKeyboardKey.wakeUp, + 0x00070000: PhysicalKeyboardKey.usbReserved, + 0x00070001: PhysicalKeyboardKey.usbErrorRollOver, + 0x00070002: PhysicalKeyboardKey.usbPostFail, + 0x00070003: PhysicalKeyboardKey.usbErrorUndefined, + 0x00070004: PhysicalKeyboardKey.keyA, + 0x00070005: PhysicalKeyboardKey.keyB, + 0x00070006: PhysicalKeyboardKey.keyC, + 0x00070007: PhysicalKeyboardKey.keyD, + 0x00070008: PhysicalKeyboardKey.keyE, + 0x00070009: PhysicalKeyboardKey.keyF, + 0x0007000a: PhysicalKeyboardKey.keyG, + 0x0007000b: PhysicalKeyboardKey.keyH, + 0x0007000c: PhysicalKeyboardKey.keyI, + 0x0007000d: PhysicalKeyboardKey.keyJ, + 0x0007000e: PhysicalKeyboardKey.keyK, + 0x0007000f: PhysicalKeyboardKey.keyL, + 0x00070010: PhysicalKeyboardKey.keyM, + 0x00070011: PhysicalKeyboardKey.keyN, + 0x00070012: PhysicalKeyboardKey.keyO, + 0x00070013: PhysicalKeyboardKey.keyP, + 0x00070014: PhysicalKeyboardKey.keyQ, + 0x00070015: PhysicalKeyboardKey.keyR, + 0x00070016: PhysicalKeyboardKey.keyS, + 0x00070017: PhysicalKeyboardKey.keyT, + 0x00070018: PhysicalKeyboardKey.keyU, + 0x00070019: PhysicalKeyboardKey.keyV, + 0x0007001a: PhysicalKeyboardKey.keyW, + 0x0007001b: PhysicalKeyboardKey.keyX, + 0x0007001c: PhysicalKeyboardKey.keyY, + 0x0007001d: PhysicalKeyboardKey.keyZ, + 0x0007001e: PhysicalKeyboardKey.digit1, + 0x0007001f: PhysicalKeyboardKey.digit2, + 0x00070020: PhysicalKeyboardKey.digit3, + 0x00070021: PhysicalKeyboardKey.digit4, + 0x00070022: PhysicalKeyboardKey.digit5, + 0x00070023: PhysicalKeyboardKey.digit6, + 0x00070024: PhysicalKeyboardKey.digit7, + 0x00070025: PhysicalKeyboardKey.digit8, + 0x00070026: PhysicalKeyboardKey.digit9, + 0x00070027: PhysicalKeyboardKey.digit0, + 0x00070028: PhysicalKeyboardKey.enter, + 0x00070029: PhysicalKeyboardKey.escape, + 0x0007002a: PhysicalKeyboardKey.backspace, + 0x0007002b: PhysicalKeyboardKey.tab, + 0x0007002c: PhysicalKeyboardKey.space, + 0x0007002d: PhysicalKeyboardKey.minus, + 0x0007002e: PhysicalKeyboardKey.equal, + 0x0007002f: PhysicalKeyboardKey.bracketLeft, + 0x00070030: PhysicalKeyboardKey.bracketRight, + 0x00070031: PhysicalKeyboardKey.backslash, + 0x00070033: PhysicalKeyboardKey.semicolon, + 0x00070034: PhysicalKeyboardKey.quote, + 0x00070035: PhysicalKeyboardKey.backquote, + 0x00070036: PhysicalKeyboardKey.comma, + 0x00070037: PhysicalKeyboardKey.period, + 0x00070038: PhysicalKeyboardKey.slash, + 0x00070039: PhysicalKeyboardKey.capsLock, + 0x0007003a: PhysicalKeyboardKey.f1, + 0x0007003b: PhysicalKeyboardKey.f2, + 0x0007003c: PhysicalKeyboardKey.f3, + 0x0007003d: PhysicalKeyboardKey.f4, + 0x0007003e: PhysicalKeyboardKey.f5, + 0x0007003f: PhysicalKeyboardKey.f6, + 0x00070040: PhysicalKeyboardKey.f7, + 0x00070041: PhysicalKeyboardKey.f8, + 0x00070042: PhysicalKeyboardKey.f9, + 0x00070043: PhysicalKeyboardKey.f10, + 0x00070044: PhysicalKeyboardKey.f11, + 0x00070045: PhysicalKeyboardKey.f12, + 0x00070046: PhysicalKeyboardKey.printScreen, + 0x00070047: PhysicalKeyboardKey.scrollLock, + 0x00070048: PhysicalKeyboardKey.pause, + 0x00070049: PhysicalKeyboardKey.insert, + 0x0007004a: PhysicalKeyboardKey.home, + 0x0007004b: PhysicalKeyboardKey.pageUp, + 0x0007004c: PhysicalKeyboardKey.delete, + 0x0007004d: PhysicalKeyboardKey.end, + 0x0007004e: PhysicalKeyboardKey.pageDown, + 0x0007004f: PhysicalKeyboardKey.arrowRight, + 0x00070050: PhysicalKeyboardKey.arrowLeft, + 0x00070051: PhysicalKeyboardKey.arrowDown, + 0x00070052: PhysicalKeyboardKey.arrowUp, + 0x00070053: PhysicalKeyboardKey.numLock, + 0x00070054: PhysicalKeyboardKey.numpadDivide, + 0x00070055: PhysicalKeyboardKey.numpadMultiply, + 0x00070056: PhysicalKeyboardKey.numpadSubtract, + 0x00070057: PhysicalKeyboardKey.numpadAdd, + 0x00070058: PhysicalKeyboardKey.numpadEnter, + 0x00070059: PhysicalKeyboardKey.numpad1, + 0x0007005a: PhysicalKeyboardKey.numpad2, + 0x0007005b: PhysicalKeyboardKey.numpad3, + 0x0007005c: PhysicalKeyboardKey.numpad4, + 0x0007005d: PhysicalKeyboardKey.numpad5, + 0x0007005e: PhysicalKeyboardKey.numpad6, + 0x0007005f: PhysicalKeyboardKey.numpad7, + 0x00070060: PhysicalKeyboardKey.numpad8, + 0x00070061: PhysicalKeyboardKey.numpad9, + 0x00070062: PhysicalKeyboardKey.numpad0, + 0x00070063: PhysicalKeyboardKey.numpadDecimal, + 0x00070064: PhysicalKeyboardKey.intlBackslash, + 0x00070065: PhysicalKeyboardKey.contextMenu, + 0x00070066: PhysicalKeyboardKey.power, + 0x00070067: PhysicalKeyboardKey.numpadEqual, + 0x00070068: PhysicalKeyboardKey.f13, + 0x00070069: PhysicalKeyboardKey.f14, + 0x0007006a: PhysicalKeyboardKey.f15, + 0x0007006b: PhysicalKeyboardKey.f16, + 0x0007006c: PhysicalKeyboardKey.f17, + 0x0007006d: PhysicalKeyboardKey.f18, + 0x0007006e: PhysicalKeyboardKey.f19, + 0x0007006f: PhysicalKeyboardKey.f20, + 0x00070070: PhysicalKeyboardKey.f21, + 0x00070071: PhysicalKeyboardKey.f22, + 0x00070072: PhysicalKeyboardKey.f23, + 0x00070073: PhysicalKeyboardKey.f24, + 0x00070074: PhysicalKeyboardKey.open, + 0x00070075: PhysicalKeyboardKey.help, + 0x00070077: PhysicalKeyboardKey.select, + 0x00070079: PhysicalKeyboardKey.again, + 0x0007007a: PhysicalKeyboardKey.undo, + 0x0007007b: PhysicalKeyboardKey.cut, + 0x0007007c: PhysicalKeyboardKey.copy, + 0x0007007d: PhysicalKeyboardKey.paste, + 0x0007007e: PhysicalKeyboardKey.find, + 0x0007007f: PhysicalKeyboardKey.audioVolumeMute, + 0x00070080: PhysicalKeyboardKey.audioVolumeUp, + 0x00070081: PhysicalKeyboardKey.audioVolumeDown, + 0x00070085: PhysicalKeyboardKey.numpadComma, + 0x00070087: PhysicalKeyboardKey.intlRo, + 0x00070088: PhysicalKeyboardKey.kanaMode, + 0x00070089: PhysicalKeyboardKey.intlYen, + 0x0007008a: PhysicalKeyboardKey.convert, + 0x0007008b: PhysicalKeyboardKey.nonConvert, + 0x00070090: PhysicalKeyboardKey.lang1, + 0x00070091: PhysicalKeyboardKey.lang2, + 0x00070092: PhysicalKeyboardKey.lang3, + 0x00070093: PhysicalKeyboardKey.lang4, + 0x00070094: PhysicalKeyboardKey.lang5, + 0x0007009b: PhysicalKeyboardKey.abort, + 0x000700a3: PhysicalKeyboardKey.props, + 0x000700b6: PhysicalKeyboardKey.numpadParenLeft, + 0x000700b7: PhysicalKeyboardKey.numpadParenRight, + 0x000700bb: PhysicalKeyboardKey.numpadBackspace, + 0x000700d0: PhysicalKeyboardKey.numpadMemoryStore, + 0x000700d1: PhysicalKeyboardKey.numpadMemoryRecall, + 0x000700d2: PhysicalKeyboardKey.numpadMemoryClear, + 0x000700d3: PhysicalKeyboardKey.numpadMemoryAdd, + 0x000700d4: PhysicalKeyboardKey.numpadMemorySubtract, + 0x000700d7: PhysicalKeyboardKey.numpadSignChange, + 0x000700d8: PhysicalKeyboardKey.numpadClear, + 0x000700d9: PhysicalKeyboardKey.numpadClearEntry, + 0x000700e0: PhysicalKeyboardKey.controlLeft, + 0x000700e1: PhysicalKeyboardKey.shiftLeft, + 0x000700e2: PhysicalKeyboardKey.altLeft, + 0x000700e3: PhysicalKeyboardKey.metaLeft, + 0x000700e4: PhysicalKeyboardKey.controlRight, + 0x000700e5: PhysicalKeyboardKey.shiftRight, + 0x000700e6: PhysicalKeyboardKey.altRight, + 0x000700e7: PhysicalKeyboardKey.metaRight, + 0x000c0060: PhysicalKeyboardKey.info, + 0x000c0061: PhysicalKeyboardKey.closedCaptionToggle, + 0x000c006f: PhysicalKeyboardKey.brightnessUp, + 0x000c0070: PhysicalKeyboardKey.brightnessDown, + 0x000c0072: PhysicalKeyboardKey.brightnessToggle, + 0x000c0073: PhysicalKeyboardKey.brightnessMinimum, + 0x000c0074: PhysicalKeyboardKey.brightnessMaximum, + 0x000c0075: PhysicalKeyboardKey.brightnessAuto, + 0x000c0083: PhysicalKeyboardKey.mediaLast, + 0x000c008c: PhysicalKeyboardKey.launchPhone, + 0x000c008d: PhysicalKeyboardKey.programGuide, + 0x000c0094: PhysicalKeyboardKey.exit, + 0x000c009c: PhysicalKeyboardKey.channelUp, + 0x000c009d: PhysicalKeyboardKey.channelDown, + 0x000c00b0: PhysicalKeyboardKey.mediaPlay, + 0x000c00b2: PhysicalKeyboardKey.mediaRecord, + 0x000c00b3: PhysicalKeyboardKey.mediaFastForward, + 0x000c00b4: PhysicalKeyboardKey.mediaRewind, + 0x000c00b5: PhysicalKeyboardKey.mediaTrackNext, + 0x000c00b6: PhysicalKeyboardKey.mediaTrackPrevious, + 0x000c00b7: PhysicalKeyboardKey.mediaStop, + 0x000c00b8: PhysicalKeyboardKey.eject, + 0x000c00cd: PhysicalKeyboardKey.mediaPlayPause, + 0x000c00cf: PhysicalKeyboardKey.speechInputToggle, + 0x000c00e5: PhysicalKeyboardKey.bassBoost, + 0x000c0183: PhysicalKeyboardKey.mediaSelect, + 0x000c0184: PhysicalKeyboardKey.launchWordProcessor, + 0x000c0186: PhysicalKeyboardKey.launchSpreadsheet, + 0x000c018a: PhysicalKeyboardKey.launchMail, + 0x000c018d: PhysicalKeyboardKey.launchContacts, + 0x000c018e: PhysicalKeyboardKey.launchCalendar, + 0x000c0192: PhysicalKeyboardKey.launchApp2, + 0x000c0194: PhysicalKeyboardKey.launchApp1, + 0x000c0196: PhysicalKeyboardKey.launchInternetBrowser, + 0x000c019c: PhysicalKeyboardKey.logOff, + 0x000c019e: PhysicalKeyboardKey.lockScreen, + 0x000c019f: PhysicalKeyboardKey.launchControlPanel, + 0x000c01a2: PhysicalKeyboardKey.selectTask, + 0x000c01a7: PhysicalKeyboardKey.launchDocuments, + 0x000c01ab: PhysicalKeyboardKey.spellCheck, + 0x000c01ae: PhysicalKeyboardKey.launchKeyboardLayout, + 0x000c01b1: PhysicalKeyboardKey.launchScreenSaver, + 0x000c01b7: PhysicalKeyboardKey.launchAudioBrowser, + 0x000c0201: PhysicalKeyboardKey.newKey, + 0x000c0203: PhysicalKeyboardKey.close, + 0x000c0207: PhysicalKeyboardKey.save, + 0x000c0208: PhysicalKeyboardKey.print, + 0x000c0221: PhysicalKeyboardKey.browserSearch, + 0x000c0223: PhysicalKeyboardKey.browserHome, + 0x000c0224: PhysicalKeyboardKey.browserBack, + 0x000c0225: PhysicalKeyboardKey.browserForward, + 0x000c0226: PhysicalKeyboardKey.browserStop, + 0x000c0227: PhysicalKeyboardKey.browserRefresh, + 0x000c022a: PhysicalKeyboardKey.browserFavorites, + 0x000c022d: PhysicalKeyboardKey.zoomIn, + 0x000c022e: PhysicalKeyboardKey.zoomOut, + 0x000c0232: PhysicalKeyboardKey.zoomToggle, + 0x000c0279: PhysicalKeyboardKey.redo, + 0x000c0289: PhysicalKeyboardKey.mailReply, + 0x000c028b: PhysicalKeyboardKey.mailForward, + 0x000c028c: PhysicalKeyboardKey.mailSend, +}; diff --git a/packages/flutter/lib/src/services/raw_keyboard.dart b/packages/flutter/lib/src/services/raw_keyboard.dart index 9788c2488a..02276c4844 100644 --- a/packages/flutter/lib/src/services/raw_keyboard.dart +++ b/packages/flutter/lib/src/services/raw_keyboard.dart @@ -6,6 +6,7 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; +import 'keyboard_key.dart'; import 'raw_keyboard_android.dart'; import 'raw_keyboard_fuschia.dart'; import 'system_channels.dart'; @@ -166,16 +167,63 @@ abstract class RawKeyEventData { } return result; } + + /// Returns an object representing the physical location of this key on a + /// QWERTY keyboard. + /// + /// {@macro flutter.services.RawKeyEvent.physicalKey} + /// + /// See also: + /// + /// * [logicalKey] for the non-location-specific key generated by this event. + /// * [RawKeyEvent.physicalKey], where this value is available on the event. + PhysicalKeyboardKey get physicalKey; + + /// Returns an object representing the logical key that was pressed. + /// + /// {@macro flutter.services.RawKeyEvent.logicalKey} + /// + /// See also: + /// + /// * [physicalKey] for the location-specific key generated by this event. + /// * [RawKeyEvent.logicalKey], where this value is available on the event. + LogicalKeyboardKey get logicalKey; + + /// Returns the Unicode string representing the label on this key. + /// + /// {@template flutter.services.RawKeyEventData.keyLabel} + /// Do not use the [keyLabel] to compose a text string: it will be missing + /// special processing for Unicode strings for combining characters and other + /// special characters, and the effects of modifiers. + /// + /// If you are looking for the character produced by a key event, use + /// [RawKeyEvent.character] instead. + /// + /// If you are composing text strings, use the [TextField] or + /// [CupertinoTextField] widgets, since those automatically handle many of the + /// complexities of managing keyboard input, like showing a soft keyboard or + /// interacting with an input method editor (IME). + /// {@endtemplate} + String get keyLabel; } -/// Base class for raw key events. +/// Defines the interface for raw key events. /// /// Raw key events pass through as much information as possible from the /// underlying platform's key events, which allows them to provide a high level /// of fidelity but a low level of portability. /// +/// The event also provides an abstraction for the [physicalKey] and the +/// [logicalKey], describing the physical location of the key, and the logical +/// meaning of the key, respectively. These are more portable representations of +/// the key events, and should produce the same results regardless of platform. +/// /// See also: /// +/// * [LogicalKeyboardKey], an object that describes the logical meaning of a +/// key. +/// * [PhysicalKeyboardKey], an object that describes the physical location of +/// a key. /// * [RawKeyDownEvent], a specialization for events representing the user /// pressing a key. /// * [RawKeyUpEvent], a specialization for events representing the user @@ -184,9 +232,11 @@ abstract class RawKeyEventData { /// * [RawKeyboardListener], a widget that listens for raw key events. @immutable abstract class RawKeyEvent { - /// Initializes fields for subclasses. + /// Initializes fields for subclasses, and provides a const constructor for + /// const subclasses. const RawKeyEvent({ @required this.data, + @required this.character, }); /// Creates a concrete [RawKeyEvent] class from a message in the form received @@ -195,6 +245,7 @@ abstract class RawKeyEvent { RawKeyEventData data; final String keymap = message['keymap']; + final String character = message['character']; switch (keymap) { case 'android': data = RawKeyEventDataAndroid( @@ -222,14 +273,119 @@ abstract class RawKeyEvent { final String type = message['type']; switch (type) { case 'keydown': - return RawKeyDownEvent(data: data); + return RawKeyDownEvent(data: data, character: character); case 'keyup': - return RawKeyUpEvent(data: data); + return RawKeyUpEvent(data: data, character: character); default: throw FlutterError('Unknown key event type: $type'); } } + /// Returns true if the given [KeyboardKey] is pressed. + bool isKeyPressed(LogicalKeyboardKey key) => RawKeyboard.instance.keysPressed.contains(key); + + /// Returns true if a CTRL modifier key is pressed, regardless of which side + /// of the keyboard it is on. + /// + /// Use [isKeyPressed] if you need to know which control key was pressed. + bool get isControlPressed { + return isKeyPressed(LogicalKeyboardKey.controlLeft) || isKeyPressed(LogicalKeyboardKey.controlRight); + } + + /// Returns true if a SHIFT modifier key is pressed, regardless of which side + /// of the keyboard it is on. + /// + /// Use [isKeyPressed] if you need to know which shift key was pressed. + bool get isShiftPressed { + return isKeyPressed(LogicalKeyboardKey.shiftLeft) || isKeyPressed(LogicalKeyboardKey.shiftRight); + } + + /// Returns true if a ALT modifier key is pressed, regardless of which side + /// of the keyboard it is on. + /// + /// Note that the ALTGR key that appears on some keyboards is considered to be + /// the same as [LogicalKeyboardKey.altRight] on some platforms (notably + /// Android). On platforms that can distinguish between `altRight` and + /// `altGr`, a press of `altGr` will not return true here, and will need to be + /// tested for separately. + /// + /// Use [isKeyPressed] if you need to know which alt key was pressed. + bool get isAltPressed { + return isKeyPressed(LogicalKeyboardKey.altLeft) || isKeyPressed(LogicalKeyboardKey.altRight); + } + + /// Returns true if a META modifier key is pressed, regardless of which side + /// of the keyboard it is on. + /// + /// Use [isKeyPressed] if you need to know which meta key was pressed. + bool get isMetaPressed { + return isKeyPressed(LogicalKeyboardKey.metaLeft) || isKeyPressed(LogicalKeyboardKey.metaRight); + } + + /// Returns an object representing the physical location of this key. + /// + /// {@template flutter.services.RawKeyEvent.physicalKey} + /// The [PhysicalKeyboardKey] ignores the key map, modifier keys (like SHIFT), + /// and the label on the key. It describes the location of the key as if it + /// were on a QWERTY keyboard regardless of the keyboard mapping in effect. + /// + /// [PhysicalKeyboardKey]s are used to describe and test for keys in a + /// particular location. + /// + /// For instance, if you wanted to make a game where the key to the right of + /// the CAPS LOCK key made the player move left, you would be comparing the + /// result of this `physicalKey` with [PhysicalKeyboardKey.keyA], since that + /// is the key next to the CAPS LOCK key on a QWERTY keyboard. This would + /// return the same thing even on a French keyboard where the key next to the + /// CAPS LOCK produces a "Q" when pressed. + /// + /// If you want to make your app respond to a key with a particular character + /// on it regardless of location of the key, use [RawKeyEvent.logicalKey] instead. + /// {@endtemplate} + /// + /// See also: + /// + /// * [logicalKey] for the non-location specific key generated by this event. + /// * [character] for the character generated by this keypress (if any). + PhysicalKeyboardKey get physicalKey => data.physicalKey; + + /// Returns an object representing the logical key that was pressed. + /// + /// {@template flutter.services.RawKeyEvent.logicalKey} + /// This method takes into account the key map and modifier keys (like SHIFT) + /// to determine which logical key to return. + /// + /// If you are looking for the character produced by a key event, use + /// [RawKeyEvent.character] instead. + /// + /// If you are collecting text strings, use the [TextField] or + /// [CupertinoTextField] widgets, since those automatically handle many of the + /// complexities of managing keyboard input, like showing a soft keyboard or + /// interacting with an input method editor (IME). + /// {@endtemplate} + LogicalKeyboardKey get logicalKey => data.logicalKey; + + /// Returns the Unicode character (grapheme cluster) completed by this + /// keystroke, if any. + /// + /// This will only return a character if this keystroke, combined with any + /// preceding keystroke(s), generated a character, and only on a "key down" + /// event. It will return null if no character has been generated by the + /// keystroke (e.g. a "dead" or "combining" key), or if the corresponding key + /// is a key without a visual representation, such as a modifier key or a + /// control key. + /// + /// This can return multiple Unicode code points, since some characters (more + /// accurately referred to as grapheme clusters) are made up of more than one + /// code point. + /// + /// The `character` doesn't take into account edits by an input method editor + /// (IME), or manage the visibility of the soft keyboard on touch devices. For + /// composing text, use the [TextField] or [CupertinoTextField] widgets, since + /// those automatically handle many of the complexities of managing keyboard + /// input. + final String character; + /// Platform-specific information about the key event. final RawKeyEventData data; } @@ -243,7 +399,8 @@ class RawKeyDownEvent extends RawKeyEvent { /// Creates a key event that represents the user pressing a key. const RawKeyDownEvent({ @required RawKeyEventData data, - }) : super(data: data); + @required String character, + }) : super(data: data, character: character); } /// The user has released a key on the keyboard. @@ -255,7 +412,8 @@ class RawKeyUpEvent extends RawKeyEvent { /// Creates a key event that represents the user releasing a key. const RawKeyUpEvent({ @required RawKeyEventData data, - }) : super(data: data); + @required String character, + }) : super(data: data, character: character); } /// An interface for listening to raw key events. @@ -300,17 +458,30 @@ class RawKeyboard { } Future _handleKeyEvent(dynamic message) async { - if (_listeners.isEmpty) { - return; - } final RawKeyEvent event = RawKeyEvent.fromMessage(message); if (event == null) { return; } + if (event is RawKeyDownEvent) { + _keysPressed.add(event.logicalKey); + } + if (event is RawKeyUpEvent) { + _keysPressed.remove(event.logicalKey); + } + if (_listeners.isEmpty) { + return; + } for (ValueChanged listener in List>.from(_listeners)) { if (_listeners.contains(listener)) { listener(event); } } } -} + + final Set _keysPressed = Set(); + + /// Returns the set of keys currently pressed. + Set get keysPressed { + return _keysPressed.toSet(); + } +} \ No newline at end of file diff --git a/packages/flutter/lib/src/services/raw_keyboard_android.dart b/packages/flutter/lib/src/services/raw_keyboard_android.dart index cc3cb57653..73efae1263 100644 --- a/packages/flutter/lib/src/services/raw_keyboard_android.dart +++ b/packages/flutter/lib/src/services/raw_keyboard_android.dart @@ -2,8 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'package:flutter/foundation.dart'; + +import 'keyboard_key.dart'; +import 'keyboard_maps.dart'; import 'raw_keyboard.dart'; +// Android sets the 0x80000000 bit on a character to indicate that it is a +// combining character, so we use this mask to remove that bit to make it a +// valid Unicode character again. +const int _kCombiningCharacterMask = 0x7fffffff; + /// Platform-specific key event data for Android. /// /// This object contains information about key events obtained from Android's @@ -82,6 +91,60 @@ class RawKeyEventDataAndroid extends RawKeyEventData { /// * [isMetaPressed], to see if a META key is pressed. final int metaState; + // Android only reports a single code point for the key label. + @override + String get keyLabel => codePoint == 0 ? null : String.fromCharCode(_combinedCodePoint).toLowerCase(); + + // Handles the logic for removing Android's "combining character" flag on the + // codePoint. + int get _combinedCodePoint => codePoint & _kCombiningCharacterMask; + + // In order for letter keys to match the corresponding constant, they need to + // be a consistent case. + int get _lowercaseCodePoint => String.fromCharCode(_combinedCodePoint).toLowerCase().codeUnitAt(0); + + @override + PhysicalKeyboardKey get physicalKey => kAndroidToPhysicalKey[scanCode] ?? PhysicalKeyboardKey.none; + + @override + LogicalKeyboardKey get logicalKey { + // Look to see if the keyCode is a printable number pad key, so that a + // difference between regular keys (e.g. "=") and the number pad version + // (e.g. the "=" on the number pad) can be determined. + final LogicalKeyboardKey numPadKey = kAndroidNumPadMap[keyCode]; + if (numPadKey != null) { + return numPadKey; + } + + // If it has a non-control-character label, then either return the existing + // constant, or construct a new Unicode-based key from it. Don't mark it as + // autogenerated, since the label uniquely identifies an ID from the Unicode + // plane. + if (keyLabel != null && keyLabel.isNotEmpty && !LogicalKeyboardKey.isControlCharacter(keyLabel)) { + final int keyId = LogicalKeyboardKey.unicodePlane | (_lowercaseCodePoint & LogicalKeyboardKey.valueMask); + return LogicalKeyboardKey.findKeyByKeyId(keyId) ?? LogicalKeyboardKey( + keyId, + keyLabel: keyLabel, + debugName: kReleaseMode ? null : 'Key ${keyLabel.toUpperCase()}', + ); + } + + // Look to see if the keyCode is one we know about and have a mapping for. + LogicalKeyboardKey newKey = kAndroidToLogicalKey[keyCode]; + if (newKey != null) { + return newKey; + } + + // This is a non-printable key that we don't know about, so we mint a new + // code with the autogenerated bit set. + const int androidKeyIdPlane = 0x00200000000; + newKey ??= LogicalKeyboardKey( + androidKeyIdPlane | keyCode | LogicalKeyboardKey.autogeneratedMask, + debugName: kReleaseMode ? null : 'Unknown Android key code $keyCode', + ); + return newKey; + } + bool _isLeftRightModifierPressed(KeyboardSide side, int anyMask, int leftMask, int rightMask) { if (metaState & anyMask == 0) { return false; @@ -308,7 +371,8 @@ class RawKeyEventDataAndroid extends RawKeyEventData { @override String toString() { - return '$runtimeType(flags: $flags, codePoint: $codePoint, keyCode: $keyCode, ' - 'scanCode: $scanCode, metaState: $metaState, modifiers down: $modifiersPressed)'; + return '$runtimeType(keyLabel: $keyLabel flags: $flags, codePoint: $codePoint, ' + 'keyCode: $keyCode, scanCode: $scanCode, metaState: $metaState, ' + 'modifiers down: $modifiersPressed)'; } } diff --git a/packages/flutter/lib/src/services/raw_keyboard_fuschia.dart b/packages/flutter/lib/src/services/raw_keyboard_fuschia.dart index e62dab9890..1f7498b306 100644 --- a/packages/flutter/lib/src/services/raw_keyboard_fuschia.dart +++ b/packages/flutter/lib/src/services/raw_keyboard_fuschia.dart @@ -2,6 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'package:flutter/foundation.dart'; + +import 'keyboard_key.dart'; +import 'keyboard_maps.dart'; import 'raw_keyboard.dart'; /// Platform-specific key event data for Fuchsia. @@ -54,6 +58,41 @@ class RawKeyEventDataFuchsia extends RawKeyEventData { /// * [isMetaPressed], to see if a META key is pressed. final int modifiers; + // Fuchsia only reports a single code point for the key label. + @override + String get keyLabel => codePoint == 0 ? null : String.fromCharCode(codePoint); + + @override + LogicalKeyboardKey get logicalKey { + // If the key has a printable representation, then make a logical key based + // on that. + if (codePoint != 0) { + return LogicalKeyboardKey( + LogicalKeyboardKey.unicodePlane | codePoint & LogicalKeyboardKey.valueMask, + keyLabel: keyLabel, + debugName: kReleaseMode ? null : 'Key $keyLabel', + ); + } + + // Look to see if the hidUsage is one we know about and have a mapping for. + LogicalKeyboardKey newKey = kFuchsiaToLogicalKey[hidUsage | LogicalKeyboardKey.hidPlane]; + if (newKey != null) { + return newKey; + } + + // This is a non-printable key that we don't know about, so we mint a new + // code with the autogenerated bit set. + const int fuchsiaKeyIdPlane = 0x00300000000; + newKey ??= LogicalKeyboardKey( + fuchsiaKeyIdPlane | hidUsage | LogicalKeyboardKey.autogeneratedMask, + debugName: kReleaseMode ? null : 'Ephemeral Fuchsia key code $hidUsage', + ); + return newKey; + } + + @override + PhysicalKeyboardKey get physicalKey => kFuchsiaToPhysicalKey[hidUsage] ?? PhysicalKeyboardKey.none; + bool _isLeftRightModifierPressed(KeyboardSide side, int anyMask, int leftMask, int rightMask) { if (modifiers & anyMask == 0) { return false; diff --git a/packages/flutter/test/services/keyboard_key_test.dart b/packages/flutter/test/services/keyboard_key_test.dart new file mode 100644 index 0000000000..96e3d7cdce --- /dev/null +++ b/packages/flutter/test/services/keyboard_key_test.dart @@ -0,0 +1,54 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/services.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + group(PhysicalKeyboardKey, () { + test('Various classes of keys can be looked up by code.', () async { + // Check a letter key + expect(PhysicalKeyboardKey.findKeyByCode(0x00070004), equals(PhysicalKeyboardKey.keyA)); + // Check a control key + expect(PhysicalKeyboardKey.findKeyByCode(0x00070029), equals(PhysicalKeyboardKey.escape)); + // Check a modifier key + expect(PhysicalKeyboardKey.findKeyByCode(0x000700e1), equals(PhysicalKeyboardKey.shiftLeft)); + }); + test('Equality is only based on HID code.', () async { + const PhysicalKeyboardKey key1 = PhysicalKeyboardKey(0x01, debugName: 'key1'); + const PhysicalKeyboardKey key2 = PhysicalKeyboardKey(0x01, debugName: 'key2'); + expect(key1, equals(key1)); + expect(key1, equals(key2)); + }); + }); + group(LogicalKeyboardKey, () { + test('Various classes of keys can be looked up by code', () async { + // Check a letter key + expect(LogicalKeyboardKey.findKeyByKeyId(0x0000000061), equals(LogicalKeyboardKey.keyA)); + // Check a control key + expect(LogicalKeyboardKey.findKeyByKeyId(0x0100070029), equals(LogicalKeyboardKey.escape)); + // Check a modifier key + expect(LogicalKeyboardKey.findKeyByKeyId(0x01000700e1), equals(LogicalKeyboardKey.shiftLeft)); + }); + test('Control characters are recognized as such', () async { + // Check some common control characters + expect(LogicalKeyboardKey.isControlCharacter('\x08'), isTrue); // BACKSPACE + expect(LogicalKeyboardKey.isControlCharacter('\x0a'), isTrue); // LINE FEED + expect(LogicalKeyboardKey.isControlCharacter('\x0d'), isTrue); // RETURN + expect(LogicalKeyboardKey.isControlCharacter('\x1b'), isTrue); // ESC + expect(LogicalKeyboardKey.isControlCharacter('\x7f'), isTrue); // DELETE + // Check non-control characters + expect(LogicalKeyboardKey.isControlCharacter('A'), isFalse); + expect(LogicalKeyboardKey.isControlCharacter(' '), isFalse); + expect(LogicalKeyboardKey.isControlCharacter('~'), isFalse); + expect(LogicalKeyboardKey.isControlCharacter('\xa0'), isFalse); // NO-BREAK SPACE + }); + test('Equality is only based on ID.', () async { + const LogicalKeyboardKey key1 = LogicalKeyboardKey(0x01, keyLabel: 'label1', debugName: 'key1'); + const LogicalKeyboardKey key2 = LogicalKeyboardKey(0x01, keyLabel: 'label2', debugName: 'key2'); + expect(key1, equals(key1)); + expect(key1, equals(key2)); + }); + }); +} \ No newline at end of file diff --git a/packages/flutter/test/services/raw_keyboard_test.dart b/packages/flutter/test/services/raw_keyboard_test.dart index d246439b03..4cc9edf197 100644 --- a/packages/flutter/test/services/raw_keyboard_test.dart +++ b/packages/flutter/test/services/raw_keyboard_test.dart @@ -97,6 +97,51 @@ void main() { } } }); + test('Printable keyboard keys are correctly translated', () { + final RawKeyEvent keyAEvent = RawKeyEvent.fromMessage({ + 'type': 'keydown', + 'keymap': 'android', + 'keyCode': 29, + 'codePoint': 'A'.codeUnitAt(0), + 'character': 'A', + 'scanCode': 30, + 'metaState': 0x0, + }); + final RawKeyEventDataAndroid data = keyAEvent.data; + expect(data.physicalKey, equals(PhysicalKeyboardKey.keyA)); + expect(data.logicalKey, equals(LogicalKeyboardKey.keyA)); + expect(data.keyLabel, equals('a')); + }); + test('Control keyboard keys are correctly translated', () { + final RawKeyEvent escapeKeyEvent = RawKeyEvent.fromMessage(const { + 'type': 'keydown', + 'keymap': 'android', + 'keyCode': 111, + 'codePoint': null, + 'character': null, + 'scanCode': 1, + 'metaState': 0x0, + }); + final RawKeyEventDataAndroid data = escapeKeyEvent.data; + expect(data.physicalKey, equals(PhysicalKeyboardKey.escape)); + expect(data.logicalKey, equals(LogicalKeyboardKey.escape)); + expect(data.keyLabel, isNull); + }); + test('Modifier keyboard keys are correctly translated', () { + final RawKeyEvent shiftLeftKeyEvent = RawKeyEvent.fromMessage(const { + 'type': 'keydown', + 'keymap': 'android', + 'keyCode': 59, + 'codePoint': null, + 'character': null, + 'scanCode': 42, + 'metaState': RawKeyEventDataAndroid.modifierLeftShift, + }); + final RawKeyEventDataAndroid data = shiftLeftKeyEvent.data; + expect(data.physicalKey, equals(PhysicalKeyboardKey.shiftLeft)); + expect(data.logicalKey, equals(LogicalKeyboardKey.shiftLeft)); + expect(data.keyLabel, isNull); + }); }); group('RawKeyEventDataFuchsia', () { const Map modifierTests = { @@ -175,5 +220,44 @@ void main() { } } }); + test('Printable keyboard keys are correctly translated', () { + final RawKeyEvent keyAEvent = RawKeyEvent.fromMessage({ + 'type': 'keydown', + 'keymap': 'fuchsia', + 'hidUsage': 0x00070004, + 'codePoint': 'a'.codeUnitAt(0), + 'character': 'a', + }); + final RawKeyEventDataFuchsia data = keyAEvent.data; + expect(data.physicalKey, equals(PhysicalKeyboardKey.keyA)); + expect(data.logicalKey, equals(LogicalKeyboardKey.keyA)); + expect(data.keyLabel, equals('a')); + }); + test('Control keyboard keys are correctly translated', () { + final RawKeyEvent escapeKeyEvent = RawKeyEvent.fromMessage(const { + 'type': 'keydown', + 'keymap': 'fuchsia', + 'hidUsage': 0x00070029, + 'codePoint': null, + 'character': null, + }); + final RawKeyEventDataFuchsia data = escapeKeyEvent.data; + expect(data.physicalKey, equals(PhysicalKeyboardKey.escape)); + expect(data.logicalKey, equals(LogicalKeyboardKey.escape)); + expect(data.keyLabel, isNull); + }); + test('Modifier keyboard keys are correctly translated', () { + final RawKeyEvent shiftLeftKeyEvent = RawKeyEvent.fromMessage(const { + 'type': 'keydown', + 'keymap': 'fuchsia', + 'hidUsage': 0x000700e1, + 'codePoint': null, + 'character': null, + }); + final RawKeyEventDataFuchsia data = shiftLeftKeyEvent.data; + expect(data.physicalKey, equals(PhysicalKeyboardKey.shiftLeft)); + expect(data.logicalKey, equals(LogicalKeyboardKey.shiftLeft)); + expect(data.keyLabel, isNull); + }); }); }