Skip to main content

ScreenTransitionView

Struct ScreenTransitionView 

Source
pub struct ScreenTransitionView { /* private fields */ }
Expand description

Paints the current screen, and — while a ScreenNav-driven transition is in progress — the previous screen too, each offset by the shared ScreenTransition’s spring-eased enter/exit values (D108/Phase 26 Step 3). Not generic over the app’s route enum: it only needs already-built widgets plus opaque u64 identity keys (ScreenNav::current_key/ previous_key/stack_keys) and the transition handle ScreenNav::transition_handle() returns — the same way ScrollView needs only a ScrollController, not the app’s own types.

§Per-screen persistence (2026-08-01)

Each screen’s subtree is addressed by its incoming_key/outgoing_key through PaintCtx::child_keyed, not positionally — see render_tree.rs’s module doc (“Identity” section) for the full story. Without this, two different screens landing at the same tree position (which they always do here — every screen paints as “the incoming child”) would alias scroll offset, animation state, and everything else sticky onto whatever screen last occupied that position: navigating to a new screen could inherit a stale, out-of-bounds scroll offset (visibly springing back to valid bounds on arrival), and navigating back would find its OWN position reset instead of where it was left. With keys, each screen gets its own permanent slot, reused (state intact, exactly where it was left) whenever that screen becomes current again, and released via valid_keys/prune_keyed_children only once it’s actually popped off the nav stack — mirroring Flutter’s Navigator, which keeps every pushed route’s Element tree alive in its Overlay until popped, not just the current one.

rsc new’s generated app.rs uses this in place of handing the current screen’s widget straight to Scaffold::new(...).

Implementations§

Source§

impl ScreenTransitionView

Source

pub fn new( incoming: impl Widget + 'static, incoming_key: u64, outgoing: Option<BoxedWidget>, outgoing_key: Option<u64>, transition: Arc<Mutex<ScreenTransition>>, valid_keys: Vec<u64>, ) -> Self

Trait Implementations§

Source§

impl Widget for ScreenTransitionView

Source§

fn layout(&self, ctx: &LayoutCtx<'_>) -> Size

Measure under ctx.constraints and return a size within them. Read more
Source§

fn paint(&self, ctx: &mut PaintCtx<'_>)

Record draw commands for ctx.rect. Read more
Source§

fn children(&self) -> Children<'_>

Declare this widget’s children. Drives every default below.
Source§

fn flex_factor(&self) -> f32

Flex weight inside Row/Column. Wrappers are transparent by default.
Source§

fn into_element(self) -> Element
where Self: Sized + 'static,

Wrap this widget in an Element so it can be returned from Component::build().

Auto Trait Implementations§

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<W> FocusApi for W
where W: Widget + Send + Sync + 'static,

Source§

fn focus_node(self, node: FocusNode) -> WithFocus<Self>

Attach a focus node. This enables focus-ring rendering and explicit neighbor wiring.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<W> HeroApi for W
where W: Widget + Send + Sync + 'static,

Source§

fn hero_tag(self, tag: impl Into<String>) -> Hero<Self>

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<W> OverlayApi for W
where W: Widget + Send + Sync + 'static,

Source§

fn dropdown( self, open: Atom<bool>, content: impl Fn() -> BoxedWidget + Send + Sync + 'static, ) -> WithOverlay<Self>

Source§

fn sheet( self, open: Atom<bool>, content: impl Fn() -> BoxedWidget + Send + Sync + 'static, ) -> WithOverlay<Self>

Source§

fn dialog( self, open: Atom<bool>, content: impl Fn() -> BoxedWidget + Send + Sync + 'static, ) -> WithOverlay<Self>

Source§

fn rich_tooltip( self, content: impl Fn() -> BoxedWidget + Send + Sync + 'static, ) -> WithOverlay<Self>

Source§

fn toast( self, open: Atom<bool>, content: impl Fn() -> BoxedWidget + Send + Sync + 'static, ) -> WithOverlay<Self>

Source§

impl<W> PressApi for W
where W: Widget + Send + Sync + 'static,

Source§

fn on_press(self, f: impl Fn() + Send + Sync + 'static) -> Pressable<Self>

Source§

fn on_long_press( self, f: impl Fn() + Send + Sync + 'static, ) -> LongPressable<Self>

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<W> WidgetExt for W
where W: Widget + 'static,

Source§

fn tooltip(self, label: impl Into<String>) -> Tooltip

Show label while the pointer hovers this widget.