Pen Settings

JavaScript

Babel includes JSX processing.

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

Flutter

              
                import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('AnimationController 动画'),
        ),
        body: HeartAnimPage(),
      ),
    );
  }
}

class HeartAnimPage extends StatefulWidget {
  HeartAnimPage({Key key}) : super(key: key);
  @override
  _HeartAnimPageState createState() => _HeartAnimPageState();
}

class _HeartAnimPageState extends State<HeartAnimPage>
    with SingleTickerProviderStateMixin {
  AnimationController controller;
  Animation<double> animation;

  @override
  void initState() {
    super.initState();
    controller =
        AnimationController(vsync: this, duration: Duration(seconds: 1));
    animation = CurvedAnimation(
      parent: controller,
      curve: Curves.elasticInOut,
      reverseCurve: Curves.easeOut,
    );
    animation.addStatusListener((status) {
      if (status == AnimationStatus.completed) {
        controller.reverse();
      } else if (status == AnimationStatus.dismissed) {
        controller.forward();
      }
    });
    animation = Tween(begin: 50.0, end: 120.0).animate(controller);
  }

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Center(
      child: AnimatedBuilder(
        animation: animation,
        builder: (context, child) {
          return Icon(
            Icons.favorite,
            color: Colors.red,
            size: animation.value,
          );
        },
      ),
    );
  }
}


class MyAnimPage extends StatelessWidget {
  final animKey = Key('animKey');
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text(' '),),
      body: HeartAnimPage(key: animKey,),
      floatingActionButton: FloatingActionButton(
        child: Icon(Icons.add),
        onPressed: (){
          if(!animKey.currentState.controller.)
        },
      ),

    );
  }
}
              
            
!
999px

Console