import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'dart:math' as math;
class AnimatedDemo extends StatefulWidget {
static const String sName = 'animatedDemo';
@override
_AnimatedDemoState createState() => _AnimatedDemoState();
}
class _AnimatedDemoState extends State<AnimatedDemo>
with TickerProviderStateMixin {
AnimationController animationController;
Animation animation;
@override
void initState() {
// TODO: implement initState
super.initState();
animationController =
AnimationController(vsync: this, duration: Duration(seconds: 2))
..addStatusListener((status) {
if (status == AnimationStatus.completed) {
animationController.reverse();
} else if (status == AnimationStatus.dismissed) {
animationController.forward();
}
});
animation =
Tween(begin: 0.0, end: 2.0 * math.pi).animate(animationController);
animationController.forward();
}
@override
void dispose() {
// TODO: implement dispose
super.dispose();
animationController.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('animated_demo')),
body: AnimatedBuilder(
animation: animation,
builder: (BuildContext context, Widget child) {
return Transform.rotate(angle: animation.value, child: child);
},
child: FlutterLogo(size: 60,),
),
);
}
}