Skip to main content

ViewHost

Trait ViewHost 

Source
pub trait ViewHost {
    // Required methods
    fn text_input(&self) -> Option<&dyn TextInputHost>;
    fn activate_system_cursor(&self, device: i64, kind: SystemMouseCursorKind);
    fn request_focus_change(
        &self,
        state: ViewFocusState,
        direction: ViewFocusDirection,
    );
}
Expand description

What one view asks of the system, provided by whoever hosts the view: a window’s view gets its window’s. Chromium’s RenderWidgetHostView and Android’s SurfaceControlViewHost are this piece; where Flutter’s embedders take the same requests on the platform as a whole, through SystemChannels.textInput, SystemChannels.mouseCursor and PlatformDispatcher.requestViewFocusChange, here each view’s own host takes them.

Required Methods§

Source

fn text_input(&self) -> Option<&dyn TextInputHost>

The input methods that edit text in this view; none where it takes no text.

Source

fn activate_system_cursor(&self, device: i64, kind: SystemMouseCursorKind)

Shows a system cursor for a pointing device over this view: Flutter’s activateSystemCursor message on SystemChannels.mouseCursor. A host with one cursor for every view shows it wherever the pointer is.

Source

fn request_focus_change( &self, state: ViewFocusState, direction: ViewFocusDirection, )

Flutter’s PlatformDispatcher.requestViewFocusChange for this view: asks the system to move the focus to it, or away from it. A host whose system has no focus to move ignores it.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§