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
81e18ac1
Commit
81e18ac1
authored
Apr 07, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
We should lerp decorations in the correct direction (#3176)
Previously we lerped them backwards. Fixes #2832
parent
3d2fc9e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
decoration.dart
packages/flutter/lib/src/painting/decoration.dart
+2
-2
decoration_test.dart
packages/flutter/test/painting/decoration_test.dart
+23
-0
No files found.
packages/flutter/lib/src/painting/decoration.dart
View file @
81e18ac1
...
...
@@ -51,9 +51,9 @@ abstract class Decoration {
/// otherwise it uses [begin]'s [lerpFrom] function.
static
Decoration
lerp
(
Decoration
begin
,
Decoration
end
,
double
t
)
{
if
(
end
!=
null
)
return
end
.
lerp
To
(
begin
,
t
);
return
end
.
lerp
From
(
begin
,
t
);
if
(
begin
!=
null
)
return
begin
.
lerp
From
(
end
,
t
);
return
begin
.
lerp
To
(
end
,
t
);
return
null
;
}
...
...
packages/flutter/test/painting/decoration_test.dart
0 → 100644
View file @
81e18ac1
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/painting.dart'
;
import
'package:test/test.dart'
;
void
main
(
)
{
test
(
"Decoration.lerp()"
,
()
{
BoxDecoration
a
=
new
BoxDecoration
(
backgroundColor:
const
Color
(
0xFFFFFFFF
));
BoxDecoration
b
=
new
BoxDecoration
(
backgroundColor:
const
Color
(
0x00000000
));
BoxDecoration
c
=
Decoration
.
lerp
(
a
,
b
,
0.0
);
expect
(
c
.
backgroundColor
,
equals
(
a
.
backgroundColor
));
c
=
Decoration
.
lerp
(
a
,
b
,
0.25
);
expect
(
c
.
backgroundColor
,
equals
(
Color
.
lerp
(
const
Color
(
0xFFFFFFFF
),
const
Color
(
0x00000000
),
0.25
)));
c
=
Decoration
.
lerp
(
a
,
b
,
1.0
);
expect
(
c
.
backgroundColor
,
equals
(
b
.
backgroundColor
));
});
}
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