Skip to main content

SlideTransition

Struct SlideTransition 

Source
pub struct SlideTransition {
    pub key: Option<KeyRef>,
    pub position: AnimationRef<Offset>,
    pub text_direction: Option<TextDirection>,
    pub transform_hit_tests: bool,
    pub child: Option<WidgetRef>,
}
Expand description

Animates the position of a widget relative to its normal position.

The translation is expressed as an Offset scaled to the child’s size. For example, an Offset with a dx of 0.25 will result in a horizontal translation of one quarter the width of the child.

By default, the offsets are applied in the coordinate system of the canvas (so positive x offsets move the child towards the right). If a text_direction is provided, then the offsets are applied in the reading direction, so in right-to-left text, positive x offsets move towards the left, and in left-to-right text, positive x offsets move towards the right.

See also:

  • AlignTransition, an animated version of an Align that animates its Align::alignment property.
  • PositionedTransition, a widget that animates its child from a start position to an end position over the lifetime of the animation.
  • RelativePositionedTransition, a widget that transitions its child’s position based on the value of a rectangle relative to a bounding box.

Fields§

§key: Option<KeyRef>§position: AnimationRef<Offset>

The animation that controls the position of the child.

If the current value of the position animation is (dx, dy), the child will be translated horizontally by width * dx and vertically by height * dy, after applying the text_direction if available.

§text_direction: Option<TextDirection>

The direction to use for the x offset described by the position.

If text_direction is None, the x offset is applied in the coordinate system of the canvas (so positive x offsets move the child towards the right).

If text_direction is TextDirection::Rtl, the x offset is applied in the reading direction such that x offsets move the child towards the left.

If text_direction is TextDirection::Ltr, the x offset is applied in the reading direction such that x offsets move the child towards the right.

§transform_hit_tests: bool

Whether hit testing should be affected by the slide animation.

If false, hit testing will proceed as if the child was not translated at all. Setting this value to false is useful for fast animations where you expect the user to commonly interact with the child widget in its final location and you want the user to benefit from “muscle memory”.

§child: Option<WidgetRef>

The widget below this widget in the tree.

Implementations§

Source§

impl SlideTransition

Source

pub fn new(position: AnimationRef<Offset>) -> SlideTransition

Creates a fractional translation transition.

Source

pub fn key(self, key: KeyRef) -> SlideTransition

Dart SlideTransition(key:).

Source

pub fn text_direction(self, text_direction: TextDirection) -> SlideTransition

Dart SlideTransition(textDirection:).

Source

pub fn transform_hit_tests(self, transform_hit_tests: bool) -> SlideTransition

Dart SlideTransition(transformHitTests:).

Source

pub fn child<K>(self, child: impl IntoWidget<K>) -> SlideTransition

Dart SlideTransition(child:).

Trait Implementations§

Source§

impl AnimatedWidget for SlideTransition

Source§

fn key(&self) -> Option<&KeyRef>

Source§

fn listenable(&self) -> Rc<dyn Listenable>

The Listenable to which this widget is listening. Read more
Source§

fn build(&self, app: &mut App, _context: BuildContext) -> WidgetRef

Override this method to build widgets that depend on the state of the listenable (e.g., the current value of the animation).
Source§

fn debug_fill_properties(&self, properties: &mut DiagnosticPropertiesBuilder)

Dart’s AnimatedWidget.debugFillProperties, which a subclass’s own body calls where Dart writes super.
Source§

impl Debug for SlideTransition

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for SlideTransition

§

impl !Send for SlideTransition

§

impl !Sync for SlideTransition

§

impl !UnwindSafe for SlideTransition

§

impl Forget for SlideTransition

§

impl Freeze for SlideTransition
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze, NonZero<u32>: Freeze, &'static AnimationVTable<Offset>: Freeze, *const RcInner<Keep> is !null: Freeze, PhantomData<RcInner<Keep>>: Freeze, *const RcInner<dyn Widget> is !null: Freeze, PhantomData<RcInner<dyn Widget>>: Freeze,

§

impl Move for SlideTransition

§

impl Unpin for SlideTransition
where Rc<dyn Key>: Unpin, NonZero<u32>: Unpin, &'static AnimationVTable<Offset>: Unpin, Rc<Keep>: Unpin, Rc<dyn Widget>: Unpin,

§

impl UnsafeUnpin for SlideTransition
where *const RcInner<dyn Key> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Key>>: UnsafeUnpin, NonZeroU32Inner: UnsafeUnpin, &'static AnimationVTable<Offset>: UnsafeUnpin, *const RcInner<Keep> is !null: UnsafeUnpin, PhantomData<RcInner<Keep>>: UnsafeUnpin, *const RcInner<dyn Widget> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Widget>>: UnsafeUnpin,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoWidget<AnimatedKind> for W
where W: AnimatedWidget,

Source§

fn into_widget(self) -> Rc<dyn Widget>

The widget as a tree node, made where this is called: its creation_location.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>