pub struct BallisticScrollActivity { /* private fields */ }Expand description
The activity a scroll view performs after being set into motion.
For example, a BallisticScrollActivity is used when the user
lifts their finger off the screen after a DragScrollActivity,
to continue the scrolling motion starting from the current velocity.
BallisticScrollActivity is also used to restore a scroll view to a valid
scroll offset when the geometry of the scroll view changes. In these
situations, the Simulation typically starts with a zero velocity.
The scrolling will be driven by the given Simulation. If a
BallisticScrollActivity is in progress when the scroll metrics change,
then the activity will be replaced with a new ballistic activity starting
from the current velocity (see crate::ScrollPhysics::create_ballistic_simulation).
To ensure the user perceives smooth motion across such a change,
the simulation should typically be the result
of crate::ScrollPhysics::create_ballistic_simulation
for the scroll physics of the scroll view.
See also:
DrivenScrollActivity, which drives a scroll view through a given animation, without resetting to a ballistic simulation when scroll metrics change.
Implementations§
Source§impl BallisticScrollActivity
impl BallisticScrollActivity
Sourcepub fn new(
app: &mut App,
delegate: AnyScrollActivityDelegate,
simulation: Box<dyn Simulation>,
vsync: impl TickerProvider,
should_ignore_pointer: bool,
) -> Ref<BallisticScrollActivity>
pub fn new( app: &mut App, delegate: AnyScrollActivityDelegate, simulation: Box<dyn Simulation>, vsync: impl TickerProvider, should_ignore_pointer: bool, ) -> Ref<BallisticScrollActivity>
Creates an activity that sets into motion a scroll view.
The simulation should typically be the result
of crate::ScrollPhysics::create_ballistic_simulation
for the scroll physics of the scroll view.
Sourcepub fn apply_move_to(self: Handle<Self>, app: &mut App, value: f64) -> bool
pub fn apply_move_to(self: Handle<Self>, app: &mut App, value: f64) -> bool
Move the position to the given location.
If the new position was fully applied, returns true. If there was any overflow, returns false.
The default implementation calls ScrollActivityDelegate::set_pixels
and returns true if the overflow was zero.
Trait Implementations§
Source§impl ScrollActivity for BallisticScrollActivity
impl ScrollActivity for BallisticScrollActivity
Source§fn scroll_activity_data(self: Handle<Self>, app: &App) -> &ScrollActivityData
fn scroll_activity_data(self: Handle<Self>, app: &App) -> &ScrollActivityData
Source§fn scroll_activity_data_mut(
self: Handle<Self>,
app: &mut App,
) -> &mut ScrollActivityData
fn scroll_activity_data_mut( self: Handle<Self>, app: &mut App, ) -> &mut ScrollActivityData
scroll_activity_data.Source§fn reset_activity(self: Handle<Self>, app: &mut App)
fn reset_activity(self: Handle<Self>, app: &mut App)
ScrollActivityDelegate when it has changed type (for
example, when changing from an Android-style scroll position to an
iOS-style scroll position). If this activity can differ between the two
modes, then it should tell the position to restart that activity
appropriately. Read moreSource§fn apply_new_dimensions(self: Handle<Self>, app: &mut App)
fn apply_new_dimensions(self: Handle<Self>, app: &mut App)
Source§fn dispatch_overscroll_notification(
self: Handle<Self>,
app: &mut App,
metrics: Rc<dyn ScrollMetrics>,
context: BuildContext,
overscroll: f64,
)
fn dispatch_overscroll_notification( self: Handle<Self>, app: &mut App, metrics: Rc<dyn ScrollMetrics>, context: BuildContext, overscroll: f64, )
OverscrollNotification with the given metrics and overscroll.Source§fn should_ignore_pointer(self: Handle<Self>, app: &App) -> bool
fn should_ignore_pointer(self: Handle<Self>, app: &App) -> bool
Source§fn is_scrolling(self: Handle<Self>, _app: &App) -> bool
fn is_scrolling(self: Handle<Self>, _app: &App) -> bool
Source§fn velocity(self: Handle<Self>, app: &mut App) -> f64
fn velocity(self: Handle<Self>, app: &mut App) -> f64
Source§fn dispose(self: Handle<Self>, app: &mut App)
fn dispose(self: Handle<Self>, app: &mut App)
Source§fn describe(self: Handle<Self>, app: &App) -> String
fn describe(self: Handle<Self>, app: &App) -> String
toString, which reads the arena and so cannot be std::fmt::Debug.Source§fn delegate(self: Handle<Self>, app: &App) -> AnyScrollActivityDelegate
fn delegate(self: Handle<Self>, app: &App) -> AnyScrollActivityDelegate
Source§fn is_disposed(self: Handle<Self>, app: &App) -> bool
fn is_disposed(self: Handle<Self>, app: &App) -> bool
dispose has run; Dart’s _isDisposed.Source§fn update_delegate(
self: Handle<Self>,
app: &mut App,
value: AnyScrollActivityDelegate,
)
fn update_delegate( self: Handle<Self>, app: &mut App, value: AnyScrollActivityDelegate, )
ScrollActivityDelegate. Read moreSource§fn dispatch_scroll_start_notification(
self: Handle<Self>,
app: &mut App,
metrics: Rc<dyn ScrollMetrics>,
context: Option<BuildContext>,
)
fn dispatch_scroll_start_notification( self: Handle<Self>, app: &mut App, metrics: Rc<dyn ScrollMetrics>, context: Option<BuildContext>, )
ScrollStartNotification with the given metrics.Source§fn dispatch_scroll_update_notification(
self: Handle<Self>,
app: &mut App,
metrics: Rc<dyn ScrollMetrics>,
context: BuildContext,
scroll_delta: f64,
)
fn dispatch_scroll_update_notification( self: Handle<Self>, app: &mut App, metrics: Rc<dyn ScrollMetrics>, context: BuildContext, scroll_delta: f64, )
ScrollUpdateNotification with the given metrics and scroll delta.Source§fn dispatch_scroll_end_notification(
self: Handle<Self>,
app: &mut App,
metrics: Rc<dyn ScrollMetrics>,
context: BuildContext,
)
fn dispatch_scroll_end_notification( self: Handle<Self>, app: &mut App, metrics: Rc<dyn ScrollMetrics>, context: BuildContext, )
ScrollEndNotification with the given metrics and overscroll.Source§fn as_hold_controller(
self: Handle<Self>,
) -> Option<Rc<dyn ScrollHoldController>>
fn as_hold_controller( self: Handle<Self>, ) -> Option<Rc<dyn ScrollHoldController>>
activity is ScrollHoldController; None — the default — for every activity
but HoldScrollActivity.Source§fn as_activity(self: Handle<Self>) -> AnyScrollActivity
fn as_activity(self: Handle<Self>) -> AnyScrollActivity
AnyScrollActivity — what to pass where a Dart API takes
a ScrollActivity.