Skip to main content

RootWidget

Struct RootWidget 

Source
pub struct RootWidget {
    pub key: Option<KeyRef>,
    pub child: Option<WidgetRef>,
    pub debug_short_description: Option<String>,
    /* private fields */
}
Expand description

A wrapper widget that will be used as the root of the widget tree.

An instance of this widget is created by WidgetsBinding::attach_root_widget.

It is used as the root of the widget tree, and provides a RootElement which does not have a render object itself and instead delegates rendering to its child.

Fields§

§key: Option<KeyRef>§child: Option<WidgetRef>

The widget below this widget in the tree.

§debug_short_description: Option<String>

A short description of this widget used by debugging aids.

Implementations§

Source§

impl RootWidget

Source

pub fn new() -> RootWidget

Creates a RootWidget; Dart’s named arguments are the setters.

Source

pub fn key(self, key: KeyRef) -> RootWidget

Dart RootWidget(key:).

Source

pub fn child<K>(self, child: impl IntoWidget<K>) -> RootWidget

Dart RootWidget(child:).

Source

pub fn debug_short_description( self, debug_short_description: impl Into<String>, ) -> RootWidget

Dart RootWidget(debug_short_description:).

Source

pub fn attach( self, app: &mut App, owner: Handle<BuildOwner>, element: Option<Handle<RootElement>>, ) -> Handle<RootElement>

Inflate this widget and attaches the resulting RootElement to the provided BuildOwner.

If element is None, this function will create a new element. Otherwise, the given element will have an update scheduled to switch to this widget.

Used by WidgetsBinding::attach_to_build_owner (which is indirectly called by run_app) to bootstrap applications.

Trait Implementations§

Source§

impl Debug for RootWidget

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RootWidget

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Widget for RootWidget

Source§

fn key(&self) -> Option<&KeyRef>

Controls how one widget replaces another widget in the tree. Read more
Source§

fn creation_location(&self) -> Option<&'static Location<'static>>

Where the widget was made, in a debug build: Dart’s creation location, which the widget inspector shows and its summary tree keeps the app’s own widgets by.
Source§

fn record_creation_location(&mut self, location: CreationLocation)

Keeps where the widget was made, for creation_location to answer: what into_widget calls on a widget that is its own tree node, which has no wrapper to keep it in. Such a widget keeps it in a field (created: Option<CreationLocation>); the default keeps nothing.
Source§

fn to_string_short(&self) -> String

Dart’s toStringShort: the type, then the key when there is one, as Text-[<'title'>].
Source§

fn create_element(&self, app: &mut App, this: WidgetRef) -> AnyElement

Inflates this configuration to a concrete instance. this is this widget’s shared reference, which the element keeps.
Source§

fn as_any(&self) -> &dyn Any

The concrete widget, for Dart’s widget as Foo.
Source§

fn widget_type(&self) -> TypeId

The concrete widget’s type, Dart’s runtimeType.
Source§

fn kind(&self) -> WidgetKind

The kind of element this widget inflates to, for Element.updateChild’s superclass check.
Source§

fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s debugFillProperties: the properties a dump shows for this widget, in Dart’s order. Dart’s Widget base only sets the dense tree style, which [to_diagnostics_node](::to_diagnostics_node) does before calling this.
Source§

fn type_name(&self) -> &'static str

The concrete widget’s type name, as Dart’s runtimeType prints in a message: the type’s own name without its module path. Read more
Source§

fn as_inherited_theme(&self) -> Option<&dyn InheritedTheme>

Dart’s widget is InheritedTheme: this widget as an InheritedTheme, when it is one. Read more
Source§

fn as_render_object(&self) -> Option<&dyn AnyRenderObjectWidget>

This widget as a RenderObjectWidget, when it is one of the three kinds the framework makes elements for (leaf, single-child, multi-child): what those elements create and update their render object through, so they are not copied per widget type.
Source§

fn as_single_child_render_object( &self, ) -> Option<&dyn AnySingleChildRenderObjectWidget>

This widget as a SingleChildRenderObjectWidget, when it is one.
Source§

fn as_multi_child_render_object( &self, ) -> Option<&dyn AnyMultiChildRenderObjectWidget>

This widget as a MultiChildRenderObjectWidget, when it is one.
Source§

fn as_parent_data(&self) -> Option<&dyn AnyParentDataWidget>

This widget as a ParentDataWidget, when it is one: what the one ParentDataElement reads, so that element is not copied per widget type.
Source§

fn as_stateful(&self) -> Option<&dyn AnyStatefulWidget>

This widget as a StatefulWidget, when it is one: what the one StatefulElement creates its state through, so that element is not copied per widget type.
Source§

fn as_inherited(&self) -> Option<&dyn AnyInheritedWidget>

This widget as an InheritedWidget, when it is one: what the one InheritedElement reads, so that element is not copied per widget type.
Source§

fn as_stateless(&self) -> Option<&dyn StatelessWidget>

This widget as a StatelessWidget, when it is one: what the one StatelessElement builds from, so that element is not copied per widget type.
Source§

fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>

Dart’s widget is PreferredSizeWidget: this widget as a PreferredSizeWidget, when it is one. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for RootWidget

§

impl !Send for RootWidget

§

impl !Sync for RootWidget

§

impl !UnwindSafe for RootWidget

§

impl Forget for RootWidget

§

impl Freeze for RootWidget
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze, *const RcInner<dyn Widget> is !null: Freeze, PhantomData<RcInner<dyn Widget>>: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze, &'static Location<'static>: Freeze,

§

impl Move for RootWidget

§

impl Unpin for RootWidget
where Rc<dyn Key>: Unpin, Rc<dyn Widget>: Unpin, *const u8 is !null: Unpin, &'static Location<'static>: Unpin,

§

impl UnsafeUnpin for RootWidget
where *const RcInner<dyn Key> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Key>>: UnsafeUnpin, *const RcInner<dyn Widget> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Widget>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, &'static Location<'static>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<W> IntoWidget<TreeNodeKind> for W
where W: Widget,

Source§

fn into_widget(self) -> Rc<dyn Widget>

The widget as a tree node, made where this is called: its creation_location.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>