pub struct ScrollPositionWithSingleContext { /* private fields */ }Expand description
A scroll position that manages scroll activities for a single
ScrollContext.
This type is a concrete implementor of ScrollPosition logic that handles a
single scroll context, such as a Scrollable. An instance of this type
manages [ScrollActivity] instances, which change what content is visible in
the Scrollable’s Viewport.
It is also the base class _DraggableScrollableSheetScrollPosition and
_CupertinoSheetScrollPosition extend: its field is the
ScrollPositionWithSingleContextData bag, the members it overrides are
ScrollPositionWithSingleContextLeaf’s, and the shared bodies are the associated
functions below.
See also:
ScrollPosition, which defines the underlying model for a position within aScrollablebut is agnostic as to how that position is changed.ScrollController, which can manipulate one or moreScrollPositions, and which usesScrollPositionWithSingleContextas its default type for scroll positions.
Implementations§
Source§impl ScrollPositionWithSingleContext
impl ScrollPositionWithSingleContext
Sourcepub fn new(
app: &mut App,
physics: ScrollPhysicsRef,
context: Rc<dyn ScrollContext>,
initial_pixels: Option<f64>,
keep_scroll_offset: bool,
old_position: Option<AnyScrollPosition>,
debug_label: Option<String>,
) -> Ref<ScrollPositionWithSingleContext>
pub fn new( app: &mut App, physics: ScrollPhysicsRef, context: Rc<dyn ScrollContext>, initial_pixels: Option<f64>, keep_scroll_offset: bool, old_position: Option<AnyScrollPosition>, debug_label: Option<String>, ) -> Ref<ScrollPositionWithSingleContext>
Create a ScrollPosition object that manages its behavior using
[ScrollActivity] objects.
The initial_pixels argument can be None, but in that case it is
imperative that the value be set, using ScrollPosition::correct_pixels, as soon as
ScrollPosition::apply_new_dimensions is invoked, before calling
ScrollPositionBase::apply_new_dimensions. Dart’s default is 0.0.
If keep_scroll_offset is true (Dart’s default), the current scroll offset is
saved with PageStorage and restored if this scroll position’s scrollable
is recreated.
Sourcepub fn init<P: ScrollPositionWithSingleContextLeaf>(
this: Handle<P>,
app: &mut App,
initial_pixels: Option<f64>,
old_position: Option<AnyScrollPosition>,
)
pub fn init<P: ScrollPositionWithSingleContextLeaf>( this: Handle<P>, app: &mut App, initial_pixels: Option<f64>, old_position: Option<AnyScrollPosition>, )
Dart’s ScrollPositionWithSingleContext constructor body, which runs the
ScrollPositionBase::init of its superclass first.
A leaf’s constructor calls this right after App::create, where Dart’s superclass
constructor would run.
Sourcepub fn axis_direction<P: ScrollPositionWithSingleContextLeaf>(
this: Handle<P>,
app: &App,
) -> AxisDirection
pub fn axis_direction<P: ScrollPositionWithSingleContextLeaf>( this: Handle<P>, app: &App, ) -> AxisDirection
Sourcepub fn set_pixels<P: ScrollPositionWithSingleContextLeaf>(
this: Handle<P>,
app: &mut App,
new_pixels: f64,
) -> f64
pub fn set_pixels<P: ScrollPositionWithSingleContextLeaf>( this: Handle<P>, app: &mut App, new_pixels: f64, ) -> f64
Sourcepub fn absorb<P: ScrollPositionWithSingleContextLeaf>(
this: Handle<P>,
app: &mut App,
other: AnyScrollPosition,
)
pub fn absorb<P: ScrollPositionWithSingleContextLeaf>( this: Handle<P>, app: &mut App, other: AnyScrollPosition, )
Sourcepub fn apply_new_dimensions<P: ScrollPositionWithSingleContextLeaf>(
this: Handle<P>,
app: &mut App,
)
pub fn apply_new_dimensions<P: ScrollPositionWithSingleContextLeaf>( this: Handle<P>, app: &mut App, )
Sourcepub fn begin_activity<P: ScrollPositionWithSingleContextLeaf>(
this: Handle<P>,
app: &mut App,
new_activity: Option<ScrollActivityRef>,
)
pub fn begin_activity<P: ScrollPositionWithSingleContextLeaf>( this: Handle<P>, app: &mut App, new_activity: Option<ScrollActivityRef>, )
Sourcepub fn apply_user_offset<P: ScrollPositionWithSingleContextLeaf>(
this: Handle<P>,
app: &mut App,
delta: f64,
)
pub fn apply_user_offset<P: ScrollPositionWithSingleContextLeaf>( this: Handle<P>, app: &mut App, delta: f64, )
Sourcepub fn go_idle<P: ScrollPositionWithSingleContextLeaf>(
this: Handle<P>,
app: &mut App,
)
pub fn go_idle<P: ScrollPositionWithSingleContextLeaf>( this: Handle<P>, app: &mut App, )
Sourcepub fn go_ballistic<P: ScrollPositionWithSingleContextLeaf>(
this: Handle<P>,
app: &mut App,
velocity: f64,
)
pub fn go_ballistic<P: ScrollPositionWithSingleContextLeaf>( this: Handle<P>, app: &mut App, velocity: f64, )
Sourcepub fn animate_to<P: ScrollPositionWithSingleContextLeaf>(
this: Handle<P>,
app: &mut App,
to: f64,
duration: Duration,
curve: Rc<dyn Curve>,
) -> CompleterFuture<()> ⓘ
pub fn animate_to<P: ScrollPositionWithSingleContextLeaf>( this: Handle<P>, app: &mut App, to: f64, duration: Duration, curve: Rc<dyn Curve>, ) -> CompleterFuture<()> ⓘ
Sourcepub fn jump_to<P: ScrollPositionWithSingleContextLeaf>(
this: Handle<P>,
app: &mut App,
value: f64,
)
pub fn jump_to<P: ScrollPositionWithSingleContextLeaf>( this: Handle<P>, app: &mut App, value: f64, )
Sourcepub fn pointer_scroll<P: ScrollPositionWithSingleContextLeaf>(
this: Handle<P>,
app: &mut App,
delta: f64,
)
pub fn pointer_scroll<P: ScrollPositionWithSingleContextLeaf>( this: Handle<P>, app: &mut App, delta: f64, )
Sourcepub fn jump_to_without_settling<P: ScrollPositionWithSingleContextLeaf>(
this: Handle<P>,
app: &mut App,
value: f64,
)
pub fn jump_to_without_settling<P: ScrollPositionWithSingleContextLeaf>( this: Handle<P>, app: &mut App, value: f64, )
Sourcepub fn hold<P: ScrollPositionWithSingleContextLeaf>(
this: Handle<P>,
app: &mut App,
hold_cancel_callback: Listener,
) -> Rc<dyn ScrollHoldController>
pub fn hold<P: ScrollPositionWithSingleContextLeaf>( this: Handle<P>, app: &mut App, hold_cancel_callback: Listener, ) -> Rc<dyn ScrollHoldController>
Sourcepub fn drag<P: ScrollPositionWithSingleContextLeaf>(
this: Handle<P>,
app: &mut App,
details: DragStartDetails,
drag_cancel_callback: Listener,
) -> Rc<dyn Drag>
pub fn drag<P: ScrollPositionWithSingleContextLeaf>( this: Handle<P>, app: &mut App, details: DragStartDetails, drag_cancel_callback: Listener, ) -> Rc<dyn Drag>
Sourcepub fn dispose<P: ScrollPositionWithSingleContextLeaf>(
this: Handle<P>,
app: &mut App,
)
pub fn dispose<P: ScrollPositionWithSingleContextLeaf>( this: Handle<P>, app: &mut App, )
Sourcepub fn debug_fill_description<P: ScrollPositionWithSingleContextLeaf>(
this: Handle<P>,
app: &App,
description: &mut Vec<String>,
)
pub fn debug_fill_description<P: ScrollPositionWithSingleContextLeaf>( this: Handle<P>, app: &App, description: &mut Vec<String>, )
Trait Implementations§
Source§impl ChangeNotifier for ScrollPositionWithSingleContext
impl ChangeNotifier for ScrollPositionWithSingleContext
fn change_notifier_data(&self) -> &ChangeNotifierData
fn change_notifier_data_mut(&mut self) -> &mut ChangeNotifierData
Source§fn will_add_listener(self: Handle<Self>, app: &mut App)
fn will_add_listener(self: Handle<Self>, app: &mut App)
addListener that
work before super.addListener go here.Source§fn did_remove_listener(self: Handle<Self>, app: &mut App)
fn did_remove_listener(self: Handle<Self>, app: &mut App)
removeListener that
work after super.removeListener go here.Source§impl ScrollActivityDelegate for ScrollPositionWithSingleContext
impl ScrollActivityDelegate for ScrollPositionWithSingleContext
Source§fn axis_direction(self: Handle<Self>, app: &App) -> AxisDirection
fn axis_direction(self: Handle<Self>, app: &App) -> AxisDirection
Source§fn set_pixels(self: Handle<Self>, app: &mut App, pixels: f64) -> f64
fn set_pixels(self: Handle<Self>, app: &mut App, pixels: f64) -> f64
Source§fn apply_user_offset(self: Handle<Self>, app: &mut App, delta: f64)
fn apply_user_offset(self: Handle<Self>, app: &mut App, delta: f64)
Source§fn go_idle(self: Handle<Self>, app: &mut App)
fn go_idle(self: Handle<Self>, app: &mut App)
Source§fn go_ballistic(self: Handle<Self>, app: &mut App, velocity: f64)
fn go_ballistic(self: Handle<Self>, app: &mut App, velocity: f64)
Source§fn as_scroll_activity_delegate(self: Handle<Self>) -> AnyScrollActivityDelegate
fn as_scroll_activity_delegate(self: Handle<Self>) -> AnyScrollActivityDelegate
AnyScrollActivityDelegate — what to pass where a Dart
API takes a ScrollActivityDelegate.Source§impl ScrollPosition for ScrollPositionWithSingleContext
impl ScrollPosition for ScrollPositionWithSingleContext
Source§fn scroll_position_data(self: Handle<Self>, app: &App) -> &ScrollPositionData
fn scroll_position_data(self: Handle<Self>, app: &App) -> &ScrollPositionData
Source§fn scroll_position_data_mut(
self: Handle<Self>,
app: &mut App,
) -> &mut ScrollPositionData
fn scroll_position_data_mut( self: Handle<Self>, app: &mut App, ) -> &mut ScrollPositionData
scroll_position_data.Source§fn axis_direction(self: Handle<Self>, app: &App) -> AxisDirection
fn axis_direction(self: Handle<Self>, app: &App) -> AxisDirection
ScrollMetrics.axisDirection.Source§fn absorb(self: Handle<Self>, app: &mut App, other: AnyScrollPosition)
fn absorb(self: Handle<Self>, app: &mut App, other: AnyScrollPosition)
ScrollPosition. Read moreSource§fn apply_new_dimensions(self: Handle<Self>, app: &mut App)
fn apply_new_dimensions(self: Handle<Self>, app: &mut App)
Source§fn begin_activity(
self: Handle<Self>,
app: &mut App,
new_activity: Option<ScrollActivityRef>,
)
fn begin_activity( self: Handle<Self>, app: &mut App, new_activity: Option<ScrollActivityRef>, )
Source§fn pointer_scroll(self: Handle<Self>, app: &mut App, delta: f64)
fn pointer_scroll(self: Handle<Self>, app: &mut App, delta: f64)
Source§fn jump_to_without_settling(self: Handle<Self>, app: &mut App, value: f64)
fn jump_to_without_settling(self: Handle<Self>, app: &mut App, value: f64)
This method bypasses scroll activity management and can cause inconsistent layouts or scrolling behavior. Use jump_to or a custom ScrollPosition instead.
ViewportOffset::jump_to or a custom ScrollPosition instead.Source§fn hold(
self: Handle<Self>,
app: &mut App,
hold_cancel_callback: Listener,
) -> Rc<dyn ScrollHoldController>
fn hold( self: Handle<Self>, app: &mut App, hold_cancel_callback: Listener, ) -> Rc<dyn ScrollHoldController>
crate::HoldScrollActivity.Source§fn drag(
self: Handle<Self>,
app: &mut App,
details: DragStartDetails,
drag_cancel_callback: Listener,
) -> Rc<dyn Drag>
fn drag( self: Handle<Self>, app: &mut App, details: DragStartDetails, drag_cancel_callback: Listener, ) -> Rc<dyn Drag>
DragStartDetails. Read moreSource§fn physics(self: Handle<Self>, app: &App) -> ScrollPhysicsRef
fn physics(self: Handle<Self>, app: &App) -> ScrollPhysicsRef
Source§fn context(self: Handle<Self>, app: &App) -> Rc<dyn ScrollContext>
fn context(self: Handle<Self>, app: &App) -> Rc<dyn ScrollContext>
Source§fn keep_scroll_offset(self: Handle<Self>, app: &App) -> bool
fn keep_scroll_offset(self: Handle<Self>, app: &App) -> bool
PageStorage and restore it if
this scroll position’s scrollable is recreated. Read moreSource§fn have_dimensions(self: Handle<Self>, app: &App) -> bool
fn have_dimensions(self: Handle<Self>, app: &App) -> bool
viewport_dimension,
min_scroll_extent,
max_scroll_extent, out_of_range,
and at_edge are available. Read moreSource§fn should_ignore_pointer(self: Handle<Self>, app: &App) -> bool
fn should_ignore_pointer(self: Handle<Self>, app: &App) -> bool
Source§fn save_scroll_offset(self: Handle<Self>, app: &mut App)
fn save_scroll_offset(self: Handle<Self>, app: &mut App)
Source§fn restore_scroll_offset(self: Handle<Self>, app: &mut App)
fn restore_scroll_offset(self: Handle<Self>, app: &mut App)
ScrollPosition is created, to restore the scroll
offset if possible. Read moreSource§fn save_offset(self: Handle<Self>, app: &mut App)
fn save_offset(self: Handle<Self>, app: &mut App)
Source§fn apply_boundary_conditions(
self: Handle<Self>,
app: &mut App,
value: f64,
) -> f64
fn apply_boundary_conditions( self: Handle<Self>, app: &mut App, value: f64, ) -> f64
Source§fn correct_for_new_dimensions(
self: Handle<Self>,
app: &mut App,
old_position: &dyn ScrollMetrics,
new_position: &dyn ScrollMetrics,
) -> bool
fn correct_for_new_dimensions( self: Handle<Self>, app: &mut App, old_position: &dyn ScrollMetrics, new_position: &dyn ScrollMetrics, ) -> bool
Source§fn ensure_visible(
self: Handle<Self>,
app: &mut App,
object: AnyRenderObject,
alignment: f64,
duration: Duration,
curve: Rc<dyn Curve>,
alignment_policy: ScrollPositionAlignmentPolicy,
target_render_object: Option<AnyRenderObject>,
) -> CompleterFuture<()> ⓘ
fn ensure_visible( self: Handle<Self>, app: &mut App, object: AnyRenderObject, alignment: f64, duration: Duration, curve: Rc<dyn Curve>, alignment_policy: ScrollPositionAlignmentPolicy, target_render_object: Option<AnyRenderObject>, ) -> CompleterFuture<()> ⓘ
Source§fn is_scrolling_notifier(
self: Handle<Self>,
app: &App,
) -> Handle<ValueNotifier<bool>>
fn is_scrolling_notifier( self: Handle<Self>, app: &App, ) -> Handle<ValueNotifier<bool>>
Source§fn activity(self: Handle<Self>, app: &App) -> Option<AnyScrollActivity>
fn activity(self: Handle<Self>, app: &App) -> Option<AnyScrollActivity>
AnyScrollActivity. Read moreSource§fn did_start_scroll(self: Handle<Self>, app: &mut App)
fn did_start_scroll(self: Handle<Self>, app: &mut App)
begin_activity to report when an activity has
started.Source§fn did_update_scroll_position_by(self: Handle<Self>, app: &mut App, delta: f64)
fn did_update_scroll_position_by(self: Handle<Self>, app: &mut App, delta: f64)
set_pixels to report a change to the
pixels position.Source§fn did_end_scroll(self: Handle<Self>, app: &mut App)
fn did_end_scroll(self: Handle<Self>, app: &mut App)
begin_activity to report when an activity has
ended. Read moreSource§fn did_overscroll_by(self: Handle<Self>, app: &mut App, value: f64)
fn did_overscroll_by(self: Handle<Self>, app: &mut App, value: f64)
set_pixels to report overscroll when an attempt is made
to change the pixels position. Overscroll is the amount of
change that was not applied to the pixels value.Source§fn did_update_scroll_direction(
self: Handle<Self>,
app: &mut App,
direction: ScrollDirection,
)
fn did_update_scroll_direction( self: Handle<Self>, app: &mut App, direction: ScrollDirection, )
ViewportOffset::user_scroll_direction has
changed. Read moreSource§fn did_update_scroll_metrics(self: Handle<Self>, app: &mut App)
fn did_update_scroll_metrics(self: Handle<Self>, app: &mut App)
ScrollMetrics have changed.Source§fn recommend_deferred_loading(
self: Handle<Self>,
app: &mut App,
context: BuildContext,
) -> bool
fn recommend_deferred_loading( self: Handle<Self>, app: &mut App, context: BuildContext, ) -> bool
Source§fn to_string(self: Handle<Self>, app: &App) -> String
fn to_string(self: Handle<Self>, app: &App) -> String
toString, which reads the arena and so cannot be Debug.Source§fn as_scroll_position(self: Handle<Self>) -> AnyScrollPosition
fn as_scroll_position(self: Handle<Self>) -> AnyScrollPosition
AnyScrollPosition — what to pass where a Dart API takes
a ScrollPosition.Source§impl ScrollPositionWithSingleContextLeaf for ScrollPositionWithSingleContext
impl ScrollPositionWithSingleContextLeaf for ScrollPositionWithSingleContext
Source§fn single_context_data(
self: Handle<Self>,
app: &App,
) -> &ScrollPositionWithSingleContextData
fn single_context_data( self: Handle<Self>, app: &App, ) -> &ScrollPositionWithSingleContextData
ScrollPositionWithSingleContext fields, held under the field single_context
(scroll_position_with_single_context_accessors!).Source§fn single_context_data_mut(
self: Handle<Self>,
app: &mut App,
) -> &mut ScrollPositionWithSingleContextData
fn single_context_data_mut( self: Handle<Self>, app: &mut App, ) -> &mut ScrollPositionWithSingleContextData
single_context_data.Source§fn axis_direction(self: Handle<Self>, app: &App) -> AxisDirection
fn axis_direction(self: Handle<Self>, app: &App) -> AxisDirection
ScrollPositionWithSingleContext.axisDirection.Source§fn set_pixels(self: Handle<Self>, app: &mut App, new_pixels: f64) -> f64
fn set_pixels(self: Handle<Self>, app: &mut App, new_pixels: f64) -> f64
ScrollPositionWithSingleContext.setPixels.Source§fn absorb(self: Handle<Self>, app: &mut App, other: AnyScrollPosition)
fn absorb(self: Handle<Self>, app: &mut App, other: AnyScrollPosition)
ScrollPositionWithSingleContext.absorb.Source§fn apply_new_dimensions(self: Handle<Self>, app: &mut App)
fn apply_new_dimensions(self: Handle<Self>, app: &mut App)
ScrollPositionWithSingleContext.applyNewDimensions.Source§fn begin_activity(
self: Handle<Self>,
app: &mut App,
new_activity: Option<ScrollActivityRef>,
)
fn begin_activity( self: Handle<Self>, app: &mut App, new_activity: Option<ScrollActivityRef>, )
ScrollPositionWithSingleContext.beginActivity.Source§fn apply_user_offset(self: Handle<Self>, app: &mut App, delta: f64)
fn apply_user_offset(self: Handle<Self>, app: &mut App, delta: f64)
ScrollPositionWithSingleContext.applyUserOffset.Source§fn go_ballistic(self: Handle<Self>, app: &mut App, velocity: f64)
fn go_ballistic(self: Handle<Self>, app: &mut App, velocity: f64)
ViewportOffset::pixels position,
starting at a particular velocity. Read moreSource§fn user_scroll_direction(self: Handle<Self>, app: &App) -> ScrollDirection
fn user_scroll_direction(self: Handle<Self>, app: &App) -> ScrollDirection
ScrollPositionWithSingleContext.userScrollDirection.Source§fn update_user_scroll_direction(
self: Handle<Self>,
app: &mut App,
value: ScrollDirection,
)
fn update_user_scroll_direction( self: Handle<Self>, app: &mut App, value: ScrollDirection, )
ViewportOffset::user_scroll_direction to the given value. Read moreSource§fn animate_to(
self: Handle<Self>,
app: &mut App,
to: f64,
duration: Duration,
curve: Rc<dyn Curve>,
) -> CompleterFuture<()> ⓘ
fn animate_to( self: Handle<Self>, app: &mut App, to: f64, duration: Duration, curve: Rc<dyn Curve>, ) -> CompleterFuture<()> ⓘ
ScrollPositionWithSingleContext.animateTo.Source§fn jump_to(self: Handle<Self>, app: &mut App, value: f64)
fn jump_to(self: Handle<Self>, app: &mut App, value: f64)
ScrollPositionWithSingleContext.jumpTo.Source§fn pointer_scroll(self: Handle<Self>, app: &mut App, delta: f64)
fn pointer_scroll(self: Handle<Self>, app: &mut App, delta: f64)
ScrollPositionWithSingleContext.pointerScroll.Source§fn jump_to_without_settling(self: Handle<Self>, app: &mut App, value: f64)
fn jump_to_without_settling(self: Handle<Self>, app: &mut App, value: f64)
ScrollPositionWithSingleContext.jumpToWithoutSettling.Source§fn hold(
self: Handle<Self>,
app: &mut App,
hold_cancel_callback: Listener,
) -> Rc<dyn ScrollHoldController>
fn hold( self: Handle<Self>, app: &mut App, hold_cancel_callback: Listener, ) -> Rc<dyn ScrollHoldController>
ScrollPositionWithSingleContext.hold.Source§impl ViewportOffset for ScrollPositionWithSingleContext
impl ViewportOffset for ScrollPositionWithSingleContext
Source§fn pixels(self: Handle<Self>, app: &App) -> f64
fn pixels(self: Handle<Self>, app: &App) -> f64
Source§fn has_pixels(self: Handle<Self>, app: &App) -> bool
fn has_pixels(self: Handle<Self>, app: &App) -> bool
pixels property is available.Source§fn apply_viewport_dimension(
self: Handle<Self>,
app: &mut App,
viewport_dimension: f64,
) -> bool
fn apply_viewport_dimension( self: Handle<Self>, app: &mut App, viewport_dimension: f64, ) -> bool
Source§fn apply_content_dimensions(
self: Handle<Self>,
app: &mut App,
min_scroll_extent: f64,
max_scroll_extent: f64,
) -> bool
fn apply_content_dimensions( self: Handle<Self>, app: &mut App, min_scroll_extent: f64, max_scroll_extent: f64, ) -> bool
Source§fn correct_by(self: Handle<Self>, app: &mut App, correction: f64)
fn correct_by(self: Handle<Self>, app: &mut App, correction: f64)
Source§fn animate_to(
self: Handle<Self>,
app: &mut App,
to: f64,
duration: Duration,
curve: Rc<dyn Curve>,
) -> CompleterFuture<()> ⓘ
fn animate_to( self: Handle<Self>, app: &mut App, to: f64, duration: Duration, curve: Rc<dyn Curve>, ) -> CompleterFuture<()> ⓘ
Source§fn move_to(
self: Handle<Self>,
app: &mut App,
to: f64,
duration: Option<Duration>,
curve: Option<Rc<dyn Curve>>,
clamp: Option<bool>,
) -> CompleterFuture<()> ⓘ
fn move_to( self: Handle<Self>, app: &mut App, to: f64, duration: Option<Duration>, curve: Option<Rc<dyn Curve>>, clamp: Option<bool>, ) -> CompleterFuture<()> ⓘ
Source§fn user_scroll_direction(self: Handle<Self>, app: &App) -> ScrollDirection
fn user_scroll_direction(self: Handle<Self>, app: &App) -> ScrollDirection
Source§fn allow_implicit_scrolling(self: Handle<Self>, app: &App) -> bool
fn allow_implicit_scrolling(self: Handle<Self>, app: &App) -> bool
pixels implicitly to respond
to a call to crate::RenderObject::show_on_screen. Read moreSource§fn as_viewport_offset(self: Handle<Self>) -> AnyViewportOffset
fn as_viewport_offset(self: Handle<Self>) -> AnyViewportOffset
ViewportOffset handle. Free: the vtable is a const, and the id is
copied.