pub trait EmbedderClient {
Show 32 methods
// Required methods
fn frame(&mut self, views: &[ViewId], frame: Frame);
fn view_added(&mut self, id: ViewId);
fn view_metrics_changed(&mut self, id: ViewId);
fn view_removed(&mut self, id: ViewId);
fn pointer_reports(&mut self, reports: Vec<PointerReport>);
fn key_data(&mut self, data: KeyData) -> bool;
fn platform_brightness_changed(&mut self);
fn locales_changed(&mut self);
fn wake(&mut self, elapsed: Duration);
// Provided methods
fn screens_changed(&mut self) { ... }
fn view_focus_changed(&mut self, event: ViewFocusEvent) { ... }
fn drag_report(&mut self, report: DragReport) { ... }
fn clipboard_event(&mut self, view: ViewId, event: ClipboardEvent) { ... }
fn edit_command(&mut self, view: ViewId, command: EditCommand) { ... }
fn menu_selected(&mut self, id: MenuId) { ... }
fn dock_menu_selected(&mut self, id: MenuId) { ... }
fn tray_icon_event(&mut self, icon: TrayIconId, event: TrayIconEvent) { ... }
fn open_requested(&mut self, request: OpenRequest) { ... }
fn notification_activated(&mut self, activation: NotificationActivation) { ... }
fn pop_route(&mut self) -> bool { ... }
fn view_close_requested(&mut self, view: ViewId) { ... }
fn window_changed(&mut self, view: ViewId) { ... }
fn view_request_failed(&mut self, request: RequestId, error: ViewError) { ... }
fn request_app_exit(&mut self, reply: AppExitReply) { ... }
fn app_lifecycle_state_changed(&mut self, state: AppLifecycleState) { ... }
fn system_fonts_changed(&mut self) { ... }
fn clipboard_changed(&mut self) { ... }
fn text_input_editing_value(
&mut self,
view: ViewId,
value: TextEditingValue,
) { ... }
fn text_input_action(&mut self, view: ViewId, action: TextInputAction) { ... }
fn text_input_closed(&mut self, view: ViewId) { ... }
fn system_context_menu_hidden(&mut self) { ... }
fn custom_context_menu_action(&mut self, callback_id: &str) { ... }
}Expand description
Complete frames and typed view lifecycle notifications.
The platform updates its view registry before sending a lifecycle method, so the client can immediately query the affected view.
Required Methods§
Sourcefn frame(&mut self, views: &[ViewId], frame: Frame)
fn frame(&mut self, views: &[ViewId], frame: Frame)
A screen refreshed at frame.elapsed: views are the views on it, in sight, that asked
for a frame (Platform::request_frame) before the
refresh began; one that asks during it is in the next.
The host never calls it from inside another call into the client.
Sourcefn view_added(&mut self, id: ViewId)
fn view_added(&mut self, id: ViewId)
A view arrived after launch: opened by the app, or given by the system. The views that
exist at launch are in Platform::views when the app starts, and none of them is
reported here.
Sourcefn view_metrics_changed(&mut self, id: ViewId)
fn view_metrics_changed(&mut self, id: ViewId)
Flutter’s window metrics event: something of id’s metrics changed, the screen it is on
included.
Sourcefn view_removed(&mut self, id: ViewId)
fn view_removed(&mut self, id: ViewId)
A view is gone; the app keeps running.
Sourcefn pointer_reports(&mut self, reports: Vec<PointerReport>)
fn pointer_reports(&mut self, reports: Vec<PointerReport>)
What pointing devices did, as the system reported it, in the order it happened: the
embedder API’s FlutterEngineSendPointerEvent. The client adds what the framework also
needs (PointerDataPacketConverter) and hands the
result to PlatformDispatcher.onPointerDataPacket.
Sourcefn key_data(&mut self, data: KeyData) -> bool
fn key_data(&mut self, data: KeyData) -> bool
Flutter PlatformDispatcher.onKeyData.
Returns whether the framework handled the event; a host that shares the keyboard with other native components should not propagate a handled one.
Sourcefn platform_brightness_changed(&mut self)
fn platform_brightness_changed(&mut self)
Flutter PlatformDispatcher.onPlatformBrightnessChanged: the host’s light or dark
preference changed, and Platform::platform_brightness already answers the new one.
Sourcefn locales_changed(&mut self)
fn locales_changed(&mut self)
Flutter PlatformDispatcher.onLocaleChanged: the host’s locale list changed, and
Platform::locales already answers the new one.
Sourcefn wake(&mut self, elapsed: Duration)
fn wake(&mut self, elapsed: Duration)
The wake asked for through Dispatcher::wake_at or
Dispatcher::wake_now.
elapsed is the platform clock, the same one Frame::elapsed reports. Dart’s
event loop runs due Timers itself; here the client advances its own clock.
Provided Methods§
Sourcefn screens_changed(&mut self)
fn screens_changed(&mut self)
Flutter FlutterEngineNotifyDisplayUpdate: a screen was added, removed or changed, and
Platform::screens already answers the new list. A view that is on another screen now
is reported through view_metrics_changed. The default drops it.
Sourcefn view_focus_changed(&mut self, event: ViewFocusEvent)
fn view_focus_changed(&mut self, event: ViewFocusEvent)
Flutter PlatformDispatcher.onViewFocusChange.
Sourcefn drag_report(&mut self, report: DragReport)
fn drag_report(&mut self, report: DragReport)
What is dragged from outside the application entered, moved over, was dropped on or left a view: the dropped report is the one its items are read in. No dart:ui hook; the default drops it.
Sourcefn clipboard_event(&mut self, view: ViewId, event: ClipboardEvent)
fn clipboard_event(&mut self, view: ViewId, event: ClipboardEvent)
The user copied, cut or pasted in view through the platform’s own command: the
browser’s, or a desktop’s Edit menu, which a key reaches only once the framework has left
it unhandled. No dart:ui hook; the default drops it.
Sourcefn edit_command(&mut self, view: ViewId, command: EditCommand)
fn edit_command(&mut self, view: ViewId, command: EditCommand)
The user chose an edit command for view from the system’s own Edit menu, which a key
reaches only once the framework has left it unhandled: undo, redo, select all or delete.
No dart:ui hook; the default drops it.
The user chose the item id of the app’s menu bar (MenuBar::set_menus). Flutter’s
Menu.selectedCallback on the flutter/menu channel. The default drops it.
The user chose the item id of the Dock icon’s menu (DockMenu::set_menu). No dart:ui
hook; the default drops it.
Sourcefn tray_icon_event(&mut self, icon: TrayIconId, event: TrayIconEvent)
fn tray_icon_event(&mut self, icon: TrayIconId, event: TrayIconEvent)
Something happened to the tray icon icon, as its system reports it. No dart:ui hook; the
default drops it.
Sourcefn open_requested(&mut self, request: OpenRequest)
fn open_requested(&mut self, request: OpenRequest)
The system asks the app to open files and links: from the file manager, another app or the command line, at launch or while it runs. A launch’s request comes once the client exists. No dart:ui hook: Flutter’s embedders hand these to their plugins. The default drops it.
Sourcefn notification_activated(&mut self, activation: NotificationActivation)
fn notification_activated(&mut self, activation: NotificationActivation)
The user clicked a notification the app posted, or one of its actions, or replied: while the app runs, or to start it, when the activation comes once the client exists. No dart:ui hook: Flutter’s apps hear these through plugins. The default drops it.
Sourcefn pop_route(&mut self) -> bool
fn pop_route(&mut self) -> bool
The user asked to go back: Android’s back button or back gesture, and whatever a later host maps onto the same idea.
Answers whether the application went back. false means there was nothing left to
go back to, and the host should then do what the platform does without the
application, which on Android is to close the activity.
Flutter sends this as popRoute on SystemChannels.navigation, and has to ask the
framework in advance whether it handles back at all, because the answer cannot
cross its channel in time. This call answers on the spot instead.
Sourcefn view_close_requested(&mut self, view: ViewId)
fn view_close_requested(&mut self, view: ViewId)
The user asked to close view: its window’s close button, or the system’s Close
command. The host closes nothing itself; the application closes the window, through
HostWindow::close, or keeps it open, such as until its user
has chosen whether to save. Nothing waits for an answer.
Flutter’s engine reports this to the window’s controller, whose delegate’s
onWindowCloseRequested closes it by default. The default here keeps the view open.
Sourcefn window_changed(&mut self, view: ViewId)
fn window_changed(&mut self, view: ViewId)
The window of view was minimized or restored, became occluded or shown, or moved, and
its HostWindow already answers how it is now: as Flutter’s window
controllers notify their listeners at the platform’s word. A resize is reported as a
metrics change alone (view_metrics_changed). The default drops it.
Sourcefn view_request_failed(&mut self, request: RequestId, error: ViewError)
fn view_request_failed(&mut self, request: RequestId, error: ViewError)
A request for a view (crate::Platform::request_view) got no view: the host could not
make its window. The default drops it.
Sourcefn request_app_exit(&mut self, reply: AppExitReply)
fn request_app_exit(&mut self, reply: AppExitReply)
The system asked the application to quit, and the application may refuse: the user
chose Quit, or is logging out. Every request comes here, a second one while the first is
still being decided included, so that the application decides each; reply takes its
answer, and the host quits on AppExitResponse::Exit.
The answer may take as long as the application needs, such as asking its user whether to save first, and is given inside a call into this client: this one, or a later one.
Flutter sends this as System.requestAppExit on SystemChannels.platform and replies
once ServicesBinding.handleRequestAppExit’s Future has completed. The default
answers Exit at once, as ServicesBinding’s own answer does.
Sourcefn app_lifecycle_state_changed(&mut self, state: AppLifecycleState)
fn app_lifecycle_state_changed(&mut self, state: AppLifecycleState)
The application entered state: its views were shown, hidden, focused or unfocused, or
the system put it in the background or brought it back. The host sends the state it is
in, and the framework fills in the states between, as Flutter’s ServicesBinding does.
Flutter sends this as the state’s name on SystemChannels.lifecycle. The default drops
it.
Sourcefn system_fonts_changed(&mut self)
fn system_fonts_changed(&mut self)
Flutter PlatformDispatcher.onSystemFontsChanged: the host registered faces the
framework did not have when text last laid out.
Sourcefn clipboard_changed(&mut self)
fn clipboard_changed(&mut self)
Another app changed what is on the clipboard, or the host cleared a copy of this app’s that expired, as far as the host can tell: at the moments its system says so, or lets it check. The app’s own writes are not reported, as it made them, but where the system tells them apart from no other change, as a browser does not. No dart:ui hook; the default drops it.
Sourcefn text_input_editing_value(&mut self, view: ViewId, value: TextEditingValue)
fn text_input_editing_value(&mut self, view: ViewId, value: TextEditingValue)
Flutter TextInputClient.updateEditingValue. The default drops it.
Sourcefn text_input_action(&mut self, view: ViewId, action: TextInputAction)
fn text_input_action(&mut self, view: ViewId, action: TextInputAction)
Flutter TextInputClient.performAction. The default drops it.
Sourcefn text_input_closed(&mut self, view: ViewId)
fn text_input_closed(&mut self, view: ViewId)
Flutter TextInputClient.connectionClosed. The default drops it.
Flutter SystemContextMenuClient.handleSystemHide. The default drops it.
Flutter SystemContextMenuClient.handleCustomContextMenuAction. The default drops it.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".