@@ -24,23 +24,27 @@ extension KeyboardInput on WidgetTester {
24
24
/// `TextField` only responds to the IME, so this method would have no
25
25
/// effect on a `TextField` .
26
26
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
+
27
31
for (int i = 0 ; i < plainText.length; i += 1 ) {
28
32
final character = plainText[i];
29
33
final keyCombo = _keyComboForCharacter (character);
30
34
31
35
if (keyCombo.isShiftPressed) {
32
- await sendKeyDownEvent (LogicalKeyboardKey .shift, platform: _keyEventPlatform );
36
+ await sendKeyDownEvent (LogicalKeyboardKey .shift, platform: platform );
33
37
}
34
38
35
39
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 );
38
42
} else {
39
- await sendKeyEvent (keyCombo.key, platform: _keyEventPlatform );
43
+ await sendKeyEvent (keyCombo.key, platform: platform );
40
44
}
41
45
42
46
if (keyCombo.isShiftPressed) {
43
- await sendKeyUpEvent (LogicalKeyboardKey .shift, platform: _keyEventPlatform );
47
+ await sendKeyUpEvent (LogicalKeyboardKey .shift, platform: platform );
44
48
}
45
49
46
50
await pump ();
0 commit comments