Remove keyLabel and debugName from Logical/PhysicalKeyboardKey (#78263)

- Remove `LogicalKeyboardKey.keyLabel`
- Make `Physical/LogicalKeyboardKey.debugName` getters
- Make `Physical/LogicalKeyboardKey()` factory constructors, which cache non-predefined instances.
This commit is contained in:
Tong Mu
2021-03-24 04:59:57 -07:00
committed by GitHub
parent 2f05751973
commit 515ef91ba1
18 changed files with 1497 additions and 808 deletions

View File

@@ -18,6 +18,7 @@ import 'package:gen_keycodes/glfw_code_gen.dart';
import 'package:gen_keycodes/gtk_code_gen.dart';
import 'package:gen_keycodes/windows_code_gen.dart';
import 'package:gen_keycodes/web_code_gen.dart';
import 'package:gen_keycodes/key_labels_code_gen.dart';
import 'package:gen_keycodes/keyboard_keys_code_gen.dart';
import 'package:gen_keycodes/keyboard_maps_code_gen.dart';
import 'package:gen_keycodes/key_data.dart';
@@ -253,6 +254,13 @@ Future<void> main(List<String> rawArguments) async {
print('Writing ${'key maps'.padRight(15)}${mapsFile.absolute}');
await mapsFile.writeAsString(KeyboardMapsCodeGenerator(data).generate());
final File keyLabelsFile = File(path.join(flutterRoot.path, 'packages', 'flutter_test', 'lib', 'src', 'key_labels.dart'));
if (!keyLabelsFile.existsSync()) {
mapsFile.createSync(recursive: true);
}
print('Writing ${'key labels'.padRight(15)}${mapsFile.absolute}');
await keyLabelsFile.writeAsString(KeyLabelsCodeGenerator(data).generate());
for (final String platform in <String>['android', 'macos', 'ios', 'glfw', 'fuchsia', 'linux', 'windows', 'web']) {
PlatformCodeGenerator codeGenerator;
switch (platform) {