pub trait RenderSliverMultiBoxAdaptor:
RenderSliver
+ RenderSliverHelpers
+ RenderSliverWithKeepAliveMixin
+ ContainerRenderObjectMixin<ChildType = AnyRenderBox, ParentDataType = SliverMultiBoxAdaptorParentData> {
Show 35 methods
// Required methods
fn adaptor_data(
self: RenderHandle<Self>,
app: &App,
) -> &RenderSliverMultiBoxAdaptorData;
fn adaptor_data_mut(
self: RenderHandle<Self>,
app: &mut App,
) -> &mut RenderSliverMultiBoxAdaptorData;
// Provided methods
fn child_manager(
self: RenderHandle<Self>,
app: &App,
) -> Rc<dyn RenderSliverBoxChildManager> { ... }
fn setup_parent_data(
self: RenderHandle<Self>,
app: &mut App,
child: AnyRenderObject,
) { ... }
fn debug_child_integrity_enabled(
self: RenderHandle<Self>,
app: &App,
) -> bool { ... }
fn set_debug_child_integrity_enabled(
self: RenderHandle<Self>,
app: &mut App,
enabled: bool,
) { ... }
fn debug_assert_child_list_locked(
self: RenderHandle<Self>,
app: &App,
) -> bool { ... }
fn debug_verify_child_order(self: RenderHandle<Self>, app: &App) -> bool { ... }
fn insert(
self: RenderHandle<Self>,
app: &mut App,
child: AnyRenderBox,
after: Option<AnyRenderBox>,
) { ... }
fn did_adopt_child(
self: RenderHandle<Self>,
app: &mut App,
child: AnyRenderBox,
) { ... }
fn move_child(
self: RenderHandle<Self>,
app: &mut App,
child: AnyRenderBox,
after: Option<AnyRenderBox>,
) { ... }
fn remove(self: RenderHandle<Self>, app: &mut App, child: AnyRenderBox) { ... }
fn remove_all(self: RenderHandle<Self>, app: &mut App) { ... }
fn keep_alive_children(
self: RenderHandle<Self>,
app: &App,
) -> Vec<AnyRenderBox> { ... }
fn create_or_obtain_child(
self: RenderHandle<Self>,
app: &mut App,
index: i32,
after: Option<AnyRenderBox>,
) { ... }
fn destroy_or_cache_child(
self: RenderHandle<Self>,
app: &mut App,
child: AnyRenderBox,
) { ... }
fn did_attach(
self: RenderHandle<Self>,
app: &mut App,
owner: Handle<PipelineOwner>,
) { ... }
fn did_detach(self: RenderHandle<Self>, app: &mut App) { ... }
fn redepth_children(self: RenderHandle<Self>, app: &mut App) { ... }
fn visit_children(
self: RenderHandle<Self>,
app: &App,
visitor: &mut dyn FnMut(AnyRenderObject),
) { ... }
fn add_initial_child(
self: RenderHandle<Self>,
app: &mut App,
index: i32,
layout_offset: f64,
) -> bool { ... }
fn insert_and_layout_leading_child(
self: RenderHandle<Self>,
app: &mut App,
child_constraints: BoxConstraints,
parent_uses_size: bool,
) -> Option<AnyRenderBox> { ... }
fn insert_and_layout_child(
self: RenderHandle<Self>,
app: &mut App,
child_constraints: BoxConstraints,
after: Option<AnyRenderBox>,
parent_uses_size: bool,
) -> Option<AnyRenderBox> { ... }
fn calculate_leading_garbage(
self: RenderHandle<Self>,
app: &App,
first_index: i32,
) -> usize { ... }
fn calculate_trailing_garbage(
self: RenderHandle<Self>,
app: &App,
last_index: i32,
) -> usize { ... }
fn collect_garbage(
self: RenderHandle<Self>,
app: &mut App,
leading_garbage: usize,
trailing_garbage: usize,
) { ... }
fn index_of(self: RenderHandle<Self>, app: &App, child: AnyRenderBox) -> i32 { ... }
fn paint_extent_of(
self: RenderHandle<Self>,
app: &App,
child: AnyRenderBox,
) -> f64 { ... }
fn hit_test_children(
self: RenderHandle<Self>,
app: &mut App,
result: &mut SliverHitTestResult<'_>,
main_axis_position: f64,
cross_axis_position: f64,
) -> bool { ... }
fn child_main_axis_position(
self: RenderHandle<Self>,
app: &App,
child: AnyRenderObject,
) -> f64 { ... }
fn child_scroll_offset(
self: RenderHandle<Self>,
app: &App,
child: AnyRenderObject,
) -> Option<f64> { ... }
fn paints_child(
self: RenderHandle<Self>,
app: &App,
child: AnyRenderBox,
) -> bool { ... }
fn apply_paint_transform(
self: RenderHandle<Self>,
app: &App,
child: AnyRenderObject,
transform: &mut Matrix4,
) { ... }
fn paint(
self: RenderHandle<Self>,
app: &mut App,
context: &mut PaintingContext,
offset: Offset,
) { ... }
fn debug_assert_child_list_is_non_empty_and_contiguous(
self: RenderHandle<Self>,
app: &App,
) -> bool { ... }
}Expand description
A sliver with multiple box children.
RenderSliverMultiBoxAdaptor is a base class for slivers that have multiple box children.
The children are managed by a RenderSliverBoxChildManager, which lets implementors create
children lazily during layout. Typically implementors will create only those children that are
actually needed to fill the SliverConstraints::remaining_paint_extent.
The contract for adding and removing children from this render object is more strict than for normal render objects:
- Children can be removed except during a layout pass if they have already been laid out during that layout pass.
- Children cannot be added except during a call to
child_manager, and then only if there is no child corresponding to that index (or the child corresponding to that index was first removed).
See also:
crate::RenderSliverToBoxAdapter, which has a single box child.crate::RenderSliverList, which places its children in a linear array.crate::RenderSliverFixedExtentList, which places its children in a linear array with a fixed extent in the main axis.
Required Methods§
Sourcefn adaptor_data(
self: RenderHandle<Self>,
app: &App,
) -> &RenderSliverMultiBoxAdaptorData
fn adaptor_data( self: RenderHandle<Self>, app: &App, ) -> &RenderSliverMultiBoxAdaptorData
Mixin field access.
Sourcefn adaptor_data_mut(
self: RenderHandle<Self>,
app: &mut App,
) -> &mut RenderSliverMultiBoxAdaptorData
fn adaptor_data_mut( self: RenderHandle<Self>, app: &mut App, ) -> &mut RenderSliverMultiBoxAdaptorData
See adaptor_data.
Provided Methods§
Sourcefn child_manager(
self: RenderHandle<Self>,
app: &App,
) -> Rc<dyn RenderSliverBoxChildManager>
fn child_manager( self: RenderHandle<Self>, app: &App, ) -> Rc<dyn RenderSliverBoxChildManager>
The delegate that manages the children of this object.
Rather than having a concrete list of children, a RenderSliverMultiBoxAdaptor uses a
RenderSliverBoxChildManager to create children during layout in order to fill the
SliverConstraints::remaining_paint_extent.
Sourcefn setup_parent_data(
self: RenderHandle<Self>,
app: &mut App,
child: AnyRenderObject,
)
fn setup_parent_data( self: RenderHandle<Self>, app: &mut App, child: AnyRenderObject, )
The body of Flutter’s setupParentData override.
Sourcefn debug_child_integrity_enabled(self: RenderHandle<Self>, app: &App) -> bool
fn debug_child_integrity_enabled(self: RenderHandle<Self>, app: &App) -> bool
Whether the integrity check is enabled.
The integrity check consists of:
- Verify that the children index in the child list is in ascending order.
- Verify that there is no dangling keep-alive child as the result of
move_child.
Sourcefn set_debug_child_integrity_enabled(
self: RenderHandle<Self>,
app: &mut App,
enabled: bool,
)
fn set_debug_child_integrity_enabled( self: RenderHandle<Self>, app: &mut App, enabled: bool, )
Sets debug_child_integrity_enabled, immediately
performing an integrity check.
Sourcefn debug_assert_child_list_locked(self: RenderHandle<Self>, app: &App) -> bool
fn debug_assert_child_list_locked(self: RenderHandle<Self>, app: &App) -> bool
Flutter’s _debugAssertChildListLocked.
Sourcefn debug_verify_child_order(self: RenderHandle<Self>, app: &App) -> bool
fn debug_verify_child_order(self: RenderHandle<Self>, app: &App) -> bool
Verify that the child list index is in strictly increasing order.
This has no effect in release builds.
Sourcefn insert(
self: RenderHandle<Self>,
app: &mut App,
child: AnyRenderBox,
after: Option<AnyRenderBox>,
)
fn insert( self: RenderHandle<Self>, app: &mut App, child: AnyRenderBox, after: Option<AnyRenderBox>, )
The body of Flutter’s insert override.
Sourcefn did_adopt_child(self: RenderHandle<Self>, app: &mut App, child: AnyRenderBox)
fn did_adopt_child(self: RenderHandle<Self>, app: &mut App, child: AnyRenderBox)
The body of Flutter’s adoptChild override, run after a child joins the child list.
Flutter overrides RenderObject.adoptChild; here the tree operation is not virtual, so
the two callers (insert and Dart’s _destroyOrCacheChild, which takes
super.adoptChild) decide whether it runs.
Sourcefn move_child(
self: RenderHandle<Self>,
app: &mut App,
child: AnyRenderBox,
after: Option<AnyRenderBox>,
)
fn move_child( self: RenderHandle<Self>, app: &mut App, child: AnyRenderBox, after: Option<AnyRenderBox>, )
The body of Flutter’s move override.
There are two scenarios:
-
The child is not kept alive. The child is in the child list maintained by
ContainerRenderObjectMixin. We can call the inherited body and update the parent data with the new slot. -
The child is kept alive. In this case, the child is no longer in the child list but might be stored in the keep-alive bucket. We need to update the location of the child in the bucket.
Sourcefn remove(self: RenderHandle<Self>, app: &mut App, child: AnyRenderBox)
fn remove(self: RenderHandle<Self>, app: &mut App, child: AnyRenderBox)
The body of Flutter’s remove override.
Sourcefn remove_all(self: RenderHandle<Self>, app: &mut App)
fn remove_all(self: RenderHandle<Self>, app: &mut App)
The body of Flutter’s removeAll override.
Sourcefn keep_alive_children(self: RenderHandle<Self>, app: &App) -> Vec<AnyRenderBox>
fn keep_alive_children(self: RenderHandle<Self>, app: &App) -> Vec<AnyRenderBox>
The children currently held in the keep-alive bucket, in insertion order.
Sourcefn create_or_obtain_child(
self: RenderHandle<Self>,
app: &mut App,
index: i32,
after: Option<AnyRenderBox>,
)
fn create_or_obtain_child( self: RenderHandle<Self>, app: &mut App, index: i32, after: Option<AnyRenderBox>, )
Flutter’s _createOrObtainChild.
Sourcefn destroy_or_cache_child(
self: RenderHandle<Self>,
app: &mut App,
child: AnyRenderBox,
)
fn destroy_or_cache_child( self: RenderHandle<Self>, app: &mut App, child: AnyRenderBox, )
Flutter’s _destroyOrCacheChild.
Sourcefn did_attach(
self: RenderHandle<Self>,
app: &mut App,
owner: Handle<PipelineOwner>,
)
fn did_attach( self: RenderHandle<Self>, app: &mut App, owner: Handle<PipelineOwner>, )
The body of Flutter’s attach override: attaches the kept-alive children too.
Sourcefn did_detach(self: RenderHandle<Self>, app: &mut App)
fn did_detach(self: RenderHandle<Self>, app: &mut App)
The body of Flutter’s detach override: detaches the kept-alive children too.
Sourcefn redepth_children(self: RenderHandle<Self>, app: &mut App)
fn redepth_children(self: RenderHandle<Self>, app: &mut App)
The body of Flutter’s redepthChildren override.
Sourcefn visit_children(
self: RenderHandle<Self>,
app: &App,
visitor: &mut dyn FnMut(AnyRenderObject),
)
fn visit_children( self: RenderHandle<Self>, app: &App, visitor: &mut dyn FnMut(AnyRenderObject), )
The body of Flutter’s visitChildren override: visits the kept-alive children too.
Sourcefn add_initial_child(
self: RenderHandle<Self>,
app: &mut App,
index: i32,
layout_offset: f64,
) -> bool
fn add_initial_child( self: RenderHandle<Self>, app: &mut App, index: i32, layout_offset: f64, ) -> bool
Called during layout to create and add the child with the given index and scroll offset.
Calls RenderSliverBoxChildManager::create_child to actually create and add the child
if necessary. The child may instead be obtained from a cache; see
KeepAliveParentData::keep_alive.
Returns false if there was no cached child and create_child did not add any child,
otherwise returns true.
Does not lay out the new child.
Sourcefn insert_and_layout_leading_child(
self: RenderHandle<Self>,
app: &mut App,
child_constraints: BoxConstraints,
parent_uses_size: bool,
) -> Option<AnyRenderBox>
fn insert_and_layout_leading_child( self: RenderHandle<Self>, app: &mut App, child_constraints: BoxConstraints, parent_uses_size: bool, ) -> Option<AnyRenderBox>
Called during layout to create, add, and lay out the child before
ContainerRenderObjectMixin::first_child.
Returns the new child or None if no child was obtained.
The child that was previously the first child, as well as any subsequent children, may be removed by this call if they have not yet been laid out during this layout pass.
Sourcefn insert_and_layout_child(
self: RenderHandle<Self>,
app: &mut App,
child_constraints: BoxConstraints,
after: Option<AnyRenderBox>,
parent_uses_size: bool,
) -> Option<AnyRenderBox>
fn insert_and_layout_child( self: RenderHandle<Self>, app: &mut App, child_constraints: BoxConstraints, after: Option<AnyRenderBox>, parent_uses_size: bool, ) -> Option<AnyRenderBox>
Called during layout to create, add, and lay out the child after the given child.
Returns the new child. It is the responsibility of the caller to configure the child’s scroll offset.
Children after the after child may be removed in the process. Only the new child may be
added.
Sourcefn calculate_leading_garbage(
self: RenderHandle<Self>,
app: &App,
first_index: i32,
) -> usize
fn calculate_leading_garbage( self: RenderHandle<Self>, app: &App, first_index: i32, ) -> usize
Returns the number of children preceding the first_index that need to be garbage
collected.
Sourcefn calculate_trailing_garbage(
self: RenderHandle<Self>,
app: &App,
last_index: i32,
) -> usize
fn calculate_trailing_garbage( self: RenderHandle<Self>, app: &App, last_index: i32, ) -> usize
Returns the number of children following the last_index that need to be garbage
collected.
Sourcefn collect_garbage(
self: RenderHandle<Self>,
app: &mut App,
leading_garbage: usize,
trailing_garbage: usize,
)
fn collect_garbage( self: RenderHandle<Self>, app: &mut App, leading_garbage: usize, trailing_garbage: usize, )
Called after layout with the number of children that can be garbage collected at the head and tail of the child list.
Children whose KeepAliveParentData::keep_alive property is set to true will be
removed to a cache instead of being dropped.
This method also collects any children that were previously kept alive but are now no
longer necessary. As such, it should be called every time perform_layout is run, even if
the arguments are both zero.
Sourcefn index_of(self: RenderHandle<Self>, app: &App, child: AnyRenderBox) -> i32
fn index_of(self: RenderHandle<Self>, app: &App, child: AnyRenderBox) -> i32
Returns the index of the given child, as given by the
SliverMultiBoxAdaptorParentData::index field of the child’s parent data.
Sourcefn paint_extent_of(
self: RenderHandle<Self>,
app: &App,
child: AnyRenderBox,
) -> f64
fn paint_extent_of( self: RenderHandle<Self>, app: &App, child: AnyRenderBox, ) -> f64
Returns the dimension of the given child in the main axis, as given by the child’s size.
This is only valid after layout.
Sourcefn hit_test_children(
self: RenderHandle<Self>,
app: &mut App,
result: &mut SliverHitTestResult<'_>,
main_axis_position: f64,
cross_axis_position: f64,
) -> bool
fn hit_test_children( self: RenderHandle<Self>, app: &mut App, result: &mut SliverHitTestResult<'_>, main_axis_position: f64, cross_axis_position: f64, ) -> bool
The body of Flutter’s hitTestChildren override.
Sourcefn child_main_axis_position(
self: RenderHandle<Self>,
app: &App,
child: AnyRenderObject,
) -> f64
fn child_main_axis_position( self: RenderHandle<Self>, app: &App, child: AnyRenderObject, ) -> f64
The body of Flutter’s childMainAxisPosition override.
Sourcefn child_scroll_offset(
self: RenderHandle<Self>,
app: &App,
child: AnyRenderObject,
) -> Option<f64>
fn child_scroll_offset( self: RenderHandle<Self>, app: &App, child: AnyRenderObject, ) -> Option<f64>
The body of Flutter’s childScrollOffset override.
Sourcefn paints_child(
self: RenderHandle<Self>,
app: &App,
child: AnyRenderBox,
) -> bool
fn paints_child( self: RenderHandle<Self>, app: &App, child: AnyRenderBox, ) -> bool
Whether the given child is painted, i.e. it is reified and not kept alive off-screen.
Flutter’s paintsChild override; RenderObject.paintsChild is not a virtual here (see
PORTING.md).
Sourcefn apply_paint_transform(
self: RenderHandle<Self>,
app: &App,
child: AnyRenderObject,
transform: &mut Matrix4,
)
fn apply_paint_transform( self: RenderHandle<Self>, app: &App, child: AnyRenderObject, transform: &mut Matrix4, )
The body of Flutter’s applyPaintTransform override.
Sourcefn paint(
self: RenderHandle<Self>,
app: &mut App,
context: &mut PaintingContext,
offset: Offset,
)
fn paint( self: RenderHandle<Self>, app: &mut App, context: &mut PaintingContext, offset: Offset, )
The body of Flutter’s paint override.
Sourcefn debug_assert_child_list_is_non_empty_and_contiguous(
self: RenderHandle<Self>,
app: &App,
) -> bool
fn debug_assert_child_list_is_non_empty_and_contiguous( self: RenderHandle<Self>, app: &App, ) -> bool
Asserts that the reified child list is not empty and has a contiguous sequence of indices.
Always returns true.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".