Flutter Engine
The Flutter Engine
|
#include <text_delegate.h>
Public Member Functions | |
TextDelegate (fuchsia::ui::views::ViewRef view_ref, fuchsia::ui::input::ImeServiceHandle ime_service, fuchsia::ui::input3::KeyboardHandle keyboard, std::function< void(std::unique_ptr< flutter::PlatformMessage >)> dispatch_callback) | |
void | OnKeyEvent (fuchsia::ui::input3::KeyEvent key_event, fuchsia::ui::input3::KeyboardListener::OnKeyEventCallback callback) override |
void | DidUpdateState (fuchsia::ui::input::TextInputState state, std::unique_ptr< fuchsia::ui::input::InputEvent > event) override |
void | OnAction (fuchsia::ui::input::InputMethodAction action) override |
void | ActivateIme () |
void | DeactivateIme () |
bool | HandleFlutterTextInputChannelPlatformMessage (std::unique_ptr< flutter::PlatformMessage > message) |
Channel handler for kTextInputChannel. More... | |
bool | HasTextState () |
TextDelegate handles keyboard inpout and text editing.
It mediates between Fuchsia's input and Flutter's platform messages. When it is initialized, it contacts fuchsia.ui.input.Keyboard
to register itself as listener of key events.
Whenever a text editing request comes from the Flutter app, it will activate Fuchsia's input method editor, and will send text edit actions coming from the Fuchsia platform over to the Flutter app, by converting FIDL messages (fuchsia.ui.input.InputMethodEditorClient
calls) to appropriate text editing Flutter platform messages.
For details refer to:
Definition at line 48 of file text_delegate.h.
flutter_runner::TextDelegate::TextDelegate | ( | fuchsia::ui::views::ViewRef | view_ref, |
fuchsia::ui::input::ImeServiceHandle | ime_service, | ||
fuchsia::ui::input3::KeyboardHandle | keyboard, | ||
std::function< void(std::unique_ptr< flutter::PlatformMessage >)> | dispatch_callback | ||
) |
Creates a new TextDelegate.
Args: view_ref: the reference to the app's view. Required for registration with Fuchsia. ime_service: a handle to Fuchsia's input method service. keyboard: the keyboard listener, gets notified of key presses and releases. dispatch_callback: a function used to send a Flutter platform message.
Definition at line 115 of file text_delegate.cc.
void flutter_runner::TextDelegate::ActivateIme | ( | ) |
Gets a new input method editor from the input connection. Run when both Scenic has focus and Flutter has requested input with setClient.
Definition at line 138 of file text_delegate.cc.
void flutter_runner::TextDelegate::DeactivateIme | ( | ) |
Detaches the input method editor connection, ending the edit session and closing the onscreen keyboard. Call when input is no longer desired, either because Scenic says we lost focus or when Flutter no longer has a text field focused.
Definition at line 156 of file text_delegate.cc.
|
override |
|fuchsia::ui::input::InputMethodEditorClient| Called by the embedder every time the edit state is updated.
Definition at line 167 of file text_delegate.cc.
bool flutter_runner::TextDelegate::HandleFlutterTextInputChannelPlatformMessage | ( | std::unique_ptr< flutter::PlatformMessage > | message | ) |
Channel handler for kTextInputChannel.
Definition at line 246 of file text_delegate.cc.
|
inline |
Returns true if there is a text state (i.e. if some text editing is in progress).
Definition at line 99 of file text_delegate.h.
|
override |
|fuchsia::ui::input::InputMethodEditorClient| Called by the embedder when the action key is pressed, and the requested action is supplied to Flutter.
Definition at line 216 of file text_delegate.cc.
|
override |
|fuchsia.ui.input3.KeyboardListener| Called by the embedder every time there is a key event to process.
Definition at line 397 of file text_delegate.cc.