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 method
    fn handles_editing_keys(&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.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§