pub struct AnimatedContainer {
pub alignment: Option<AlignmentGeometry>,
pub padding: Option<EdgeInsetsGeometry>,
pub decoration: Option<DecorationRef>,
pub foreground_decoration: Option<DecorationRef>,
pub constraints: Option<BoxConstraints>,
pub margin: Option<EdgeInsetsGeometry>,
pub transform: Option<Matrix4>,
pub transform_alignment: Option<AlignmentGeometry>,
pub child: Option<WidgetRef>,
pub clip_behavior: Clip,
/* private fields */
}Expand description
A container that gradually changes its values over a period of time.
The AnimatedContainer will automatically animate between the old and
new values of properties when they change using the provided curve and
duration. Properties that are null are not animated. Its child and
descendants are not animated.
This class is useful for generating simple implicit transitions between
different parameters to Container with its internal
AnimationController. For more complex animations, you’ll likely want to
use a subclass of Transition such as the DecoratedBoxTransition or use
your own AnimationController.
See also:
AnimatedPadding, which is a subset of this widget that only supports animating thepadding.AnimatedPositioned, which, as a child of aStack, automatically transitions its child’s position over a given duration whenever the given position changes.AnimatedAlign, which automatically transitions its child’s position over a given duration whenever the givenAnimatedAlign::alignmentchanges.
Fields§
§alignment: Option<AlignmentGeometry>Align the child within the container.
If non-None, the container will expand to fill its parent and position its
child within itself according to the given value. If the incoming
constraints are unbounded, then the child will be shrink-wrapped instead.
Ignored if child is None.
padding: Option<EdgeInsetsGeometry>Empty space to inscribe inside the decoration. The
child, if any, is placed inside this padding.
decoration: Option<DecorationRef>The decoration to paint behind the child.
A shorthand for specifying just a solid color is available in
color.
foreground_decoration: Option<DecorationRef>The decoration to paint in front of the child.
constraints: Option<BoxConstraints>Additional constraints to apply to the child.
The width and height setters are combined with the
given constraints: this is Dart’s folded field.
The padding goes inside the constraints.
margin: Option<EdgeInsetsGeometry>Empty space to surround the decoration and
child.
transform: Option<Matrix4>The transformation matrix to apply before painting the container.
transform_alignment: Option<AlignmentGeometry>The alignment of the origin, relative to the size of the container, if
transform is specified.
When transform is None, the value of this property is ignored.
child: Option<WidgetRef>The child contained by the container.
If None, and if the constraints are unbounded or also None,
the container will expand to fill all available space in its parent, unless
the parent provides unbounded constraints, in which case the container
will attempt to be as small as possible.
clip_behavior: ClipThe clip behavior when decoration is not None.
Defaults to Clip::None. Must be Clip::None if
decoration is None.
Unlike other properties of AnimatedContainer, changes to this property
apply immediately and have no animation.
Implementations§
Source§impl AnimatedContainer
impl AnimatedContainer
Sourcepub fn new(duration: Duration) -> AnimatedContainer
pub fn new(duration: Duration) -> AnimatedContainer
Creates a container that animates its parameters implicitly.
Sourcepub fn alignment(self, alignment: AlignmentGeometry) -> AnimatedContainer
pub fn alignment(self, alignment: AlignmentGeometry) -> AnimatedContainer
Dart AnimatedContainer(alignment:).
Sourcepub fn padding(
self,
padding: impl Into<EdgeInsetsGeometry>,
) -> AnimatedContainer
pub fn padding( self, padding: impl Into<EdgeInsetsGeometry>, ) -> AnimatedContainer
Dart AnimatedContainer(padding:); must be non-negative.
Sourcepub fn color(self, color: impl Into<AnyColor>) -> AnimatedContainer
pub fn color(self, color: impl Into<AnyColor>) -> AnimatedContainer
Dart AnimatedContainer(color:), the shorthand for a solid-color
decoration; cannot be combined with one.
Sourcepub fn decoration(
self,
decoration: impl Into<DecorationRef>,
) -> AnimatedContainer
pub fn decoration( self, decoration: impl Into<DecorationRef>, ) -> AnimatedContainer
Dart AnimatedContainer(decoration:); cannot be combined with
color.
Sourcepub fn foreground_decoration(
self,
foreground_decoration: impl Into<DecorationRef>,
) -> AnimatedContainer
pub fn foreground_decoration( self, foreground_decoration: impl Into<DecorationRef>, ) -> AnimatedContainer
Dart AnimatedContainer(foregroundDecoration:).
Sourcepub fn width(self, width: f64) -> AnimatedContainer
pub fn width(self, width: f64) -> AnimatedContainer
Dart AnimatedContainer(width:): tightens constraints.
Sourcepub fn height(self, height: f64) -> AnimatedContainer
pub fn height(self, height: f64) -> AnimatedContainer
Dart AnimatedContainer(height:): tightens constraints.
Sourcepub fn constraints(self, constraints: BoxConstraints) -> AnimatedContainer
pub fn constraints(self, constraints: BoxConstraints) -> AnimatedContainer
Dart AnimatedContainer(constraints:); must be valid.
Sourcepub fn margin(self, margin: impl Into<EdgeInsetsGeometry>) -> AnimatedContainer
pub fn margin(self, margin: impl Into<EdgeInsetsGeometry>) -> AnimatedContainer
Dart AnimatedContainer(margin:); must be non-negative.
Sourcepub fn transform(self, transform: Matrix4) -> AnimatedContainer
pub fn transform(self, transform: Matrix4) -> AnimatedContainer
Dart AnimatedContainer(transform:).
Sourcepub fn transform_alignment(
self,
transform_alignment: AlignmentGeometry,
) -> AnimatedContainer
pub fn transform_alignment( self, transform_alignment: AlignmentGeometry, ) -> AnimatedContainer
Dart AnimatedContainer(transformAlignment:).
Sourcepub fn child<K>(self, child: impl IntoWidget<K>) -> AnimatedContainer
pub fn child<K>(self, child: impl IntoWidget<K>) -> AnimatedContainer
Dart AnimatedContainer(child:).
Sourcepub fn clip_behavior(self, clip_behavior: Clip) -> AnimatedContainer
pub fn clip_behavior(self, clip_behavior: Clip) -> AnimatedContainer
Dart AnimatedContainer(clipBehavior:).
Sourcepub fn key(self, key: KeyRef) -> AnimatedContainer
pub fn key(self, key: KeyRef) -> AnimatedContainer
Dart key:.
Sourcepub fn curve(self, curve: Rc<dyn Curve>) -> AnimatedContainer
pub fn curve(self, curve: Rc<dyn Curve>) -> AnimatedContainer
Dart curve:.
Sourcepub fn on_end(self, on_end: Listener) -> AnimatedContainer
pub fn on_end(self, on_end: Listener) -> AnimatedContainer
Dart onEnd:.
Trait Implementations§
Source§impl Debug for AnimatedContainer
impl Debug for AnimatedContainer
Source§impl ImplicitlyAnimatedWidget for AnimatedContainer
impl ImplicitlyAnimatedWidget for AnimatedContainer
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 AnimatedContainer
impl StatefulWidget for AnimatedContainer
Source§type State = AnimatedContainerState
type State = AnimatedContainerState
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) -> AnimatedContainerState
fn create_state(&self) -> AnimatedContainerState
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 AnimatedContainer
impl !Send for AnimatedContainer
impl !Sync for AnimatedContainer
impl !UnwindSafe for AnimatedContainer
impl Forget for AnimatedContainer
impl Freeze for AnimatedContainerwhere
*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,
&'static dyn ColorExtension: Freeze,
*const RcInner<dyn ColorExtension> is !null: Freeze,
PhantomData<RcInner<dyn ColorExtension>>: Freeze,
*const RcInner<dyn Decoration> is !null: Freeze,
PhantomData<RcInner<dyn Decoration>>: Freeze,
*const RcInner<dyn Widget> is !null: Freeze,
PhantomData<RcInner<dyn Widget>>: Freeze,
impl Move for AnimatedContainer
impl Unpin for AnimatedContainer
impl UnsafeUnpin for AnimatedContainerwhere
*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,
&'static dyn ColorExtension: UnsafeUnpin,
*const RcInner<dyn ColorExtension> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn ColorExtension>>: UnsafeUnpin,
*const RcInner<dyn Decoration> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Decoration>>: 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.