-
-
Save efortuna/af79b41b714d00b8f6081ca059b511d3 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
| class ColorAnimationWithStaticFinal extends StatelessWidget { | |
| static final colorTween = ColorTween(begin: Colors.white, end: Colors.red); | |
| @override | |
| Widget build(BuildContext context) { | |
| return Stack( | |
| children: <Widget>[ | |
| starsBackground, | |
| Center( | |
| child: TweenAnimationBuilder<Color>( | |
| tween: colorTween, | |
| duration: Duration(seconds: 2), | |
| builder: (_, Color color, __) { | |
| return ColorFiltered( | |
| child: Image.asset('assets/sun.png'), | |
| colorFilter: ColorFilter.mode(color, BlendMode.modulate), | |
| ); | |
| }, | |
| ), | |
| ), | |
| ], | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe we can consider changing line 2 to ;
static final colorTween = Tween<Color>(begin: Colors.white, end: Colors.red);