Skip to main content

CustomScrollView

Struct CustomScrollView 

Source
pub struct CustomScrollView {
    pub slivers: Vec<WidgetRef>,
    /* private fields */
}
Expand description

A ScrollView that combines multiple slivers in one scrollable view.

A CustomScrollView lets you combine lists, grids, and other widgets in a single scrollable view by supplying slivers directly. Slivers can represent lists, grids, and expanding headers. Widgets that use the box layout model can be included using a SliverToBoxAdapter.

ⓘ
CustomScrollView::new().slivers([
    SliverToBoxAdapter::new().child(header).into_widget(),
    SliverList::list(items).into_widget(),
])

Fields§

§slivers: Vec<WidgetRef>

The slivers to place inside the viewport.

A sliver is a widget backed by a RenderSliver, i.e. one that implements the constraint/geometry protocol that uses SliverConstraints and SliverGeometry. This is as distinct from those widgets that are backed by RenderBox, which use BoxConstraints and Size respectively, and are known as box widgets.

While boxes are much more straightforward (implementing a simple two-dimensional Cartesian layout system), slivers are much more powerful, and are optimized for one-axis scrolling environments.

In general, slivers always wrap box widgets to actually render anything; the sliver part of the equation is mostly about how these boxes should be laid out in a viewport.

Implementations§

Source§

impl CustomScrollView

Source

pub fn new() -> CustomScrollView

Creates a ScrollView that combines multiple slivers in one scrollable view.

Source

pub fn key(self, key: KeyRef) -> CustomScrollView

Dart key:.

Source

pub fn scroll_direction(self, scroll_direction: Axis) -> CustomScrollView

Dart scrollDirection:.

Source

pub fn reverse(self, reverse: bool) -> CustomScrollView

Dart reverse:.

Source

pub fn controller(self, controller: ScrollControllerRef) -> CustomScrollView

Dart controller:.

Source

pub fn primary(self, primary: bool) -> CustomScrollView

Dart primary:.

Source

pub fn physics(self, physics: ScrollPhysicsRef) -> CustomScrollView

Dart physics:.

Source

pub fn shrink_wrap(self, shrink_wrap: bool) -> CustomScrollView

Dart shrinkWrap:.

Source

pub fn cache_extent(self, cache_extent: f64) -> CustomScrollView

👎Deprecated:

Use scroll_cache_extent instead.

Dart cacheExtent:.

Source

pub fn scroll_cache_extent( self, scroll_cache_extent: ScrollCacheExtent, ) -> CustomScrollView

Dart scrollCacheExtent:.

Source

pub fn semantic_child_count(self, semantic_child_count: i32) -> CustomScrollView

Dart semanticChildCount:.

Source

pub fn drag_start_behavior( self, drag_start_behavior: DragStartBehavior, ) -> CustomScrollView

Dart dragStartBehavior:.

Source

pub fn keyboard_dismiss_behavior( self, keyboard_dismiss_behavior: ScrollViewKeyboardDismissBehavior, ) -> CustomScrollView

Dart keyboardDismissBehavior:.

Source

pub fn restoration_id( self, restoration_id: impl Into<String>, ) -> CustomScrollView

Dart restorationId:.

Source

pub fn clip_behavior(self, clip_behavior: Clip) -> CustomScrollView

Dart clipBehavior:.

Source

pub fn hit_test_behavior( self, hit_test_behavior: HitTestBehavior, ) -> CustomScrollView

Dart hitTestBehavior:.

Source

pub fn scroll_behavior( self, scroll_behavior: ScrollBehaviorRef, ) -> CustomScrollView

Dart CustomScrollView(scrollBehavior:).

Source

pub fn center(self, center: KeyRef) -> CustomScrollView

Dart CustomScrollView(center:).

Source

pub fn anchor(self, anchor: f64) -> CustomScrollView

Dart CustomScrollView(anchor:).

Source

pub fn paint_order(self, paint_order: SliverPaintOrder) -> CustomScrollView

Dart CustomScrollView(paintOrder:).

Source

pub fn slivers( self, slivers: impl IntoIterator<Item = WidgetRef>, ) -> CustomScrollView

Dart CustomScrollView(slivers:).

Trait Implementations§

Source§

impl Clone for CustomScrollView

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CustomScrollView

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CustomScrollView

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl ScrollView for CustomScrollView

Source§

fn scroll_view_data(&self) -> &ScrollViewData

Source§

fn scroll_view_data_mut(&mut self) -> &mut ScrollViewData

The ScrollViewData bag, mutably.
Source§

fn build_slivers( &self, _app: &mut App, _context: BuildContext, ) -> Vec<WidgetRef>

Build the list of widgets to place inside the viewport. Read more
Source§

fn get_direction(&self, app: &mut App, context: BuildContext) -> AxisDirection

Returns the AxisDirection in which the scroll view scrolls. Read more
Source§

fn build_viewport( &self, app: &mut App, context: BuildContext, offset: ViewportOffsetRef, axis_direction: AxisDirection, slivers: Vec<WidgetRef>, ) -> WidgetRef

Build the viewport. Read more
Source§

impl StatelessWidget for CustomScrollView

Source§

fn key(&self) -> Option<&KeyRef>

Source§

fn debug_fill_properties( &self, app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s 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

Describes the part of the user interface represented by this widget. Read more
Source§

fn debug_check_constructor(&self)

Dart’s constructor asserts that relate two or more arguments. Read more
Source§

fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>

Dart’s 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 CustomScrollView

§

impl !Send for CustomScrollView

§

impl !Sync for CustomScrollView

§

impl !UnwindSafe for CustomScrollView

§

impl Forget for CustomScrollView

§

impl Freeze for CustomScrollView
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze, NonZero<u32>: Freeze, &'static ScrollControllerVTable: Freeze, *const RcInner<Keep> is !null: Freeze, PhantomData<RcInner<Keep>>: Freeze, *const RcInner<dyn ScrollPhysics> is !null: Freeze, PhantomData<RcInner<dyn ScrollPhysics>>: Freeze, *const RcInner<dyn ScrollBehavior> is !null: Freeze, PhantomData<RcInner<dyn ScrollBehavior>>: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze, PhantomData<Rc<dyn Widget>>: Freeze,

§

impl Move for CustomScrollView

§

impl Unpin for CustomScrollView
where Rc<dyn Key>: Unpin, NonZero<u32>: Unpin, &'static ScrollControllerVTable: Unpin, Rc<Keep>: Unpin, Rc<dyn ScrollPhysics>: Unpin, Rc<dyn ScrollBehavior>: Unpin, *const u8 is !null: Unpin, Rc<dyn Widget>: Unpin,

§

impl UnsafeUnpin for CustomScrollView
where *const RcInner<dyn Key> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Key>>: UnsafeUnpin, NonZeroU32Inner: UnsafeUnpin, &'static ScrollControllerVTable: UnsafeUnpin, *const RcInner<Keep> is !null: UnsafeUnpin, PhantomData<RcInner<Keep>>: UnsafeUnpin, *const RcInner<dyn ScrollPhysics> is !null: UnsafeUnpin, PhantomData<RcInner<dyn ScrollPhysics>>: UnsafeUnpin, *const RcInner<dyn ScrollBehavior> is !null: UnsafeUnpin, PhantomData<RcInner<dyn ScrollBehavior>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, PhantomData<Rc<dyn Widget>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<W> IntoWidget<StatelessKind> for W
where W: StatelessWidget,

Source§

fn into_widget(self) -> Rc<dyn Widget>

The widget as a tree node, made where this is called: its creation_location.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>