-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simulate IME messages when pressing ENTER (Resolves #19) #20
Simulate IME messages when pressing ENTER (Resolves #19) #20
Conversation
lib/src/keyboard.dart
Outdated
@@ -81,7 +82,40 @@ extension KeyboardInput on WidgetTester { | |||
|
|||
Future<void> pressEnter() async { | |||
await sendKeyEvent(LogicalKeyboardKey.enter, platform: _keyEventPlatform); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason that you removed this pumpAndSettle()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed by mistake.
} | ||
|
||
await ime.typeText('\n', finder: finder, getter: getter); | ||
await pump(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these actions actually separated by a frame in the real Flutter implementation? Or do they happen in the same frame?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They happen in the same frame. Updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
When a widget is attached to the IME, if a ENTER key press isn't handled, the IME generates a
\n
followed by aTextInputAction.newline
.This PR adds the methods
pressEnterWithIme
andpressNumpadEnterWithIme
to simulate these messages.