HeroAnimation class
Hero-animates its child from one layout position to another within the same Route.
If between two frames, the position of a HeroAnimation
with the same tag
changes, a hero animation will be triggered.
Use key
to allow Flutter framework to detect HeroAnimation repositioning
under the same tree node.
HeroAnimation can be created by two factories:
Provides FlightState, so a child widget can rebuild its subtree according to it, e.g change opacity when a hero flight started == FlightState.isFlightStarted.
HeroAnimation.builder(
builder: (context, flightState, child) {
return AnimatedOpacity(
opacity: flightState.isFlightStarted() ? 0.5 : 1.0,
child: child,
),
})
Creates HeroAnimation without FlightState rebuilds
========================HOW IT FLIES?=====================================
HeroAnimation child is inflated to
HeroStill
and HeroFly
widgets.
When a hero is still - HeroStill
is visible, HeroFly
is hidden in the same position.
When the hero flies, then it's vice versa - HeroFly
is visible,
HeroStill
is hidden.
To get the fly destination position HeroAnimation checks the
appearance in a tree of another HeroAnimation widget with the same tag,
than HeroAnimationController
animates change of layout position
from one to another HeroAnimation.
===========================================================================
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- HeroAnimation
Constructors
- HeroAnimation.builder({required HeroAnimationBuilder builder, required String tag, Key? key, Widget? child})
-
Build FlightState aware child subtree.
builder
is called each time FlightState changes. eg text is changed onflightEndedMode()
factory - HeroAnimation.child({required String tag, required Widget child, Key? key})
-
factory
Properties
- child → Widget?
-
The widget subtree that will "fly" from one hero position to another once
hero with the same tag changes its layout position.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- heroBuilder → HeroAnimationBuilder?
-
A
HeroAnimationBuilder
which builds a widget depending on the FlightState's value.final - key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tag → String
-
The identifier for this particular hero.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → HeroAnimationState -
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}) → 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