pub struct SliverGrid {
pub key: Option<KeyRef>,
pub delegate: SliverChildDelegateRef,
pub grid_delegate: Rc<dyn SliverGridDelegate>,
}Expand description
A sliver that places multiple box children in a two dimensional arrangement.
To learn more about slivers, see CustomScrollView::slivers.
SliverGrid places its children in arbitrary positions determined by
grid_delegate. Each child is forced to have the size specified by the
grid_delegate.
The main axis direction of a grid is the direction in which it scrolls; the cross axis direction is the orthogonal direction.
See also:
SliverList, which places its children in a linear array.SliverFixedExtentList, which places its children in a linear array with a fixed extent in the main axis.
Fields§
§key: Option<KeyRef>§delegate: SliverChildDelegateRefThe delegate that provides the children for this widget.
grid_delegate: Rc<dyn SliverGridDelegate>The delegate that controls the size and position of the children.
Implementations§
Source§impl SliverGrid
impl SliverGrid
Sourcepub fn new(
delegate: SliverChildDelegateRef,
grid_delegate: Rc<dyn SliverGridDelegate>,
) -> SliverGrid
pub fn new( delegate: SliverChildDelegateRef, grid_delegate: Rc<dyn SliverGridDelegate>, ) -> SliverGrid
Creates a sliver that places multiple box children in a two dimensional arrangement.
Sourcepub fn builder(
grid_delegate: Rc<dyn SliverGridDelegate>,
item_builder: impl Fn(&mut App, BuildContext, i32) -> Option<WidgetRef> + 'static,
) -> SliverGridBuilder
pub fn builder( grid_delegate: Rc<dyn SliverGridDelegate>, item_builder: impl Fn(&mut App, BuildContext, i32) -> Option<WidgetRef> + 'static, ) -> SliverGridBuilder
A sliver that creates a 2D array of widgets that are created on demand.
This constructor is appropriate for sliver grids 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 SliverGrid 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 count(cross_axis_count: i32) -> SliverGridCount
pub fn count(cross_axis_count: i32) -> SliverGridCount
Creates a sliver that places multiple box children in a two dimensional arrangement with a fixed number of tiles in the cross axis.
Uses a SliverGridDelegateWithFixedCrossAxisCount as the
grid_delegate, and a SliverChildListDelegate as the
delegate.
See also:
GridView::count, the equivalent constructor forGridViewwidgets.
Sourcepub fn extent(max_cross_axis_extent: f64) -> SliverGridExtent
pub fn extent(max_cross_axis_extent: f64) -> SliverGridExtent
Creates a sliver that places multiple box children in a two dimensional arrangement with tiles that each have a maximum cross-axis extent.
Uses a SliverGridDelegateWithMaxCrossAxisExtent as the
grid_delegate, and a SliverChildListDelegate as the
delegate.
See also:
GridView::extent, the equivalent constructor forGridViewwidgets.
Sourcepub fn list(
grid_delegate: Rc<dyn SliverGridDelegate>,
children: Vec<WidgetRef>,
) -> SliverGridList
pub fn list( grid_delegate: Rc<dyn SliverGridDelegate>, children: Vec<WidgetRef>, ) -> SliverGridList
Creates a sliver that places multiple box children in a two dimensional arrangement.
To learn more about slivers, see CustomScrollView::slivers.
Uses a SliverChildListDelegate as the delegate.
Sourcepub fn key(self, key: KeyRef) -> SliverGrid
pub fn key(self, key: KeyRef) -> SliverGrid
Dart SliverGrid(key:).
Trait Implementations§
Source§impl Debug for SliverGrid
impl Debug for SliverGrid
Source§impl RenderObjectWidget for SliverGrid
impl RenderObjectWidget for SliverGrid
Source§type RenderObject = RenderSliverGrid
type RenderObject = RenderSliverGrid
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 update_render_object(
&self,
app: &mut App,
_context: BuildContext,
render_object: RenderHandle<RenderSliverGrid>,
)
fn update_render_object( &self, app: &mut App, _context: BuildContext, render_object: RenderHandle<RenderSliverGrid>, )
create_render_object. 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 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 SliverGrid
impl SliverMultiBoxAdaptorWidget for SliverGrid
Source§fn delegate(&self) -> &SliverChildDelegateRef
fn delegate(&self) -> &SliverChildDelegateRef
Source§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>
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>
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.Source§fn create_element(&self, app: &mut App, this: WidgetRef) -> AnyElementwhere
Self: Sized,
fn create_element(&self, app: &mut App, this: WidgetRef) -> AnyElementwhere
Self: Sized,
impl SliverWithKeepAliveWidget for SliverGrid
Auto Trait Implementations§
impl !RefUnwindSafe for SliverGrid
impl !Send for SliverGrid
impl !Sync for SliverGrid
impl !UnwindSafe for SliverGrid
impl Forget for SliverGrid
impl Freeze for SliverGridwhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
*const RcInner<dyn SliverChildDelegate> is !null: Freeze,
PhantomData<RcInner<dyn SliverChildDelegate>>: Freeze,
*const RcInner<dyn SliverGridDelegate> is !null: Freeze,
PhantomData<RcInner<dyn SliverGridDelegate>>: Freeze,
impl Move for SliverGrid
impl Unpin for SliverGrid
impl UnsafeUnpin for SliverGridwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
*const RcInner<dyn SliverChildDelegate> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn SliverChildDelegate>>: UnsafeUnpin,
*const RcInner<dyn SliverGridDelegate> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn SliverGridDelegate>>: 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.