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
d12098da
Unverified
Commit
d12098da
authored
Dec 09, 2020
by
houyushan
Committed by
GitHub
Dec 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a ConstantTween's clerical error and Add some Tween testcases. (#71830)
parent
ceca634e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
1 deletion
+31
-1
tween.dart
packages/flutter/lib/src/animation/tween.dart
+1
-1
tween_test.dart
packages/flutter/test/animation/tween_test.dart
+30
-0
No files found.
packages/flutter/lib/src/animation/tween.dart
View file @
d12098da
...
...
@@ -436,7 +436,7 @@ class ConstantTween<T> extends Tween<T> {
T
lerp
(
double
t
)
=>
begin
as
T
;
@override
String
toString
()
=>
'
${objectRuntimeType(this, '
Reverse
Tween')}
(value:
$begin
)'
;
String
toString
()
=>
'
${objectRuntimeType(this, '
Constant
Tween')}
(value:
$begin
)'
;
}
/// Transforms the value of the given animation by the given curve.
...
...
packages/flutter/test/animation/tween_test.dart
View file @
d12098da
...
...
@@ -93,4 +93,34 @@ void main() {
expect
(
tween
.
lerp
(
0.5
),
100.0
);
expect
(
tween
.
lerp
(
1.0
),
100.0
);
});
test
(
'ReverseTween'
,
()
{
final
ReverseTween
<
int
>
tween
=
ReverseTween
<
int
>(
IntTween
(
begin:
5
,
end:
9
));
expect
(
tween
.
lerp
(
0.5
),
7
);
expect
(
tween
.
lerp
(
0.7
),
6
);
});
test
(
'ColorTween'
,
()
{
final
ColorTween
tween
=
ColorTween
(
begin:
const
Color
(
0xff000000
),
end:
const
Color
(
0xffffffff
)
);
expect
(
tween
.
lerp
(
0.0
),
const
Color
(
0xff000000
));
expect
(
tween
.
lerp
(
0.5
),
const
Color
(
0xff7f7f7f
));
expect
(
tween
.
lerp
(
0.7
),
const
Color
(
0xffb2b2b2
));
expect
(
tween
.
lerp
(
1.0
),
const
Color
(
0xffffffff
));
});
test
(
'StepTween'
,
()
{
final
StepTween
tween
=
StepTween
(
begin:
5
,
end:
9
);
expect
(
tween
.
lerp
(
0.5
),
7
);
expect
(
tween
.
lerp
(
0.7
),
7
);
});
test
(
'CurveTween'
,
()
{
final
CurveTween
tween
=
CurveTween
(
curve:
Curves
.
easeIn
);
expect
(
tween
.
transform
(
0.0
),
0.0
);
expect
(
tween
.
transform
(
0.5
),
0.31640625
);
expect
(
tween
.
transform
(
1.0
),
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