RanimatedContainer class
A Container but animates in a way that's well suited to layout animations. We can define "ranimation" as a way of implementing animation where the layout update is instant (where in a sense it has already ran), but where the visuals move to the new layout smoothly. It has many advantages:
- Doesn't have to call layout every frame of the animation
- Can animate layout changes (conventional animations can't, or can only animate it in limited ways while making it very awkward to work with)
- Allows the user to immediately interact with the application as if the change had completed, rather than having to wait for the animation to complete. This also avoids certain kinds of bugs.
- Allows the animation to plan its motion more intelligently because the target isn't constantly being changed. shortcomings and bugs there's some major todo here though:
- need to interpolate between decorations (using lerpTo methods)
- Animate changes to the clipping rect on size change, not just the decoration.
- Adjust the animation using alignment as a positioning cue as to how the origin of the RenderObject probably moved as a result of the size change.
- Also animate the offset of the contents. Ranimated objects can't animate their origins.
- Render decoration foreground in front of the child.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- RanimatedContainer
Constructors
- RanimatedContainer.new({Key? key, AlignmentGeometry? alignment, EdgeInsetsGeometry? padding, Color? color, Decoration? decoration, Decoration? foregroundDecoration, double? width, double? height, BoxConstraints? constraints, EdgeInsetsGeometry? margin, Matrix4? transform, AlignmentGeometry? transformAlignment, Widget? child, Clip clipBehavior = Clip.none, required Duration animationDuration})
- Creates a widget that combines common painting, positioning, and sizing widgets.
Properties
- alignment → AlignmentGeometry?
-
Align the child within the container.
final
- animationDuration → Duration
-
final
- child → Widget?
-
The child contained by the container.
final
- clipBehavior → Clip
-
The clip behavior when RanimatedContainer.decoration is not null.
final
- color → Color?
-
The color to paint behind the child.
final
- constraints → BoxConstraints?
-
Additional constraints to apply to the child.
final
- decoration → Decoration?
-
The decoration to paint behind the child.
final
- foregroundDecoration → Decoration?
-
The decoration to paint in front of the child.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- margin → EdgeInsetsGeometry?
-
Empty space to surround the decoration and child.
final
- padding → EdgeInsetsGeometry?
-
Empty space to inscribe inside the decoration. The child, if any, is
placed inside this padding.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- transform → Matrix4?
-
The transformation matrix to apply before painting the container.
final
- transformAlignment → AlignmentGeometry?
-
The alignment of the origin, relative to the size of the container, if transform is specified.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< RanimatedContainer> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited