Skip to main content

SingleChildRenderObjectElementBase

Trait SingleChildRenderObjectElementBase 

Source
pub trait SingleChildRenderObjectElementBase: RenderObjectElement + RenderObjectWidgetCalls {
    // Required methods
    fn single_child_data(
        self: Handle<Self>,
        app: &App,
    ) -> &SingleChildRenderObjectElementData;
    fn single_child_data_mut(
        self: Handle<Self>,
        app: &mut App,
    ) -> &mut SingleChildRenderObjectElementData;

    // Provided methods
    fn child(self: Handle<Self>, app: &App) -> Option<AnyElement> { ... }
    fn update_child_from_widget(self: Handle<Self>, app: &mut App) { ... }
    fn visit_children(
        self: Handle<Self>,
        app: &App,
        visitor: &mut dyn FnMut(AnyElement),
    ) { ... }
    fn forget_child(self: Handle<Self>, app: &mut App, child: AnyElement) { ... }
    fn mount(
        self: Handle<Self>,
        app: &mut App,
        parent: Option<AnyElement>,
        new_slot: Option<Slot>,
    ) { ... }
    fn update(self: Handle<Self>, app: &mut App, new_widget: WidgetRef) { ... }
    fn insert_render_object_child(
        self: Handle<Self>,
        app: &mut App,
        child: AnyRenderObject,
        slot: Option<Slot>,
    ) { ... }
    fn move_render_object_child(
        self: Handle<Self>,
        _app: &mut App,
        _child: AnyRenderObject,
        _old_slot: Option<Slot>,
        _new_slot: Option<Slot>,
    ) { ... }
    fn remove_render_object_child(
        self: Handle<Self>,
        app: &mut App,
        child: AnyRenderObject,
        slot: Option<Slot>,
    ) { ... }
}
Expand description

The bodies of Dart’s SingleChildRenderObjectElement: an Element that uses a SingleChildRenderObjectWidget as its configuration.

The child is optional.

This element subclass can be used for RenderObjectWidgets whose RenderObjects use the RenderObjectWithChildMixin mixin. Such widgets are expected to inherit from SingleChildRenderObjectWidget.

Flutter’s class is instantiable and also subclassed (SingleChildScrollView’s viewport element), so the bodies live on this trait and SingleChildRenderObjectElement is the plain leaf that implements it; a subclass calls the body it overrides by name where Dart writes super.

The bodies reach the widget’s child and its render object’s child slot through Widget::as_single_child_render_object, which only the framework’s wrapper answers: an element implementing this trait needs its widget to reach the tree through IntoWidget as a SingleChildRenderObjectWidget, with its own create_element (as SingleChildViewport does), not through an impl Widget of its own.

Required Methods§

Source

fn single_child_data( self: Handle<Self>, app: &App, ) -> &SingleChildRenderObjectElementData

The child slot, held under the field single_child.

Source

fn single_child_data_mut( self: Handle<Self>, app: &mut App, ) -> &mut SingleChildRenderObjectElementData

Provided Methods§

Source

fn child(self: Handle<Self>, app: &App) -> Option<AnyElement>

The child element, if any.

Source

fn update_child_from_widget(self: Handle<Self>, app: &mut App)

Dart’s updateChild(_child, (widget as SingleChildRenderObjectWidget).child, null), which both mount and update run.

Source

fn visit_children( self: Handle<Self>, app: &App, visitor: &mut dyn FnMut(AnyElement), )

SingleChildRenderObjectElement.visitChildren.

Source

fn forget_child(self: Handle<Self>, app: &mut App, child: AnyElement)

SingleChildRenderObjectElement.forgetChild.

Source

fn mount( self: Handle<Self>, app: &mut App, parent: Option<AnyElement>, new_slot: Option<Slot>, )

SingleChildRenderObjectElement.mount.

Source

fn update(self: Handle<Self>, app: &mut App, new_widget: WidgetRef)

SingleChildRenderObjectElement.update.

Source

fn insert_render_object_child( self: Handle<Self>, app: &mut App, child: AnyRenderObject, slot: Option<Slot>, )

SingleChildRenderObjectElement.insertRenderObjectChild.

Source

fn move_render_object_child( self: Handle<Self>, _app: &mut App, _child: AnyRenderObject, _old_slot: Option<Slot>, _new_slot: Option<Slot>, )

SingleChildRenderObjectElement.moveRenderObjectChild.

Source

fn remove_render_object_child( self: Handle<Self>, app: &mut App, child: AnyRenderObject, slot: Option<Slot>, )

SingleChildRenderObjectElement.removeRenderObjectChild.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§