AnimatedRotation class Null safety
Animated version of Transform.rotate which automatically transitions the child's rotation over a given duration whenever the given rotation changes.
This code defines a widget that uses AnimatedRotation to rotate a FlutterLogo
gradually by an eighth of a turn (45 degrees) with each press of the button.
    class LogoRotate extends StatefulWidget {
  const LogoRotate({super.key});
  @override
  State<LogoRotate> createState() => LogoRotateState();
}
class LogoRotateState extends State<LogoRotate> {
  double turns = 0.0;
  void _changeRotation() {
    setState(() => turns += 1.0 / 8.0);
  }
  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        ElevatedButton(
          onPressed: _changeRotation,
          child: const Text('Rotate Logo'),
        ),
        Padding(
          padding: const EdgeInsets.all(50),
          child: AnimatedRotation(
            turns: turns,
            duration: const Duration(seconds: 1),
            child: const FlutterLogo(),
          ),
        ),
      ],
    );
  }
}See also:
- AnimatedScale, for animating the scale of a child.
- RotationTransition, an explicitly animated version of this widget, where an Animation is provided by the caller instead of being built in.
- Inheritance
- 
    - Object
- DiagnosticableTree
- Widget
- StatefulWidget
- ImplicitlyAnimatedWidget
- AnimatedRotation
 
Constructors
- AnimatedRotation({Key? key, Widget? child, required double turns, Alignment alignment = Alignment.center, FilterQuality? filterQuality, Curve curve = Curves.linear, required Duration duration, VoidCallback? onEnd})
- 
          Creates a widget that animates its rotation implicitly.
            const
Properties
- alignment → Alignment
- 
  The alignment of the origin of the coordinate system in which the rotation
takes place, relative to the size of the box.
  final
- child → Widget?
- 
  The widget below this widget in the tree.
  final
- curve → Curve
- 
  The curve to apply when animating the parameters of this container.
  finalinherited
- duration → Duration
- 
  The duration over which to animate the parameters of this container.
  finalinherited
- filterQuality → FilterQuality?
- 
  The filter quality with which to apply the transform as a bitmap operation.
  final
- hashCode → int
- The hash code for this object.
- key → Key?
- 
  Controls how one widget replaces another widget in the tree.
  finalinherited
- onEnd → VoidCallback?
- 
  Called every time an animation completes.
  finalinherited
- runtimeType → Type
- 
  A representation of the runtime type of the object.
  read-onlyinherited
- turns → double
- 
  The animation that controls the rotation of the child.
  final
Methods
- 
  createElement() → StatefulElement 
- 
  Creates a StatefulElement to manage this widget's location in the tree.
  inherited
- 
  createState() → ImplicitlyAnimatedWidgetState< AnimatedRotation> 
- 
  Creates the mutable state for this widget at a given location in the tree.
  override
- 
  debugDescribeChildren() → List< DiagnosticsNode> 
- 
  Returns a list of DiagnosticsNodeobjects describing this node's children.protected">@protectedinherited
- 
  debugFillProperties(DiagnosticPropertiesBuilder properties) → void 
- 
  Add additional properties associated with the node.
  override
- 
  noSuchMethod(Invocation invocation) → dynamic 
- 
  Invoked when a non-existent 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.
  nonVirtual">@nonVirtualinherited