This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree 5 files changed +12
-22
lines changed 5 files changed +12
-22
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,8 @@ class Ticker {
51
51
52
52
_onTick (timeStamp);
53
53
54
- if (isTicking)
54
+ // The onTick callback may have scheduled another tick already.
55
+ if (isTicking && _animationId == null )
55
56
_scheduleTick ();
56
57
}
57
58
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ class TweenSimulation extends Simulation {
14
14
final double end;
15
15
16
16
TweenSimulation (Duration duration, this .begin, this .end) :
17
- _durationInSeconds = duration.inMilliseconds / 1000.0 {
17
+ _durationInSeconds = duration.inMicroseconds / Duration . MICROSECONDS_PER_SECOND {
18
18
assert (_durationInSeconds > 0.0 );
19
19
assert (begin != null && begin >= 0.0 && begin <= 1.0 );
20
20
assert (end != null && end >= 0.0 && end <= 1.0 );
Original file line number Diff line number Diff line change 2
2
// Use of this source code is governed by a BSD-style license that can be
3
3
// found in the LICENSE file.
4
4
5
- import 'dart:async' ;
6
5
import 'dart:sky' as sky;
7
6
8
7
import 'package:sky/animation/animated_value.dart' ;
@@ -69,9 +68,7 @@ class Drawer extends StatefulComponent {
69
68
_performance.attachedForce = kDefaultSpringForce;
70
69
71
70
if (navigator != null ) {
72
- scheduleMicrotask (() {
73
- navigator.pushState (this , (_) => _performance.reverse ());
74
- });
71
+ navigator.pushState (this , (_) => _performance.reverse ());
75
72
}
76
73
}
77
74
@@ -120,14 +117,12 @@ class Drawer extends StatefulComponent {
120
117
}
121
118
122
119
void _onDismissed () {
123
- scheduleMicrotask (() {
124
- if (navigator != null &&
125
- navigator.currentRoute is RouteState &&
126
- (navigator.currentRoute as RouteState ).owner == this ) // TODO(ianh): remove cast once analyzer is cleverer
127
- navigator.pop ();
128
- if (onDismissed != null )
129
- onDismissed ();
130
- });
120
+ if (navigator != null &&
121
+ navigator.currentRoute is RouteState &&
122
+ (navigator.currentRoute as RouteState ).owner == this ) // TODO(ianh): remove cast once analyzer is cleverer
123
+ navigator.pop ();
124
+ if (onDismissed != null )
125
+ onDismissed ();
131
126
}
132
127
133
128
bool get _isMostlyClosed => _performance.progress < 0.5 ;
Original file line number Diff line number Diff line change 2
2
// Use of this source code is governed by a BSD-style license that can be
3
3
// found in the LICENSE file.
4
4
5
- import 'dart:async' ;
6
5
import 'dart:sky' as sky;
7
6
8
7
import 'package:sky/animation/animated_value.dart' ;
@@ -72,11 +71,7 @@ class PopupMenu extends StatefulComponent {
72
71
}
73
72
74
73
void _open () {
75
- if (navigator != null ) {
76
- scheduleMicrotask (() {
77
- navigator.pushState (this , (_) => _close ());
78
- });
79
- }
74
+ navigator.pushState (this , (_) => _close ());
80
75
}
81
76
82
77
void _close () {
Original file line number Diff line number Diff line change 2
2
// Use of this source code is governed by a BSD-style license that can be
3
3
// found in the LICENSE file.
4
4
5
- import 'dart:async' ;
6
5
7
6
import 'package:sky/animation/animated_value.dart' ;
8
7
import 'package:sky/animation/animation_performance.dart' ;
@@ -61,7 +60,7 @@ class SnackBar extends Component {
61
60
62
61
void _onDismissed () {
63
62
if (onDismissed != null )
64
- scheduleMicrotask (() { onDismissed (); } );
63
+ onDismissed ();
65
64
}
66
65
67
66
Widget build () {
You can’t perform that action at this time.
0 commit comments