@@ -24,23 +24,27 @@ extension KeyboardInput on WidgetTester {
2424 /// `TextField` only responds to the IME, so this method would have no
2525 /// effect on a `TextField` .
2626 Future <void > typeKeyboardText (String plainText) async {
27+ // Avoid generating characters with an "ios" platform due to Flutter bug.
28+ // TODO: Remove special platform selection when Flutter issue is solved (https://github.com/flutter/flutter/issues/133956)
29+ final platform = _keyEventPlatform != "ios" ? _keyEventPlatform : "android" ;
30+
2731 for (int i = 0 ; i < plainText.length; i += 1 ) {
2832 final character = plainText[i];
2933 final keyCombo = _keyComboForCharacter (character);
3034
3135 if (keyCombo.isShiftPressed) {
32- await sendKeyDownEvent (LogicalKeyboardKey .shift, platform: _keyEventPlatform );
36+ await sendKeyDownEvent (LogicalKeyboardKey .shift, platform: platform );
3337 }
3438
3539 if (keyCombo.isShiftPressed) {
36- await sendKeyDownEvent (keyCombo.physicalKey! , platform: _keyEventPlatform , character: character);
37- await sendKeyUpEvent (keyCombo.physicalKey! , platform: _keyEventPlatform );
40+ await sendKeyDownEvent (keyCombo.physicalKey! , platform: platform , character: character);
41+ await sendKeyUpEvent (keyCombo.physicalKey! , platform: platform );
3842 } else {
39- await sendKeyEvent (keyCombo.key, platform: _keyEventPlatform );
43+ await sendKeyEvent (keyCombo.key, platform: platform );
4044 }
4145
4246 if (keyCombo.isShiftPressed) {
43- await sendKeyUpEvent (LogicalKeyboardKey .shift, platform: _keyEventPlatform );
47+ await sendKeyUpEvent (LogicalKeyboardKey .shift, platform: platform );
4448 }
4549
4650 await pump ();
0 commit comments