class MyBlinkingButton extends StatefulWidget { @override _MyBlinkingButtonState createState() => _MyBlinkingButtonState(); } class _MyBlinkingButtonState extends State<MyBlinkingButton> with SingleTickerProviderStateMixin { AnimationController _animationController; @override void initState() { _animationController = new AnimationController(vsync: this, duration: Duration(seconds: 1)); _animationController.repeat(reverse: true); super.initState(); } @override Widget build(BuildContext context) { return FadeTransition( opacity: _animationController, child: MaterialButton( onPressed: () => null, child: Text("Text button"), color: Colors.green, ), ); } @override void dispose() { _animationController.dispose(); super.dispose(); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter