pub struct SliverList {
pub key: Option<KeyRef>,
pub delegate: SliverChildDelegateRef,
}Expand description
A sliver that places multiple box children in a linear array along the main axis.
To learn more about slivers, see CustomScrollView::slivers.
Each child is forced to have the SliverConstraints::cross_axis_extent in the cross axis but
determines its own main axis extent.
SliverList determines its scroll offset by “dead reckoning” because children outside the
visible part of the sliver are not materialized, which means SliverList cannot learn their
main axis extent. Instead, newly materialized children are placed adjacent to existing
children.
If the children have a fixed extent in the main axis, consider using
SliverFixedExtentList rather than SliverList because SliverFixedExtentList does
not need to perform layout on its children to obtain their extent in the main axis and is
therefore more efficient.
See also:
CustomScrollView, which accepts slivers likeSliverListto create custom scroll effects.SliverFixedExtentList, which is more efficient for children with the same extent in the main axis.SliverGrid, which places multiple children in a two dimensional grid.
Fields§
§key: Option<KeyRef>§delegate: SliverChildDelegateRefThe delegate that provides the children for this widget.
Implementations§
Source§impl SliverList
impl SliverList
Sourcepub fn new(delegate: SliverChildDelegateRef) -> SliverList
pub fn new(delegate: SliverChildDelegateRef) -> SliverList
Creates a sliver that places box children in a linear array.
Sourcepub fn builder(
item_builder: impl Fn(&mut App, BuildContext, i32) -> Option<WidgetRef> + 'static,
) -> SliverListBuilder
pub fn builder( item_builder: impl Fn(&mut App, BuildContext, i32) -> Option<WidgetRef> + 'static, ) -> SliverListBuilder
A sliver that places multiple box children in a linear array along the main axis.
This constructor is appropriate for sliver lists with a large (or infinite) number of children because the builder is called only for those children that are actually visible.
Providing a non-None item_count improves the ability
of the SliverList to estimate the maximum scroll extent.
The item builder will be called only with indices greater than or equal to zero and less than the item count.
Sourcepub fn separated(
item_builder: impl Fn(&mut App, BuildContext, i32) -> Option<WidgetRef> + 'static,
separator_builder: impl Fn(&mut App, BuildContext, i32) -> Option<WidgetRef> + 'static,
) -> SliverListSeparated
pub fn separated( item_builder: impl Fn(&mut App, BuildContext, i32) -> Option<WidgetRef> + 'static, separator_builder: impl Fn(&mut App, BuildContext, i32) -> Option<WidgetRef> + 'static, ) -> SliverListSeparated
A sliver that places multiple box children, separated by box widgets, in a linear array along the main axis.
This constructor is appropriate for sliver lists with a large (or infinite) number of children because the builder is called only for those children that are actually visible.
The separator_builder is similar to item_builder, except it is the widget that gets
placed between item_builder(context, index) and item_builder(context, index + 1).
Sourcepub fn list(children: Vec<WidgetRef>) -> SliverListList
pub fn list(children: Vec<WidgetRef>) -> SliverListList
A sliver that places multiple box children in a linear array along the main axis, built from an explicit list of widgets.
Sourcepub fn key(self, key: KeyRef) -> SliverList
pub fn key(self, key: KeyRef) -> SliverList
Dart SliverList(key:).
Trait Implementations§
Source§impl Debug for SliverList
impl Debug for SliverList
Source§impl RenderObjectWidget for SliverList
impl RenderObjectWidget for SliverList
Source§type RenderObject = RenderSliverList
type RenderObject = RenderSliverList
covariant RenderObject parameter type.Source§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
debugFillProperties: the properties a dump shows for this widget, in Dart’s
order. Dart’s Widget base only sets the dense tree style, which the framework does.Source§fn create_render_object(
&self,
app: &mut App,
context: BuildContext,
) -> AnyRenderObject
fn create_render_object( &self, app: &mut App, context: BuildContext, ) -> AnyRenderObject
RenderObject class that this widget represents, using the
configuration described by this widget. Read moreSource§fn to_string_short(&self) -> String
fn to_string_short(&self) -> String
toStringShort, for a widget that names itself apart from its type, as
SizedBox.expand does; see Widget::to_string_short.Source§fn debug_visit_onstage_children(
&self,
app: &App,
children: &[AnyElement],
visitor: &mut dyn FnMut(AnyElement),
)
fn debug_visit_onstage_children( &self, app: &App, children: &[AnyElement], visitor: &mut dyn FnMut(AnyElement), )
debugVisitOnstageChildren of the element this widget makes, for a widget whose
Dart element subclass overrides it only to hide children (_OffstageElement,
_IndexedStackElement): calls visitor for each of children, in order, that is
onstage. Waft’s generic single- and multi-child elements stand in for those subclasses
and ask their widget here; an element of a widget’s own overrides
Element::debug_visit_onstage_children instead.Source§fn update_render_object(
&self,
app: &mut App,
context: BuildContext,
render_object: RenderHandle<Self::RenderObject>,
)
fn update_render_object( &self, app: &mut App, context: BuildContext, render_object: RenderHandle<Self::RenderObject>, )
create_render_object. Read moreSource§fn did_unmount_render_object(
&self,
app: &mut App,
render_object: RenderHandle<Self::RenderObject>,
)
fn did_unmount_render_object( &self, app: &mut App, render_object: RenderHandle<Self::RenderObject>, )
RenderObject will be of the same type as returned by this object’s
create_render_object.Source§impl SliverMultiBoxAdaptorWidget for SliverList
impl SliverMultiBoxAdaptorWidget for SliverList
Source§fn delegate(&self) -> &SliverChildDelegateRef
fn delegate(&self) -> &SliverChildDelegateRef
Source§fn create_element(&self, app: &mut App, this: WidgetRef) -> AnyElement
fn create_element(&self, app: &mut App, this: WidgetRef) -> AnyElement
Source§fn debug_fill_properties(&self, properties: &mut DiagnosticPropertiesBuilder)
fn debug_fill_properties(&self, properties: &mut DiagnosticPropertiesBuilder)
SliverMultiBoxAdaptorWidget.debugFillProperties, which a subclass’s own body
calls where Dart writes super.impl SliverWithKeepAliveWidget for SliverList
Auto Trait Implementations§
impl !RefUnwindSafe for SliverList
impl !Send for SliverList
impl !Sync for SliverList
impl !UnwindSafe for SliverList
impl Forget for SliverList
impl Freeze for SliverListwhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
*const RcInner<dyn SliverChildDelegate> is !null: Freeze,
PhantomData<RcInner<dyn SliverChildDelegate>>: Freeze,
impl Move for SliverList
impl Unpin for SliverList
impl UnsafeUnpin for SliverListwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
*const RcInner<dyn SliverChildDelegate> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn SliverChildDelegate>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<W> IntoWidget<SliverMultiBoxAdaptorKind> for Wwhere
W: SliverMultiBoxAdaptorWidget,
<W as RenderObjectWidget>::RenderObject: RenderSliverMultiBoxAdaptor,
impl<W> IntoWidget<SliverMultiBoxAdaptorKind> for Wwhere
W: SliverMultiBoxAdaptorWidget,
<W as RenderObjectWidget>::RenderObject: RenderSliverMultiBoxAdaptor,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.