pub struct SliverChildListDelegate {
pub add_automatic_keep_alives: bool,
pub add_repaint_boundaries: bool,
pub add_semantic_indexes: bool,
pub semantic_index_offset: i32,
pub semantic_index_callback: SemanticIndexCallback,
pub children: Vec<WidgetRef>,
/* private fields */
}Expand description
A delegate that supplies children for slivers using an explicit list.
Many slivers lazily construct their box children to avoid creating more children than are
visible through the Viewport. This delegate provides children using an explicit list, which
is convenient but reduces the benefit of building children lazily.
In general building all the widgets in advance is not efficient. It is better to create a
delegate that builds them on demand using SliverChildBuilderDelegate or by implementing
SliverChildDelegate directly.
This type is provided for the cases where either the list of children is known well in advance, and therefore will not be built each time the delegate itself is created, or the list is small, such that it’s likely always visible (and thus there is nothing to be gained by building it on demand). For example, the body of a dialog box might fit both of these conditions.
The widgets in the given children list are automatically wrapped in
AutomaticKeepAlive widgets if
add_automatic_keep_alives is true (the default) and in
RepaintBoundary widgets if add_repaint_boundaries is
true (also the default).
§Accessibility
CustomScrollView requires that its semantic children are annotated using
IndexedSemantics. This is done by default in the delegate with the
add_semantic_indexes parameter set to true.
See also:
SliverChildBuilderDelegate, which is a delegate that uses a builder callback to construct the children.
Fields§
§add_automatic_keep_alives: boolWhether to wrap each child in an AutomaticKeepAlive.
add_repaint_boundaries: boolWhether to wrap each child in a RepaintBoundary.
add_semantic_indexes: boolWhether to wrap each child in an IndexedSemantics.
semantic_index_offset: i32An initial offset to add to the semantic indexes generated by this widget.
semantic_index_callback: SemanticIndexCallbackA SemanticIndexCallback which is used when
add_semantic_indexes is true.
children: Vec<WidgetRef>The widgets to display.
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.
A widget is immutable, so a new list must be provided whenever the children change.
Implementations§
Source§impl SliverChildListDelegate
impl SliverChildListDelegate
Sourcepub fn new(children: Vec<WidgetRef>) -> SliverChildListDelegate
pub fn new(children: Vec<WidgetRef>) -> SliverChildListDelegate
Creates a delegate that supplies children for slivers using the given list.
If the order of children never changes, consider using fixed.
Sourcepub fn fixed(children: Vec<WidgetRef>) -> SliverChildListDelegate
pub fn fixed(children: Vec<WidgetRef>) -> SliverChildListDelegate
Creates a constant version of the delegate that supplies children for slivers using the given list.
If the order of the children will change, consider using new.
Sourcepub fn add_automatic_keep_alives(self, value: bool) -> SliverChildListDelegate
pub fn add_automatic_keep_alives(self, value: bool) -> SliverChildListDelegate
Dart SliverChildListDelegate(addAutomaticKeepAlives:).
Sourcepub fn add_repaint_boundaries(self, value: bool) -> SliverChildListDelegate
pub fn add_repaint_boundaries(self, value: bool) -> SliverChildListDelegate
Dart SliverChildListDelegate(addRepaintBoundaries:).
Sourcepub fn add_semantic_indexes(self, value: bool) -> SliverChildListDelegate
pub fn add_semantic_indexes(self, value: bool) -> SliverChildListDelegate
Dart SliverChildListDelegate(addSemanticIndexes:).
Sourcepub fn semantic_index_offset(self, value: i32) -> SliverChildListDelegate
pub fn semantic_index_offset(self, value: i32) -> SliverChildListDelegate
Dart SliverChildListDelegate(semanticIndexOffset:).
Sourcepub fn semantic_index_callback(
self,
value: SemanticIndexCallback,
) -> SliverChildListDelegate
pub fn semantic_index_callback( self, value: SemanticIndexCallback, ) -> SliverChildListDelegate
Dart SliverChildListDelegate(semanticIndexCallback:).
Sourcepub fn into_delegate(self) -> SliverChildDelegateRef
pub fn into_delegate(self) -> SliverChildDelegateRef
The delegate as the shared reference a sliver widget takes.
Trait Implementations§
Source§impl Debug for SliverChildListDelegate
impl Debug for SliverChildListDelegate
Source§impl SliverChildDelegate for SliverChildListDelegate
impl SliverChildDelegate for SliverChildListDelegate
Source§fn find_index_by_key(&self, key: &KeyRef) -> Option<i32>
fn find_index_by_key(&self, key: &KeyRef) -> Option<i32>
Source§fn build(
&self,
_app: &mut App,
_context: BuildContext,
index: i32,
) -> Option<WidgetRef>
fn build( &self, _app: &mut App, _context: BuildContext, index: i32, ) -> Option<WidgetRef>
Source§fn estimated_child_count(&self) -> Option<i32>
fn estimated_child_count(&self) -> Option<i32>
Source§fn should_rebuild(&self, old_delegate: &dyn SliverChildDelegate) -> bool
fn should_rebuild(&self, old_delegate: &dyn SliverChildDelegate) -> bool
Source§fn estimate_max_scroll_offset(
&self,
first_index: i32,
last_index: i32,
leading_scroll_offset: f64,
trailing_scroll_offset: f64,
) -> Option<f64>
fn estimate_max_scroll_offset( &self, first_index: i32, last_index: i32, leading_scroll_offset: f64, trailing_scroll_offset: f64, ) -> Option<f64>
Source§fn did_finish_layout(&self, first_index: i32, last_index: i32)
fn did_finish_layout(&self, first_index: i32, last_index: i32)
Source§fn delegate_type(&self) -> TypeId
fn delegate_type(&self) -> TypeId
runtimeType.Source§fn debug_fill_description(&self, description: &mut Vec<String>)
fn debug_fill_description(&self, description: &mut Vec<String>)
toString.