pub struct Shell { /* private fields */ }Expand description
Host-facing isolate: the AppCell plus the methods the embedder pushes.
Every push is one call into the app: the App is borrowed for the binding call and
released before the cell’s checkpoint, where the microtasks and futures the event queued
run.
Implementations§
Source§impl Shell
impl Shell
Sourcepub fn new(platform: Rc<dyn Platform>, setup: impl FnOnce(&mut App)) -> Shell
pub fn new(platform: Rc<dyn Platform>, setup: impl FnOnce(&mut App)) -> Shell
Builds the heap from platform, then runs application setup.
Setup (later widgets run_app) requests the first frame when it
installs work that needs one.
Sourcepub fn app(&self) -> RefMut<'_, App>
pub fn app(&self) -> RefMut<'_, App>
The App, borrowed until the guard drops. A host that needs the whole thing, a borrow
and then the checkpoint, takes cell.
pub fn cell(&self) -> &Rc<AppCell>
Trait Implementations§
Source§impl EmbedderClient for Shell
impl EmbedderClient for Shell
Source§fn frame(&mut self, views: &[ViewId], frame: Frame)
fn frame(&mut self, views: &[ViewId], frame: Frame)
The app’s timers run to the platform’s clock, and the frame’s time is its vsync’s target,
as the engine hands _beginFrame (Animator::BeginFrame); a frame drawn outside a vsync
takes the platform’s clock.
Source§fn view_added(&mut self, id: ViewId)
fn view_added(&mut self, id: ViewId)
The framework hears which view came, then “metrics changed”, as _addView invokes it;
then a frame is scheduled, as RuntimeController::AddView schedules one once the view is
added. Without it, a build scheduled while the app had no view, such as the one that puts
the new view’s window on it, would wait for an event of the view’s window, which a Wayland
window, unseen until it presents a picture, never sends.
Source§fn view_removed(&mut self, id: ViewId)
fn view_removed(&mut self, id: ViewId)
The framework hears which view went, then “metrics changed”, as _removeView invokes
it.
Source§fn screens_changed(&mut self)
fn screens_changed(&mut self)
“Metrics changed”, as _updateDisplays invokes it.
Source§fn request_app_exit(&mut self, reply: AppExitReply)
fn request_app_exit(&mut self, reply: AppExitReply)
The binding’s answer goes to reply at the checkpoint of the call in which the
observers decide: this push’s own when they answer at once.
Source§fn service_extension_call(&mut self, call: ServiceExtensionCall)
fn service_extension_call(&mut self, call: ServiceExtensionCall)
The extension’s answer goes to call.reply when its task ends: at this push’s checkpoint
when it answers at once.
Source§fn app_lifecycle_state_changed(&mut self, state: AppLifecycleState)
fn app_lifecycle_state_changed(&mut self, state: AppLifecycleState)
On resumed or inactive, every view is marked to present and asked for a frame before
the bindings hear the state: a view that did not change while the app was away would
otherwise present nothing.
Source§fn view_metrics_changed(&mut self, _id: ViewId)
fn view_metrics_changed(&mut self, _id: ViewId)
id’s metrics changed, the screen it is on
included.Source§fn view_focus_changed(&mut self, event: ViewFocusEvent)
fn view_focus_changed(&mut self, event: ViewFocusEvent)
PlatformDispatcher.onViewFocusChange.Source§fn drag_report(&mut self, report: DragReport)
fn drag_report(&mut self, report: DragReport)
Source§fn clipboard_event(&mut self, view: ViewId, event: ClipboardEvent)
fn clipboard_event(&mut self, view: ViewId, event: ClipboardEvent)
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.Source§fn edit_command(&mut self, view: ViewId, command: EditCommand)
fn edit_command(&mut self, view: ViewId, command: EditCommand)
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.id of the app’s menu bar (MenuBar::set_menus). Flutter’s
Menu.selectedCallback on the flutter/menu channel. The default drops it.id of the Dock icon’s menu (DockMenu::set_menu). No dart:ui
hook; the default drops it.Source§fn tray_icon_event(&mut self, icon: u64, event: TrayIconEvent)
fn tray_icon_event(&mut self, icon: u64, event: TrayIconEvent)
icon, as its system reports it. No dart:ui hook; the
default drops it.Source§fn open_requested(&mut self, request: OpenRequest)
fn open_requested(&mut self, request: OpenRequest)
Source§fn notification_activated(&mut self, activation: NotificationActivation)
fn notification_activated(&mut self, activation: NotificationActivation)
Source§fn pointer_reports(&mut self, reports: Vec<PointerReport>)
fn pointer_reports(&mut self, reports: Vec<PointerReport>)
FlutterEngineSendPointerEvent. The client adds what the framework also
needs (PointerDataPacketConverter) and hands the
result to PlatformDispatcher.onPointerDataPacket.Source§fn pop_route(&mut self, view: ViewId) -> bool
fn pop_route(&mut self, view: ViewId) -> bool
view: Android’s back button or back gesture, in the
activity whose window the view is, and whatever a later host maps onto the same idea. Read moreSource§fn view_close_requested(&mut self, view: ViewId)
fn view_close_requested(&mut self, view: ViewId)
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. Read moreSource§fn window_changed(&mut self, view: ViewId)
fn window_changed(&mut self, view: ViewId)
view was minimized or restored, became occluded or shown, went full screen
or left it, or moved, as it does when maximized or returned, 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.Source§fn view_request_failed(&mut self, request: RequestId, error: ViewError)
fn view_request_failed(&mut self, request: RequestId, error: ViewError)
crate::Platform::request_view) got no view: the host could not
make its window. The default drops it.Source§fn platform_brightness_changed(&mut self)
fn platform_brightness_changed(&mut self)
PlatformDispatcher.onPlatformBrightnessChanged: the host’s light or dark
preference changed, and Platform::platform_brightness already answers the new one.Source§fn locales_changed(&mut self)
fn locales_changed(&mut self)
PlatformDispatcher.onLocaleChanged: the host’s locale list changed, and
Platform::locales already answers the new one.Source§fn system_fonts_changed(&mut self)
fn system_fonts_changed(&mut self)
PlatformDispatcher.onSystemFontsChanged: the host registered faces the
framework did not have when text last laid out.Source§fn clipboard_changed(&mut self)
fn clipboard_changed(&mut self)
Source§fn text_input_editing_value(&mut self, _view: ViewId, value: TextEditingValue)
fn text_input_editing_value(&mut self, _view: ViewId, value: TextEditingValue)
TextInputClient.updateEditingValue. The default drops it.Source§fn text_input_action(&mut self, _view: ViewId, action: TextInputAction)
fn text_input_action(&mut self, _view: ViewId, action: TextInputAction)
TextInputClient.performAction. The default drops it.Source§fn text_input_closed(&mut self, _view: ViewId)
fn text_input_closed(&mut self, _view: ViewId)
TextInputClient.connectionClosed. The default drops it.SystemContextMenuClient.handleSystemHide. The default drops it.SystemContextMenuClient.handleCustomContextMenuAction. The default drops it.Auto Trait Implementations§
impl !RefUnwindSafe for Shell
impl !Send for Shell
impl !Sync for Shell
impl !UnwindSafe for Shell
impl Forget for Shell
impl Freeze for Shell
impl Move for Shell
impl Unpin for Shell
impl UnsafeUnpin for Shellwhere
*const RcInner<AppCell> is !null: UnsafeUnpin,
PhantomData<RcInner<AppCell>>: UnsafeUnpin,
*const RcInner<dyn Platform> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Platform>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<(i64, PointerState)>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.