0

Need help in basic way to implement of Animation in Flutter, basic Rotate,Fade-In,Scale,Translate animations. How to work on it, and apply combination of these animation. Flutter docs didn't help, unable to find any resource. Need basics way to do as explained here for Android XML https://www.androidhive.info/2013/06/android-working-with-xml-animations/

1
  • Flutter docs didn't help --> really?? Commented Jun 2, 2018 at 11:53

1 Answer 1

1

This is the simplest example of animation in Flutter.

class Home extends StatefulWidget {
@override
HomeState createState() {
    return new HomeState();
}
}

class HomeState extends State<Home> with TickerProviderStateMixin {
AnimationController controller;

@override
void initState() {
    super.initState();
    controller = new AnimationController(
        vsync: this, duration: new Duration(milliseconds: 2000));
}

@override
Widget build(BuildContext context) {
    return new Scaffold(
    body: new Center(
        child: new Column(
        mainAxisSize: MainAxisSize.min,
        children: <Widget>[
            new RotationTransition(
            turns: new Tween(begin: 0.0, end: 1.0).animate(controller),
            child: new Container(
                width: 150.0,
                height: 150.0,
                color: Colors.blue,
            ),
            ),
            new MaterialButton(
            child: new Text('Start Animation'),
            onPressed: () {
                setState(() {
                controller.forward().then((_) {
                    controller.reverse();
                });
                });
            },
            )
        ],
        ),
    ),
    );
}
}

All I have used is RotationTransition and AnimationController

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.