Created
June 27, 2019 10:36
-
-
Save flutter-devs/89e362502fef09502479896e3f006268 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @override | |
| Widget build(BuildContext context) { | |
| return Scaffold( | |
| appBar: AppBar( | |
| title: Text('Example Animations'), | |
| ), | |
| body: Column( | |
| mainAxisAlignment: MainAxisAlignment.center, | |
| children: <Widget>[ | |
| firstChild(), | |
| SizedBox( | |
| height: 50.0, | |
| ), | |
| secondChild(), | |
| ], | |
| ), | |
| ); | |
| } | |
| Widget secondChild() { | |
| return Row( | |
| mainAxisAlignment: MainAxisAlignment.spaceAround, | |
| children: <Widget>[ | |
| Expanded( | |
| child: AnimatedBuilder( | |
| animation: _heartAnimationController, | |
| builder: (context, child) { | |
| return Center( | |
| child: Container( | |
| child: Center( | |
| child: Icon( | |
| Icons.favorite, | |
| color: Colors.red, | |
| size: _heartAnimation.value, | |
| ), | |
| ), | |
| ), | |
| ); | |
| }, | |
| ), | |
| ), | |
| Expanded( | |
| child: Padding( | |
| padding: const EdgeInsets.only(right: 12.0), | |
| child: OutlineButton( | |
| padding: const EdgeInsets.all(12.0), | |
| color: Colors.white, | |
| textColor: Colors.black, | |
| child: Text('Start Beating Heart Animation'), | |
| onPressed: () { | |
| _heartAnimationController.forward(); | |
| }, | |
| splashColor: Colors.red, | |
| ), | |
| ), | |
| ) | |
| ], | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment