Skip to main content

ScrollViewData

Struct ScrollViewData 

Source
pub struct ScrollViewData {
Show 19 fields pub key: Option<KeyRef>, pub scroll_direction: Axis, pub reverse: bool, pub controller: Option<ScrollControllerRef>, pub primary: Option<bool>, pub physics: Option<ScrollPhysicsRef>, pub scroll_behavior: Option<ScrollBehaviorRef>, pub shrink_wrap: bool, pub center: Option<KeyRef>, pub anchor: f64, pub cache_extent: Option<f64>, pub scroll_cache_extent: Option<ScrollCacheExtent>, pub semantic_child_count: Option<i32>, pub paint_order: SliverPaintOrder, pub drag_start_behavior: DragStartBehavior, pub keyboard_dismiss_behavior: Option<ScrollViewKeyboardDismissBehavior>, pub restoration_id: Option<String>, pub clip_behavior: Clip, pub hit_test_behavior: HitTestBehavior,
}
Expand description

The fields of Dart’s ScrollView, which its subclasses carry.

Dart’s physics initializer — the one that substitutes an AlwaysScrollableScrollPhysics for an omitted physics — runs in ScrollViewBase::build instead, because a fluent setter cannot see the primary, controller and scroll_direction a later setter will supply.

Fields§

§key: Option<KeyRef>§scroll_direction: Axis

The Axis along which the scroll view’s offset increases.

For the direction in which active scrolling may be occurring, see ScrollDirection.

Defaults to Axis::Vertical.

§reverse: bool

Whether the scroll view scrolls in the reading direction.

For example, if the reading direction is left-to-right and scroll_direction is Axis::Horizontal, then the scroll view scrolls from left to right when reverse is false and from right to left when it is true.

Defaults to false.

§controller: Option<ScrollControllerRef>

An object that can be used to control the position to which this scroll view is scrolled.

Must be None if primary is true.

§primary: Option<bool>

Whether this is the primary scroll view associated with the parent PrimaryScrollController.

When this is true, the scroll view is scrollable even if it does not have sufficient content to actually scroll. Otherwise, by default the user can only scroll the view if it has sufficient content.

Cannot be true while a controller is provided, only one controller can be associated with a scroll view.

Setting to false will explicitly prevent inheriting any PrimaryScrollController.

Defaults to None. When None, and a controller is not provided, PrimaryScrollController::should_inherit is used to decide automatic inheritance.

§physics: Option<ScrollPhysicsRef>

How the scroll view should respond to user input.

For example, determines how the scroll view continues to animate after the user stops dragging the scroll view.

Defaults to matching platform conventions. Furthermore, if primary is false, then the user cannot scroll if there is insufficient content to scroll, while if it is true, they can always attempt to scroll.

If an explicit ScrollBehaviorRef is provided to scroll_behavior, the physics provided by that behavior will take precedence after this one.

§scroll_behavior: Option<ScrollBehaviorRef>

A ScrollBehaviorRef that will be applied to this widget individually.

Defaults to None, wherein the inherited behavior is copied and modified to alter the viewport decoration.

§shrink_wrap: bool

Whether the extent of the scroll view in the scroll_direction should be determined by the contents being viewed.

If the scroll view does not shrink wrap, then the scroll view will expand to the maximum allowed size in the scroll direction. If the scroll view has unbounded constraints in the scroll direction, then this must be true.

Shrink wrapping the content of the scroll view is significantly more expensive than expanding to the maximum allowed size because the content can expand and contract during scrolling, which means the size of the scroll view needs to be recomputed whenever the scroll position changes.

Defaults to false.

§center: Option<KeyRef>

The first child in the GrowthDirection::Forward growth direction.

Children after the center will be placed in the AxisDirection determined by scroll_direction and reverse relative to the center. Children before the center will be placed in the opposite of the axis direction relative to the center. This makes the center the inflection point of the growth direction.

The center must be the key of one of the slivers built by ScrollView::build_slivers.

Of the built-in subclasses of ScrollView, only CustomScrollView supports a center.

§anchor: f64

The relative position of the zero scroll offset.

For example, if the anchor is 0.5 and the AxisDirection determined by scroll_direction and reverse is AxisDirection::Down or AxisDirection::Up, then the zero scroll offset is vertically centered within the viewport. If the anchor is 1.0, and the axis direction is AxisDirection::Right, then the zero scroll offset is on the left edge of the viewport.

§cache_extent: Option<f64>
👎Deprecated:

Use scroll_cache_extent instead.

Deprecated: use scroll_cache_extent instead.

The viewport has an area before and after the visible area to cache items that are about to become visible when the user scrolls.

§scroll_cache_extent: Option<ScrollCacheExtent>

The viewport has an area before and after the visible area to cache items that are about to become visible when the user scrolls.

§semantic_child_count: Option<i32>

The number of children that will contribute semantic information.

Some subtypes of ScrollView can infer this value automatically. For example ListView will use the number of widgets in the child list, while the ListView::separated constructor will use half that amount.

For CustomScrollView and other types which do not receive a builder or list of widgets, the child count must be explicitly provided. If the number is unknown or unbounded this should be left unset.

§paint_order: SliverPaintOrder

The order in which the viewport paints its slivers.

Defaults to SliverPaintOrder::FirstIsTop.

§drag_start_behavior: DragStartBehavior

Determines the way that drag start behavior is handled.

§keyboard_dismiss_behavior: Option<ScrollViewKeyboardDismissBehavior>

How this ScrollView will dismiss the keyboard automatically.

If None then it will fall back to scroll_behavior. If that is also None, the inherited ScrollBehavior::get_keyboard_dismiss_behavior will be used.

§restoration_id: Option<String>

Restoration ID to save and restore the scroll offset of the scrollable.

§clip_behavior: Clip

The content will be clipped (or not) according to this option.

Defaults to Clip::HardEdge.

§hit_test_behavior: HitTestBehavior

How to behave during hit testing when deciding how the hit test propagates to children and whether to consider targets behind this scroll view.

Defaults to HitTestBehavior::Opaque.

Implementations§

Source§

impl ScrollViewData

Source

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

Dart’s ScrollView.debugFillProperties, which every scroll view’s own body calls where Dart writes super.

Source

pub fn new() -> ScrollViewData

Dart’s ScrollView constructor defaults.

Trait Implementations§

Source§

impl Clone for ScrollViewData

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 ScrollViewData

Source§

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

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

impl Default for ScrollViewData

Source§

fn default() -> ScrollViewData

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

Auto Trait Implementations§

§

impl !RefUnwindSafe for ScrollViewData

§

impl !Send for ScrollViewData

§

impl !Sync for ScrollViewData

§

impl !UnwindSafe for ScrollViewData

§

impl Forget for ScrollViewData

§

impl Freeze for ScrollViewData
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,

§

impl Move for ScrollViewData

§

impl Unpin for ScrollViewData
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,

§

impl UnsafeUnpin for ScrollViewData
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,

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<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>