pub struct AnimatedPositioned {
pub child: WidgetRef,
pub left: Option<f64>,
pub top: Option<f64>,
pub right: Option<f64>,
pub bottom: Option<f64>,
pub width: Option<f64>,
pub height: Option<f64>,
/* private fields */
}Expand description
Animated version of Positioned which automatically transitions the child’s
position over a given duration whenever the given position changes.
Only works if it’s the child of a Stack.
This widget is a good choice if the size of the child would end up
changing as a result of this animation. If the size is intended to remain
the same, with only the position changing over time, then consider
SlideTransition instead. SlideTransition only triggers a repaint each
frame of the animation, whereas AnimatedPositioned will trigger a relayout
as well.
For the animation, you can choose a curve as
well as a duration and the widget will
automatically animate to the new target position. If you require more control over the
animation (e.g. if you want to stop it mid-animation), consider using a
PositionedTransition instead.
See also:
AnimatedPositionedDirectional, which adapts to the ambientDirectionality(the same as this widget, but for animatingPositionedDirectional).
Fields§
§child: WidgetRefThe widget below this widget in the tree.
left: Option<f64>The offset of the child’s left edge from the left of the stack.
top: Option<f64>The offset of the child’s top edge from the top of the stack.
right: Option<f64>The offset of the child’s right edge from the right of the stack.
bottom: Option<f64>The offset of the child’s bottom edge from the bottom of the stack.
width: Option<f64>The child’s width.
Only two out of the three horizontal values (left,
right, width) can be set. The third must be None.
height: Option<f64>The child’s height.
Only two out of the three vertical values (top,
bottom, height) can be set. The third must be
None.
Implementations§
Source§impl AnimatedPositioned
impl AnimatedPositioned
Sourcepub fn new<K>(
child: impl IntoWidget<K>,
duration: Duration,
) -> AnimatedPositioned
pub fn new<K>( child: impl IntoWidget<K>, duration: Duration, ) -> AnimatedPositioned
Sourcepub fn from_rect<K>(
child: impl IntoWidget<K>,
rect: Rect,
duration: Duration,
) -> AnimatedPositioned
pub fn from_rect<K>( child: impl IntoWidget<K>, rect: Rect, duration: Duration, ) -> AnimatedPositioned
Creates a widget that animates the rectangle it occupies implicitly.
Sourcepub fn left(self, left: f64) -> AnimatedPositioned
pub fn left(self, left: f64) -> AnimatedPositioned
Dart AnimatedPositioned(left:).
Sourcepub fn top(self, top: f64) -> AnimatedPositioned
pub fn top(self, top: f64) -> AnimatedPositioned
Dart AnimatedPositioned(top:).
Sourcepub fn right(self, right: f64) -> AnimatedPositioned
pub fn right(self, right: f64) -> AnimatedPositioned
Dart AnimatedPositioned(right:).
Sourcepub fn bottom(self, bottom: f64) -> AnimatedPositioned
pub fn bottom(self, bottom: f64) -> AnimatedPositioned
Dart AnimatedPositioned(bottom:).
Sourcepub fn width(self, width: f64) -> AnimatedPositioned
pub fn width(self, width: f64) -> AnimatedPositioned
Dart AnimatedPositioned(width:).
Sourcepub fn height(self, height: f64) -> AnimatedPositioned
pub fn height(self, height: f64) -> AnimatedPositioned
Dart AnimatedPositioned(height:).
Sourcepub fn key(self, key: KeyRef) -> AnimatedPositioned
pub fn key(self, key: KeyRef) -> AnimatedPositioned
Dart key:.
Sourcepub fn curve(self, curve: Rc<dyn Curve>) -> AnimatedPositioned
pub fn curve(self, curve: Rc<dyn Curve>) -> AnimatedPositioned
Dart curve:.
Sourcepub fn on_end(self, on_end: Listener) -> AnimatedPositioned
pub fn on_end(self, on_end: Listener) -> AnimatedPositioned
Dart onEnd:.
Trait Implementations§
Source§impl Debug for AnimatedPositioned
impl Debug for AnimatedPositioned
Source§impl ImplicitlyAnimatedWidget for AnimatedPositioned
impl ImplicitlyAnimatedWidget for AnimatedPositioned
Source§fn implicitly_animated_widget_data_mut(
&mut self,
) -> &mut ImplicitlyAnimatedWidgetData
fn implicitly_animated_widget_data_mut( &mut self, ) -> &mut ImplicitlyAnimatedWidgetData
ImplicitlyAnimatedWidgetData bag, mutably.Source§impl StatefulWidget for AnimatedPositioned
impl StatefulWidget for AnimatedPositioned
Source§type State = AnimatedPositionedState
type State = AnimatedPositionedState
Source§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
debugFillProperties: the properties a dump shows for this widget, in Dart’s
order. Dart’s Widget base only sets the dense tree style, which the framework does.Source§fn create_state(&self) -> AnimatedPositionedState
fn create_state(&self) -> AnimatedPositionedState
Source§fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>
fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>
Source§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
Widget::type_name. A stateful form another widget kind becomes (an animated or
status transition widget) names the widget it wraps.Auto Trait Implementations§
impl !RefUnwindSafe for AnimatedPositioned
impl !Send for AnimatedPositioned
impl !Sync for AnimatedPositioned
impl !UnwindSafe for AnimatedPositioned
impl Forget for AnimatedPositioned
impl Freeze for AnimatedPositionedwhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
*const RcInner<dyn Curve> is !null: Freeze,
PhantomData<RcInner<dyn Curve>>: Freeze,
*const RcInner<dyn Fn(&mut App)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App)>>: Freeze,
NonZero<u32>: Freeze,
*const (): Freeze,
*const RcInner<dyn Widget> is !null: Freeze,
PhantomData<RcInner<dyn Widget>>: Freeze,
impl Move for AnimatedPositioned
impl Unpin for AnimatedPositioned
impl UnsafeUnpin for AnimatedPositionedwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
*const RcInner<dyn Curve> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Curve>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App)>>: UnsafeUnpin,
NonZeroU32Inner: UnsafeUnpin,
*const (): 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<StatefulKind> for Wwhere
W: StatefulWidget,
impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.