Refactor layers example (#83070)
This commit is contained in:
parent
cce5e3aa9c
commit
1ca84e60b8
@ -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;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
_animation = AnimationController(
|
|
||||||
duration: const Duration(milliseconds: 3600),
|
duration: const Duration(milliseconds: 3600),
|
||||||
vsync: this,
|
vsync: this,
|
||||||
)..repeat();
|
)..repeat();
|
||||||
_calculationManager = CalculationManager(
|
late final CalculationManager _calculationManager = CalculationManager(
|
||||||
onProgressListener: _handleProgressUpdate,
|
onProgressListener: _handleProgressUpdate,
|
||||||
onResultListener: _handleResult,
|
onResultListener: _handleResult,
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
@ -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;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
// We use 3600 milliseconds instead of 1800 milliseconds because 0.0 -> 1.0
|
// 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
|
// represents an entire turn of the square whereas in the other examples
|
||||||
// we used 0.0 -> math.pi, which is only half a turn.
|
// we used 0.0 -> math.pi, which is only half a turn.
|
||||||
_animation = AnimationController(
|
late final AnimationController _animation = AnimationController(
|
||||||
duration: const Duration(milliseconds: 3600),
|
duration: const Duration(milliseconds: 3600),
|
||||||
vsync: this,
|
vsync: this,
|
||||||
)..repeat();
|
)..repeat();
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user