Xây dựng hoạt ảnh tùy chỉnh bằng AnimationController trong Flutter
class MyAnimationScreen extends StatefulWidget {
  @override
  _MyAnimationScreenState createState() => _MyAnimationScreenState();
}

class _MyAnimationScreenState extends State<MyAnimationScreen> with SingleTickerProviderStateMixin {
  late AnimationController _controller;

  @override
  void initState() {
    super.initState();
    _controller = AnimationController(
      vsync: this,
      duration: Duration(seconds: 2),
    );
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }
}
_controller.forward();  // Chạy từ 0 -> 1
_controller.reverse();  // Chạy ngược từ 1 -> 0
_controller.repeat();   // Lặp vô hạn
_controller.stop();     // Dừng hoạt ảnh
@override
Widget build(BuildContext context) {
  return Scaffold(
    body: Center(
      child: AnimatedBuilder(
        animation: _controller,
        builder: (context, child) {
          return Transform.scale(
            scale: _controller.value,
            child: Container(
              width: 100,
              height: 100,
              color: Colors.blue,
            ),
          );
        },
      ),
    ),
    floatingActionButton: FloatingActionButton(
      onPressed: () {
        _controller.forward(from: 0);
      },
      child: Icon(Icons.play_arrow),
    ),
  );
}
Animation<double> _sizeAnimation = Tween<double>(begin: 50, end: 200).animate(_controller);