Skip to main content

default_physics

Function default_physics 

Source
pub fn default_physics() -> Rc<dyn ScrollPhysics>
Expand description

The physics a scroll surface installs when the app names none: Android → parity::Clamping (paired with effect::OverscrollEffect::Stretch, the Material-3-Expressive edge stretch), everywhere else → parity::Bouncing at parity::DecelerationRate::Normal (paired with effect::OverscrollEffect::Translate).

rubber_band::RubberBand — the feel both surfaces used to hard-code — is no longer any platform’s default; it stays reachable as an explicit .physics(RubberBand::new()) opt-in.

Rc<dyn ScrollPhysics>, matching what the two scroll widgets store, so installing the default is one allocation and every later (re)install is an Rc::clone.

Selection is a cfg! expression, not a #[cfg] block: both arms type-check on every host, so a change here cannot compile on desktop and break the Android build.