Skip to main content

MultiChildRenderObjectElementBase

Trait MultiChildRenderObjectElementBase 

Source
pub trait MultiChildRenderObjectElementBase: RenderObjectElement + RenderObjectWidgetCalls {
    // Required methods
    fn multi_child_data(
        self: Handle<Self>,
        app: &App,
    ) -> &MultiChildRenderObjectElementData;
    fn multi_child_data_mut(
        self: Handle<Self>,
        app: &mut App,
    ) -> &mut MultiChildRenderObjectElementData;

    // Provided methods
    fn children(self: Handle<Self>, app: &App) -> Vec<AnyElement> { ... }
    fn after_render_object(
        app: &App,
        slot: Option<&Slot>,
    ) -> Option<AnyRenderObject> { ... }
    fn indexed_slot(slot: Option<&Slot>) -> &IndexedSlot { ... }
    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 MultiChildRenderObjectElement: an Element that uses a MultiChildRenderObjectWidget as its configuration.

This element subclass can be used for RenderObjectWidgets whose RenderObjects use the ContainerRenderObjectMixin mixin with a parent data type that implements ContainerParentDataMixin. Such widgets are expected to inherit from MultiChildRenderObjectWidget.

Flutter’s class is instantiable and also subclassed (Viewport’s element), so the bodies live on this trait and MultiChildRenderObjectElement 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 children and its render object’s child list through Widget::as_multi_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 MultiChildRenderObjectWidget, with its own create_element (as Viewport and the overlay’s Theater do), not through an impl Widget of its own.

See also:

Required Methods§

Source

fn multi_child_data( self: Handle<Self>, app: &App, ) -> &MultiChildRenderObjectElementData

The child list, held under the field multi_child.

Source

fn multi_child_data_mut( self: Handle<Self>, app: &mut App, ) -> &mut MultiChildRenderObjectElementData

Provided Methods§

Source

fn children(self: Handle<Self>, app: &App) -> Vec<AnyElement>

The current list of children of this element.

This list is filtered to hide elements that have been forgotten (using Element::forget_child).

Source

fn after_render_object( app: &App, slot: Option<&Slot>, ) -> Option<AnyRenderObject>

Dart’s slot.value?.renderObject: the child this child is inserted after, as the container’s ChildType.

Source

fn indexed_slot(slot: Option<&Slot>) -> &IndexedSlot

Dart’s IndexedSlot<Element?> slot parameter type.

Source

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

MultiChildRenderObjectElement.visitChildren.

Source

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

MultiChildRenderObjectElement.forgetChild.

Source

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

MultiChildRenderObjectElement.mount.

Source

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

MultiChildRenderObjectElement.update.

Source

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

MultiChildRenderObjectElement.insertRenderObjectChild.

Source

fn move_render_object_child( self: Handle<Self>, app: &mut App, child: AnyRenderObject, _old_slot: Option<Slot>, new_slot: Option<Slot>, )

MultiChildRenderObjectElement.moveRenderObjectChild.

Source

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

MultiChildRenderObjectElement.removeRenderObjectChild.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§