@@ -305,8 +305,8 @@ class KeyboardMapsCodeGenerator extends BaseCodeGenerator {
|
||||
String get _webPhysicalKeyMap {
|
||||
final OutputLines<String> lines = OutputLines<String>('Web physical key map');
|
||||
for (final PhysicalKeyEntry entry in keyData.entries) {
|
||||
if (entry.name != null) {
|
||||
lines.add(entry.name, " '${entry.name}': PhysicalKeyboardKey.${entry.constantName},");
|
||||
for (final String webCodes in entry.webCodes()) {
|
||||
lines.add(entry.name, " '$webCodes': PhysicalKeyboardKey.${entry.constantName},");
|
||||
}
|
||||
}
|
||||
return lines.sortedJoin().trimRight();
|
||||
|
||||
@@ -372,6 +372,9 @@ class LogicalKeyData {
|
||||
|
||||
glfwNameToKeyCode.forEach((String glfwName, int value) {
|
||||
final String? name = nameToFlutterName[glfwName];
|
||||
if (name == null) {
|
||||
return;
|
||||
}
|
||||
final LogicalKeyEntry? entry = data[nameToFlutterName[glfwName]];
|
||||
if (entry == null) {
|
||||
print('Invalid logical entry by name $name (from GLFW $glfwName)');
|
||||
|
||||
@@ -259,6 +259,12 @@ class PhysicalKeyEntry {
|
||||
/// The Chromium event code for the key.
|
||||
final String? chromiumCode;
|
||||
|
||||
Iterable<String> webCodes() sync* {
|
||||
if (chromiumCode != null) {
|
||||
yield chromiumCode!;
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a JSON map from the key data.
|
||||
Map<String, dynamic> toJson() {
|
||||
return removeEmptyValues(<String, dynamic>{
|
||||
|
||||
@@ -35,7 +35,7 @@ class KeyCodesJavaGenerator extends BaseCodeGenerator {
|
||||
final OutputLines<int> lines = OutputLines<int>('Physical Key list');
|
||||
for (final PhysicalKeyEntry entry in keyData.entries) {
|
||||
lines.add(entry.usbHidCode, '''
|
||||
public static final long PHYSICAL_${_toUpperSnake(entry.constantName)} = ${toHex(entry.usbHidCode)}l;''');
|
||||
public static final long PHYSICAL_${_toUpperSnake(entry.constantName)} = ${toHex(entry.usbHidCode)}L;''');
|
||||
}
|
||||
return lines.sortedJoin().trimRight();
|
||||
}
|
||||
@@ -45,7 +45,7 @@ class KeyCodesJavaGenerator extends BaseCodeGenerator {
|
||||
final OutputLines<int> lines = OutputLines<int>('Logical Key list');
|
||||
for (final LogicalKeyEntry entry in logicalData.entries) {
|
||||
lines.add(entry.value, '''
|
||||
public static final long LOGICAL_${_toUpperSnake(entry.constantName)} = ${toHex(entry.value, digits: 11)}l;''');
|
||||
public static final long LOGICAL_${_toUpperSnake(entry.constantName)} = ${toHex(entry.value, digits: 11)}L;''');
|
||||
}
|
||||
return lines.sortedJoin().trimRight();
|
||||
}
|
||||
|
||||
@@ -37,9 +37,9 @@ class WebCodeGenerator extends PlatformCodeGenerator {
|
||||
String get _webPhysicalKeyCodeMap {
|
||||
final OutputLines<String> lines = OutputLines<String>('Web physical map');
|
||||
for (final PhysicalKeyEntry entry in keyData.entries) {
|
||||
if (entry.name != null) {
|
||||
lines.add(entry.name,
|
||||
" '${entry.name}': ${toHex(entry.usbHidCode)}, // ${entry.constantName}");
|
||||
for (final String webCode in entry.webCodes()) {
|
||||
lines.add(webCode,
|
||||
" '$webCode': ${toHex(entry.usbHidCode)}, // ${entry.constantName}");
|
||||
}
|
||||
}
|
||||
return lines.sortedJoin().trimRight();
|
||||
|
||||
Reference in New Issue
Block a user