Skip to main content

TextInputHost

Trait TextInputHost 

Source
pub trait TextInputHost {
    // Required methods
    fn start(&self, configuration: &TextInputConfiguration);
    fn stop(&self);
    fn set_editing_state(&self, value: &TextEditingValue);
    fn set_composing_rect(&self, rect: Rect);
    fn set_caret_rect(&self, rect: Rect);
    fn set_client_geometry(&self, size: Size, transform: &Matrix4);

    // Provided methods
    fn handles_editing_keys(&self) -> bool { ... }
    fn provides_edit_commands(&self) -> bool { ... }
}
Expand description

The host side of Flutter’s text input connection for one view.

Required Methods§

Source

fn start(&self, configuration: &TextInputConfiguration)

Flutter TextInput.attach / TextInputConnection.show: start an IME session for this view.

Source

fn stop(&self)

Flutter TextInputConnection.close: end the IME session.

Source

fn set_editing_state(&self, value: &TextEditingValue)

Flutter TextInputConnection.setEditingState.

Source

fn set_composing_rect(&self, rect: Rect)

Flutter TextInput.setComposingRect.

Source

fn set_caret_rect(&self, rect: Rect)

Flutter TextInput.setCaretRect.

Source

fn set_client_geometry(&self, size: Size, transform: &Matrix4)

Flutter TextInput.setEditableSizeAndTransform.

Provided Methods§

Source

fn handles_editing_keys(&self) -> bool

Whether this text input turns editing keys into edits before the framework sees them: backspace and delete, caret movement, the line and document ends.

Flutter has no such question because each of its embedders is written for one host: its macOS and iOS embedders do interpret those keys, and its text field bindings for those platforms step aside so a key is not acted on twice.

Defaults to false, which is what a host built on a windowing library that reports plain key presses should answer, whichever platform it runs on. A host that hands the framework the operating system’s own editing commands answers true, and the field then leaves those keys to it.

Source

fn provides_edit_commands(&self) -> bool

Whether the host sends the view Edit’s commands as events through a command of its own, which the user’s ⌘C, ⌘X and ⌘V reach once the framework leaves them unhandled: macOS’s Edit menu, or the host’s of a program that runs inside another app. A text field then leaves those keys unhandled and acts on the clipboard_event the command sends, as Flutter’s text fields on the web leave them to the browser.

Defaults to false: a host whose system has no such command, or whose app may have set a menu bar without Edit’s commands, keeps them in the field.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§