Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
ec9df2f2
Commit
ec9df2f2
authored
Aug 04, 2017
by
Michael Goderbauer
Committed by
GitHub
Aug 04, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow Duration.Zero for animateTo (#11515)
parent
802d5d20
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
animation_controller.dart
packages/flutter/lib/src/animation/animation_controller.dart
+4
-1
animation_controller_test.dart
...ges/flutter/test/animation/animation_controller_test.dart
+14
-0
No files found.
packages/flutter/lib/src/animation/animation_controller.dart
View file @
ec9df2f2
...
@@ -341,7 +341,10 @@ class AnimationController extends Animation<double>
...
@@ -341,7 +341,10 @@ class AnimationController extends Animation<double>
}
}
stop
();
stop
();
if
(
simulationDuration
==
Duration
.
ZERO
)
{
if
(
simulationDuration
==
Duration
.
ZERO
)
{
assert
(
value
==
target
);
if
(
value
!=
target
)
{
_value
=
target
.
clamp
(
lowerBound
,
upperBound
);
notifyListeners
();
}
_status
=
(
_direction
==
_AnimationDirection
.
forward
)
?
_status
=
(
_direction
==
_AnimationDirection
.
forward
)
?
AnimationStatus
.
completed
:
AnimationStatus
.
completed
:
AnimationStatus
.
dismissed
;
AnimationStatus
.
dismissed
;
...
...
packages/flutter/test/animation/animation_controller_test.dart
View file @
ec9df2f2
...
@@ -6,6 +6,7 @@ import 'dart:ui' as ui;
...
@@ -6,6 +6,7 @@ import 'dart:ui' as ui;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/animation.dart'
;
import
'package:flutter/animation.dart'
;
import
'package:flutter/scheduler.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
import
'../scheduler/scheduler_tester.dart'
;
import
'../scheduler/scheduler_tester.dart'
;
...
@@ -381,4 +382,17 @@ void main() {
...
@@ -381,4 +382,17 @@ void main() {
expect
(
statusLog
,
equals
(<
AnimationStatus
>[
AnimationStatus
.
reverse
,
AnimationStatus
.
dismissed
]));
expect
(
statusLog
,
equals
(<
AnimationStatus
>[
AnimationStatus
.
reverse
,
AnimationStatus
.
dismissed
]));
expect
(
controller
.
value
,
currentValue
);
expect
(
controller
.
value
,
currentValue
);
});
});
test
(
'animateTo can deal with duration == Duration.ZERO'
,
()
{
final
AnimationController
controller
=
new
AnimationController
(
duration:
const
Duration
(
milliseconds:
100
),
vsync:
const
TestVSync
(),
);
controller
.
forward
(
from:
0.2
);
expect
(
controller
.
value
,
0.2
);
controller
.
animateTo
(
1.0
,
duration:
Duration
.
ZERO
);
expect
(
SchedulerBinding
.
instance
.
transientCallbackCount
,
equals
(
0
),
reason:
'Expected no animation.'
);
expect
(
controller
.
value
,
1.0
);
});
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment