Unverified Commit 1ca84e60 authored by Abhishek Ghaskata's avatar Abhishek Ghaskata Committed by GitHub

Refactor layers example (#83070)

parent cce5e3aa
...@@ -210,21 +210,14 @@ class IsolateExampleState extends State<StatefulWidget> with SingleTickerProvide ...@@ -210,21 +210,14 @@ class IsolateExampleState extends State<StatefulWidget> with SingleTickerProvide
String _label = 'Start'; String _label = 'Start';
String _result = ' '; String _result = ' ';
double _progress = 0.0; double _progress = 0.0;
late AnimationController _animation; late final AnimationController _animation = AnimationController(
late CalculationManager _calculationManager; duration: const Duration(milliseconds: 3600),
vsync: this,
@override )..repeat();
void initState() { late final CalculationManager _calculationManager = CalculationManager(
super.initState(); onProgressListener: _handleProgressUpdate,
_animation = AnimationController( onResultListener: _handleResult,
duration: const Duration(milliseconds: 3600), );
vsync: this,
)..repeat();
_calculationManager = CalculationManager(
onProgressListener: _handleProgressUpdate,
onResultListener: _handleResult,
);
}
@override @override
void dispose() { void dispose() {
......
...@@ -12,19 +12,13 @@ class SpinningSquare extends StatefulWidget { ...@@ -12,19 +12,13 @@ class SpinningSquare extends StatefulWidget {
} }
class _SpinningSquareState extends State<SpinningSquare> with SingleTickerProviderStateMixin { class _SpinningSquareState extends State<SpinningSquare> with SingleTickerProviderStateMixin {
late AnimationController _animation; // 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
@override // we used 0.0 -> math.pi, which is only half a turn.
void initState() { late final AnimationController _animation = AnimationController(
super.initState(); duration: const Duration(milliseconds: 3600),
// We use 3600 milliseconds instead of 1800 milliseconds because 0.0 -> 1.0 vsync: this,
// represents an entire turn of the square whereas in the other examples )..repeat();
// we used 0.0 -> math.pi, which is only half a turn.
_animation = AnimationController(
duration: const Duration(milliseconds: 3600),
vsync: this,
)..repeat();
}
@override @override
void dispose() { void dispose() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment