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:
IndexedSlot, which is used as theElementslots for the children of aMultiChildRenderObjectElement.AnyElement::update_children, which discusses whyIndexedSlotis used for the slots of the children.
Required Methods§
Sourcefn multi_child_data(
self: Handle<Self>,
app: &App,
) -> &MultiChildRenderObjectElementData
fn multi_child_data( self: Handle<Self>, app: &App, ) -> &MultiChildRenderObjectElementData
The child list, held under the field multi_child.
Sourcefn multi_child_data_mut(
self: Handle<Self>,
app: &mut App,
) -> &mut MultiChildRenderObjectElementData
fn multi_child_data_mut( self: Handle<Self>, app: &mut App, ) -> &mut MultiChildRenderObjectElementData
See multi_child_data.
Provided Methods§
Sourcefn children(self: Handle<Self>, app: &App) -> Vec<AnyElement>
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).
Sourcefn after_render_object(
app: &App,
slot: Option<&Slot>,
) -> Option<AnyRenderObject>
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.
Sourcefn indexed_slot(slot: Option<&Slot>) -> &IndexedSlot
fn indexed_slot(slot: Option<&Slot>) -> &IndexedSlot
Dart’s IndexedSlot<Element?> slot parameter type.
Sourcefn visit_children(
self: Handle<Self>,
app: &App,
visitor: &mut dyn FnMut(AnyElement),
)
fn visit_children( self: Handle<Self>, app: &App, visitor: &mut dyn FnMut(AnyElement), )
MultiChildRenderObjectElement.visitChildren.
Sourcefn forget_child(self: Handle<Self>, app: &mut App, child: AnyElement)
fn forget_child(self: Handle<Self>, app: &mut App, child: AnyElement)
MultiChildRenderObjectElement.forgetChild.
Sourcefn mount(
self: Handle<Self>,
app: &mut App,
parent: Option<AnyElement>,
new_slot: Option<Slot>,
)
fn mount( self: Handle<Self>, app: &mut App, parent: Option<AnyElement>, new_slot: Option<Slot>, )
MultiChildRenderObjectElement.mount.
Sourcefn update(self: Handle<Self>, app: &mut App, new_widget: WidgetRef)
fn update(self: Handle<Self>, app: &mut App, new_widget: WidgetRef)
MultiChildRenderObjectElement.update.
Sourcefn insert_render_object_child(
self: Handle<Self>,
app: &mut App,
child: AnyRenderObject,
slot: Option<Slot>,
)
fn insert_render_object_child( self: Handle<Self>, app: &mut App, child: AnyRenderObject, slot: Option<Slot>, )
MultiChildRenderObjectElement.insertRenderObjectChild.
Sourcefn move_render_object_child(
self: Handle<Self>,
app: &mut App,
child: AnyRenderObject,
_old_slot: Option<Slot>,
new_slot: Option<Slot>,
)
fn move_render_object_child( self: Handle<Self>, app: &mut App, child: AnyRenderObject, _old_slot: Option<Slot>, new_slot: Option<Slot>, )
MultiChildRenderObjectElement.moveRenderObjectChild.
Sourcefn remove_render_object_child(
self: Handle<Self>,
app: &mut App,
child: AnyRenderObject,
_slot: Option<Slot>,
)
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".