pub trait SliverMultiBoxAdaptorWidget: SliverWithKeepAliveWidgetwhere
Self::RenderObject: RenderSliverMultiBoxAdaptor,{
// Required method
fn delegate(&self) -> &SliverChildDelegateRef;
// Provided methods
fn debug_fill_properties(
&self,
properties: &mut DiagnosticPropertiesBuilder,
) { ... }
fn create_element(&self, app: &mut App, this: WidgetRef) -> AnyElement
where Self: Sized { ... }
fn estimate_max_scroll_offset(
&self,
constraints: Option<SliverConstraints>,
first_index: i32,
last_index: i32,
leading_scroll_offset: f64,
trailing_scroll_offset: f64,
) -> Option<f64> { ... }
}Expand description
A base class for slivers that have multiple box children.
Helps implementors build their children lazily using a SliverChildDelegate.
The widgets returned by the delegate are cached and the delegate is only
consulted again if it changes and the new delegate’s SliverChildDelegate::should_rebuild
method returns true.
Required Methods§
Sourcefn delegate(&self) -> &SliverChildDelegateRef
fn delegate(&self) -> &SliverChildDelegateRef
The delegate that provides the children for this widget.
The children are constructed lazily using this delegate to avoid creating more children
than are visible through the Viewport.
§Using more than one delegate in a Viewport
If multiple delegates are used in a single scroll view, the first child of each delegate will always be laid out, even if it extends beyond the currently viewable area. This is because at least one child is required in order to estimate the max scroll offset for the whole scroll view, as it uses the currently built children to estimate the remaining children’s extent.
Provided Methods§
Sourcefn debug_fill_properties(&self, properties: &mut DiagnosticPropertiesBuilder)
fn debug_fill_properties(&self, properties: &mut DiagnosticPropertiesBuilder)
Dart’s SliverMultiBoxAdaptorWidget.debugFillProperties, which a subclass’s own body
calls where Dart writes super.
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 lazily builds this widget’s children.
Dart’s createElement; an implementor that needs the moved children replaced passes
true (see SliverMultiBoxAdaptorElement::new).
Sourcefn estimate_max_scroll_offset(
&self,
constraints: Option<SliverConstraints>,
first_index: i32,
last_index: i32,
leading_scroll_offset: f64,
trailing_scroll_offset: f64,
) -> Option<f64>
fn estimate_max_scroll_offset( &self, constraints: Option<SliverConstraints>, first_index: i32, last_index: i32, leading_scroll_offset: f64, trailing_scroll_offset: f64, ) -> Option<f64>
Returns an estimate of the max scroll extent for all the children.
Implementors should override this function if they have additional information about their max scroll extent.
This is used by SliverMultiBoxAdaptorElement to implement part of the
RenderSliverBoxChildManager API.
The default implementation defers to the delegate via its
SliverChildDelegate::estimate_max_scroll_offset method.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".