mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
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.
41 lines
1.5 KiB
Cheetah
41 lines
1.5 KiB
Cheetah
// 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<int, LogicalKeyboardKey> kAndroidToLogicalKey = <int, LogicalKeyboardKey>{
|
|
@@@ANDROID_KEY_CODE_MAP@@@
|
|
};
|
|
|
|
/// Maps Android-specific scan codes to the matching [PhysicalKeyboardKey].
|
|
const Map<int, PhysicalKeyboardKey> kAndroidToPhysicalKey = <int, PhysicalKeyboardKey>{
|
|
@@@ANDROID_SCAN_CODE_MAP@@@
|
|
};
|
|
|
|
/// 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<int, LogicalKeyboardKey> kAndroidNumPadMap = <int, LogicalKeyboardKey>{
|
|
@@@ANDROID_NUMPAD_MAP@@@
|
|
};
|
|
|
|
/// Maps Fuchsia-specific IDs to the matching [LogicalKeyboardKey].
|
|
const Map<int, LogicalKeyboardKey> kFuchsiaToLogicalKey = <int, LogicalKeyboardKey>{
|
|
@@@FUCHSIA_KEY_CODE_MAP@@@
|
|
};
|
|
|
|
/// Maps Fuchsia-specific USB HID Usage IDs to the matching
|
|
/// [PhysicalKeyboardKey].
|
|
const Map<int, PhysicalKeyboardKey> kFuchsiaToPhysicalKey = <int, PhysicalKeyboardKey>{
|
|
@@@FUCHSIA_SCAN_CODE_MAP@@@
|
|
};
|