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
f27fa0ec
Commit
f27fa0ec
authored
Sep 01, 2016
by
Hans Muller
Committed by
GitHub
Sep 01, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gallery animation demo: lazily compute screen dimensions (#5715)
parent
1152fd60
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
11 deletions
+19
-11
animation_demo.dart
examples/flutter_gallery/lib/demo/animation_demo.dart
+19
-11
No files found.
examples/flutter_gallery/lib/demo/animation_demo.dart
View file @
f27fa0ec
...
...
@@ -71,7 +71,7 @@ class _PointDemoPainter extends CustomPainter {
final
Paint
paint
=
new
Paint
();
if
(
arc
.
center
!=
null
)
drawPoint
(
canvas
,
arc
.
center
,
Colors
.
blue
[
400
]);
drawPoint
(
canvas
,
arc
.
center
,
Colors
.
grey
[
400
]);
paint
..
color
=
Colors
.
green
[
500
].
withOpacity
(
0.25
)
...
...
@@ -115,6 +115,7 @@ class _PointDemoState extends State<_PointDemo> {
CurvedAnimation
_animation
;
_DragTarget
_dragTarget
;
Size
_screenSize
;
Point
_begin
;
Point
_end
;
...
...
@@ -177,8 +178,11 @@ class _PointDemoState extends State<_PointDemo> {
@override
Widget
build
(
BuildContext
context
)
{
final
Size
screenSize
=
MediaQuery
.
of
(
context
).
size
;
_begin
=
new
Point
(
screenSize
.
width
*
0.5
,
screenSize
.
height
*
0.2
);
_end
=
new
Point
(
screenSize
.
width
*
0.1
,
screenSize
.
height
*
0.4
);
if
(
_screenSize
==
null
||
_screenSize
!=
screenSize
)
{
_screenSize
=
screenSize
;
_begin
=
new
Point
(
screenSize
.
width
*
0.5
,
screenSize
.
height
*
0.2
);
_end
=
new
Point
(
screenSize
.
width
*
0.1
,
screenSize
.
height
*
0.4
);
}
final
MaterialPointArcTween
arc
=
new
MaterialPointArcTween
(
begin:
_begin
,
end:
_end
);
return
new
RawGestureDetector
(
...
...
@@ -276,6 +280,7 @@ class _RectangleDemoState extends State<_RectangleDemo> {
CurvedAnimation
_animation
;
_DragTarget
_dragTarget
;
Size
_screenSize
;
Rect
_begin
;
Rect
_end
;
...
...
@@ -337,14 +342,17 @@ class _RectangleDemoState extends State<_RectangleDemo> {
@override
Widget
build
(
BuildContext
context
)
{
final
Size
screenSize
=
MediaQuery
.
of
(
context
).
size
;
_begin
=
new
Rect
.
fromLTWH
(
screenSize
.
width
*
0.5
,
screenSize
.
height
*
0.2
,
screenSize
.
width
*
0.4
,
screenSize
.
height
*
0.2
);
_end
=
new
Rect
.
fromLTWH
(
screenSize
.
width
*
0.1
,
screenSize
.
height
*
0.4
,
screenSize
.
width
*
0.3
,
screenSize
.
height
*
0.3
);
if
(
_screenSize
==
null
||
_screenSize
!=
screenSize
)
{
_screenSize
=
screenSize
;
_begin
=
new
Rect
.
fromLTWH
(
screenSize
.
width
*
0.5
,
screenSize
.
height
*
0.2
,
screenSize
.
width
*
0.4
,
screenSize
.
height
*
0.2
);
_end
=
new
Rect
.
fromLTWH
(
screenSize
.
width
*
0.1
,
screenSize
.
height
*
0.4
,
screenSize
.
width
*
0.3
,
screenSize
.
height
*
0.3
);
}
final
MaterialRectArcTween
arc
=
new
MaterialRectArcTween
(
begin:
_begin
,
end:
_end
);
return
new
RawGestureDetector
(
...
...
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