Dispose AnimationController in examples (#5207)
These examples should show the best practices for working with AnimationControllers. Fixes #5206
This commit is contained in:
@@ -227,6 +227,12 @@ class IsolateExampleState extends State<StatefulWidget> {
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_animation.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Material(
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user