Skip to content

Instantly share code, notes, and snippets.

@ShaiqAhmedkhan
Last active January 29, 2020 12:58
Show Gist options
  • Save ShaiqAhmedkhan/dbb482a8d8424504c0dcee5ad883b35b to your computer and use it in GitHub Desktop.
Save ShaiqAhmedkhan/dbb482a8d8424504c0dcee5ad883b35b to your computer and use it in GitHub Desktop.
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