Skip to main content

SlottedMultiChildRenderObjectWidget

Trait SlottedMultiChildRenderObjectWidget 

Source
pub trait SlottedMultiChildRenderObjectWidget: RenderObjectWidget{
    type Slot: SlotValue;

    // Required methods
    fn slots(&self) -> Vec<Self::Slot>;
    fn child_for_slot(&self, slot: &Self::Slot) -> Option<WidgetRef>;
}
Expand description

A superclass for RenderObjectWidgets that configure RenderObject subclasses that organize their children in different slots.

Implementers of this trait have to provide the list of available slots by overriding slots. The list of slots must never change for a given type.

The child_for_slot method returns the child widget that should be configured for the provided slot. The returned widget may be None if no widget should occupy the slot. The RenderObject must use the SlottedContainerRenderObjectMixin, whose child_for_slot returns the render object of the slot’s child.

Like any other RenderObjectWidget, an implementer has to provide create_render_object and update_render_object.

Required Associated Types§

Source

type Slot: SlotValue

Dart’s SlotType.

Required Methods§

Source

fn slots(&self) -> Vec<Self::Slot>

This method is called to obtain the list of slots that the widget has.

The list must never change, and its entries must be unique.

Source

fn child_for_slot(&self, slot: &Self::Slot) -> Option<WidgetRef>

Given a slot this method returns the widget that should occupy that slot.

The method may return None if the slot should be empty.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§