-
Notifications
You must be signed in to change notification settings - Fork 6k
Impl. key event channel for iOS #9010
Conversation
shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm
Outdated
Show resolved
Hide resolved
|
In re-reading this, I realized that this PR is only for sending the backspace key, right? That's not really all that useful in the broader scheme of things. Ideally, there would be support for all the keys on the keyboard, like the other platforms. Is that just not feasible, or is there other work to be done for that? And if so, what needs to be done? |
|
Lol, yes sorry to disappoint. :D Unfortunately, iOS's doesn't expose key events to us, as the other platforms do. We are strictly limited by the callbacks exposed by UIKeyInput, I thought about reversing any text received in In any case, this PR should serve as a starting point, if we decide to take on that task. |
|
@snowxd thanks for your contribution. I'd prefer not to merge something with only a partial implementation. I agree that an implementation that can 'reverse engineer' out the key events required to get from state A to state B is likely to be a significant undertaking. @gspencergoog @stuartmorgan how would you like to proceed on this? |
|
@cbracken I think you and/or @gspencergoog are the right people to figure out how to proceed with this/#8606 based on the discussion in the two bugs. I was originally looped in to weigh in on similarities with desktop work on key events, but the fundamental limitation discussed above doesn't apply to desktop, so this is now specifically a question of what the best way to handle iOS. |
|
Sounds good. @snowxd just to set expectations, @gspencergoog is out for a couple weeks and I'll be out starting next week until mid-July, but we'll sync up then and get back on this. Apologies for the latency. |
|
Hey, no worries. I was playing around with javascript KeyEvents in Chrome, on iOS, and I noticed that they take a simple approach ignoring modifiers and non-ascii characters (?). I think replicating the same behavior by reversing Essentially, we would reverse every character received to their ASCII equivalent and map that to their key code. Lowercase and uppercase characters would map to the same key code. |
…29845_ios-raw-keyevent
|
Given that we don't plan to take this PR in its current partial implementation, I'm going to close this for now. We'd absolutely welcome an implementation that emits synthesized key events based on diffs between strings though. Thanks for your contribution! |
|
@snowxd, the final approach you mention sounds interesting, but I think (as you mentioned above) that it might have significant problems when trying to support various non-ASCII keys. If you can find a way, though, we'd love to see it. |
Following the discussion in #8606, this PR implements a key event channel to pass key press events (from TextFields) in iOS.
References flutter/flutter#29845
@stuartmorgan @cbracken @gspencergoog