pub struct SizeTransition {
pub key: Option<KeyRef>,
pub axis: Axis,
pub size_factor: AnimationRef<f64>,
pub axis_alignment: Option<f64>,
pub alignment: Option<AlignmentGeometry>,
pub fixed_cross_axis_size_factor: Option<f64>,
pub child: Option<WidgetRef>,
}Expand description
Animates its own size and clips and aligns its child.
SizeTransition acts as a ClipRect that animates either its width or its
height, depending upon the value of axis. The alignment of the child is
specified by the alignment.
Like most widgets, SizeTransition will conform to the constraints it is
given, so be sure to put it in a context where it can change size. For
instance, if you place it into a Container with a fixed size, then the
SizeTransition will not be able to change size, and will appear to do
nothing.
See also:
AnimatedCrossFade, for a widget that automatically animates between the sizes of two children, fading between them.ScaleTransition, a widget that scales the size of the child instead of clipping it.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>See Widget::key.
axis: AxisAxis::Horizontal if size_factor modifies the width,
otherwise Axis::Vertical.
size_factor: AnimationRef<f64>The animation that controls the (clipped) size of the child.
The width or height (depending on the axis value) of this widget will
be its intrinsic width or height multiplied by
size_factor’s value at the current point in the animation.
If the value of size_factor is less than one, the child will be
clipped in the appropriate axis.
axis_alignment: Option<f64>Use alignment instead. This property provides full control over both axes, which is an improvement over the old axisAlignment. This feature was deprecated after v3.41.0-1.0.pre.
Describes how to align the child along the axis that
size_factor is modifying.
A value of -1.0 indicates the top when axis is Axis::Vertical, and
the start when axis is Axis::Horizontal. The start is on the left
when the text direction in effect is TextDirection::Ltr and on the right when it
is TextDirection::Rtl.
A value of 1.0 indicates the bottom or end, depending upon the axis.
A value of 0.0 (the default) indicates the center for either axis
value.
This property has been deprecated and superseded by
alignment. Existing usages can be migrated as follows:
- If
axisisAxis::Horizontal, replace withAlignmentGeometry::xy(axis_alignment.unwrap_or(0.0), -1.0). - If
axisisAxis::Vertical, replace withAlignmentGeometry::xy(-1.0, axis_alignment.unwrap_or(0.0)).
alignment: Option<AlignmentGeometry>The alignment of the child within the parent during the transition.
fixed_cross_axis_size_factor: Option<f64>The factor by which to multiply the cross axis size of the child.
If the value of fixed_cross_axis_size_factor
is less than one, the child will be clipped along the appropriate axis.
If None (the default), the cross axis size is as large as the parent.
child: Option<WidgetRef>The widget below this widget in the tree.
Implementations§
Source§impl SizeTransition
impl SizeTransition
Sourcepub fn new(size_factor: AnimationRef<f64>) -> SizeTransition
pub fn new(size_factor: AnimationRef<f64>) -> SizeTransition
Creates a size transition.
The axis defaults to Axis::Vertical. The
alignment defaults to the center of the modified axis, which
centers the child within the parent during the transition.
Sourcepub fn key(self, key: KeyRef) -> SizeTransition
pub fn key(self, key: KeyRef) -> SizeTransition
Dart SizeTransition(key:).
Sourcepub fn axis(self, axis: Axis) -> SizeTransition
pub fn axis(self, axis: Axis) -> SizeTransition
Dart SizeTransition(axis:).
Sourcepub fn axis_alignment(self, axis_alignment: f64) -> SizeTransition
👎Deprecated: Use alignment instead. This property provides full control over both axes, which is an improvement over the old axisAlignment. This feature was deprecated after v3.41.0-1.0.pre.
pub fn axis_alignment(self, axis_alignment: f64) -> SizeTransition
Use alignment instead. This property provides full control over both axes, which is an improvement over the old axisAlignment. This feature was deprecated after v3.41.0-1.0.pre.
Dart SizeTransition(axisAlignment:).
Sourcepub fn alignment(self, alignment: AlignmentGeometry) -> SizeTransition
pub fn alignment(self, alignment: AlignmentGeometry) -> SizeTransition
Dart SizeTransition(alignment:).
Sourcepub fn fixed_cross_axis_size_factor(
self,
fixed_cross_axis_size_factor: f64,
) -> SizeTransition
pub fn fixed_cross_axis_size_factor( self, fixed_cross_axis_size_factor: f64, ) -> SizeTransition
Dart SizeTransition(fixedCrossAxisSizeFactor:).
Sourcepub fn child<K>(self, child: impl IntoWidget<K>) -> SizeTransition
pub fn child<K>(self, child: impl IntoWidget<K>) -> SizeTransition
Dart SizeTransition(child:).
Trait Implementations§
Source§impl AnimatedWidget for SizeTransition
impl AnimatedWidget for SizeTransition
Source§fn listenable(&self) -> Rc<dyn Listenable>
fn listenable(&self) -> Rc<dyn Listenable>
Listenable to which this widget is listening. Read moreSource§fn build(&self, app: &mut App, _context: BuildContext) -> WidgetRef
fn build(&self, app: &mut App, _context: BuildContext) -> WidgetRef
Source§fn debug_fill_properties(&self, properties: &mut DiagnosticPropertiesBuilder)
fn debug_fill_properties(&self, properties: &mut DiagnosticPropertiesBuilder)
AnimatedWidget.debugFillProperties, which a subclass’s own body calls where
Dart writes super.Auto Trait Implementations§
impl !RefUnwindSafe for SizeTransition
impl !Send for SizeTransition
impl !Sync for SizeTransition
impl !UnwindSafe for SizeTransition
impl Forget for SizeTransition
impl Freeze for SizeTransitionwhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
NonZero<u32>: Freeze,
&'static AnimationVTable<f64>: 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 SizeTransition
impl Unpin for SizeTransition
impl UnsafeUnpin for SizeTransitionwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
NonZeroU32Inner: UnsafeUnpin,
&'static AnimationVTable<f64>: 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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<W> IntoWidget<AnimatedKind> for Wwhere
W: AnimatedWidget,
impl<W> IntoWidget<AnimatedKind> for Wwhere
W: AnimatedWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.