pub struct SliverFillRemaining {
pub key: Option<KeyRef>,
pub child: Option<WidgetRef>,
pub has_scroll_body: bool,
pub fill_overscroll: bool,
}Expand description
A sliver that contains a single box child that fills the remaining space in the viewport.
To learn more about slivers, see CustomScrollView::slivers.
SliverFillRemaining will size its child to fill the viewport in the cross
axis. The extent of the sliver and its child’s size in the main axis is computed
conditionally, described in further detail below.
Typically this will be the last sliver in a viewport, since (by definition) there is never any room for anything beyond this sliver.
§Main Axis Extent
§When SliverFillRemaining has a scrollable child
The has_scroll_body flag indicates whether the sliver’s child has a
scrollable body. This value is never null, and defaults to true. A common example of this use
is a NestedScrollView. In this case, the sliver will size its child to fill the maximum
available extent. SliverFillRemaining will not constrain the scrollable area, as it could
potentially have an infinite depth. This is also true for use cases such as a ScrollView
when ScrollView::shrink_wrap is true.
§When SliverFillRemaining does not have a scrollable child
When has_scroll_body is set to false, the child’s size is taken
into account when considering the extent to which it should fill the space. The extent to
which the preceding slivers have been scrolled is also taken into account in deciding how to
layout this sliver.
SliverFillRemaining will size its child to fill the viewport in the main
axis if that space is larger than the child’s extent, and the amount of space that has been
scrolled beforehand has not exceeded the main axis extent of the viewport.
SliverFillRemaining will defer to the size of its child if the child’s
size exceeds the remaining space in the viewport.
SliverFillRemaining will defer to the size of its child if the
SliverConstraints::preceding_scroll_extent exceeded the length of the viewport’s main axis.
For ScrollPhysics that allow overscroll, such as BouncingScrollPhysics, setting the
fill_overscroll flag to true allows the size of the
child to stretch, filling the overscroll area. It does this regardless of
the path chosen to provide the child’s size.
See also:
SliverFillViewport, which sizes its children based on the size of the viewport, regardless of what else is in the scroll view.crate::SliverList, which shows a list of variable-sized children in a viewport.
Fields§
§key: Option<KeyRef>§child: Option<WidgetRef>Box child widget that fills the remaining space in the viewport.
The main SliverFillRemaining documentation contains more details.
has_scroll_body: boolIndicates whether the child has a scrollable body, this value cannot be null.
Defaults to true such that the child will extend beyond the viewport and scroll, as seen
in NestedScrollView.
Setting this value to false will allow the child to fill the remainder of the viewport
and not extend further. However, if the SliverConstraints::preceding_scroll_extent
and/or the child’s extent exceeds the size of the viewport, the sliver
will defer to the child’s size rather than overriding it.
fill_overscroll: boolIndicates whether the child should stretch to fill the overscroll area created by certain
scroll physics, such as iOS’ default scroll physics. This flag is only relevant when
has_scroll_body is false.
Defaults to false, meaning that the default behavior is for the child to maintain its size and not extend into the overscroll area.
Implementations§
Source§impl SliverFillRemaining
impl SliverFillRemaining
Sourcepub fn new() -> SliverFillRemaining
pub fn new() -> SliverFillRemaining
Creates a sliver that fills the remaining space in the viewport.
Sourcepub fn key(self, key: KeyRef) -> SliverFillRemaining
pub fn key(self, key: KeyRef) -> SliverFillRemaining
Dart SliverFillRemaining(key:).
Sourcepub fn child<K>(self, child: impl IntoWidget<K>) -> SliverFillRemaining
pub fn child<K>(self, child: impl IntoWidget<K>) -> SliverFillRemaining
Dart SliverFillRemaining(child:).
Sourcepub fn has_scroll_body(self, has_scroll_body: bool) -> SliverFillRemaining
pub fn has_scroll_body(self, has_scroll_body: bool) -> SliverFillRemaining
Dart SliverFillRemaining(hasScrollBody:).
Sourcepub fn fill_overscroll(self, fill_overscroll: bool) -> SliverFillRemaining
pub fn fill_overscroll(self, fill_overscroll: bool) -> SliverFillRemaining
Dart SliverFillRemaining(fillOverscroll:).
Trait Implementations§
Source§impl Debug for SliverFillRemaining
impl Debug for SliverFillRemaining
Source§impl Default for SliverFillRemaining
impl Default for SliverFillRemaining
Source§fn default() -> SliverFillRemaining
fn default() -> SliverFillRemaining
Source§impl StatelessWidget for SliverFillRemaining
impl StatelessWidget for SliverFillRemaining
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 build(&self, _app: &mut App, _context: BuildContext) -> WidgetRef
fn build(&self, _app: &mut App, _context: BuildContext) -> WidgetRef
Source§fn debug_check_constructor(&self)
fn debug_check_constructor(&self)
Source§fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>
fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>
this is PreferredSizeWidget: a widget that implements PreferredSizeWidget
answers with itself, which is what a parent asking an erased child for its preferred
size reads.Auto Trait Implementations§
impl !RefUnwindSafe for SliverFillRemaining
impl !Send for SliverFillRemaining
impl !Sync for SliverFillRemaining
impl !UnwindSafe for SliverFillRemaining
impl Forget for SliverFillRemaining
impl Freeze for SliverFillRemaining
impl Move for SliverFillRemaining
impl Unpin for SliverFillRemaining
impl UnsafeUnpin for SliverFillRemainingwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
*const RcInner<dyn Widget> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Widget>>: 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<StatelessKind> for Wwhere
W: StatelessWidget,
impl<W> IntoWidget<StatelessKind> for Wwhere
W: StatelessWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.