Refactor layers example (#83070)

This commit is contained in:
Abhishek Ghaskata
2021-05-21 23:04:08 +05:30
committed by GitHub
parent cce5e3aa9c
commit 1ca84e60b8
2 changed files with 15 additions and 28 deletions

View File

@@ -12,19 +12,13 @@ class SpinningSquare extends StatefulWidget {
}
class _SpinningSquareState extends State<SpinningSquare> with SingleTickerProviderStateMixin {
late AnimationController _animation;
@override
void initState() {
super.initState();
// We use 3600 milliseconds instead of 1800 milliseconds because 0.0 -> 1.0
// represents an entire turn of the square whereas in the other examples
// we used 0.0 -> math.pi, which is only half a turn.
_animation = AnimationController(
duration: const Duration(milliseconds: 3600),
vsync: this,
)..repeat();
}
// We use 3600 milliseconds instead of 1800 milliseconds because 0.0 -> 1.0
// represents an entire turn of the square whereas in the other examples
// we used 0.0 -> math.pi, which is only half a turn.
late final AnimationController _animation = AnimationController(
duration: const Duration(milliseconds: 3600),
vsync: this,
)..repeat();
@override
void dispose() {