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
3373d0ba
Commit
3373d0ba
authored
Oct 28, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch clients from ui.view to ui.window
parent
02a1ebab
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
81 additions
and
83 deletions
+81
-83
hello_world.dart
examples/raw/hello_world.dart
+10
-10
painting.dart
examples/raw/painting.dart
+9
-9
shadow.dart
examples/raw/shadow.dart
+7
-7
spinning_arabic.dart
examples/raw/spinning_arabic.dart
+11
-11
spinning_image.dart
examples/raw/spinning_image.dart
+11
-11
spinning_square.dart
examples/raw/spinning_square.dart
+10
-10
interactive_flex.dart
examples/rendering/interactive_flex.dart
+1
-1
stock_menu.dart
examples/stocks/lib/stock_menu.dart
+2
-2
scheduler.dart
packages/flutter/lib/src/animation/scheduler.dart
+5
-7
scroll_behavior.dart
packages/flutter/lib/src/animation/scroll_behavior.dart
+3
-3
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+1
-1
binding.dart
packages/flutter/lib/src/rendering/binding.dart
+3
-3
view.dart
packages/flutter/lib/src/rendering/view.dart
+4
-4
viewport.dart
packages/flutter/lib/src/rendering/viewport.dart
+1
-1
scheduler_test.dart
packages/unit/test/animation/scheduler_test.dart
+2
-2
widget_tester.dart
packages/unit/test/widget/widget_tester.dart
+1
-1
No files found.
examples/raw/hello_world.dart
View file @
3373d0ba
...
@@ -21,8 +21,8 @@ ui.Picture paint(ui.Rect paintBounds) {
...
@@ -21,8 +21,8 @@ ui.Picture paint(ui.Rect paintBounds) {
}
}
ui
.
Scene
composite
(
ui
.
Picture
picture
,
ui
.
Rect
paintBounds
)
{
ui
.
Scene
composite
(
ui
.
Picture
picture
,
ui
.
Rect
paintBounds
)
{
final
double
devicePixelRatio
=
ui
.
vie
w
.
devicePixelRatio
;
final
double
devicePixelRatio
=
ui
.
windo
w
.
devicePixelRatio
;
ui
.
Rect
sceneBounds
=
new
ui
.
Rect
.
fromLTWH
(
0.0
,
0.0
,
ui
.
view
.
width
*
devicePixelRatio
,
ui
.
view
.
height
*
devicePixelRatio
);
ui
.
Rect
sceneBounds
=
new
ui
.
Rect
.
fromLTWH
(
0.0
,
0.0
,
ui
.
window
.
size
.
width
*
devicePixelRatio
,
ui
.
window
.
size
.
height
*
devicePixelRatio
);
Float64List
deviceTransform
=
new
Float64List
(
16
)
Float64List
deviceTransform
=
new
Float64List
(
16
)
..[
0
]
=
devicePixelRatio
..[
0
]
=
devicePixelRatio
..[
5
]
=
devicePixelRatio
..[
5
]
=
devicePixelRatio
...
@@ -35,23 +35,23 @@ ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
...
@@ -35,23 +35,23 @@ ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
return
sceneBuilder
.
build
();
return
sceneBuilder
.
build
();
}
}
void
beginFrame
(
double
timeStamp
)
{
void
beginFrame
(
Duration
timeStamp
)
{
ui
.
Rect
paintBounds
=
new
ui
.
Rect
.
fromLTWH
(
0.0
,
0.0
,
ui
.
view
.
width
,
ui
.
view
.
height
)
;
ui
.
Rect
paintBounds
=
ui
.
Point
.
origin
&
ui
.
window
.
size
;
ui
.
Picture
picture
=
paint
(
paintBounds
);
ui
.
Picture
picture
=
paint
(
paintBounds
);
ui
.
Scene
scene
=
composite
(
picture
,
paintBounds
);
ui
.
Scene
scene
=
composite
(
picture
,
paintBounds
);
ui
.
view
.
scene
=
scene
;
ui
.
window
.
render
(
scene
)
;
}
}
bool
handleEvent
(
ui
.
Event
event
)
{
bool
handleEvent
(
ui
.
Event
event
)
{
if
(
event
.
type
==
'pointerdown'
)
{
if
(
event
.
type
==
'pointerdown'
)
{
color
=
new
ui
.
Color
.
fromARGB
(
255
,
0
,
0
,
255
);
color
=
new
ui
.
Color
.
fromARGB
(
255
,
0
,
0
,
255
);
ui
.
vie
w
.
scheduleFrame
();
ui
.
windo
w
.
scheduleFrame
();
return
true
;
return
true
;
}
}
if
(
event
.
type
==
'pointerup'
)
{
if
(
event
.
type
==
'pointerup'
)
{
color
=
new
ui
.
Color
.
fromARGB
(
255
,
0
,
255
,
0
);
color
=
new
ui
.
Color
.
fromARGB
(
255
,
0
,
255
,
0
);
ui
.
vie
w
.
scheduleFrame
();
ui
.
windo
w
.
scheduleFrame
();
return
true
;
return
true
;
}
}
...
@@ -66,7 +66,7 @@ bool handleEvent(ui.Event event) {
...
@@ -66,7 +66,7 @@ bool handleEvent(ui.Event event) {
void
main
(
)
{
void
main
(
)
{
print
(
'Hello, world'
);
print
(
'Hello, world'
);
color
=
new
ui
.
Color
.
fromARGB
(
255
,
0
,
255
,
0
);
color
=
new
ui
.
Color
.
fromARGB
(
255
,
0
,
255
,
0
);
ui
.
view
.
setFrameCallback
(
beginFrame
)
;
ui
.
window
.
onBeginFrame
=
beginFrame
;
ui
.
view
.
setEventCallback
(
handleEvent
)
;
ui
.
window
.
onEvent
=
handleEvent
;
ui
.
vie
w
.
scheduleFrame
();
ui
.
windo
w
.
scheduleFrame
();
}
}
examples/raw/painting.dart
View file @
3373d0ba
...
@@ -17,9 +17,9 @@ ui.Picture paint(ui.Rect paintBounds) {
...
@@ -17,9 +17,9 @@ ui.Picture paint(ui.Rect paintBounds) {
canvas
.
drawPaint
(
new
ui
.
Paint
()..
color
=
const
ui
.
Color
(
0xFFFFFFFF
));
canvas
.
drawPaint
(
new
ui
.
Paint
()..
color
=
const
ui
.
Color
(
0xFFFFFFFF
));
canvas
.
save
();
canvas
.
save
();
canvas
.
translate
(-
mid
.
x
/
2.0
,
ui
.
view
.
height
*
2.0
);
canvas
.
translate
(-
mid
.
x
/
2.0
,
ui
.
window
.
size
.
height
*
2.0
);
canvas
.
clipRect
(
canvas
.
clipRect
(
new
ui
.
Rect
.
fromLTRB
(
0.0
,
-
ui
.
view
.
height
,
ui
.
view
.
width
,
radius
));
new
ui
.
Rect
.
fromLTRB
(
0.0
,
-
ui
.
window
.
size
.
height
,
ui
.
window
.
size
.
width
,
radius
));
canvas
.
translate
(
mid
.
x
,
mid
.
y
);
canvas
.
translate
(
mid
.
x
,
mid
.
y
);
paint
.
color
=
const
ui
.
Color
.
fromARGB
(
128
,
255
,
0
,
255
);
paint
.
color
=
const
ui
.
Color
.
fromARGB
(
128
,
255
,
0
,
255
);
...
@@ -94,8 +94,8 @@ ui.Picture paint(ui.Rect paintBounds) {
...
@@ -94,8 +94,8 @@ ui.Picture paint(ui.Rect paintBounds) {
}
}
ui
.
Scene
composite
(
ui
.
Picture
picture
,
ui
.
Rect
paintBounds
)
{
ui
.
Scene
composite
(
ui
.
Picture
picture
,
ui
.
Rect
paintBounds
)
{
final
double
devicePixelRatio
=
ui
.
vie
w
.
devicePixelRatio
;
final
double
devicePixelRatio
=
ui
.
windo
w
.
devicePixelRatio
;
ui
.
Rect
sceneBounds
=
new
ui
.
Rect
.
fromLTWH
(
0.0
,
0.0
,
ui
.
view
.
width
*
devicePixelRatio
,
ui
.
view
.
height
*
devicePixelRatio
);
ui
.
Rect
sceneBounds
=
new
ui
.
Rect
.
fromLTWH
(
0.0
,
0.0
,
ui
.
window
.
size
.
width
*
devicePixelRatio
,
ui
.
window
.
size
.
height
*
devicePixelRatio
);
Float64List
deviceTransform
=
new
Float64List
(
16
)
Float64List
deviceTransform
=
new
Float64List
(
16
)
..[
0
]
=
devicePixelRatio
..[
0
]
=
devicePixelRatio
..[
5
]
=
devicePixelRatio
..[
5
]
=
devicePixelRatio
...
@@ -108,14 +108,14 @@ ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
...
@@ -108,14 +108,14 @@ ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
return
sceneBuilder
.
build
();
return
sceneBuilder
.
build
();
}
}
void
beginFrame
(
double
timeStamp
)
{
void
beginFrame
(
Duration
timeStamp
)
{
ui
.
Rect
paintBounds
=
new
ui
.
Rect
.
fromLTWH
(
0.0
,
0.0
,
ui
.
view
.
width
,
ui
.
view
.
height
)
;
ui
.
Rect
paintBounds
=
ui
.
Point
.
origin
&
ui
.
window
.
size
;
ui
.
Picture
picture
=
paint
(
paintBounds
);
ui
.
Picture
picture
=
paint
(
paintBounds
);
ui
.
Scene
scene
=
composite
(
picture
,
paintBounds
);
ui
.
Scene
scene
=
composite
(
picture
,
paintBounds
);
ui
.
view
.
scene
=
scene
;
ui
.
window
.
render
(
scene
)
;
}
}
void
main
(
)
{
void
main
(
)
{
ui
.
view
.
setFrameCallback
(
beginFrame
)
;
ui
.
window
.
onBeginFrame
=
beginFrame
;
ui
.
vie
w
.
scheduleFrame
();
ui
.
windo
w
.
scheduleFrame
();
}
}
examples/raw/shadow.dart
View file @
3373d0ba
...
@@ -37,8 +37,8 @@ ui.Picture paint(ui.Rect paintBounds) {
...
@@ -37,8 +37,8 @@ ui.Picture paint(ui.Rect paintBounds) {
}
}
ui
.
Scene
composite
(
ui
.
Picture
picture
,
ui
.
Rect
paintBounds
)
{
ui
.
Scene
composite
(
ui
.
Picture
picture
,
ui
.
Rect
paintBounds
)
{
final
double
devicePixelRatio
=
ui
.
vie
w
.
devicePixelRatio
;
final
double
devicePixelRatio
=
ui
.
windo
w
.
devicePixelRatio
;
ui
.
Rect
sceneBounds
=
new
ui
.
Rect
.
fromLTWH
(
0.0
,
0.0
,
ui
.
view
.
width
*
devicePixelRatio
,
ui
.
view
.
height
*
devicePixelRatio
);
ui
.
Rect
sceneBounds
=
new
ui
.
Rect
.
fromLTWH
(
0.0
,
0.0
,
ui
.
window
.
size
.
width
*
devicePixelRatio
,
ui
.
window
.
size
.
height
*
devicePixelRatio
);
Float64List
deviceTransform
=
new
Float64List
(
16
)
Float64List
deviceTransform
=
new
Float64List
(
16
)
..[
0
]
=
devicePixelRatio
..[
0
]
=
devicePixelRatio
..[
5
]
=
devicePixelRatio
..[
5
]
=
devicePixelRatio
...
@@ -51,14 +51,14 @@ ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
...
@@ -51,14 +51,14 @@ ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
return
sceneBuilder
.
build
();
return
sceneBuilder
.
build
();
}
}
void
beginFrame
(
double
timeStamp
)
{
void
beginFrame
(
Duration
timeStamp
)
{
ui
.
Rect
paintBounds
=
new
ui
.
Rect
.
fromLTWH
(
0.0
,
0.0
,
ui
.
view
.
width
,
ui
.
view
.
height
)
;
ui
.
Rect
paintBounds
=
ui
.
Point
.
origin
&
ui
.
window
.
size
;
ui
.
Picture
picture
=
paint
(
paintBounds
);
ui
.
Picture
picture
=
paint
(
paintBounds
);
ui
.
Scene
scene
=
composite
(
picture
,
paintBounds
);
ui
.
Scene
scene
=
composite
(
picture
,
paintBounds
);
ui
.
view
.
scene
=
scene
;
ui
.
window
.
render
(
scene
)
;
}
}
void
main
(
)
{
void
main
(
)
{
ui
.
view
.
setFrameCallback
(
beginFrame
)
;
ui
.
window
.
onBeginFrame
=
beginFrame
;
ui
.
vie
w
.
scheduleFrame
();
ui
.
windo
w
.
scheduleFrame
();
}
}
examples/raw/spinning_arabic.dart
View file @
3373d0ba
...
@@ -6,14 +6,14 @@ import 'dart:math' as math;
...
@@ -6,14 +6,14 @@ import 'dart:math' as math;
import
'dart:ui'
as
ui
;
import
'dart:ui'
as
ui
;
import
'dart:typed_data'
;
import
'dart:typed_data'
;
double
timeBase
=
null
;
Duration
timeBase
=
null
;
ui
.
Paragraph
paragraph
;
ui
.
Paragraph
paragraph
;
ui
.
Picture
paint
(
ui
.
Rect
paintBounds
,
double
delta
)
{
ui
.
Picture
paint
(
ui
.
Rect
paintBounds
,
double
delta
)
{
ui
.
PictureRecorder
recorder
=
new
ui
.
PictureRecorder
();
ui
.
PictureRecorder
recorder
=
new
ui
.
PictureRecorder
();
ui
.
Canvas
canvas
=
new
ui
.
Canvas
(
recorder
,
paintBounds
);
ui
.
Canvas
canvas
=
new
ui
.
Canvas
(
recorder
,
paintBounds
);
canvas
.
translate
(
ui
.
view
.
width
/
2.0
,
ui
.
view
.
height
/
2.0
);
canvas
.
translate
(
ui
.
window
.
size
.
width
/
2.0
,
ui
.
window
.
size
.
height
/
2.0
);
canvas
.
rotate
(
math
.
PI
*
delta
/
1800
);
canvas
.
rotate
(
math
.
PI
*
delta
/
1800
);
canvas
.
drawRect
(
new
ui
.
Rect
.
fromLTRB
(-
100.0
,
-
100.0
,
100.0
,
100.0
),
canvas
.
drawRect
(
new
ui
.
Rect
.
fromLTRB
(-
100.0
,
-
100.0
,
100.0
,
100.0
),
new
ui
.
Paint
()..
color
=
const
ui
.
Color
.
fromARGB
(
255
,
0
,
255
,
0
));
new
ui
.
Paint
()..
color
=
const
ui
.
Color
.
fromARGB
(
255
,
0
,
255
,
0
));
...
@@ -29,8 +29,8 @@ ui.Picture paint(ui.Rect paintBounds, double delta) {
...
@@ -29,8 +29,8 @@ ui.Picture paint(ui.Rect paintBounds, double delta) {
}
}
ui
.
Scene
composite
(
ui
.
Picture
picture
,
ui
.
Rect
paintBounds
)
{
ui
.
Scene
composite
(
ui
.
Picture
picture
,
ui
.
Rect
paintBounds
)
{
final
double
devicePixelRatio
=
ui
.
vie
w
.
devicePixelRatio
;
final
double
devicePixelRatio
=
ui
.
windo
w
.
devicePixelRatio
;
ui
.
Rect
sceneBounds
=
new
ui
.
Rect
.
fromLTWH
(
0.0
,
0.0
,
ui
.
view
.
width
*
devicePixelRatio
,
ui
.
view
.
height
*
devicePixelRatio
);
ui
.
Rect
sceneBounds
=
new
ui
.
Rect
.
fromLTWH
(
0.0
,
0.0
,
ui
.
window
.
size
.
width
*
devicePixelRatio
,
ui
.
window
.
size
.
height
*
devicePixelRatio
);
Float64List
deviceTransform
=
new
Float64List
(
16
)
Float64List
deviceTransform
=
new
Float64List
(
16
)
..[
0
]
=
devicePixelRatio
..[
0
]
=
devicePixelRatio
..[
5
]
=
devicePixelRatio
..[
5
]
=
devicePixelRatio
...
@@ -43,15 +43,15 @@ ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
...
@@ -43,15 +43,15 @@ ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
return
sceneBuilder
.
build
();
return
sceneBuilder
.
build
();
}
}
void
beginFrame
(
double
timeStamp
)
{
void
beginFrame
(
Duration
timeStamp
)
{
if
(
timeBase
==
null
)
if
(
timeBase
==
null
)
timeBase
=
timeStamp
;
timeBase
=
timeStamp
;
double
delta
=
timeStamp
-
timeBase
;
double
delta
=
(
timeStamp
-
timeBase
).
inMicroseconds
/
Duration
.
MICROSECONDS_PER_MILLISECOND
;
ui
.
Rect
paintBounds
=
new
ui
.
Rect
.
fromLTWH
(
0.0
,
0.0
,
ui
.
view
.
width
,
ui
.
view
.
height
)
;
ui
.
Rect
paintBounds
=
ui
.
Point
.
origin
&
ui
.
window
.
size
;
ui
.
Picture
picture
=
paint
(
paintBounds
,
delta
);
ui
.
Picture
picture
=
paint
(
paintBounds
,
delta
);
ui
.
Scene
scene
=
composite
(
picture
,
paintBounds
);
ui
.
Scene
scene
=
composite
(
picture
,
paintBounds
);
ui
.
view
.
scene
=
scene
;
ui
.
window
.
render
(
scene
)
;
ui
.
vie
w
.
scheduleFrame
();
ui
.
windo
w
.
scheduleFrame
();
}
}
void
main
(
)
{
void
main
(
)
{
...
@@ -63,6 +63,6 @@ void main() {
...
@@ -63,6 +63,6 @@ void main() {
builder
.
addText
(
" و أكثر قليلا لجعله أطول. "
);
builder
.
addText
(
" و أكثر قليلا لجعله أطول. "
);
paragraph
=
builder
.
build
(
new
ui
.
ParagraphStyle
());
paragraph
=
builder
.
build
(
new
ui
.
ParagraphStyle
());
ui
.
view
.
setFrameCallback
(
beginFrame
)
;
ui
.
window
.
onBeginFrame
=
beginFrame
;
ui
.
vie
w
.
scheduleFrame
();
ui
.
windo
w
.
scheduleFrame
();
}
}
examples/raw/spinning_image.dart
View file @
3373d0ba
...
@@ -8,7 +8,7 @@ import 'dart:typed_data';
...
@@ -8,7 +8,7 @@ import 'dart:typed_data';
import
'package:flutter/services.dart'
;
import
'package:flutter/services.dart'
;
double
timeBase
=
null
;
Duration
timeBase
=
null
;
ui
.
Image
image
=
null
;
ui
.
Image
image
=
null
;
String
url1
=
"https://raw.githubusercontent.com/dart-lang/logos/master/logos_and_wordmarks/dart-logo.png"
;
String
url1
=
"https://raw.githubusercontent.com/dart-lang/logos/master/logos_and_wordmarks/dart-logo.png"
;
...
@@ -42,8 +42,8 @@ ui.Picture paint(ui.Rect paintBounds, double delta) {
...
@@ -42,8 +42,8 @@ ui.Picture paint(ui.Rect paintBounds, double delta) {
}
}
ui
.
Scene
composite
(
ui
.
Picture
picture
,
ui
.
Rect
paintBounds
)
{
ui
.
Scene
composite
(
ui
.
Picture
picture
,
ui
.
Rect
paintBounds
)
{
final
double
devicePixelRatio
=
ui
.
vie
w
.
devicePixelRatio
;
final
double
devicePixelRatio
=
ui
.
windo
w
.
devicePixelRatio
;
ui
.
Rect
sceneBounds
=
new
ui
.
Rect
.
fromLTWH
(
0.0
,
0.0
,
ui
.
view
.
width
*
devicePixelRatio
,
ui
.
view
.
height
*
devicePixelRatio
);
ui
.
Rect
sceneBounds
=
new
ui
.
Rect
.
fromLTWH
(
0.0
,
0.0
,
ui
.
window
.
size
.
width
*
devicePixelRatio
,
ui
.
window
.
size
.
height
*
devicePixelRatio
);
Float64List
deviceTransform
=
new
Float64List
(
16
)
Float64List
deviceTransform
=
new
Float64List
(
16
)
..[
0
]
=
devicePixelRatio
..[
0
]
=
devicePixelRatio
..[
5
]
=
devicePixelRatio
..[
5
]
=
devicePixelRatio
...
@@ -56,15 +56,15 @@ ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
...
@@ -56,15 +56,15 @@ ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
return
sceneBuilder
.
build
();
return
sceneBuilder
.
build
();
}
}
void
beginFrame
(
double
timeStamp
)
{
void
beginFrame
(
Duration
timeStamp
)
{
if
(
timeBase
==
null
)
if
(
timeBase
==
null
)
timeBase
=
timeStamp
;
timeBase
=
timeStamp
;
double
delta
=
timeStamp
-
timeBase
;
double
delta
=
(
timeStamp
-
timeBase
).
inMicroseconds
/
Duration
.
MICROSECONDS_PER_MILLISECOND
;
ui
.
Rect
paintBounds
=
new
ui
.
Rect
.
fromLTWH
(
0.0
,
0.0
,
ui
.
view
.
width
,
ui
.
view
.
height
)
;
ui
.
Rect
paintBounds
=
ui
.
Point
.
origin
&
ui
.
window
.
size
;
ui
.
Picture
picture
=
paint
(
paintBounds
,
delta
);
ui
.
Picture
picture
=
paint
(
paintBounds
,
delta
);
ui
.
Scene
scene
=
composite
(
picture
,
paintBounds
);
ui
.
Scene
scene
=
composite
(
picture
,
paintBounds
);
ui
.
view
.
scene
=
scene
;
ui
.
window
.
render
(
scene
)
;
ui
.
vie
w
.
scheduleFrame
();
ui
.
windo
w
.
scheduleFrame
();
}
}
...
@@ -72,7 +72,7 @@ void handleImageLoad(result) {
...
@@ -72,7 +72,7 @@ void handleImageLoad(result) {
if
(
result
!=
image
)
{
if
(
result
!=
image
)
{
print
(
"
${result.width}
x
${result.width}
image loaded!"
);
print
(
"
${result.width}
x
${result.width}
image loaded!"
);
image
=
result
;
image
=
result
;
ui
.
vie
w
.
scheduleFrame
();
ui
.
windo
w
.
scheduleFrame
();
}
else
{
}
else
{
print
(
"Existing image was loaded again"
);
print
(
"Existing image was loaded again"
);
}
}
...
@@ -93,6 +93,6 @@ bool handleEvent(ui.Event event) {
...
@@ -93,6 +93,6 @@ bool handleEvent(ui.Event event) {
void
main
(
)
{
void
main
(
)
{
imageCache
.
load
(
url1
).
first
.
then
(
handleImageLoad
);
imageCache
.
load
(
url1
).
first
.
then
(
handleImageLoad
);
ui
.
view
.
setEventCallback
(
handleEvent
)
;
ui
.
window
.
onEvent
=
handleEvent
;
ui
.
view
.
setFrameCallback
(
beginFrame
)
;
ui
.
window
.
onBeginFrame
=
beginFrame
;
}
}
examples/raw/spinning_square.dart
View file @
3373d0ba
...
@@ -6,16 +6,16 @@ import 'dart:math' as math;
...
@@ -6,16 +6,16 @@ import 'dart:math' as math;
import
'dart:ui'
as
ui
;
import
'dart:ui'
as
ui
;
import
'dart:typed_data'
;
import
'dart:typed_data'
;
double
timeBase
=
null
;
Duration
timeBase
=
null
;
void
beginFrame
(
double
timeStamp
)
{
void
beginFrame
(
Duration
timeStamp
)
{
ui
.
tracing
.
begin
(
'beginFrame'
);
ui
.
tracing
.
begin
(
'beginFrame'
);
if
(
timeBase
==
null
)
if
(
timeBase
==
null
)
timeBase
=
timeStamp
;
timeBase
=
timeStamp
;
double
delta
=
timeStamp
-
timeBase
;
double
delta
=
(
timeStamp
-
timeBase
).
inMicroseconds
/
Duration
.
MICROSECONDS_PER_MILLISECOND
;
// paint
// paint
ui
.
Rect
paintBounds
=
new
ui
.
Rect
.
fromLTWH
(
0.0
,
0.0
,
ui
.
view
.
width
,
ui
.
view
.
height
)
;
ui
.
Rect
paintBounds
=
ui
.
Point
.
origin
&
ui
.
window
.
size
;
ui
.
PictureRecorder
recorder
=
new
ui
.
PictureRecorder
();
ui
.
PictureRecorder
recorder
=
new
ui
.
PictureRecorder
();
ui
.
Canvas
canvas
=
new
ui
.
Canvas
(
recorder
,
paintBounds
);
ui
.
Canvas
canvas
=
new
ui
.
Canvas
(
recorder
,
paintBounds
);
canvas
.
translate
(
paintBounds
.
width
/
2.0
,
paintBounds
.
height
/
2.0
);
canvas
.
translate
(
paintBounds
.
width
/
2.0
,
paintBounds
.
height
/
2.0
);
...
@@ -25,8 +25,8 @@ void beginFrame(double timeStamp) {
...
@@ -25,8 +25,8 @@ void beginFrame(double timeStamp) {
ui
.
Picture
picture
=
recorder
.
endRecording
();
ui
.
Picture
picture
=
recorder
.
endRecording
();
// composite
// composite
final
double
devicePixelRatio
=
ui
.
vie
w
.
devicePixelRatio
;
final
double
devicePixelRatio
=
ui
.
windo
w
.
devicePixelRatio
;
ui
.
Rect
sceneBounds
=
new
ui
.
Rect
.
fromLTWH
(
0.0
,
0.0
,
ui
.
view
.
width
*
devicePixelRatio
,
ui
.
view
.
height
*
devicePixelRatio
);
ui
.
Rect
sceneBounds
=
new
ui
.
Rect
.
fromLTWH
(
0.0
,
0.0
,
ui
.
window
.
size
.
width
*
devicePixelRatio
,
ui
.
window
.
size
.
height
*
devicePixelRatio
);
Float64List
deviceTransform
=
new
Float64List
(
16
)
Float64List
deviceTransform
=
new
Float64List
(
16
)
..[
0
]
=
devicePixelRatio
..[
0
]
=
devicePixelRatio
..[
5
]
=
devicePixelRatio
..[
5
]
=
devicePixelRatio
...
@@ -36,13 +36,13 @@ void beginFrame(double timeStamp) {
...
@@ -36,13 +36,13 @@ void beginFrame(double timeStamp) {
..
pushTransform
(
deviceTransform
)
..
pushTransform
(
deviceTransform
)
..
addPicture
(
ui
.
Offset
.
zero
,
picture
,
paintBounds
)
..
addPicture
(
ui
.
Offset
.
zero
,
picture
,
paintBounds
)
..
pop
();
..
pop
();
ui
.
view
.
scene
=
sceneBuilder
.
build
(
);
ui
.
window
.
render
(
sceneBuilder
.
build
()
);
ui
.
tracing
.
end
(
'beginFrame'
);
ui
.
tracing
.
end
(
'beginFrame'
);
ui
.
vie
w
.
scheduleFrame
();
ui
.
windo
w
.
scheduleFrame
();
}
}
void
main
(
)
{
void
main
(
)
{
ui
.
view
.
setFrameCallback
(
beginFrame
)
;
ui
.
window
.
onBeginFrame
=
beginFrame
;
ui
.
vie
w
.
scheduleFrame
();
ui
.
windo
w
.
scheduleFrame
();
}
}
examples/rendering/interactive_flex.dart
View file @
3373d0ba
...
@@ -101,5 +101,5 @@ Pancetta meatball tongue tenderloin rump tail jowl boudin.""";
...
@@ -101,5 +101,5 @@ Pancetta meatball tongue tenderloin rump tail jowl boudin.""";
updateTaskDescription
(
'Interactive Flex'
,
topColor
);
updateTaskDescription
(
'Interactive Flex'
,
topColor
);
new
FlutterBinding
(
root:
root
);
new
FlutterBinding
(
root:
root
);
ui
.
view
.
setEventCallback
(
handleEvent
)
;
ui
.
window
.
onEvent
=
handleEvent
;
}
}
examples/stocks/lib/stock_menu.dart
View file @
3373d0ba
...
@@ -12,8 +12,8 @@ Future showStockMenu({BuildContext context, bool autorefresh, ValueChanged<bool>
...
@@ -12,8 +12,8 @@ Future showStockMenu({BuildContext context, bool autorefresh, ValueChanged<bool>
switch
(
await
showMenu
(
switch
(
await
showMenu
(
context:
context
,
context:
context
,
position:
new
MenuPosition
(
position:
new
MenuPosition
(
right:
ui
.
view
.
paddingR
ight
+
_kMenuMargin
,
right:
ui
.
window
.
padding
.
r
ight
+
_kMenuMargin
,
top:
ui
.
view
.
paddingT
op
+
_kMenuMargin
top:
ui
.
window
.
padding
.
t
op
+
_kMenuMargin
),
),
items:
<
PopupMenuItem
>[
items:
<
PopupMenuItem
>[
new
PopupMenuItem
(
new
PopupMenuItem
(
...
...
packages/flutter/lib/src/animation/scheduler.dart
View file @
3373d0ba
...
@@ -27,7 +27,7 @@ SchedulerExceptionHandler debugSchedulerExceptionHandler;
...
@@ -27,7 +27,7 @@ SchedulerExceptionHandler debugSchedulerExceptionHandler;
class
Scheduler
{
class
Scheduler
{
/// Requires clients to use the [scheduler] singleton
/// Requires clients to use the [scheduler] singleton
Scheduler
.
_
()
{
Scheduler
.
_
()
{
ui
.
view
.
setFrameCallback
(
beginFrame
)
;
ui
.
window
.
onBeginFrame
=
beginFrame
;
}
}
bool
_haveScheduledVisualUpdate
=
false
;
bool
_haveScheduledVisualUpdate
=
false
;
...
@@ -49,13 +49,11 @@ class Scheduler {
...
@@ -49,13 +49,11 @@ class Scheduler {
/// [requestAnimationFrame], then calls all the callbacks registered by
/// [requestAnimationFrame], then calls all the callbacks registered by
/// [addPersistentFrameCallback], which typically drive the rendering pipeline,
/// [addPersistentFrameCallback], which typically drive the rendering pipeline,
/// and finally calls the callbacks registered by [requestPostFrameCallback].
/// and finally calls the callbacks registered by [requestPostFrameCallback].
void
beginFrame
(
double
rawTimeStamp
)
{
void
beginFrame
(
Duration
rawTimeStamp
)
{
assert
(!
_inFrame
);
assert
(!
_inFrame
);
_inFrame
=
true
;
_inFrame
=
true
;
rawTimeStamp
/=
timeDilation
;
Duration
timeStamp
=
new
Duration
(
final
Duration
timeStamp
=
new
Duration
(
microseconds:
(
rawTimeStamp
.
inMicroseconds
/
timeDilation
).
round
());
microseconds:
(
rawTimeStamp
*
Duration
.
MICROSECONDS_PER_MILLISECOND
).
round
()
);
_haveScheduledVisualUpdate
=
false
;
_haveScheduledVisualUpdate
=
false
;
assert
(
_postFrameCallbacks
.
length
==
0
);
assert
(
_postFrameCallbacks
.
length
==
0
);
...
@@ -148,7 +146,7 @@ class Scheduler {
...
@@ -148,7 +146,7 @@ class Scheduler {
void
ensureVisualUpdate
()
{
void
ensureVisualUpdate
()
{
if
(
_haveScheduledVisualUpdate
)
if
(
_haveScheduledVisualUpdate
)
return
;
return
;
ui
.
vie
w
.
scheduleFrame
();
ui
.
windo
w
.
scheduleFrame
();
_haveScheduledVisualUpdate
=
true
;
_haveScheduledVisualUpdate
=
true
;
}
}
}
}
...
...
packages/flutter/lib/src/animation/scroll_behavior.dart
View file @
3373d0ba
...
@@ -109,11 +109,11 @@ Simulation _createFlingScrollSimulation(double position, double velocity, double
...
@@ -109,11 +109,11 @@ Simulation _createFlingScrollSimulation(double position, double velocity, double
// scrolling less than one logical pixel per frame. We're essentially
// scrolling less than one logical pixel per frame. We're essentially
// normalizing by the devicePixelRatio so that the threshold has the
// normalizing by the devicePixelRatio so that the threshold has the
// same effect independent of the device's pixel density.
// same effect independent of the device's pixel density.
double
endVelocity
=
15.0
*
ui
.
vie
w
.
devicePixelRatio
;
double
endVelocity
=
15.0
*
ui
.
windo
w
.
devicePixelRatio
;
// Similar to endVelocity. Stop scrolling when we're this close to
// Similar to endVelocity. Stop scrolling when we're this close to
// destiniation scroll offset.
// destiniation scroll offset.
double
endDistance
=
0.5
*
ui
.
vie
w
.
devicePixelRatio
;
double
endDistance
=
0.5
*
ui
.
windo
w
.
devicePixelRatio
;
SpringDescription
spring
=
new
SpringDescription
.
withDampingRatio
(
mass:
1.0
,
springConstant:
170.0
,
ratio:
1.1
);
SpringDescription
spring
=
new
SpringDescription
.
withDampingRatio
(
mass:
1.0
,
springConstant:
170.0
,
ratio:
1.1
);
ScrollSimulation
simulation
=
ScrollSimulation
simulation
=
...
@@ -124,7 +124,7 @@ Simulation _createFlingScrollSimulation(double position, double velocity, double
...
@@ -124,7 +124,7 @@ Simulation _createFlingScrollSimulation(double position, double velocity, double
Simulation
_createSnapScrollSimulation
(
double
startOffset
,
double
endOffset
,
double
velocity
)
{
Simulation
_createSnapScrollSimulation
(
double
startOffset
,
double
endOffset
,
double
velocity
)
{
double
startVelocity
=
velocity
*
_kSecondsPerMillisecond
;
double
startVelocity
=
velocity
*
_kSecondsPerMillisecond
;
double
endVelocity
=
15.0
*
ui
.
vie
w
.
devicePixelRatio
*
velocity
.
sign
;
double
endVelocity
=
15.0
*
ui
.
windo
w
.
devicePixelRatio
*
velocity
.
sign
;
return
new
FrictionSimulation
.
through
(
startOffset
,
endOffset
,
startVelocity
,
endVelocity
);
return
new
FrictionSimulation
.
through
(
startOffset
,
endOffset
,
startVelocity
,
endVelocity
);
}
}
...
...
packages/flutter/lib/src/material/scaffold.dart
View file @
3373d0ba
...
@@ -28,7 +28,7 @@ class Scaffold extends StatelessComponent {
...
@@ -28,7 +28,7 @@ class Scaffold extends StatelessComponent {
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
double
toolBarHeight
=
0.0
;
double
toolBarHeight
=
0.0
;
if
(
toolBar
!=
null
)
if
(
toolBar
!=
null
)
toolBarHeight
=
kToolBarHeight
+
ui
.
view
.
paddingT
op
;
toolBarHeight
=
kToolBarHeight
+
ui
.
window
.
padding
.
t
op
;
double
statusBarHeight
=
0.0
;
double
statusBarHeight
=
0.0
;
if
(
statusBar
!=
null
)
if
(
statusBar
!=
null
)
...
...
packages/flutter/lib/src/rendering/binding.dart
View file @
3373d0ba
...
@@ -132,9 +132,9 @@ class FlutterBinding extends HitTestTarget {
...
@@ -132,9 +132,9 @@ class FlutterBinding extends HitTestTarget {
assert
(
_instance
==
null
);
assert
(
_instance
==
null
);
_instance
=
this
;
_instance
=
this
;
ui
.
view
.
setEventCallback
(
_handleEvent
);
ui
.
window
.
onEvent
=
_handleEvent
;
ui
.
window
.
onMetricsChanged
=
_handleMetricsChanged
;
ui
.
view
.
setMetricsChangedCallback
(
_handleMetricsChanged
);
if
(
renderViewOverride
==
null
)
{
if
(
renderViewOverride
==
null
)
{
_renderView
=
new
RenderView
(
child:
root
);
_renderView
=
new
RenderView
(
child:
root
);
_renderView
.
attach
();
_renderView
.
attach
();
...
@@ -166,7 +166,7 @@ class FlutterBinding extends HitTestTarget {
...
@@ -166,7 +166,7 @@ class FlutterBinding extends HitTestTarget {
bool
removeMetricListener
(
MetricListener
listener
)
=>
_metricListeners
.
remove
(
listener
);
bool
removeMetricListener
(
MetricListener
listener
)
=>
_metricListeners
.
remove
(
listener
);
void
_handleMetricsChanged
()
{
void
_handleMetricsChanged
()
{
Size
size
=
new
Size
(
ui
.
view
.
width
,
ui
.
view
.
height
)
;
Size
size
=
ui
.
window
.
size
;
_renderView
.
rootConstraints
=
new
ViewConstraints
(
size:
size
);
_renderView
.
rootConstraints
=
new
ViewConstraints
(
size:
size
);
for
(
MetricListener
listener
in
_metricListeners
)
for
(
MetricListener
listener
in
_metricListeners
)
listener
(
size
);
listener
(
size
);
...
...
packages/flutter/lib/src/rendering/view.dart
View file @
3373d0ba
...
@@ -62,7 +62,7 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
...
@@ -62,7 +62,7 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
}
}
Matrix4
get
_logicalToDeviceTransform
{
Matrix4
get
_logicalToDeviceTransform
{
double
devicePixelRatio
=
ui
.
vie
w
.
devicePixelRatio
;
double
devicePixelRatio
=
ui
.
windo
w
.
devicePixelRatio
;
return
new
Matrix4
.
diagonal3Values
(
devicePixelRatio
,
devicePixelRatio
,
1.0
);
return
new
Matrix4
.
diagonal3Values
(
devicePixelRatio
,
devicePixelRatio
,
1.0
);
}
}
...
@@ -119,10 +119,10 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
...
@@ -119,10 +119,10 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
ui
.
tracing
.
begin
(
'RenderView.compositeFrame'
);
ui
.
tracing
.
begin
(
'RenderView.compositeFrame'
);
try
{
try
{
(
layer
as
TransformLayer
).
transform
=
_logicalToDeviceTransform
;
(
layer
as
TransformLayer
).
transform
=
_logicalToDeviceTransform
;
Rect
bounds
=
Point
.
origin
&
(
size
*
ui
.
vie
w
.
devicePixelRatio
);
Rect
bounds
=
Point
.
origin
&
(
size
*
ui
.
windo
w
.
devicePixelRatio
);
ui
.
SceneBuilder
builder
=
new
ui
.
SceneBuilder
(
bounds
);
ui
.
SceneBuilder
builder
=
new
ui
.
SceneBuilder
(
bounds
);
layer
.
addToScene
(
builder
,
Offset
.
zero
);
layer
.
addToScene
(
builder
,
Offset
.
zero
);
ui
.
view
.
scene
=
builder
.
build
(
);
ui
.
window
.
render
(
builder
.
build
()
);
}
finally
{
}
finally
{
ui
.
tracing
.
end
(
'RenderView.compositeFrame'
);
ui
.
tracing
.
end
(
'RenderView.compositeFrame'
);
}
}
...
@@ -130,6 +130,6 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
...
@@ -130,6 +130,6 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
Rect
get
paintBounds
=>
Point
.
origin
&
size
;
Rect
get
paintBounds
=>
Point
.
origin
&
size
;
String
debugDescribeSettings
(
String
prefix
)
=>
'
${prefix}
view width:
${ui.view.width}
(in device pixels)
\n
${prefix}
view height:
${ui.view.height}
(in device pixels)
\n
${prefix}
device pixel ratio:
${ui.vie
w.devicePixelRatio}
(device pixels per logical pixel)
\n
${prefix}
root constraints:
$rootConstraints
(in logical pixels)
\n
'
;
String
debugDescribeSettings
(
String
prefix
)
=>
'
${prefix}
window size:
${ui.window.size}
(in device pixels)
\n
${prefix}
device pixel ratio:
${ui.windo
w.devicePixelRatio}
(device pixels per logical pixel)
\n
${prefix}
root constraints:
$rootConstraints
(in logical pixels)
\n
'
;
// call to ${super.debugDescribeSettings(prefix)} is omitted because the root superclasses don't include any interesting information for this class
// call to ${super.debugDescribeSettings(prefix)} is omitted because the root superclasses don't include any interesting information for this class
}
}
packages/flutter/lib/src/rendering/viewport.dart
View file @
3373d0ba
...
@@ -136,7 +136,7 @@ class RenderViewport extends RenderBox with RenderObjectWithChildMixin<RenderBox
...
@@ -136,7 +136,7 @@ class RenderViewport extends RenderBox with RenderObjectWithChildMixin<RenderBox
}
}
Offset
get
_scrollOffsetRoundedToIntegerDevicePixels
{
Offset
get
_scrollOffsetRoundedToIntegerDevicePixels
{
double
devicePixelRatio
=
ui
.
vie
w
.
devicePixelRatio
;
double
devicePixelRatio
=
ui
.
windo
w
.
devicePixelRatio
;
int
dxInDevicePixels
=
(
scrollOffset
.
dx
*
devicePixelRatio
).
round
();
int
dxInDevicePixels
=
(
scrollOffset
.
dx
*
devicePixelRatio
).
round
();
int
dyInDevicePixels
=
(
scrollOffset
.
dy
*
devicePixelRatio
).
round
();
int
dyInDevicePixels
=
(
scrollOffset
.
dy
*
devicePixelRatio
).
round
();
return
new
Offset
(
dxInDevicePixels
/
devicePixelRatio
,
return
new
Offset
(
dxInDevicePixels
/
devicePixelRatio
,
...
...
packages/unit/test/animation/scheduler_test.dart
View file @
3373d0ba
...
@@ -26,7 +26,7 @@ void main() {
...
@@ -26,7 +26,7 @@ void main() {
scheduler
.
requestAnimationFrame
(
firstCallback
);
scheduler
.
requestAnimationFrame
(
firstCallback
);
secondId
=
scheduler
.
requestAnimationFrame
(
secondCallback
);
secondId
=
scheduler
.
requestAnimationFrame
(
secondCallback
);
scheduler
.
beginFrame
(
16.0
);
scheduler
.
beginFrame
(
const
Duration
(
milliseconds:
16
)
);
expect
(
firstCallbackRan
,
isTrue
);
expect
(
firstCallbackRan
,
isTrue
);
expect
(
secondCallbackRan
,
isFalse
);
expect
(
secondCallbackRan
,
isFalse
);
...
@@ -34,7 +34,7 @@ void main() {
...
@@ -34,7 +34,7 @@ void main() {
firstCallbackRan
=
false
;
firstCallbackRan
=
false
;
secondCallbackRan
=
false
;
secondCallbackRan
=
false
;
scheduler
.
beginFrame
(
32.0
);
scheduler
.
beginFrame
(
const
Duration
(
milliseconds:
32
)
);
expect
(
firstCallbackRan
,
isFalse
);
expect
(
firstCallbackRan
,
isFalse
);
expect
(
secondCallbackRan
,
isFalse
);
expect
(
secondCallbackRan
,
isFalse
);
...
...
packages/unit/test/widget/widget_tester.dart
View file @
3373d0ba
...
@@ -42,7 +42,7 @@ class WidgetTester {
...
@@ -42,7 +42,7 @@ class WidgetTester {
void
pump
([
Duration
duration
])
{
void
pump
([
Duration
duration
])
{
if
(
duration
!=
null
)
if
(
duration
!=
null
)
async
.
elapse
(
duration
);
async
.
elapse
(
duration
);
scheduler
.
beginFrame
(
clock
.
now
().
millisecondsSinceEpoch
.
toDouble
(
));
scheduler
.
beginFrame
(
new
Duration
(
milliseconds:
clock
.
now
().
millisecondsSinceEpoch
));
async
.
flushMicrotasks
();
async
.
flushMicrotasks
();
}
}
...
...
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