Fix the character field of the RawKeyEvent to hold correct data on non-Android platforms. (#65667)

This fixes a problem where the character field of the RawKeyEvent was not being set at all for non-Android platforms.

I also updated the key maps, and corrected a problem with the Windows key map where the backquote character wasn't correctly mapped.
This commit is contained in:
Greg Spencer
2020-09-15 13:02:16 -07:00
committed by GitHub
parent b8a39c15f8
commit 199a7c1964
8 changed files with 78 additions and 17 deletions

View File

@@ -79,6 +79,7 @@ class _HardwareKeyDemoState extends State<RawKeyboardDemo> {
final String modifierList = data.modifiersPressed.keys.map<String>(_getEnumName).join(', ').replaceAll('Modifier', '');
final List<Widget> dataText = <Widget>[
Text('${_event.runtimeType}'),
if (_event.character?.isNotEmpty ?? false) Text('character produced: "${_event.character}"'),
Text('modifiers set: $modifierList'),
];
if (data is RawKeyEventDataAndroid) {
@@ -114,6 +115,10 @@ class _HardwareKeyDemoState extends State<RawKeyboardDemo> {
dataText.add(Text('scanCode: ${data.scanCode}'));
dataText.add(Text('characterCodePoint: ${data.characterCodePoint}'));
dataText.add(Text('modifiers: ${data.modifiers} (${_asHex(data.modifiers)})'));
} else if (data is RawKeyEventDataWeb) {
dataText.add(Text('key: ${data.key}'));
dataText.add(Text('code: ${data.code}'));
dataText.add(Text('metaState: ${data.metaState} (${_asHex(data.metaState)})'));
}
dataText.add(Text('logical: ${_event.logicalKey}'));
dataText.add(Text('physical: ${_event.physicalKey}'));