Dispose AnimationController in examples (#5207)

These examples should show the best practices for working with
AnimationControllers.

Fixes #5206
This commit is contained in:
Adam Barth
2016-08-04 08:55:59 -07:00
committed by GitHub
parent 88536859b4
commit 22210c8baf
2 changed files with 12 additions and 0 deletions

View File

@@ -227,6 +227,12 @@ class IsolateExampleState extends State<StatefulWidget> {
);
}
@override
void dispose() {
_animation.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return new Material(

View File

@@ -23,6 +23,12 @@ class _SpinningSquareState extends State<SpinningSquare> {
)..repeat();
}
@override
void dispose() {
_animation.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return new RotationTransition(