[Keyboard, iOS] Generate iOS's special key mapping (#106909)
This commit is contained in:
@@ -6,6 +6,7 @@ import 'package:path/path.dart' as path;
|
||||
|
||||
import 'base_code_gen.dart';
|
||||
import 'constants.dart';
|
||||
import 'data.dart';
|
||||
import 'logical_key_data.dart';
|
||||
import 'physical_key_data.dart';
|
||||
import 'utils.dart';
|
||||
@@ -105,6 +106,15 @@ class IOSCodeGenerator extends PlatformCodeGenerator {
|
||||
return modifierKeyMap.toString().trimRight();
|
||||
}
|
||||
|
||||
String get _specialKeyMapping {
|
||||
final OutputLines<int> lines = OutputLines<int>('iOS special key mapping');
|
||||
kIosSpecialKeyMapping.forEach((String key, String logicalName) {
|
||||
final int value = logicalData.entryByName(logicalName).value;
|
||||
lines.add(value, ' @"$key" : @(${toHex(value)}),');
|
||||
});
|
||||
return lines.join().trimRight();
|
||||
}
|
||||
|
||||
/// This generates some keys that needs special attention.
|
||||
String get _specialKeyConstants {
|
||||
final StringBuffer specialKeyConstants = StringBuffer();
|
||||
@@ -137,6 +147,7 @@ class IOSCodeGenerator extends PlatformCodeGenerator {
|
||||
'KEYCODE_TO_MODIFIER_FLAG_MAP': _keyToModifierFlagMap,
|
||||
'MODIFIER_FLAG_TO_KEYCODE_MAP': _modifierFlagToKeyMap,
|
||||
'SPECIAL_KEY_CONSTANTS': _specialKeyConstants,
|
||||
'SPECIAL_KEY_MAPPING': _specialKeyMapping,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user