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: AxisThe 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: boolWhether 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: boolWhether 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: f64The 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>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: SliverPaintOrderThe order in which the viewport paints its slivers.
Defaults to SliverPaintOrder::FirstIsTop.
drag_start_behavior: DragStartBehaviorDetermines 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: ClipThe content will be clipped (or not) according to this option.
Defaults to Clip::HardEdge.
hit_test_behavior: HitTestBehaviorHow 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
impl ScrollViewData
Sourcepub fn debug_fill_properties(
&self,
app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
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.
Sourcepub fn new() -> ScrollViewData
pub fn new() -> ScrollViewData
Dart’s ScrollView constructor defaults.