Last active
January 29, 2020 12:58
-
-
Save ShaiqAhmedkhan/dbb482a8d8424504c0dcee5ad883b35b 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 TimerStopper extends StatelessWidget { | |
final List<AnimationController> controllers; | |
const TimerStopper({Key key, this.controllers}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return GestureDetector( | |
onTap: () { | |
controllers.forEach((controller) { | |
if (controller.isAnimating) { | |
controller.stop(); | |
} else { | |
controller.repeat(); | |
} | |
}); | |
}, | |
child: Container( | |
decoration: BoxDecoration( | |
color: Colors.transparent, | |
), | |
width: MediaQuery | |
.of(context) | |
.size | |
.width, | |
height: MediaQuery | |
.of(context) | |
.size | |
.height, ), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment