Revert "Keyboard events (#83752)" (#87171)

This reverts commit 5f792ba170.
This commit is contained in:
Tong Mu
2021-07-28 02:32:08 -07:00
committed by GitHub
parent 863c42a8b4
commit 2f4f170dd2
38 changed files with 282 additions and 2518 deletions

View File

@@ -327,9 +327,6 @@ class LogicalKeyboardKey extends KeyboardKey {
@@@LOGICAL_KEY_DEFINITIONS@@@
/// A list of all predefined constant [LogicalKeyboardKey]s.
static Iterable<LogicalKeyboardKey> get knownLogicalKeys => _knownLogicalKeys.values;
// A list of all predefined constant LogicalKeyboardKeys so they can be
// searched.
static const Map<int, LogicalKeyboardKey> _knownLogicalKeys = <int, LogicalKeyboardKey>{
@@ -492,9 +489,6 @@ class PhysicalKeyboardKey extends KeyboardKey {
@@@PHYSICAL_KEY_DEFINITIONS@@@
/// A list of all predefined constant [PhysicalKeyboardKey]s.
static Iterable<PhysicalKeyboardKey> get knownPhysicalKeys => _knownPhysicalKeys.values;
// A list of all the predefined constant PhysicalKeyboardKeys so that they
// can be searched.
static const Map<int, PhysicalKeyboardKey> _knownPhysicalKeys = <int, PhysicalKeyboardKey>{

View File

@@ -176,5 +176,41 @@
"Zoom": ["ZOOM"],
"Noname": ["NONAME"],
"Pa1": ["PA1"],
"OemClear": ["OEM_CLEAR"]
"OemClear": ["OEM_CLEAR"],
"0": ["0"],
"1": ["1"],
"2": ["2"],
"3": ["3"],
"4": ["4"],
"5": ["5"],
"6": ["6"],
"7": ["7"],
"8": ["8"],
"9": ["9"],
"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"]
}

View File

@@ -24,16 +24,6 @@ bool _isAsciiLetter(String? char) {
|| (charCode >= charLowerA && charCode <= charLowerZ);
}
bool _isDigit(String? char) {
if (char == null)
return false;
final int charDigit0 = '0'.codeUnitAt(0);
final int charDigit9 = '9'.codeUnitAt(0);
assert(char.length == 1);
final int charCode = char.codeUnitAt(0);
return charCode >= charDigit0 && charCode <= charDigit9;
}
/// Generates the keyboard_maps.dart files, based on the information in the key
/// data structure given to it.
class KeyboardMapsCodeGenerator extends BaseCodeGenerator {
@@ -181,9 +171,7 @@ class KeyboardMapsCodeGenerator extends BaseCodeGenerator {
// because they are not used by the embedding. Add them manually.
final List<int>? keyCodes = entry.windowsValues.isNotEmpty
? entry.windowsValues
: (_isAsciiLetter(entry.keyLabel) ? <int>[entry.keyLabel!.toUpperCase().codeUnitAt(0)] :
_isDigit(entry.keyLabel) ? <int>[entry.keyLabel!.toUpperCase().codeUnitAt(0)] :
null);
: (_isAsciiLetter(entry.keyLabel) ? <int>[entry.keyLabel!.toUpperCase().codeUnitAt(0)] : null);
if (keyCodes != null) {
for (final int code in keyCodes) {
lines.add(code, ' $code: LogicalKeyboardKey.${entry.constantName},');