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
b3b9b221
Unverified
Commit
b3b9b221
authored
Mar 23, 2018
by
Greg Spencer
Committed by
GitHub
Mar 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating checkmark animation (#15850)
parent
ce283781
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
checkbox.dart
packages/flutter/lib/src/material/checkbox.dart
+14
-7
No files found.
packages/flutter/lib/src/material/checkbox.dart
View file @
b3b9b221
...
...
@@ -253,17 +253,24 @@ class _RenderCheckbox extends RenderToggleable {
void
_drawCheck
(
Canvas
canvas
,
Offset
origin
,
double
t
,
Paint
paint
)
{
assert
(
t
>=
0.0
&&
t
<=
1.0
);
// As t goes from 0.0 to 1.0, animate the two checkmark strokes from the
//
mid point outwards
.
// As t goes from 0.0 to 1.0, animate the two check
mark strokes from the
//
short side to the long side
.
final
Path
path
=
new
Path
();
const
Offset
start
=
const
Offset
(
_kEdgeSize
*
0.15
,
_kEdgeSize
*
0.45
);
const
Offset
mid
=
const
Offset
(
_kEdgeSize
*
0.4
,
_kEdgeSize
*
0.7
);
const
Offset
end
=
const
Offset
(
_kEdgeSize
*
0.85
,
_kEdgeSize
*
0.25
);
final
Offset
drawStart
=
Offset
.
lerp
(
start
,
mid
,
1.0
-
t
);
final
Offset
drawEnd
=
Offset
.
lerp
(
mid
,
end
,
t
);
path
.
moveTo
(
origin
.
dx
+
drawStart
.
dx
,
origin
.
dy
+
drawStart
.
dy
);
path
.
lineTo
(
origin
.
dx
+
mid
.
dx
,
origin
.
dy
+
mid
.
dy
);
path
.
lineTo
(
origin
.
dx
+
drawEnd
.
dx
,
origin
.
dy
+
drawEnd
.
dy
);
if
(
t
<
0.5
)
{
final
double
strokeT
=
t
*
2.0
;
final
Offset
drawMid
=
Offset
.
lerp
(
start
,
mid
,
strokeT
);
path
.
moveTo
(
origin
.
dx
+
start
.
dx
,
origin
.
dy
+
start
.
dy
);
path
.
lineTo
(
origin
.
dx
+
drawMid
.
dx
,
origin
.
dy
+
drawMid
.
dy
);
}
else
{
final
double
strokeT
=
(
t
-
0.5
)
*
2.0
;
final
Offset
drawEnd
=
Offset
.
lerp
(
mid
,
end
,
strokeT
);
path
.
moveTo
(
origin
.
dx
+
start
.
dx
,
origin
.
dy
+
start
.
dy
);
path
.
lineTo
(
origin
.
dx
+
mid
.
dx
,
origin
.
dy
+
mid
.
dy
);
path
.
lineTo
(
origin
.
dx
+
drawEnd
.
dx
,
origin
.
dy
+
drawEnd
.
dy
);
}
canvas
.
drawPath
(
path
,
paint
);
}
...
...
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