pub trait MultiChildRenderObjectWidget: RenderObjectWidgetwhere
Self::RenderObject: ContainerRenderObjectMixin,{
// Required method
fn children(&self) -> &[WidgetRef];
// Provided method
fn create_element(&self, app: &mut App, this: WidgetRef) -> AnyElement
where Self: Sized { ... }
}Expand description
A superclass for RenderObjectWidgets that configure RenderObject subclasses that have a
single list of children. (This superclass only provides the storage for that child list, it
doesn’t actually provide the updating logic.)
The render object assigned to this widget must use ContainerRenderObjectMixin, which
provides the necessary functionality to visit the children of the container render object
(the render object belonging to the children widgets).
See also:
Stack, which usesMultiChildRenderObjectWidget.RenderStack, for an example implementation of the associated render object.
Required Methods§
Sourcefn children(&self) -> &[WidgetRef]
fn children(&self) -> &[WidgetRef]
The widgets below this widget in the tree.
If this list is going to be mutated, it is usually wise to put a Key on each of the
child widgets, so that the framework can match old configurations to new configurations
and maintain the underlying render objects.
Also, a widget is immutable, so directly modifying the children of a
widget already in the tree results in incorrect behaviour. Whenever the children list is
modified, a new list should be provided.
Provided Methods§
Sourcefn create_element(&self, app: &mut App, this: WidgetRef) -> AnyElementwhere
Self: Sized,
fn create_element(&self, app: &mut App, this: WidgetRef) -> AnyElementwhere
Self: Sized,
Creates the element that manages this widget’s children.
Dart’s createElement; a widget whose element has bodies of its own (Viewport)
overrides it with an element that implements MultiChildRenderObjectElementBase.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".