content: import 'package:flutter/material.dart';
  
  void main() => runApp(MyApp());
  
  class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        title: 'Flutter Demo',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: MyHomePage(title: 'AnimatedWidget'),
      );
    }
  }
  
  class MyHomePage extends StatefulWidget {
    MyHomePage({Key key, this.title}) : super(key: key);
    final String title;
  
    @override
    _MyHomePageState createState() => _MyHomePageState();
  }
  
  class _MyHomePageState extends State<MyHomePage> with SingleTickerProviderStateMixin {
    AnimationController _controller;
    Animation<double> _animation;
  
    void initState() {
      super.initState();
      _controller = AnimationController(
        duration: const Duration(seconds: 3),
        vsync: this,
      );
      _animation = _controller.drive(
        Tween<double>(begin: 0, end: 300),
      );
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
        ),
        body: Center(
          child: AnimatedLogo(animation: _animation),
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: () => _controller.forward(),
        ),
      );
    }
  }
  
  class AnimatedLogo extends AnimatedWidget {
    AnimatedLogo({
      Key key,
      Animation<double> animation,
    }) : super(key: key, listenable: animation);
  
    Widget build(BuildContext context) {
      final Animation<double> animation = listenable;
      return Center(
        child: Container(
          height: animation.value,
          width: animation.value,
          // 何度も呼ばれる
          child: const FlutterLogo(),
        ),
      );
    }
  }
  