Commit ecce1eb3 authored by Adam Barth's avatar Adam Barth

Import dart:ui as ui (instead of as sky)

parent 65eba908
...@@ -49,7 +49,7 @@ class ExplosionBig extends Explosion { ...@@ -49,7 +49,7 @@ class ExplosionBig extends Explosion {
// Add ring // Add ring
Sprite sprtRing = new Sprite(sheet["explosion_ring.png"]); Sprite sprtRing = new Sprite(sheet["explosion_ring.png"]);
sprtRing.transferMode = sky.TransferMode.plus; sprtRing.transferMode = ui.TransferMode.plus;
addChild(sprtRing); addChild(sprtRing);
Action scale = new ActionTween( (a) => sprtRing.scale = a, 0.2, 1.0, 0.75); Action scale = new ActionTween( (a) => sprtRing.scale = a, 0.2, 1.0, 0.75);
...@@ -63,7 +63,7 @@ class ExplosionBig extends Explosion { ...@@ -63,7 +63,7 @@ class ExplosionBig extends Explosion {
Sprite sprtFlare = new Sprite(sheet["explosion_flare.png"]); Sprite sprtFlare = new Sprite(sheet["explosion_flare.png"]);
sprtFlare.pivot = new Point(0.3, 1.0); sprtFlare.pivot = new Point(0.3, 1.0);
sprtFlare.scaleX = 0.3; sprtFlare.scaleX = 0.3;
sprtFlare.transferMode = sky.TransferMode.plus; sprtFlare.transferMode = ui.TransferMode.plus;
sprtFlare.rotation = randomDouble() * 360.0; sprtFlare.rotation = randomDouble() * 360.0;
addChild(sprtFlare); addChild(sprtFlare);
...@@ -86,7 +86,7 @@ class ExplosionMini extends Explosion { ...@@ -86,7 +86,7 @@ class ExplosionMini extends Explosion {
Sprite star = new Sprite(sheet["star_0.png"]); Sprite star = new Sprite(sheet["star_0.png"]);
star.scale = 0.5; star.scale = 0.5;
star.colorOverlay = new Color(0xff95f4fb); star.colorOverlay = new Color(0xff95f4fb);
star.transferMode = sky.TransferMode.plus; star.transferMode = ui.TransferMode.plus;
addChild(star); addChild(star);
double rotationStart = randomDouble() * 90.0; double rotationStart = randomDouble() * 90.0;
......
...@@ -2,7 +2,7 @@ library game; ...@@ -2,7 +2,7 @@ library game;
import 'dart:async'; import 'dart:async';
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:skysprites/skysprites.dart'; import 'package:skysprites/skysprites.dart';
......
...@@ -26,7 +26,7 @@ class GameDemoNode extends NodeWithSize { ...@@ -26,7 +26,7 @@ class GameDemoNode extends NodeWithSize {
addChild(_starField); addChild(_starField);
// Add nebula // Add nebula
_nebula = new RepeatedImage(_images["assets/nebula.png"], sky.TransferMode.plus); _nebula = new RepeatedImage(_images["assets/nebula.png"], ui.TransferMode.plus);
addChild(_nebula); addChild(_nebula);
// Setup game screen, it will always be anchored to the bottom of the screen // Setup game screen, it will always be anchored to the bottom of the screen
......
...@@ -16,7 +16,7 @@ abstract class GameObject extends Node { ...@@ -16,7 +16,7 @@ abstract class GameObject extends Node {
Paint _paintDebug = new Paint() Paint _paintDebug = new Paint()
..color=new Color(0xffff0000) ..color=new Color(0xffff0000)
..strokeWidth = 1.0 ..strokeWidth = 1.0
..setStyle(sky.PaintingStyle.stroke); ..setStyle(ui.PaintingStyle.stroke);
bool collidingWith(GameObject obj) { bool collidingWith(GameObject obj) {
return (GameMath.distanceBetweenPoints(position, obj.position) return (GameMath.distanceBetweenPoints(position, obj.position)
...@@ -111,7 +111,7 @@ class Ship extends GameObject { ...@@ -111,7 +111,7 @@ class Ship extends GameObject {
_sprtShield = new Sprite(f.sheet["shield.png"]); _sprtShield = new Sprite(f.sheet["shield.png"]);
_sprtShield.scale = 0.35; _sprtShield.scale = 0.35;
_sprtShield.transferMode = sky.TransferMode.plus; _sprtShield.transferMode = ui.TransferMode.plus;
addChild(_sprtShield); addChild(_sprtShield);
radius = 20.0; radius = 20.0;
...@@ -188,7 +188,7 @@ class Laser extends GameObject { ...@@ -188,7 +188,7 @@ class Laser extends GameObject {
Sprite sprt = new Sprite(f.sheet["explosion_particle.png"]); Sprite sprt = new Sprite(f.sheet["explosion_particle.png"]);
sprt.scale = 0.5; sprt.scale = 0.5;
sprt.colorOverlay = laserColor; sprt.colorOverlay = laserColor;
sprt.transferMode = sky.TransferMode.plus; sprt.transferMode = ui.TransferMode.plus;
addChild(sprt); addChild(sprt);
sprites.add(sprt); sprites.add(sprt);
} }
......
...@@ -10,7 +10,7 @@ class PowerBar extends NodeWithSize { ...@@ -10,7 +10,7 @@ class PowerBar extends NodeWithSize {
Paint _paintOutline = new Paint() Paint _paintOutline = new Paint()
..color = new Color(0xffffffff) ..color = new Color(0xffffffff)
..strokeWidth = 1.0 ..strokeWidth = 1.0
..setStyle(sky.PaintingStyle.stroke); ..setStyle(ui.PaintingStyle.stroke);
void paint(PaintingCanvas canvas) { void paint(PaintingCanvas canvas) {
applyTransformForPivot(canvas); applyTransformForPivot(canvas);
......
...@@ -4,7 +4,7 @@ class RepeatedImage extends Node { ...@@ -4,7 +4,7 @@ class RepeatedImage extends Node {
Sprite _sprt0; Sprite _sprt0;
Sprite _sprt1; Sprite _sprt1;
RepeatedImage(sky.Image image, [sky.TransferMode mode = null]) { RepeatedImage(ui.Image image, [ui.TransferMode mode = null]) {
_sprt0 = new Sprite.fromImage(image); _sprt0 = new Sprite.fromImage(image);
_sprt0.size = new Size(1024.0, 1024.0); _sprt0.size = new Size(1024.0, 1024.0);
_sprt0.pivot = Point.origin; _sprt0.pivot = Point.origin;
......
part of game; part of game;
class StarField extends NodeWithSize { class StarField extends NodeWithSize {
sky.Image _image; ui.Image _image;
SpriteSheet _spriteSheet; SpriteSheet _spriteSheet;
int _numStars; int _numStars;
bool _autoScroll; bool _autoScroll;
...@@ -15,9 +15,9 @@ class StarField extends NodeWithSize { ...@@ -15,9 +15,9 @@ class StarField extends NodeWithSize {
Size _paddedSize = Size.zero; Size _paddedSize = Size.zero;
Paint _paint = new Paint() Paint _paint = new Paint()
..filterQuality = sky.FilterQuality.low ..filterQuality = ui.FilterQuality.low
..isAntiAlias = false ..isAntiAlias = false
..transferMode = sky.TransferMode.plus; ..transferMode = ui.TransferMode.plus;
StarField(this._spriteSheet, this._numStars, [this._autoScroll = false]) : super(Size.zero) { StarField(this._spriteSheet, this._numStars, [this._autoScroll = false]) : super(Size.zero) {
_image = _spriteSheet.image; _image = _spriteSheet.image;
...@@ -48,9 +48,9 @@ class StarField extends NodeWithSize { ...@@ -48,9 +48,9 @@ class StarField extends NodeWithSize {
void paint(PaintingCanvas canvas) { void paint(PaintingCanvas canvas) {
// Create a transform for each star // Create a transform for each star
List<sky.RSTransform> transforms = []; List<ui.RSTransform> transforms = [];
for (int i = 0; i < _numStars; i++) { for (int i = 0; i < _numStars; i++) {
sky.RSTransform transform = new sky.RSTransform( ui.RSTransform transform = new ui.RSTransform(
_starScales[i], _starScales[i],
0.0, 0.0,
_starPositions[i].x - _padding, _starPositions[i].x - _padding,
...@@ -60,7 +60,7 @@ class StarField extends NodeWithSize { ...@@ -60,7 +60,7 @@ class StarField extends NodeWithSize {
} }
// Draw the stars // Draw the stars
canvas.drawAtlas(_image, transforms, _rects, _colors, sky.TransferMode.modulate, null, _paint); canvas.drawAtlas(_image, transforms, _rects, _colors, ui.TransferMode.modulate, null, _paint);
} }
void move(double dx, double dy) { void move(double dx, double dy) {
......
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'dart:math' as math; import 'dart:math' as math;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -202,7 +202,7 @@ class TestPerformanceAtlas extends PerformanceTest { ...@@ -202,7 +202,7 @@ class TestPerformanceAtlas extends PerformanceTest {
double rotation = 0.0; double rotation = 0.0;
List<Rect> rects = []; List<Rect> rects = [];
Paint cachedPaint = new Paint() Paint cachedPaint = new Paint()
..filterQuality = sky.FilterQuality.low ..filterQuality = ui.FilterQuality.low
..isAntiAlias = false; ..isAntiAlias = false;
TestPerformanceAtlas() { TestPerformanceAtlas() {
...@@ -216,7 +216,7 @@ class TestPerformanceAtlas extends PerformanceTest { ...@@ -216,7 +216,7 @@ class TestPerformanceAtlas extends PerformanceTest {
void paint(PaintingCanvas canvas) { void paint(PaintingCanvas canvas) {
// Setup transforms // Setup transforms
List<sky.RSTransform> transforms = []; List<ui.RSTransform> transforms = [];
for (int x = 0; x < grid; x++) { for (int x = 0; x < grid; x++) {
for (int y = 0; y < grid; y++) { for (int y = 0; y < grid; y++) {
...@@ -238,12 +238,12 @@ class TestPerformanceAtlas extends PerformanceTest { ...@@ -238,12 +238,12 @@ class TestPerformanceAtlas extends PerformanceTest {
rotation += 1.0; rotation += 1.0;
} }
sky.RSTransform createTransform(double x, double y, double ax, double ay, double rot, double scale) { ui.RSTransform createTransform(double x, double y, double ax, double ay, double rot, double scale) {
double scos = math.cos(convertDegrees2Radians(rot)) * scale; double scos = math.cos(convertDegrees2Radians(rot)) * scale;
double ssin = math.sin(convertDegrees2Radians(rot)) * scale; double ssin = math.sin(convertDegrees2Radians(rot)) * scale;
double tx = x + -scos * ax + ssin * ay; double tx = x + -scos * ax + ssin * ay;
double ty = y + -ssin * ax - scos * ay; double ty = y + -ssin * ax - scos * ay;
return new sky.RSTransform(scos, ssin, tx, ty); return new ui.RSTransform(scos, ssin, tx, ty);
} }
} }
...@@ -255,7 +255,7 @@ class TestPerformanceAtlas2 extends PerformanceTest { ...@@ -255,7 +255,7 @@ class TestPerformanceAtlas2 extends PerformanceTest {
double rotation = 0.0; double rotation = 0.0;
List<Rect> rects = []; List<Rect> rects = [];
Paint cachedPaint = new Paint() Paint cachedPaint = new Paint()
..filterQuality = sky.FilterQuality.low ..filterQuality = ui.FilterQuality.low
..isAntiAlias = false; ..isAntiAlias = false;
TestPerformanceAtlas2() { TestPerformanceAtlas2() {
...@@ -269,7 +269,7 @@ class TestPerformanceAtlas2 extends PerformanceTest { ...@@ -269,7 +269,7 @@ class TestPerformanceAtlas2 extends PerformanceTest {
void paint(PaintingCanvas canvas) { void paint(PaintingCanvas canvas) {
// Setup transforms // Setup transforms
List<sky.RSTransform> transforms = []; List<ui.RSTransform> transforms = [];
for (int x = 12; x < grid - 12; x++) { for (int x = 12; x < grid - 12; x++) {
for (int y = 0; y < grid; y++) { for (int y = 0; y < grid; y++) {
...@@ -291,11 +291,11 @@ class TestPerformanceAtlas2 extends PerformanceTest { ...@@ -291,11 +291,11 @@ class TestPerformanceAtlas2 extends PerformanceTest {
rotation += 1.0; rotation += 1.0;
} }
sky.RSTransform createTransform(double x, double y, double ax, double ay, double rot, double scale) { ui.RSTransform createTransform(double x, double y, double ax, double ay, double rot, double scale) {
double scos = math.cos(convertDegrees2Radians(rot)) * scale; double scos = math.cos(convertDegrees2Radians(rot)) * scale;
double ssin = math.sin(convertDegrees2Radians(rot)) * scale; double ssin = math.sin(convertDegrees2Radians(rot)) * scale;
double tx = x + -scos * ax + ssin * ay; double tx = x + -scos * ax + ssin * ay;
double ty = y + -ssin * ax - scos * ay; double ty = y + -ssin * ax - scos * ay;
return new sky.RSTransform(scos, ssin, tx, ty); return new ui.RSTransform(scos, ssin, tx, ty);
} }
} }
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'dart:math'; import 'dart:math';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -85,7 +85,7 @@ class MineDiggerState extends State<MineDigger> { ...@@ -85,7 +85,7 @@ class MineDiggerState extends State<MineDigger> {
} }
PointerEventListener _pointerDownHandlerFor(int posX, int posY) { PointerEventListener _pointerDownHandlerFor(int posX, int posY) {
return (sky.PointerEvent event) { return (ui.PointerEvent event) {
if (event.buttons == 1) { if (event.buttons == 1) {
probe(posX, posY); probe(posX, posY);
} else if (event.buttons == 2) { } else if (event.buttons == 2) {
...@@ -190,7 +190,7 @@ class MineDiggerState extends State<MineDigger> { ...@@ -190,7 +190,7 @@ class MineDiggerState extends State<MineDigger> {
); );
} }
void handleToolbarPointerDown(sky.PointerEvent event) { void handleToolbarPointerDown(ui.PointerEvent event) {
setState(() { setState(() {
resetGame(); resetGame();
}); });
......
...@@ -2,20 +2,20 @@ ...@@ -2,20 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'dart:typed_data'; import 'dart:typed_data';
void drawText(sky.Canvas canvas, String lh) { void drawText(ui.Canvas canvas, String lh) {
sky.Paint paint = new sky.Paint(); ui.Paint paint = new ui.Paint();
// offset down // offset down
canvas.translate(0.0, 100.0); canvas.translate(0.0, 100.0);
// set up the text // set up the text
sky.Document document = new sky.Document(); ui.Document document = new ui.Document();
sky.Text arabic = document.createText("مرحبا"); ui.Text arabic = document.createText("مرحبا");
sky.Text english = document.createText(" Hello"); ui.Text english = document.createText(" Hello");
sky.Element block = document.createElement('div'); ui.Element block = document.createElement('div');
block.style['display'] = 'paragraph'; block.style['display'] = 'paragraph';
block.style['font-family'] = 'monospace'; block.style['font-family'] = 'monospace';
block.style['font-size'] = '50px'; block.style['font-size'] = '50px';
...@@ -23,21 +23,21 @@ void drawText(sky.Canvas canvas, String lh) { ...@@ -23,21 +23,21 @@ void drawText(sky.Canvas canvas, String lh) {
block.style['color'] = '#0000A0'; block.style['color'] = '#0000A0';
block.appendChild(arabic); block.appendChild(arabic);
block.appendChild(english); block.appendChild(english);
sky.LayoutRoot layoutRoot = new sky.LayoutRoot(); ui.LayoutRoot layoutRoot = new ui.LayoutRoot();
layoutRoot.rootElement = block; layoutRoot.rootElement = block;
layoutRoot.maxWidth = sky.view.width - 20.0; // you need to set a width for this to paint layoutRoot.maxWidth = ui.view.width - 20.0; // you need to set a width for this to paint
layoutRoot.layout(); layoutRoot.layout();
// draw a line at the text's baseline // draw a line at the text's baseline
sky.Path path = new sky.Path(); ui.Path path = new ui.Path();
path.moveTo(0.0, 0.0); path.moveTo(0.0, 0.0);
path.lineTo(block.maxContentWidth, 0.0); path.lineTo(block.maxContentWidth, 0.0);
path.moveTo(0.0, block.alphabeticBaseline); path.moveTo(0.0, block.alphabeticBaseline);
path.lineTo(block.maxContentWidth, block.alphabeticBaseline); path.lineTo(block.maxContentWidth, block.alphabeticBaseline);
path.moveTo(0.0, block.height); path.moveTo(0.0, block.height);
path.lineTo(block.maxContentWidth, block.height); path.lineTo(block.maxContentWidth, block.height);
paint.color = const sky.Color(0xFFFF9000); paint.color = const ui.Color(0xFFFF9000);
paint.setStyle(sky.PaintingStyle.stroke); paint.setStyle(ui.PaintingStyle.stroke);
paint.strokeWidth = 3.0; paint.strokeWidth = 3.0;
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
...@@ -45,14 +45,14 @@ void drawText(sky.Canvas canvas, String lh) { ...@@ -45,14 +45,14 @@ void drawText(sky.Canvas canvas, String lh) {
layoutRoot.paint(canvas); layoutRoot.paint(canvas);
} }
sky.Picture paint(sky.Rect paintBounds) { ui.Picture paint(ui.Rect paintBounds) {
sky.PictureRecorder recorder = new sky.PictureRecorder(); ui.PictureRecorder recorder = new ui.PictureRecorder();
sky.Canvas canvas = new sky.Canvas(recorder, paintBounds); ui.Canvas canvas = new ui.Canvas(recorder, paintBounds);
sky.Paint paint = new sky.Paint(); ui.Paint paint = new ui.Paint();
paint.color = const sky.Color(0xFFFFFFFF); paint.color = const ui.Color(0xFFFFFFFF);
paint.setStyle(sky.PaintingStyle.fill); paint.setStyle(ui.PaintingStyle.fill);
canvas.drawRect(new sky.Rect.fromLTRB(0.0, 0.0, sky.view.width, sky.view.height), paint); canvas.drawRect(new ui.Rect.fromLTRB(0.0, 0.0, ui.view.width, ui.view.height), paint);
canvas.translate(10.0, 0.0); canvas.translate(10.0, 0.0);
drawText(canvas, '1.0'); drawText(canvas, '1.0');
...@@ -61,29 +61,29 @@ sky.Picture paint(sky.Rect paintBounds) { ...@@ -61,29 +61,29 @@ sky.Picture paint(sky.Rect paintBounds) {
return recorder.endRecording(); return recorder.endRecording();
} }
sky.Scene composite(sky.Picture picture, sky.Rect paintBounds) { ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
final double devicePixelRatio = sky.view.devicePixelRatio; final double devicePixelRatio = ui.view.devicePixelRatio;
sky.Rect sceneBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width * devicePixelRatio, sky.view.height * devicePixelRatio); ui.Rect sceneBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width * devicePixelRatio, ui.view.height * devicePixelRatio);
Float64List deviceTransform = new Float64List(16) Float64List deviceTransform = new Float64List(16)
..[0] = devicePixelRatio ..[0] = devicePixelRatio
..[5] = devicePixelRatio ..[5] = devicePixelRatio
..[10] = 1.0 ..[10] = 1.0
..[15] = 1.0; ..[15] = 1.0;
sky.SceneBuilder sceneBuilder = new sky.SceneBuilder(sceneBounds) ui.SceneBuilder sceneBuilder = new ui.SceneBuilder(sceneBounds)
..pushTransform(deviceTransform) ..pushTransform(deviceTransform)
..addPicture(sky.Offset.zero, picture, paintBounds) ..addPicture(ui.Offset.zero, picture, paintBounds)
..pop(); ..pop();
return sceneBuilder.build(); return sceneBuilder.build();
} }
void beginFrame(double timeStamp) { void beginFrame(double timeStamp) {
sky.Rect paintBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width, sky.view.height); ui.Rect paintBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width, ui.view.height);
sky.Picture picture = paint(paintBounds); ui.Picture picture = paint(paintBounds);
sky.Scene scene = composite(picture, paintBounds); ui.Scene scene = composite(picture, paintBounds);
sky.view.scene = scene; ui.view.scene = scene;
} }
void main() { void main() {
sky.view.setFrameCallback(beginFrame); ui.view.setFrameCallback(beginFrame);
sky.view.scheduleFrame(); ui.view.scheduleFrame();
} }
...@@ -2,56 +2,56 @@ ...@@ -2,56 +2,56 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'dart:typed_data'; import 'dart:typed_data';
sky.Color color; ui.Color color;
sky.Picture paint(sky.Rect paintBounds) { ui.Picture paint(ui.Rect paintBounds) {
sky.PictureRecorder recorder = new sky.PictureRecorder(); ui.PictureRecorder recorder = new ui.PictureRecorder();
sky.Canvas canvas = new sky.Canvas(recorder, paintBounds); ui.Canvas canvas = new ui.Canvas(recorder, paintBounds);
sky.Size size = paintBounds.size; ui.Size size = paintBounds.size;
double radius = size.shortestSide * 0.45; double radius = size.shortestSide * 0.45;
sky.Paint paint = new sky.Paint() ui.Paint paint = new ui.Paint()
..color = color; ..color = color;
canvas.drawCircle(size.center(sky.Point.origin), radius, paint); canvas.drawCircle(size.center(ui.Point.origin), radius, paint);
return recorder.endRecording(); return recorder.endRecording();
} }
sky.Scene composite(sky.Picture picture, sky.Rect paintBounds) { ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
final double devicePixelRatio = sky.view.devicePixelRatio; final double devicePixelRatio = ui.view.devicePixelRatio;
sky.Rect sceneBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width * devicePixelRatio, sky.view.height * devicePixelRatio); ui.Rect sceneBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width * devicePixelRatio, ui.view.height * devicePixelRatio);
Float64List deviceTransform = new Float64List(16) Float64List deviceTransform = new Float64List(16)
..[0] = devicePixelRatio ..[0] = devicePixelRatio
..[5] = devicePixelRatio ..[5] = devicePixelRatio
..[10] = 1.0 ..[10] = 1.0
..[15] = 1.0; ..[15] = 1.0;
sky.SceneBuilder sceneBuilder = new sky.SceneBuilder(sceneBounds) ui.SceneBuilder sceneBuilder = new ui.SceneBuilder(sceneBounds)
..pushTransform(deviceTransform) ..pushTransform(deviceTransform)
..addPicture(sky.Offset.zero, picture, paintBounds) ..addPicture(ui.Offset.zero, picture, paintBounds)
..pop(); ..pop();
return sceneBuilder.build(); return sceneBuilder.build();
} }
void beginFrame(double timeStamp) { void beginFrame(double timeStamp) {
sky.Rect paintBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width, sky.view.height); ui.Rect paintBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width, ui.view.height);
sky.Picture picture = paint(paintBounds); ui.Picture picture = paint(paintBounds);
sky.Scene scene = composite(picture, paintBounds); ui.Scene scene = composite(picture, paintBounds);
sky.view.scene = scene; ui.view.scene = scene;
} }
bool handleEvent(sky.Event event) { bool handleEvent(ui.Event event) {
if (event.type == 'pointerdown') { if (event.type == 'pointerdown') {
color = new sky.Color.fromARGB(255, 0, 0, 255); color = new ui.Color.fromARGB(255, 0, 0, 255);
sky.view.scheduleFrame(); ui.view.scheduleFrame();
return true; return true;
} }
if (event.type == 'pointerup') { if (event.type == 'pointerup') {
color = new sky.Color.fromARGB(255, 0, 255, 0); color = new ui.Color.fromARGB(255, 0, 255, 0);
sky.view.scheduleFrame(); ui.view.scheduleFrame();
return true; return true;
} }
...@@ -65,8 +65,8 @@ bool handleEvent(sky.Event event) { ...@@ -65,8 +65,8 @@ bool handleEvent(sky.Event event) {
void main() { void main() {
print('Hello, world'); print('Hello, world');
color = new sky.Color.fromARGB(255, 0, 255, 0); color = new ui.Color.fromARGB(255, 0, 255, 0);
sky.view.setFrameCallback(beginFrame); ui.view.setFrameCallback(beginFrame);
sky.view.setEventCallback(handleEvent); ui.view.setEventCallback(handleEvent);
sky.view.scheduleFrame(); ui.view.scheduleFrame();
} }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'dart:typed_data'; import 'dart:typed_data';
const kMaxIterations = 100; const kMaxIterations = 100;
...@@ -14,9 +14,9 @@ void report(String s) { ...@@ -14,9 +14,9 @@ void report(String s) {
// print("$s\n"); // print("$s\n");
} }
sky.LayoutRoot layoutRoot = new sky.LayoutRoot(); ui.LayoutRoot layoutRoot = new ui.LayoutRoot();
sky.Document document = new sky.Document(); ui.Document document = new ui.Document();
sky.Element root; ui.Element root;
math.Random random = new math.Random(); math.Random random = new math.Random();
bool pickThis(double odds) { bool pickThis(double odds) {
...@@ -29,19 +29,19 @@ String generateCharacter(int min, int max) { ...@@ -29,19 +29,19 @@ String generateCharacter(int min, int max) {
return result; return result;
} }
String colorToCSSString(sky.Color color) { String colorToCSSString(ui.Color color) {
return 'rgba(${color.red}, ${color.green}, ${color.blue}, ${color.alpha / 255.0})'; return 'rgba(${color.red}, ${color.green}, ${color.blue}, ${color.alpha / 255.0})';
} }
void mutate(sky.Canvas canvas) { void mutate(ui.Canvas canvas) {
// mutate the DOM randomly // mutate the DOM randomly
int iterationsLeft = kMaxIterations; int iterationsLeft = kMaxIterations;
sky.Node node = root; ui.Node node = root;
sky.Node other = null; ui.Node other = null;
while (node != null && iterationsLeft > 0) { while (node != null && iterationsLeft > 0) {
iterationsLeft -= 1; iterationsLeft -= 1;
if (node is sky.Element && pickThis(0.4)) { if (node is ui.Element && pickThis(0.4)) {
node = (node as sky.Element).firstChild; node = (node as ui.Element).firstChild;
} else if (node.nextSibling != null && pickThis(0.5)) { } else if (node.nextSibling != null && pickThis(0.5)) {
node = node.nextSibling; node = node.nextSibling;
} else if (other == null && node != root && pickThis(0.1)) { } else if (other == null && node != root && pickThis(0.1)) {
...@@ -57,7 +57,7 @@ void mutate(sky.Canvas canvas) { ...@@ -57,7 +57,7 @@ void mutate(sky.Canvas canvas) {
} else if (node != root && pickThis(0.001)) { } else if (node != root && pickThis(0.001)) {
report("remove()"); report("remove()");
node.remove(); node.remove();
} else if (node is sky.Element) { } else if (node is ui.Element) {
if (pickThis(0.1)) { if (pickThis(0.1)) {
report("appending a new text node (ASCII)"); report("appending a new text node (ASCII)");
node.appendChild(document.createText(generateCharacter(0x20, 0x7F))); node.appendChild(document.createText(generateCharacter(0x20, 0x7F)));
...@@ -80,7 +80,7 @@ void mutate(sky.Canvas canvas) { ...@@ -80,7 +80,7 @@ void mutate(sky.Canvas canvas) {
break; break;
} else if (pickThis(0.1)) { } else if (pickThis(0.1)) {
report("styling: color"); report("styling: color");
node.style['color'] = colorToCSSString(new sky.Color(random.nextInt(0xFFFFFFFF) | 0xC0808080)); node.style['color'] = colorToCSSString(new ui.Color(random.nextInt(0xFFFFFFFF) | 0xC0808080));
break; break;
} else if (pickThis(0.1)) { } else if (pickThis(0.1)) {
report("styling: font-size"); report("styling: font-size");
...@@ -148,12 +148,12 @@ void mutate(sky.Canvas canvas) { ...@@ -148,12 +148,12 @@ void mutate(sky.Canvas canvas) {
break; break;
} else if (pickThis(0.1)) { } else if (pickThis(0.1)) {
report("styling: text-decoration-color"); report("styling: text-decoration-color");
node.style['text-decoration-color'] = colorToCSSString(new sky.Color(random.nextInt(0xFFFFFFFF))); node.style['text-decoration-color'] = colorToCSSString(new ui.Color(random.nextInt(0xFFFFFFFF)));
break; break;
} }
} else { } else {
assert(node is sky.Text); assert(node is ui.Text);
final sky.Text text = node; final ui.Text text = node;
if (pickThis(0.1)) { if (pickThis(0.1)) {
report("appending a new text node (ASCII)"); report("appending a new text node (ASCII)");
text.appendData(generateCharacter(0x20, 0x7F)); text.appendData(generateCharacter(0x20, 0x7F));
...@@ -182,8 +182,8 @@ void mutate(sky.Canvas canvas) { ...@@ -182,8 +182,8 @@ void mutate(sky.Canvas canvas) {
node = root; node = root;
int count = 1; int count = 1;
while (node != null) { while (node != null) {
if (node is sky.Element && node.firstChild != null) { if (node is ui.Element && node.firstChild != null) {
node = (node as sky.Element).firstChild; node = (node as ui.Element).firstChild;
count += 1; count += 1;
} else { } else {
while (node != null && node.nextSibling == null) while (node != null && node.nextSibling == null)
...@@ -202,40 +202,40 @@ void mutate(sky.Canvas canvas) { ...@@ -202,40 +202,40 @@ void mutate(sky.Canvas canvas) {
// draw the result // draw the result
report("recording..."); report("recording...");
layoutRoot.maxWidth = sky.view.width; layoutRoot.maxWidth = ui.view.width;
layoutRoot.layout(); layoutRoot.layout();
layoutRoot.paint(canvas); layoutRoot.paint(canvas);
report("painting..."); report("painting...");
} }
sky.Picture paint(sky.Rect paintBounds) { ui.Picture paint(ui.Rect paintBounds) {
sky.PictureRecorder recorder = new sky.PictureRecorder(); ui.PictureRecorder recorder = new ui.PictureRecorder();
sky.Canvas canvas = new sky.Canvas(recorder, paintBounds); ui.Canvas canvas = new ui.Canvas(recorder, paintBounds);
mutate(canvas); mutate(canvas);
return recorder.endRecording(); return recorder.endRecording();
} }
sky.Scene composite(sky.Picture picture, sky.Rect paintBounds) { ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
final double devicePixelRatio = sky.view.devicePixelRatio; final double devicePixelRatio = ui.view.devicePixelRatio;
sky.Rect sceneBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width * devicePixelRatio, sky.view.height * devicePixelRatio); ui.Rect sceneBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width * devicePixelRatio, ui.view.height * devicePixelRatio);
Float64List deviceTransform = new Float64List(16) Float64List deviceTransform = new Float64List(16)
..[0] = devicePixelRatio ..[0] = devicePixelRatio
..[5] = devicePixelRatio ..[5] = devicePixelRatio
..[10] = 1.0 ..[10] = 1.0
..[15] = 1.0; ..[15] = 1.0;
sky.SceneBuilder sceneBuilder = new sky.SceneBuilder(sceneBounds) ui.SceneBuilder sceneBuilder = new ui.SceneBuilder(sceneBounds)
..pushTransform(deviceTransform) ..pushTransform(deviceTransform)
..addPicture(sky.Offset.zero, picture, paintBounds) ..addPicture(ui.Offset.zero, picture, paintBounds)
..pop(); ..pop();
return sceneBuilder.build(); return sceneBuilder.build();
} }
void beginFrame(double timeStamp) { void beginFrame(double timeStamp) {
sky.Rect paintBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width, sky.view.height); ui.Rect paintBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width, ui.view.height);
sky.Picture picture = paint(paintBounds); ui.Picture picture = paint(paintBounds);
sky.Scene scene = composite(picture, paintBounds); ui.Scene scene = composite(picture, paintBounds);
sky.view.scene = scene; ui.view.scene = scene;
sky.view.scheduleFrame(); ui.view.scheduleFrame();
} }
void main() { void main() {
...@@ -243,6 +243,6 @@ void main() { ...@@ -243,6 +243,6 @@ void main() {
root.style['display'] = 'paragraph'; root.style['display'] = 'paragraph';
root.style['color'] = '#FFFFFF'; root.style['color'] = '#FFFFFF';
layoutRoot.rootElement = root; layoutRoot.rootElement = root;
sky.view.setFrameCallback(beginFrame); ui.view.setFrameCallback(beginFrame);
sky.view.scheduleFrame(); ui.view.scheduleFrame();
} }
...@@ -2,34 +2,34 @@ ...@@ -2,34 +2,34 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:typed_data'; import 'dart:typed_data';
sky.Picture paint(sky.Rect paintBounds) { ui.Picture paint(ui.Rect paintBounds) {
sky.PictureRecorder recorder = new sky.PictureRecorder(); ui.PictureRecorder recorder = new ui.PictureRecorder();
sky.Canvas canvas = new sky.Canvas(recorder, paintBounds); ui.Canvas canvas = new ui.Canvas(recorder, paintBounds);
sky.Size size = paintBounds.size; ui.Size size = paintBounds.size;
sky.Paint paint = new sky.Paint(); ui.Paint paint = new ui.Paint();
sky.Point mid = size.center(sky.Point.origin); ui.Point mid = size.center(ui.Point.origin);
double radius = size.shortestSide / 2.0; double radius = size.shortestSide / 2.0;
canvas.drawPaint(new sky.Paint()..color = const sky.Color(0xFFFFFFFF)); canvas.drawPaint(new ui.Paint()..color = const ui.Color(0xFFFFFFFF));
canvas.save(); canvas.save();
canvas.translate(-mid.x/2.0, sky.view.height*2.0); canvas.translate(-mid.x/2.0, ui.view.height*2.0);
canvas.clipRect( canvas.clipRect(
new sky.Rect.fromLTRB(0.0, -sky.view.height, sky.view.width, radius)); new ui.Rect.fromLTRB(0.0, -ui.view.height, ui.view.width, radius));
canvas.translate(mid.x, mid.y); canvas.translate(mid.x, mid.y);
paint.color = const sky.Color.fromARGB(128, 255, 0, 255); paint.color = const ui.Color.fromARGB(128, 255, 0, 255);
canvas.rotate(math.PI/4.0); canvas.rotate(math.PI/4.0);
sky.Gradient yellowBlue = new sky.Gradient.linear( ui.Gradient yellowBlue = new ui.Gradient.linear(
[new sky.Point(-radius, -radius), new sky.Point(0.0, 0.0)], [new ui.Point(-radius, -radius), new ui.Point(0.0, 0.0)],
[const sky.Color(0xFFFFFF00), const sky.Color(0xFF0000FF)]); [const ui.Color(0xFFFFFF00), const ui.Color(0xFF0000FF)]);
canvas.drawRect(new sky.Rect.fromLTRB(-radius, -radius, radius, radius), canvas.drawRect(new ui.Rect.fromLTRB(-radius, -radius, radius, radius),
new sky.Paint()..setShader(yellowBlue)); new ui.Paint()..setShader(yellowBlue));
// Scale x and y by 0.5. // Scale x and y by 0.5.
var scaleMatrix = new Float64List.fromList([ var scaleMatrix = new Float64List.fromList([
...@@ -39,70 +39,70 @@ sky.Picture paint(sky.Rect paintBounds) { ...@@ -39,70 +39,70 @@ sky.Picture paint(sky.Rect paintBounds) {
0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0,
]); ]);
canvas.concat(scaleMatrix); canvas.concat(scaleMatrix);
paint.color = const sky.Color.fromARGB(128, 0, 255, 0); paint.color = const ui.Color.fromARGB(128, 0, 255, 0);
canvas.drawCircle(sky.Point.origin, radius, paint); canvas.drawCircle(ui.Point.origin, radius, paint);
canvas.restore(); canvas.restore();
canvas.translate(0.0, 50.0); canvas.translate(0.0, 50.0);
var builder = new sky.LayerDrawLooperBuilder() var builder = new ui.LayerDrawLooperBuilder()
..addLayerOnTop( ..addLayerOnTop(
new sky.DrawLooperLayerInfo() new ui.DrawLooperLayerInfo()
..setOffset(const sky.Offset(150.0, 0.0)) ..setOffset(const ui.Offset(150.0, 0.0))
..setColorMode(sky.TransferMode.src) ..setColorMode(ui.TransferMode.src)
..setPaintBits(sky.PaintBits.all), ..setPaintBits(ui.PaintBits.all),
new sky.Paint() new ui.Paint()
..color = const sky.Color.fromARGB(128, 255, 255, 0) ..color = const ui.Color.fromARGB(128, 255, 255, 0)
..colorFilter = new sky.ColorFilter.mode( ..colorFilter = new ui.ColorFilter.mode(
const sky.Color.fromARGB(128, 0, 0, 255), sky.TransferMode.srcIn) const ui.Color.fromARGB(128, 0, 0, 255), ui.TransferMode.srcIn)
..maskFilter = new sky.MaskFilter.blur( ..maskFilter = new ui.MaskFilter.blur(
sky.BlurStyle.normal, 3.0, highQuality: true)) ui.BlurStyle.normal, 3.0, highQuality: true))
..addLayerOnTop( ..addLayerOnTop(
new sky.DrawLooperLayerInfo() new ui.DrawLooperLayerInfo()
..setOffset(const sky.Offset(75.0, 75.0)) ..setOffset(const ui.Offset(75.0, 75.0))
..setColorMode(sky.TransferMode.src) ..setColorMode(ui.TransferMode.src)
..setPaintBits(sky.PaintBits.shader), ..setPaintBits(ui.PaintBits.shader),
new sky.Paint() new ui.Paint()
..shader = new sky.Gradient.radial( ..shader = new ui.Gradient.radial(
new sky.Point(0.0, 0.0), radius/3.0, new ui.Point(0.0, 0.0), radius/3.0,
[const sky.Color(0xFFFFFF00), const sky.Color(0xFFFF0000)], [const ui.Color(0xFFFFFF00), const ui.Color(0xFFFF0000)],
null, sky.TileMode.mirror) null, ui.TileMode.mirror)
// Since we're don't set sky.PaintBits.maskFilter, this has no effect. // Since we're don't set ui.PaintBits.maskFilter, this has no effect.
..maskFilter = new sky.MaskFilter.blur( ..maskFilter = new ui.MaskFilter.blur(
sky.BlurStyle.normal, 50.0, highQuality: true)) ui.BlurStyle.normal, 50.0, highQuality: true))
..addLayerOnTop( ..addLayerOnTop(
new sky.DrawLooperLayerInfo()..setOffset(const sky.Offset(225.0, 75.0)), new ui.DrawLooperLayerInfo()..setOffset(const ui.Offset(225.0, 75.0)),
// Since this layer uses a DST color mode, this has no effect. // Since this layer uses a DST color mode, this has no effect.
new sky.Paint()..color = const sky.Color.fromARGB(128, 255, 0, 0)); new ui.Paint()..color = const ui.Color.fromARGB(128, 255, 0, 0));
paint.drawLooper = builder.build(); paint.drawLooper = builder.build();
canvas.drawCircle(sky.Point.origin, radius, paint); canvas.drawCircle(ui.Point.origin, radius, paint);
return recorder.endRecording(); return recorder.endRecording();
} }
sky.Scene composite(sky.Picture picture, sky.Rect paintBounds) { ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
final double devicePixelRatio = sky.view.devicePixelRatio; final double devicePixelRatio = ui.view.devicePixelRatio;
sky.Rect sceneBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width * devicePixelRatio, sky.view.height * devicePixelRatio); ui.Rect sceneBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width * devicePixelRatio, ui.view.height * devicePixelRatio);
Float32List deviceTransform = new Float32List(16) Float32List deviceTransform = new Float32List(16)
..[0] = devicePixelRatio ..[0] = devicePixelRatio
..[5] = devicePixelRatio ..[5] = devicePixelRatio
..[10] = 1.0 ..[10] = 1.0
..[15] = 1.0; ..[15] = 1.0;
sky.SceneBuilder sceneBuilder = new sky.SceneBuilder(sceneBounds) ui.SceneBuilder sceneBuilder = new ui.SceneBuilder(sceneBounds)
..pushTransform(deviceTransform) ..pushTransform(deviceTransform)
..addPicture(sky.Offset.zero, picture, paintBounds) ..addPicture(ui.Offset.zero, picture, paintBounds)
..pop(); ..pop();
return sceneBuilder.build(); return sceneBuilder.build();
} }
void beginFrame(double timeStamp) { void beginFrame(double timeStamp) {
sky.Rect paintBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width, sky.view.height); ui.Rect paintBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width, ui.view.height);
sky.Picture picture = paint(paintBounds); ui.Picture picture = paint(paintBounds);
sky.Scene scene = composite(picture, paintBounds); ui.Scene scene = composite(picture, paintBounds);
sky.view.scene = scene; ui.view.scene = scene;
} }
void main() { void main() {
sky.view.setFrameCallback(beginFrame); ui.view.setFrameCallback(beginFrame);
sky.view.scheduleFrame(); ui.view.scheduleFrame();
} }
...@@ -2,63 +2,63 @@ ...@@ -2,63 +2,63 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'dart:typed_data'; import 'dart:typed_data';
sky.Picture paint(sky.Rect paintBounds) { ui.Picture paint(ui.Rect paintBounds) {
sky.PictureRecorder recorder = new sky.PictureRecorder(); ui.PictureRecorder recorder = new ui.PictureRecorder();
sky.Canvas canvas = new sky.Canvas(recorder, paintBounds); ui.Canvas canvas = new ui.Canvas(recorder, paintBounds);
double size = 100.0; double size = 100.0;
canvas.translate(size + 10.0, size + 10.0); canvas.translate(size + 10.0, size + 10.0);
sky.Paint paint = new sky.Paint(); ui.Paint paint = new ui.Paint();
paint.color = const sky.Color.fromARGB(255, 0, 255, 0); paint.color = const ui.Color.fromARGB(255, 0, 255, 0);
var builder = new sky.LayerDrawLooperBuilder() var builder = new ui.LayerDrawLooperBuilder()
// Shadow layer. // Shadow layer.
..addLayerOnTop( ..addLayerOnTop(
new sky.DrawLooperLayerInfo() new ui.DrawLooperLayerInfo()
..setPaintBits(sky.PaintBits.all) ..setPaintBits(ui.PaintBits.all)
..setOffset(const sky.Offset(5.0, 5.0)) ..setOffset(const ui.Offset(5.0, 5.0))
..setColorMode(sky.TransferMode.src), ..setColorMode(ui.TransferMode.src),
new sky.Paint() new ui.Paint()
..color = const sky.Color.fromARGB(128, 55, 55, 55) ..color = const ui.Color.fromARGB(128, 55, 55, 55)
..maskFilter = new sky.MaskFilter.blur(sky.BlurStyle.normal, 5.0) ..maskFilter = new ui.MaskFilter.blur(ui.BlurStyle.normal, 5.0)
) )
// Main layer. // Main layer.
..addLayerOnTop(new sky.DrawLooperLayerInfo(), new sky.Paint()); ..addLayerOnTop(new ui.DrawLooperLayerInfo(), new ui.Paint());
paint.drawLooper = builder.build(); paint.drawLooper = builder.build();
canvas.drawPaint( canvas.drawPaint(
new sky.Paint()..color = const sky.Color.fromARGB(255, 255, 255, 255)); new ui.Paint()..color = const ui.Color.fromARGB(255, 255, 255, 255));
canvas.drawRect(new sky.Rect.fromLTRB(-size, -size, size, size), paint); canvas.drawRect(new ui.Rect.fromLTRB(-size, -size, size, size), paint);
return recorder.endRecording(); return recorder.endRecording();
} }
sky.Scene composite(sky.Picture picture, sky.Rect paintBounds) { ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
final double devicePixelRatio = sky.view.devicePixelRatio; final double devicePixelRatio = ui.view.devicePixelRatio;
sky.Rect sceneBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width * devicePixelRatio, sky.view.height * devicePixelRatio); ui.Rect sceneBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width * devicePixelRatio, ui.view.height * devicePixelRatio);
Float64List deviceTransform = new Float64List(16) Float64List deviceTransform = new Float64List(16)
..[0] = devicePixelRatio ..[0] = devicePixelRatio
..[5] = devicePixelRatio ..[5] = devicePixelRatio
..[10] = 1.0 ..[10] = 1.0
..[15] = 1.0; ..[15] = 1.0;
sky.SceneBuilder sceneBuilder = new sky.SceneBuilder(sceneBounds) ui.SceneBuilder sceneBuilder = new ui.SceneBuilder(sceneBounds)
..pushTransform(deviceTransform) ..pushTransform(deviceTransform)
..addPicture(sky.Offset.zero, picture, paintBounds) ..addPicture(ui.Offset.zero, picture, paintBounds)
..pop(); ..pop();
return sceneBuilder.build(); return sceneBuilder.build();
} }
void beginFrame(double timeStamp) { void beginFrame(double timeStamp) {
sky.Rect paintBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width, sky.view.height); ui.Rect paintBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width, ui.view.height);
sky.Picture picture = paint(paintBounds); ui.Picture picture = paint(paintBounds);
sky.Scene scene = composite(picture, paintBounds); ui.Scene scene = composite(picture, paintBounds);
sky.view.scene = scene; ui.view.scene = scene;
} }
void main() { void main() {
sky.view.setFrameCallback(beginFrame); ui.view.setFrameCallback(beginFrame);
sky.view.scheduleFrame(); ui.view.scheduleFrame();
} }
...@@ -3,20 +3,20 @@ ...@@ -3,20 +3,20 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'dart:typed_data'; import 'dart:typed_data';
double timeBase = null; double timeBase = null;
sky.LayoutRoot layoutRoot = new sky.LayoutRoot(); ui.LayoutRoot layoutRoot = new ui.LayoutRoot();
sky.Picture paint(sky.Rect paintBounds, double delta) { ui.Picture paint(ui.Rect paintBounds, double delta) {
sky.PictureRecorder recorder = new sky.PictureRecorder(); ui.PictureRecorder recorder = new ui.PictureRecorder();
sky.Canvas canvas = new sky.Canvas(recorder, paintBounds); ui.Canvas canvas = new ui.Canvas(recorder, paintBounds);
canvas.translate(sky.view.width / 2.0, sky.view.height / 2.0); canvas.translate(ui.view.width / 2.0, ui.view.height / 2.0);
canvas.rotate(math.PI * delta / 1800); canvas.rotate(math.PI * delta / 1800);
canvas.drawRect(new sky.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 sky.Paint()..color = const sky.Color.fromARGB(255, 0, 255, 0)); new ui.Paint()..color = const ui.Color.fromARGB(255, 0, 255, 0));
double sin = math.sin(delta / 200); double sin = math.sin(delta / 200);
layoutRoot.maxWidth = 150.0 + (50 * sin); layoutRoot.maxWidth = 150.0 + (50 * sin);
...@@ -28,17 +28,17 @@ sky.Picture paint(sky.Rect paintBounds, double delta) { ...@@ -28,17 +28,17 @@ sky.Picture paint(sky.Rect paintBounds, double delta) {
return recorder.endRecording(); return recorder.endRecording();
} }
sky.Scene composite(sky.Picture picture, sky.Rect paintBounds) { ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
final double devicePixelRatio = sky.view.devicePixelRatio; final double devicePixelRatio = ui.view.devicePixelRatio;
sky.Rect sceneBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width * devicePixelRatio, sky.view.height * devicePixelRatio); ui.Rect sceneBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width * devicePixelRatio, ui.view.height * devicePixelRatio);
Float64List deviceTransform = new Float64List(16) Float64List deviceTransform = new Float64List(16)
..[0] = devicePixelRatio ..[0] = devicePixelRatio
..[5] = devicePixelRatio ..[5] = devicePixelRatio
..[10] = 1.0 ..[10] = 1.0
..[15] = 1.0; ..[15] = 1.0;
sky.SceneBuilder sceneBuilder = new sky.SceneBuilder(sceneBounds) ui.SceneBuilder sceneBuilder = new ui.SceneBuilder(sceneBounds)
..pushTransform(deviceTransform) ..pushTransform(deviceTransform)
..addPicture(sky.Offset.zero, picture, paintBounds) ..addPicture(ui.Offset.zero, picture, paintBounds)
..pop(); ..pop();
return sceneBuilder.build(); return sceneBuilder.build();
} }
...@@ -47,15 +47,15 @@ void beginFrame(double timeStamp) { ...@@ -47,15 +47,15 @@ void beginFrame(double timeStamp) {
if (timeBase == null) if (timeBase == null)
timeBase = timeStamp; timeBase = timeStamp;
double delta = timeStamp - timeBase; double delta = timeStamp - timeBase;
sky.Rect paintBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width, sky.view.height); ui.Rect paintBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width, ui.view.height);
sky.Picture picture = paint(paintBounds, delta); ui.Picture picture = paint(paintBounds, delta);
sky.Scene scene = composite(picture, paintBounds); ui.Scene scene = composite(picture, paintBounds);
sky.view.scene = scene; ui.view.scene = scene;
sky.view.scheduleFrame(); ui.view.scheduleFrame();
} }
void main() { void main() {
var document = new sky.Document(); var document = new ui.Document();
var arabic = document.createText("هذا هو قليلا طويلة من النص الذي يجب التفاف ."); var arabic = document.createText("هذا هو قليلا طويلة من النص الذي يجب التفاف .");
var more = document.createText(" و أكثر قليلا لجعله أطول. "); var more = document.createText(" و أكثر قليلا لجعله أطول. ");
var block = document.createElement('p'); var block = document.createElement('p');
...@@ -68,6 +68,6 @@ void main() { ...@@ -68,6 +68,6 @@ void main() {
layoutRoot.rootElement = block; layoutRoot.rootElement = block;
sky.view.setFrameCallback(beginFrame); ui.view.setFrameCallback(beginFrame);
sky.view.scheduleFrame(); ui.view.scheduleFrame();
} }
...@@ -3,29 +3,29 @@ ...@@ -3,29 +3,29 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
double timeBase = null; double timeBase = null;
sky.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";
String url2 = "http://i2.kym-cdn.com/photos/images/facebook/000/581/296/c09.jpg"; String url2 = "http://i2.kym-cdn.com/photos/images/facebook/000/581/296/c09.jpg";
sky.Picture paint(sky.Rect paintBounds, double delta) { ui.Picture paint(ui.Rect paintBounds, double delta) {
sky.PictureRecorder recorder = new sky.PictureRecorder(); ui.PictureRecorder recorder = new ui.PictureRecorder();
sky.Canvas canvas = new sky.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);
canvas.rotate(math.PI * delta / 1800); canvas.rotate(math.PI * delta / 1800);
canvas.scale(0.2, 0.2); canvas.scale(0.2, 0.2);
sky.Paint paint = new sky.Paint()..color = const sky.Color.fromARGB(255, 0, 255, 0); ui.Paint paint = new ui.Paint()..color = const ui.Color.fromARGB(255, 0, 255, 0);
// Draw image // Draw image
if (image != null) if (image != null)
canvas.drawImage(image, new sky.Point(-image.width / 2.0, -image.height / 2.0), paint); canvas.drawImage(image, new ui.Point(-image.width / 2.0, -image.height / 2.0), paint);
// Draw cut out of image // Draw cut out of image
canvas.rotate(math.PI * delta / 1800); canvas.rotate(math.PI * delta / 1800);
...@@ -33,25 +33,25 @@ sky.Picture paint(sky.Rect paintBounds, double delta) { ...@@ -33,25 +33,25 @@ sky.Picture paint(sky.Rect paintBounds, double delta) {
var w = image.width.toDouble(); var w = image.width.toDouble();
var h = image.width.toDouble(); var h = image.width.toDouble();
canvas.drawImageRect(image, canvas.drawImageRect(image,
new sky.Rect.fromLTRB(w * 0.25, h * 0.25, w * 0.75, h * 0.75), new ui.Rect.fromLTRB(w * 0.25, h * 0.25, w * 0.75, h * 0.75),
new sky.Rect.fromLTRB(-w / 4.0, -h / 4.0, w / 4.0, h / 4.0), new ui.Rect.fromLTRB(-w / 4.0, -h / 4.0, w / 4.0, h / 4.0),
paint); paint);
} }
return recorder.endRecording(); return recorder.endRecording();
} }
sky.Scene composite(sky.Picture picture, sky.Rect paintBounds) { ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
final double devicePixelRatio = sky.view.devicePixelRatio; final double devicePixelRatio = ui.view.devicePixelRatio;
sky.Rect sceneBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width * devicePixelRatio, sky.view.height * devicePixelRatio); ui.Rect sceneBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width * devicePixelRatio, ui.view.height * devicePixelRatio);
Float64List deviceTransform = new Float64List(16) Float64List deviceTransform = new Float64List(16)
..[0] = devicePixelRatio ..[0] = devicePixelRatio
..[5] = devicePixelRatio ..[5] = devicePixelRatio
..[10] = 1.0 ..[10] = 1.0
..[15] = 1.0; ..[15] = 1.0;
sky.SceneBuilder sceneBuilder = new sky.SceneBuilder(sceneBounds) ui.SceneBuilder sceneBuilder = new ui.SceneBuilder(sceneBounds)
..pushTransform(deviceTransform) ..pushTransform(deviceTransform)
..addPicture(sky.Offset.zero, picture, paintBounds) ..addPicture(ui.Offset.zero, picture, paintBounds)
..pop(); ..pop();
return sceneBuilder.build(); return sceneBuilder.build();
} }
...@@ -60,11 +60,11 @@ void beginFrame(double timeStamp) { ...@@ -60,11 +60,11 @@ void beginFrame(double timeStamp) {
if (timeBase == null) if (timeBase == null)
timeBase = timeStamp; timeBase = timeStamp;
double delta = timeStamp - timeBase; double delta = timeStamp - timeBase;
sky.Rect paintBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width, sky.view.height); ui.Rect paintBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width, ui.view.height);
sky.Picture picture = paint(paintBounds, delta); ui.Picture picture = paint(paintBounds, delta);
sky.Scene scene = composite(picture, paintBounds); ui.Scene scene = composite(picture, paintBounds);
sky.view.scene = scene; ui.view.scene = scene;
sky.view.scheduleFrame(); ui.view.scheduleFrame();
} }
...@@ -72,13 +72,13 @@ void handleImageLoad(result) { ...@@ -72,13 +72,13 @@ 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;
sky.view.scheduleFrame(); ui.view.scheduleFrame();
} else { } else {
print("Existing image was loaded again"); print("Existing image was loaded again");
} }
} }
bool handleEvent(sky.Event event) { bool handleEvent(ui.Event event) {
if (event.type == "pointerdown") { if (event.type == "pointerdown") {
return true; return true;
} }
...@@ -93,6 +93,6 @@ bool handleEvent(sky.Event event) { ...@@ -93,6 +93,6 @@ bool handleEvent(sky.Event event) {
void main() { void main() {
imageCache.load(url1).first.then(handleImageLoad); imageCache.load(url1).first.then(handleImageLoad);
sky.view.setEventCallback(handleEvent); ui.view.setEventCallback(handleEvent);
sky.view.setFrameCallback(beginFrame); ui.view.setFrameCallback(beginFrame);
} }
...@@ -3,46 +3,46 @@ ...@@ -3,46 +3,46 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'dart:typed_data'; import 'dart:typed_data';
double timeBase = null; double timeBase = null;
void beginFrame(double timeStamp) { void beginFrame(double timeStamp) {
sky.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;
// paint // paint
sky.Rect paintBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width, sky.view.height); ui.Rect paintBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width, ui.view.height);
sky.PictureRecorder recorder = new sky.PictureRecorder(); ui.PictureRecorder recorder = new ui.PictureRecorder();
sky.Canvas canvas = new sky.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);
canvas.rotate(math.PI * delta / 1800); canvas.rotate(math.PI * delta / 1800);
canvas.drawRect(new sky.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 sky.Paint()..color = const sky.Color.fromARGB(255, 0, 255, 0)); new ui.Paint()..color = const ui.Color.fromARGB(255, 0, 255, 0));
sky.Picture picture = recorder.endRecording(); ui.Picture picture = recorder.endRecording();
// composite // composite
final double devicePixelRatio = sky.view.devicePixelRatio; final double devicePixelRatio = ui.view.devicePixelRatio;
sky.Rect sceneBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width * devicePixelRatio, sky.view.height * devicePixelRatio); ui.Rect sceneBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width * devicePixelRatio, ui.view.height * devicePixelRatio);
Float64List deviceTransform = new Float64List(16) Float64List deviceTransform = new Float64List(16)
..[0] = devicePixelRatio ..[0] = devicePixelRatio
..[5] = devicePixelRatio ..[5] = devicePixelRatio
..[10] = 1.0 ..[10] = 1.0
..[15] = 1.0; ..[15] = 1.0;
sky.SceneBuilder sceneBuilder = new sky.SceneBuilder(sceneBounds) ui.SceneBuilder sceneBuilder = new ui.SceneBuilder(sceneBounds)
..pushTransform(deviceTransform) ..pushTransform(deviceTransform)
..addPicture(sky.Offset.zero, picture, paintBounds) ..addPicture(ui.Offset.zero, picture, paintBounds)
..pop(); ..pop();
sky.view.scene = sceneBuilder.build(); ui.view.scene = sceneBuilder.build();
sky.tracing.end('beginFrame'); ui.tracing.end('beginFrame');
sky.view.scheduleFrame(); ui.view.scheduleFrame();
} }
void main() { void main() {
sky.view.setFrameCallback(beginFrame); ui.view.setFrameCallback(beginFrame);
sky.view.scheduleFrame(); ui.view.scheduleFrame();
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -50,7 +50,7 @@ RenderBox getBox(double lh) { ...@@ -50,7 +50,7 @@ RenderBox getBox(double lh) {
path.lineTo(w, h); path.lineTo(w, h);
Paint paint = new Paint(); Paint paint = new Paint();
paint.color = const Color(0xFFFF9000); paint.color = const Color(0xFFFF9000);
paint.setStyle(sky.PaintingStyle.stroke); paint.setStyle(ui.PaintingStyle.stroke);
paint.strokeWidth = 3.0; paint.strokeWidth = 3.0;
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -15,7 +15,7 @@ void main() { ...@@ -15,7 +15,7 @@ void main() {
additionalConstraints: new BoxConstraints.tightFor(height: 100.0), additionalConstraints: new BoxConstraints.tightFor(height: 100.0),
child: new RenderDecoratedBox( child: new RenderDecoratedBox(
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: new sky.Color(0xFFFFFF00) backgroundColor: new ui.Color(0xFFFFFF00)
) )
) )
) )
...@@ -27,12 +27,12 @@ void main() { ...@@ -27,12 +27,12 @@ void main() {
child: new RenderDecoratedBox( child: new RenderDecoratedBox(
decoration: new BoxDecoration( decoration: new BoxDecoration(
border: new Border( border: new Border(
top: new BorderSide(color: new sky.Color(0xFFF00000), width: 5.0), top: new BorderSide(color: new ui.Color(0xFFF00000), width: 5.0),
right: new BorderSide(color: new sky.Color(0xFFFF9000), width: 10.0), right: new BorderSide(color: new ui.Color(0xFFFF9000), width: 10.0),
bottom: new BorderSide(color: new sky.Color(0xFFFFF000), width: 15.0), bottom: new BorderSide(color: new ui.Color(0xFFFFF000), width: 15.0),
left: new BorderSide(color: new sky.Color(0xFF00FF00), width: 20.0) left: new BorderSide(color: new ui.Color(0xFF00FF00), width: 20.0)
), ),
backgroundColor: new sky.Color(0xFFDDDDDD) backgroundColor: new ui.Color(0xFFDDDDDD)
) )
) )
) )
...@@ -43,7 +43,7 @@ void main() { ...@@ -43,7 +43,7 @@ void main() {
additionalConstraints: new BoxConstraints.tightFor(height: 100.0), additionalConstraints: new BoxConstraints.tightFor(height: 100.0),
child: new RenderDecoratedBox( child: new RenderDecoratedBox(
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: new sky.Color(0xFFFFFF00) backgroundColor: new ui.Color(0xFFFFFF00)
) )
) )
) )
...@@ -54,7 +54,7 @@ void main() { ...@@ -54,7 +54,7 @@ void main() {
additionalConstraints: new BoxConstraints.tightFor(height: 100.0), additionalConstraints: new BoxConstraints.tightFor(height: 100.0),
child: new RenderDecoratedBox( child: new RenderDecoratedBox(
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: new sky.Color(0xFFFFFF00) backgroundColor: new ui.Color(0xFFFFFF00)
) )
) )
) )
...@@ -65,7 +65,7 @@ void main() { ...@@ -65,7 +65,7 @@ void main() {
additionalConstraints: new BoxConstraints.tightFor(height: 100.0), additionalConstraints: new BoxConstraints.tightFor(height: 100.0),
child: new RenderDecoratedBox( child: new RenderDecoratedBox(
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: new sky.Color(0xFFFFFF00) backgroundColor: new ui.Color(0xFFFFFF00)
) )
) )
) )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'solid_color_box.dart'; import 'solid_color_box.dart';
...@@ -11,24 +11,24 @@ RenderBox buildFlexExample() { ...@@ -11,24 +11,24 @@ RenderBox buildFlexExample() {
RenderFlex flexRoot = new RenderFlex(direction: FlexDirection.vertical); RenderFlex flexRoot = new RenderFlex(direction: FlexDirection.vertical);
RenderDecoratedBox root = new RenderDecoratedBox( RenderDecoratedBox root = new RenderDecoratedBox(
decoration: new BoxDecoration(backgroundColor: const sky.Color(0xFF000000)), decoration: new BoxDecoration(backgroundColor: const ui.Color(0xFF000000)),
child: flexRoot child: flexRoot
); );
void addFlexChildSolidColor(RenderFlex parent, sky.Color backgroundColor, { int flex: 0 }) { void addFlexChildSolidColor(RenderFlex parent, ui.Color backgroundColor, { int flex: 0 }) {
RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor); RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor);
parent.add(child); parent.add(child);
child.parentData.flex = flex; child.parentData.flex = flex;
} }
// Yellow bar at top // Yellow bar at top
addFlexChildSolidColor(flexRoot, const sky.Color(0xFFFFFF00), flex: 1); addFlexChildSolidColor(flexRoot, const ui.Color(0xFFFFFF00), flex: 1);
// Turquoise box // Turquoise box
flexRoot.add(new RenderSolidColorBox(const sky.Color(0x7700FFFF), desiredSize: new sky.Size(100.0, 100.0))); flexRoot.add(new RenderSolidColorBox(const ui.Color(0x7700FFFF), desiredSize: new ui.Size(100.0, 100.0)));
var renderDecoratedBlock = new RenderDecoratedBox( var renderDecoratedBlock = new RenderDecoratedBox(
decoration: new BoxDecoration(backgroundColor: const sky.Color(0xFFFFFFFF)) decoration: new BoxDecoration(backgroundColor: const ui.Color(0xFFFFFFFF))
); );
flexRoot.add(new RenderPadding(padding: const EdgeDims.all(10.0), child: renderDecoratedBlock)); flexRoot.add(new RenderPadding(padding: const EdgeDims.all(10.0), child: renderDecoratedBlock));
...@@ -36,11 +36,11 @@ RenderBox buildFlexExample() { ...@@ -36,11 +36,11 @@ RenderBox buildFlexExample() {
var row = new RenderFlex(direction: FlexDirection.horizontal); var row = new RenderFlex(direction: FlexDirection.horizontal);
// Purple and blue cells // Purple and blue cells
addFlexChildSolidColor(row, const sky.Color(0x77FF00FF), flex: 1); addFlexChildSolidColor(row, const ui.Color(0x77FF00FF), flex: 1);
addFlexChildSolidColor(row, const sky.Color(0xFF0000FF), flex: 2); addFlexChildSolidColor(row, const ui.Color(0xFF0000FF), flex: 2);
var decoratedRow = new RenderDecoratedBox( var decoratedRow = new RenderDecoratedBox(
decoration: new BoxDecoration(backgroundColor: const sky.Color(0xFF333333)), decoration: new BoxDecoration(backgroundColor: const ui.Color(0xFF333333)),
child: row child: row
); );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'dart:math' as math; import 'dart:math' as math;
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
...@@ -19,7 +19,7 @@ class Touch { ...@@ -19,7 +19,7 @@ class Touch {
class RenderImageGrow extends RenderImage { class RenderImageGrow extends RenderImage {
final Size _startingSize; final Size _startingSize;
RenderImageGrow(sky.Image image, Size size) RenderImageGrow(ui.Image image, Size size)
: _startingSize = size, super(image: image, width: size.width, height: size.height); : _startingSize = size, super(image: image, width: size.width, height: size.height);
double _growth = 0.0; double _growth = 0.0;
...@@ -35,7 +35,7 @@ RenderImageGrow image; ...@@ -35,7 +35,7 @@ RenderImageGrow image;
Map<int, Touch> touches = new Map(); Map<int, Touch> touches = new Map();
void handleEvent(event) { void handleEvent(event) {
if (event is sky.PointerEvent) { if (event is ui.PointerEvent) {
if (event.type == 'pointermove') if (event.type == 'pointermove')
image.growth = math.max(0.0, image.growth + event.x - touches[event.pointer].x); image.growth = math.max(0.0, image.growth + event.x - touches[event.pointer].x);
touches[event.pointer] = new Touch(event.x, event.y); touches[event.pointer] = new Touch(event.x, event.y);
...@@ -59,7 +59,7 @@ void main() { ...@@ -59,7 +59,7 @@ void main() {
// Resizeable image // Resizeable image
image = new RenderImageGrow(null, new Size(100.0, null)); image = new RenderImageGrow(null, new Size(100.0, null));
imageCache.load("https://www.dartlang.org/logos/dart-logo.png").first.then((sky.Image dartLogo) { imageCache.load("https://www.dartlang.org/logos/dart-logo.png").first.then((ui.Image dartLogo) {
image.image = dartLogo; image.image = dartLogo;
}); });
...@@ -99,5 +99,5 @@ Pancetta meatball tongue tenderloin rump tail jowl boudin."""; ...@@ -99,5 +99,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);
sky.view.setEventCallback(handleEvent); ui.view.setEventCallback(handleEvent);
} }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -528,7 +528,7 @@ class RenderSolidColor extends RenderDecoratedSector { ...@@ -528,7 +528,7 @@ class RenderSolidColor extends RenderDecoratedSector {
deltaTheta = constraints.constrainDeltaTheta(desiredDeltaTheta); deltaTheta = constraints.constrainDeltaTheta(desiredDeltaTheta);
} }
void handleEvent(sky.Event event, HitTestEntry entry) { void handleEvent(ui.Event event, HitTestEntry entry) {
if (event.type == 'pointerdown') if (event.type == 'pointerdown')
decoration = new BoxDecoration(backgroundColor: const Color(0xFFFF0000)); decoration = new BoxDecoration(backgroundColor: const Color(0xFFFF0000));
else if (event.type == 'pointerup') else if (event.type == 'pointerup')
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -42,7 +42,7 @@ class RenderSolidColorBox extends RenderDecoratedBox { ...@@ -42,7 +42,7 @@ class RenderSolidColorBox extends RenderDecoratedBox {
size = constraints.constrain(desiredSize); size = constraints.constrain(desiredSize);
} }
void handleEvent(sky.Event event, BoxHitTestEntry entry) { void handleEvent(ui.Event event, BoxHitTestEntry entry) {
if (event.type == 'pointerdown') if (event.type == 'pointerdown')
decoration = new BoxDecoration(backgroundColor: const Color(0xFFFF0000)); decoration = new BoxDecoration(backgroundColor: const Color(0xFFFF0000));
else if (event.type == 'pointerup') else if (event.type == 'pointerup')
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -15,15 +15,15 @@ RenderTransform transformBox; ...@@ -15,15 +15,15 @@ RenderTransform transformBox;
void main() { void main() {
RenderFlex flexRoot = new RenderFlex(direction: FlexDirection.vertical); RenderFlex flexRoot = new RenderFlex(direction: FlexDirection.vertical);
void addFlexChildSolidColor(RenderFlex parent, sky.Color backgroundColor, { int flex: 0 }) { void addFlexChildSolidColor(RenderFlex parent, ui.Color backgroundColor, { int flex: 0 }) {
RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor); RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor);
parent.add(child); parent.add(child);
child.parentData.flex = flex; child.parentData.flex = flex;
} }
addFlexChildSolidColor(flexRoot, const sky.Color(0xFFFF00FF), flex: 1); addFlexChildSolidColor(flexRoot, const ui.Color(0xFFFF00FF), flex: 1);
addFlexChildSolidColor(flexRoot, const sky.Color(0xFFFFFF00), flex: 2); addFlexChildSolidColor(flexRoot, const ui.Color(0xFFFFFF00), flex: 2);
addFlexChildSolidColor(flexRoot, const sky.Color(0xFF00FFFF), flex: 1); addFlexChildSolidColor(flexRoot, const ui.Color(0xFF00FFFF), flex: 1);
transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.identity()); transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.identity());
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -24,7 +24,7 @@ class Dot { ...@@ -24,7 +24,7 @@ class Dot {
Dot({ Color color }) : _paint = new Paint()..color = color; Dot({ Color color }) : _paint = new Paint()..color = color;
void update(sky.PointerEvent event) { void update(ui.PointerEvent event) {
position = new Point(event.x, event.y); position = new Point(event.x, event.y);
radius = 5 + (95 * event.pressure); radius = 5 + (95 * event.pressure);
} }
...@@ -39,8 +39,8 @@ class RenderTouchDemo extends RenderBox { ...@@ -39,8 +39,8 @@ class RenderTouchDemo extends RenderBox {
RenderTouchDemo(); RenderTouchDemo();
void handleEvent(sky.Event event, BoxHitTestEntry entry) { void handleEvent(ui.Event event, BoxHitTestEntry entry) {
if (event is sky.PointerEvent) { if (event is ui.PointerEvent) {
switch (event.type) { switch (event.type) {
case 'pointerdown': case 'pointerdown':
Color color = kColors[event.pointer.remainder(kColors.length)]; Color color = kColors[event.pointer.remainder(kColors.length)];
......
...@@ -2,16 +2,16 @@ ...@@ -2,16 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
void main() { void main() {
RenderDecoratedBox green = new RenderDecoratedBox( RenderDecoratedBox green = new RenderDecoratedBox(
decoration: new BoxDecoration(backgroundColor: const sky.Color(0xFF00FF00)) decoration: new BoxDecoration(backgroundColor: const ui.Color(0xFF00FF00))
); );
RenderConstrainedBox box = new RenderConstrainedBox( RenderConstrainedBox box = new RenderConstrainedBox(
additionalConstraints: new BoxConstraints.tight(const sky.Size(200.0, 200.0)), additionalConstraints: new BoxConstraints.tight(const ui.Size(200.0, 200.0)),
child: green child: green
); );
......
...@@ -6,7 +6,7 @@ library stocks; ...@@ -6,7 +6,7 @@ library stocks;
import 'dart:async'; import 'dart:async';
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
......
...@@ -25,7 +25,7 @@ class StockArrow extends StatelessComponent { ...@@ -25,7 +25,7 @@ class StockArrow extends StatelessComponent {
// TODO(jackson): This should change colors with the theme // TODO(jackson): This should change colors with the theme
Color color = _colorForPercentChange(percentChange); Color color = _colorForPercentChange(percentChange);
const double kSize = 40.0; const double kSize = 40.0;
var arrow = new CustomPaint(callback: (sky.Canvas canvas, Size size) { var arrow = new CustomPaint(callback: (ui.Canvas canvas, Size size) {
Paint paint = new Paint()..color = color; Paint paint = new Paint()..color = color;
paint.strokeWidth = 1.0; paint.strokeWidth = 1.0;
const double padding = 2.0; const double padding = 2.0;
...@@ -49,11 +49,11 @@ class StockArrow extends StatelessComponent { ...@@ -49,11 +49,11 @@ class StockArrow extends StatelessComponent {
path.lineTo(centerX + w, arrowY + h); path.lineTo(centerX + w, arrowY + h);
path.lineTo(centerX - w, arrowY + h); path.lineTo(centerX - w, arrowY + h);
path.close(); path.close();
paint.setStyle(sky.PaintingStyle.fill); paint.setStyle(ui.PaintingStyle.fill);
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
// Draw a circle that circumscribes the arrow. // Draw a circle that circumscribes the arrow.
paint.setStyle(sky.PaintingStyle.stroke); paint.setStyle(ui.PaintingStyle.stroke);
canvas.drawCircle(new Point(centerX, centerY), r, paint); canvas.drawCircle(new Point(centerX, centerY), r, paint);
}); });
......
...@@ -12,8 +12,8 @@ Future showStockMenu(NavigatorState navigator, { bool autorefresh, ValueChanged ...@@ -12,8 +12,8 @@ Future showStockMenu(NavigatorState navigator, { bool autorefresh, ValueChanged
switch (await showMenu( switch (await showMenu(
navigator: navigator, navigator: navigator,
position: new MenuPosition( position: new MenuPosition(
right: sky.view.paddingRight + _kMenuMargin, right: ui.view.paddingRight + _kMenuMargin,
top: sky.view.paddingTop + _kMenuMargin top: ui.view.paddingTop + _kMenuMargin
), ),
builder: (NavigatorState navigator) { builder: (NavigatorState navigator) {
return <PopupMenuItem>[ return <PopupMenuItem>[
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/painting.dart'; import 'package:flutter/painting.dart';
...@@ -299,7 +299,7 @@ class CardCollectionState extends State<CardCollection> { ...@@ -299,7 +299,7 @@ class CardCollectionState extends State<CardCollection> {
}); });
} }
sky.Shader _createShader(Rect bounds) { ui.Shader _createShader(Rect bounds) {
return new LinearGradient( return new LinearGradient(
begin: Point.origin, begin: Point.origin,
end: new Point(0.0, bounds.height), end: new Point(0.0, bounds.height),
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -31,14 +31,14 @@ class Marker extends StatelessComponent { ...@@ -31,14 +31,14 @@ class Marker extends StatelessComponent {
final double size; final double size;
final MarkerType type; final MarkerType type;
void paintMarker(sky.Canvas canvas, _) { void paintMarker(ui.Canvas canvas, _) {
Paint paint = new Paint()..color = const Color(0x8000FF00); Paint paint = new Paint()..color = const Color(0x8000FF00);
paint.setStyle(sky.PaintingStyle.fill); paint.setStyle(ui.PaintingStyle.fill);
double r = size / 2.0; double r = size / 2.0;
canvas.drawCircle(new Point(r, r), r, paint); canvas.drawCircle(new Point(r, r), r, paint);
paint.color = const Color(0xFFFFFFFF); paint.color = const Color(0xFFFFFFFF);
paint.setStyle(sky.PaintingStyle.stroke); paint.setStyle(ui.PaintingStyle.stroke);
paint.strokeWidth = 1.0; paint.strokeWidth = 1.0;
if (type == MarkerType.topLeft) { if (type == MarkerType.topLeft) {
canvas.drawLine(new Point(r, r), new Point(r + r - 1.0, r), paint); canvas.drawLine(new Point(r, r), new Point(r + r - 1.0, r), paint);
...@@ -103,7 +103,7 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> { ...@@ -103,7 +103,7 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> {
}); });
} }
void handlePointerDown(GlobalKey target, sky.PointerEvent event) { void handlePointerDown(GlobalKey target, ui.PointerEvent event) {
setState(() { setState(() {
markers[MarkerType.touch] = new Point(event.x, event.y); markers[MarkerType.touch] = new Point(event.x, event.y);
final RenderBox box = target.currentContext.findRenderObject(); final RenderBox box = target.currentContext.findRenderObject();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -11,7 +11,7 @@ import 'package:flutter/rendering.dart'; ...@@ -11,7 +11,7 @@ import 'package:flutter/rendering.dart';
import '../rendering/solid_color_box.dart'; import '../rendering/solid_color_box.dart';
// Solid colour, RenderObject version // Solid colour, RenderObject version
void addFlexChildSolidColor(RenderFlex parent, sky.Color backgroundColor, { int flex: 0 }) { void addFlexChildSolidColor(RenderFlex parent, ui.Color backgroundColor, { int flex: 0 }) {
RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor); RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor);
parent.add(child); parent.add(child);
child.parentData.flex = flex; child.parentData.flex = flex;
...@@ -81,9 +81,9 @@ void main() { ...@@ -81,9 +81,9 @@ void main() {
new RenderBoxToWidgetAdapter(proxy, builder); // adds itself to proxy new RenderBoxToWidgetAdapter(proxy, builder); // adds itself to proxy
RenderFlex flexRoot = new RenderFlex(direction: FlexDirection.vertical); RenderFlex flexRoot = new RenderFlex(direction: FlexDirection.vertical);
addFlexChildSolidColor(flexRoot, const sky.Color(0xFFFF00FF), flex: 1); addFlexChildSolidColor(flexRoot, const ui.Color(0xFFFF00FF), flex: 1);
flexRoot.add(proxy); flexRoot.add(proxy);
addFlexChildSolidColor(flexRoot, const sky.Color(0xFF0000FF), flex: 1); addFlexChildSolidColor(flexRoot, const ui.Color(0xFF0000FF), flex: 1);
transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.identity()); transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.identity());
RenderPadding root = new RenderPadding(padding: new EdgeDims.all(80.0), child: transformBox); RenderPadding root = new RenderPadding(padding: new EdgeDims.all(80.0), child: transformBox);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:collection'; import 'dart:collection';
import 'dart:ui' as sky; import 'dart:ui' as ui;
/// Slows down animations by this factor to help in development. /// Slows down animations by this factor to help in development.
double timeDilation = 1.0; double timeDilation = 1.0;
...@@ -20,7 +20,7 @@ typedef void SchedulerCallback(Duration timeStamp); ...@@ -20,7 +20,7 @@ typedef void SchedulerCallback(Duration timeStamp);
class Scheduler { class Scheduler {
/// Requires clients to use the [scheduler] singleton /// Requires clients to use the [scheduler] singleton
Scheduler._() { Scheduler._() {
sky.view.setFrameCallback(beginFrame); ui.view.setFrameCallback(beginFrame);
} }
bool _haveScheduledVisualUpdate = false; bool _haveScheduledVisualUpdate = false;
...@@ -88,7 +88,7 @@ class Scheduler { ...@@ -88,7 +88,7 @@ class Scheduler {
void ensureVisualUpdate() { void ensureVisualUpdate() {
if (_haveScheduledVisualUpdate) if (_haveScheduledVisualUpdate)
return; return;
sky.view.scheduleFrame(); ui.view.scheduleFrame();
_haveScheduledVisualUpdate = true; _haveScheduledVisualUpdate = true;
} }
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:newton/newton.dart'; import 'package:newton/newton.dart';
...@@ -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 * sky.view.devicePixelRatio; double endVelocity = 15.0 * ui.view.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 * sky.view.devicePixelRatio; double endDistance = 0.5 * ui.view.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 * sky.view.devicePixelRatio * velocity.sign; double endVelocity = 15.0 * ui.view.devicePixelRatio * velocity.sign;
return new FrictionSimulation.through(startOffset, endOffset, startVelocity, endVelocity); return new FrictionSimulation.through(startOffset, endOffset, startVelocity, endVelocity);
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'arena.dart'; import 'arena.dart';
import 'recognizer.dart'; import 'recognizer.dart';
...@@ -16,17 +16,17 @@ enum DragState { ...@@ -16,17 +16,17 @@ enum DragState {
typedef void GestureDragStartCallback(); typedef void GestureDragStartCallback();
typedef void GestureDragUpdateCallback(double delta); typedef void GestureDragUpdateCallback(double delta);
typedef void GestureDragEndCallback(sky.Offset velocity); typedef void GestureDragEndCallback(ui.Offset velocity);
typedef void GesturePanStartCallback(); typedef void GesturePanStartCallback();
typedef void GesturePanUpdateCallback(sky.Offset delta); typedef void GesturePanUpdateCallback(ui.Offset delta);
typedef void GesturePanEndCallback(sky.Offset velocity); typedef void GesturePanEndCallback(ui.Offset velocity);
typedef void _GesturePolymorphicUpdateCallback<T>(T delta); typedef void _GesturePolymorphicUpdateCallback<T>(T delta);
int _eventTime(sky.PointerEvent event) => (event.timeStamp * 1000.0).toInt(); // microseconds int _eventTime(ui.PointerEvent event) => (event.timeStamp * 1000.0).toInt(); // microseconds
bool _isFlingGesture(sky.GestureVelocity velocity) { bool _isFlingGesture(ui.GestureVelocity velocity) {
double velocitySquared = velocity.x * velocity.x + velocity.y * velocity.y; double velocitySquared = velocity.x * velocity.x + velocity.y * velocity.y;
return velocity.isValid && return velocity.isValid &&
velocitySquared > kMinFlingVelocity * kMinFlingVelocity && velocitySquared > kMinFlingVelocity * kMinFlingVelocity &&
...@@ -45,12 +45,12 @@ abstract class _DragGestureRecognizer<T extends dynamic> extends GestureRecogniz ...@@ -45,12 +45,12 @@ abstract class _DragGestureRecognizer<T extends dynamic> extends GestureRecogniz
T _pendingDragDelta; T _pendingDragDelta;
T get _initialPendingDragDelta; T get _initialPendingDragDelta;
T _getDragDelta(sky.PointerEvent event); T _getDragDelta(ui.PointerEvent event);
bool get _hasSufficientPendingDragDeltaToAccept; bool get _hasSufficientPendingDragDeltaToAccept;
final sky.VelocityTracker _velocityTracker = new sky.VelocityTracker(); final ui.VelocityTracker _velocityTracker = new ui.VelocityTracker();
void addPointer(sky.PointerEvent event) { void addPointer(ui.PointerEvent event) {
startTrackingPointer(event.pointer); startTrackingPointer(event.pointer);
if (_state == DragState.ready) { if (_state == DragState.ready) {
_state = DragState.possible; _state = DragState.possible;
...@@ -58,7 +58,7 @@ abstract class _DragGestureRecognizer<T extends dynamic> extends GestureRecogniz ...@@ -58,7 +58,7 @@ abstract class _DragGestureRecognizer<T extends dynamic> extends GestureRecogniz
} }
} }
void handleEvent(sky.PointerEvent event) { void handleEvent(ui.PointerEvent event) {
assert(_state != DragState.ready); assert(_state != DragState.ready);
if (event.type == 'pointermove') { if (event.type == 'pointermove') {
_velocityTracker.addPosition(_eventTime(event), event.pointer, event.x, event.y); _velocityTracker.addPosition(_eventTime(event), event.pointer, event.x, event.y);
...@@ -96,10 +96,10 @@ abstract class _DragGestureRecognizer<T extends dynamic> extends GestureRecogniz ...@@ -96,10 +96,10 @@ abstract class _DragGestureRecognizer<T extends dynamic> extends GestureRecogniz
bool wasAccepted = (_state == DragState.accepted); bool wasAccepted = (_state == DragState.accepted);
_state = DragState.ready; _state = DragState.ready;
if (wasAccepted && onEnd != null) { if (wasAccepted && onEnd != null) {
sky.GestureVelocity gestureVelocity = _velocityTracker.getVelocity(pointer); ui.GestureVelocity gestureVelocity = _velocityTracker.getVelocity(pointer);
sky.Offset velocity = sky.Offset.zero; ui.Offset velocity = ui.Offset.zero;
if (_isFlingGesture(gestureVelocity)) if (_isFlingGesture(gestureVelocity))
velocity = new sky.Offset(gestureVelocity.x, gestureVelocity.y); velocity = new ui.Offset(gestureVelocity.x, gestureVelocity.y);
onEnd(velocity); onEnd(velocity);
} }
_velocityTracker.reset(); _velocityTracker.reset();
...@@ -120,7 +120,7 @@ class VerticalDragGestureRecognizer extends _DragGestureRecognizer<double> { ...@@ -120,7 +120,7 @@ class VerticalDragGestureRecognizer extends _DragGestureRecognizer<double> {
}) : super(router: router, onStart: onStart, onUpdate: onUpdate, onEnd: onEnd); }) : super(router: router, onStart: onStart, onUpdate: onUpdate, onEnd: onEnd);
double get _initialPendingDragDelta => 0.0; double get _initialPendingDragDelta => 0.0;
double _getDragDelta(sky.PointerEvent event) => event.dy; double _getDragDelta(ui.PointerEvent event) => event.dy;
bool get _hasSufficientPendingDragDeltaToAccept => _pendingDragDelta.abs() > kTouchSlop; bool get _hasSufficientPendingDragDeltaToAccept => _pendingDragDelta.abs() > kTouchSlop;
} }
...@@ -133,11 +133,11 @@ class HorizontalDragGestureRecognizer extends _DragGestureRecognizer<double> { ...@@ -133,11 +133,11 @@ class HorizontalDragGestureRecognizer extends _DragGestureRecognizer<double> {
}) : super(router: router, onStart: onStart, onUpdate: onUpdate, onEnd: onEnd); }) : super(router: router, onStart: onStart, onUpdate: onUpdate, onEnd: onEnd);
double get _initialPendingDragDelta => 0.0; double get _initialPendingDragDelta => 0.0;
double _getDragDelta(sky.PointerEvent event) => event.dx; double _getDragDelta(ui.PointerEvent event) => event.dx;
bool get _hasSufficientPendingDragDeltaToAccept => _pendingDragDelta.abs() > kTouchSlop; bool get _hasSufficientPendingDragDeltaToAccept => _pendingDragDelta.abs() > kTouchSlop;
} }
class PanGestureRecognizer extends _DragGestureRecognizer<sky.Offset> { class PanGestureRecognizer extends _DragGestureRecognizer<ui.Offset> {
PanGestureRecognizer({ PanGestureRecognizer({
PointerRouter router, PointerRouter router,
GesturePanStartCallback onStart, GesturePanStartCallback onStart,
...@@ -145,8 +145,8 @@ class PanGestureRecognizer extends _DragGestureRecognizer<sky.Offset> { ...@@ -145,8 +145,8 @@ class PanGestureRecognizer extends _DragGestureRecognizer<sky.Offset> {
GesturePanEndCallback onEnd GesturePanEndCallback onEnd
}) : super(router: router, onStart: onStart, onUpdate: onUpdate, onEnd: onEnd); }) : super(router: router, onStart: onStart, onUpdate: onUpdate, onEnd: onEnd);
sky.Offset get _initialPendingDragDelta => sky.Offset.zero; ui.Offset get _initialPendingDragDelta => ui.Offset.zero;
sky.Offset _getDragDelta(sky.PointerEvent event) => new sky.Offset(event.dx, event.dy); ui.Offset _getDragDelta(ui.PointerEvent event) => new ui.Offset(event.dx, event.dy);
bool get _hasSufficientPendingDragDeltaToAccept { bool get _hasSufficientPendingDragDeltaToAccept {
return _pendingDragDelta.distance > kPanSlop; return _pendingDragDelta.distance > kPanSlop;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'arena.dart'; import 'arena.dart';
import 'constants.dart'; import 'constants.dart';
...@@ -22,7 +22,7 @@ class LongPressGestureRecognizer extends PrimaryPointerGestureRecognizer { ...@@ -22,7 +22,7 @@ class LongPressGestureRecognizer extends PrimaryPointerGestureRecognizer {
onLongPress(); onLongPress();
} }
void handlePrimaryPointer(sky.PointerEvent event) { void handlePrimaryPointer(ui.PointerEvent event) {
if (event.type == 'pointerup') if (event.type == 'pointerup')
resolve(GestureDisposition.rejected); resolve(GestureDisposition.rejected);
} }
......
...@@ -2,18 +2,18 @@ ...@@ -2,18 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
/// A callback that receives a [sky.PointerEvent] /// A callback that receives a [ui.PointerEvent]
typedef void PointerRoute(sky.PointerEvent event); typedef void PointerRoute(ui.PointerEvent event);
/// A routing table for [sky.PointerEvent] events. /// A routing table for [ui.PointerEvent] events.
class PointerRouter { class PointerRouter {
final Map<int, List<PointerRoute>> _routeMap = new Map<int, List<PointerRoute>>(); final Map<int, List<PointerRoute>> _routeMap = new Map<int, List<PointerRoute>>();
/// Adds a route to the routing table /// Adds a route to the routing table
/// ///
/// Whenever this object routes a [sky.PointerEvent] corresponding to /// Whenever this object routes a [ui.PointerEvent] corresponding to
/// pointer, call route. /// pointer, call route.
void addRoute(int pointer, PointerRoute route) { void addRoute(int pointer, PointerRoute route) {
List<PointerRoute> routes = _routeMap.putIfAbsent(pointer, () => new List<PointerRoute>()); List<PointerRoute> routes = _routeMap.putIfAbsent(pointer, () => new List<PointerRoute>());
...@@ -23,7 +23,7 @@ class PointerRouter { ...@@ -23,7 +23,7 @@ class PointerRouter {
/// Removes a route from the routing table /// Removes a route from the routing table
/// ///
/// No longer call route when routing a [sky.PointerEvent] corresponding to /// No longer call route when routing a [ui.PointerEvent] corresponding to
/// pointer. Requires that this route was previously added to the router. /// pointer. Requires that this route was previously added to the router.
void removeRoute(int pointer, PointerRoute route) { void removeRoute(int pointer, PointerRoute route) {
assert(_routeMap.containsKey(pointer)); assert(_routeMap.containsKey(pointer));
...@@ -37,7 +37,7 @@ class PointerRouter { ...@@ -37,7 +37,7 @@ class PointerRouter {
/// Call the routes registed for this pointer event. /// Call the routes registed for this pointer event.
/// ///
/// Calls the routes in the order in which they were added to the route. /// Calls the routes in the order in which they were added to the route.
void route(sky.PointerEvent event) { void route(ui.PointerEvent event) {
List<PointerRoute> routes = _routeMap[event.pointer]; List<PointerRoute> routes = _routeMap[event.pointer];
if (routes == null) if (routes == null)
return; return;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async'; import 'dart:async';
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'arena.dart'; import 'arena.dart';
import 'constants.dart'; import 'constants.dart';
...@@ -22,9 +22,9 @@ abstract class GestureRecognizer extends GestureArenaMember { ...@@ -22,9 +22,9 @@ abstract class GestureRecognizer extends GestureArenaMember {
final Set<int> _trackedPointers = new Set<int>(); final Set<int> _trackedPointers = new Set<int>();
/// The primary entry point for users of this class. /// The primary entry point for users of this class.
void addPointer(sky.PointerEvent event); void addPointer(ui.PointerEvent event);
void handleEvent(sky.PointerEvent event); void handleEvent(ui.PointerEvent event);
void acceptGesture(int pointer) { } void acceptGesture(int pointer) { }
void rejectGesture(int pointer) { } void rejectGesture(int pointer) { }
void didStopTrackingLastPointer(int pointer); void didStopTrackingLastPointer(int pointer);
...@@ -58,7 +58,7 @@ abstract class GestureRecognizer extends GestureArenaMember { ...@@ -58,7 +58,7 @@ abstract class GestureRecognizer extends GestureArenaMember {
didStopTrackingLastPointer(pointer); didStopTrackingLastPointer(pointer);
} }
void stopTrackingIfPointerNoLongerDown(sky.PointerEvent event) { void stopTrackingIfPointerNoLongerDown(ui.PointerEvent event) {
if (event.type == 'pointerup' || event.type == 'pointercancel') if (event.type == 'pointerup' || event.type == 'pointercancel')
stopTrackingPointer(event.pointer); stopTrackingPointer(event.pointer);
} }
...@@ -71,8 +71,8 @@ enum GestureRecognizerState { ...@@ -71,8 +71,8 @@ enum GestureRecognizerState {
defunct defunct
} }
sky.Point _getPoint(sky.PointerEvent event) { ui.Point _getPoint(ui.PointerEvent event) {
return new sky.Point(event.x, event.y); return new ui.Point(event.x, event.y);
} }
abstract class PrimaryPointerGestureRecognizer extends GestureRecognizer { abstract class PrimaryPointerGestureRecognizer extends GestureRecognizer {
...@@ -83,10 +83,10 @@ abstract class PrimaryPointerGestureRecognizer extends GestureRecognizer { ...@@ -83,10 +83,10 @@ abstract class PrimaryPointerGestureRecognizer extends GestureRecognizer {
GestureRecognizerState state = GestureRecognizerState.ready; GestureRecognizerState state = GestureRecognizerState.ready;
int primaryPointer; int primaryPointer;
sky.Point initialPosition; ui.Point initialPosition;
Timer _timer; Timer _timer;
void addPointer(sky.PointerEvent event) { void addPointer(ui.PointerEvent event) {
startTrackingPointer(event.pointer); startTrackingPointer(event.pointer);
if (state == GestureRecognizerState.ready) { if (state == GestureRecognizerState.ready) {
state = GestureRecognizerState.possible; state = GestureRecognizerState.possible;
...@@ -97,7 +97,7 @@ abstract class PrimaryPointerGestureRecognizer extends GestureRecognizer { ...@@ -97,7 +97,7 @@ abstract class PrimaryPointerGestureRecognizer extends GestureRecognizer {
} }
} }
void handleEvent(sky.PointerEvent event) { void handleEvent(ui.PointerEvent event) {
assert(state != GestureRecognizerState.ready); assert(state != GestureRecognizerState.ready);
if (state == GestureRecognizerState.possible && event.pointer == primaryPointer) { if (state == GestureRecognizerState.possible && event.pointer == primaryPointer) {
// TODO(abarth): Maybe factor the slop handling out into a separate class? // TODO(abarth): Maybe factor the slop handling out into a separate class?
...@@ -110,7 +110,7 @@ abstract class PrimaryPointerGestureRecognizer extends GestureRecognizer { ...@@ -110,7 +110,7 @@ abstract class PrimaryPointerGestureRecognizer extends GestureRecognizer {
} }
/// Override to provide behavior for the primary pointer when the gesture is still possible. /// Override to provide behavior for the primary pointer when the gesture is still possible.
void handlePrimaryPointer(sky.PointerEvent event); void handlePrimaryPointer(ui.PointerEvent event);
/// Override to be notified with [deadline] is exceeded. /// Override to be notified with [deadline] is exceeded.
/// ///
...@@ -143,8 +143,8 @@ abstract class PrimaryPointerGestureRecognizer extends GestureRecognizer { ...@@ -143,8 +143,8 @@ abstract class PrimaryPointerGestureRecognizer extends GestureRecognizer {
} }
} }
double _getDistance(sky.PointerEvent event) { double _getDistance(ui.PointerEvent event) {
sky.Offset offset = _getPoint(event) - initialPosition; ui.Offset offset = _getPoint(event) - initialPosition;
return offset.distance; return offset.distance;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'arena.dart'; import 'arena.dart';
import 'recognizer.dart'; import 'recognizer.dart';
...@@ -15,8 +15,8 @@ enum ScaleState { ...@@ -15,8 +15,8 @@ enum ScaleState {
started started
} }
typedef void GestureScaleStartCallback(sky.Point focalPoint); typedef void GestureScaleStartCallback(ui.Point focalPoint);
typedef void GestureScaleUpdateCallback(double scale, sky.Point focalPoint); typedef void GestureScaleUpdateCallback(double scale, ui.Point focalPoint);
typedef void GestureScaleEndCallback(); typedef void GestureScaleEndCallback();
class ScaleGestureRecognizer extends GestureRecognizer { class ScaleGestureRecognizer extends GestureRecognizer {
...@@ -31,21 +31,21 @@ class ScaleGestureRecognizer extends GestureRecognizer { ...@@ -31,21 +31,21 @@ class ScaleGestureRecognizer extends GestureRecognizer {
double _initialSpan; double _initialSpan;
double _currentSpan; double _currentSpan;
Map<int, sky.Point> _pointerLocations; Map<int, ui.Point> _pointerLocations;
double get _scaleFactor => _initialSpan > 0.0 ? _currentSpan / _initialSpan : 1.0; double get _scaleFactor => _initialSpan > 0.0 ? _currentSpan / _initialSpan : 1.0;
void addPointer(sky.PointerEvent event) { void addPointer(ui.PointerEvent event) {
startTrackingPointer(event.pointer); startTrackingPointer(event.pointer);
if (_state == ScaleState.ready) { if (_state == ScaleState.ready) {
_state = ScaleState.possible; _state = ScaleState.possible;
_initialSpan = 0.0; _initialSpan = 0.0;
_currentSpan = 0.0; _currentSpan = 0.0;
_pointerLocations = new Map<int, sky.Point>(); _pointerLocations = new Map<int, ui.Point>();
} }
} }
void handleEvent(sky.PointerEvent event) { void handleEvent(ui.PointerEvent event) {
assert(_state != ScaleState.ready); assert(_state != ScaleState.ready);
bool configChanged = false; bool configChanged = false;
switch(event.type) { switch(event.type) {
...@@ -55,10 +55,10 @@ class ScaleGestureRecognizer extends GestureRecognizer { ...@@ -55,10 +55,10 @@ class ScaleGestureRecognizer extends GestureRecognizer {
break; break;
case 'pointerdown': case 'pointerdown':
configChanged = true; configChanged = true;
_pointerLocations[event.pointer] = new sky.Point(event.x, event.y); _pointerLocations[event.pointer] = new ui.Point(event.x, event.y);
break; break;
case 'pointermove': case 'pointermove':
_pointerLocations[event.pointer] = new sky.Point(event.x, event.y); _pointerLocations[event.pointer] = new ui.Point(event.x, event.y);
break; break;
} }
...@@ -71,10 +71,10 @@ class ScaleGestureRecognizer extends GestureRecognizer { ...@@ -71,10 +71,10 @@ class ScaleGestureRecognizer extends GestureRecognizer {
int count = _pointerLocations.keys.length; int count = _pointerLocations.keys.length;
// Compute the focal point // Compute the focal point
sky.Point focalPoint = sky.Point.origin; ui.Point focalPoint = ui.Point.origin;
for (int pointer in _pointerLocations.keys) for (int pointer in _pointerLocations.keys)
focalPoint += _pointerLocations[pointer].toOffset(); focalPoint += _pointerLocations[pointer].toOffset();
focalPoint = new sky.Point(focalPoint.x / count, focalPoint.y / count); focalPoint = new ui.Point(focalPoint.x / count, focalPoint.y / count);
// Span is the average deviation from focal point // Span is the average deviation from focal point
double totalDeviation = 0.0; double totalDeviation = 0.0;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'arena.dart'; import 'arena.dart';
import 'constants.dart'; import 'constants.dart';
...@@ -23,7 +23,7 @@ class ShowPressGestureRecognizer extends PrimaryPointerGestureRecognizer { ...@@ -23,7 +23,7 @@ class ShowPressGestureRecognizer extends PrimaryPointerGestureRecognizer {
onShowPress(); onShowPress();
} }
void handlePrimaryPointer(sky.PointerEvent event) { void handlePrimaryPointer(ui.PointerEvent event) {
if (event.type == 'pointerup') if (event.type == 'pointerup')
resolve(GestureDisposition.rejected); resolve(GestureDisposition.rejected);
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'arena.dart'; import 'arena.dart';
import 'recognizer.dart'; import 'recognizer.dart';
...@@ -17,7 +17,7 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer { ...@@ -17,7 +17,7 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer {
GestureTapCallback onTapDown; GestureTapCallback onTapDown;
GestureTapCallback onTapCancel; GestureTapCallback onTapCancel;
void handlePrimaryPointer(sky.PointerEvent event) { void handlePrimaryPointer(ui.PointerEvent event) {
if (event.type == 'pointerdown') { if (event.type == 'pointerdown') {
if (onTapDown != null) if (onTapDown != null)
onTapDown(); onTapDown();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
...@@ -12,8 +12,8 @@ import 'theme.dart'; ...@@ -12,8 +12,8 @@ import 'theme.dart';
export 'package:flutter/rendering.dart' show ValueChanged; export 'package:flutter/rendering.dart' show ValueChanged;
const double _kMidpoint = 0.5; const double _kMidpoint = 0.5;
const sky.Color _kLightUncheckedColor = const sky.Color(0x8A000000); const ui.Color _kLightUncheckedColor = const ui.Color(0x8A000000);
const sky.Color _kDarkUncheckedColor = const sky.Color(0xB2FFFFFF); const ui.Color _kDarkUncheckedColor = const ui.Color(0xB2FFFFFF);
const double _kEdgeSize = 18.0; const double _kEdgeSize = 18.0;
const double _kEdgeRadius = 1.0; const double _kEdgeRadius = 1.0;
const double _kStrokeWidth = 2.0; const double _kStrokeWidth = 2.0;
...@@ -126,7 +126,7 @@ class _RenderCheckbox extends RenderToggleable { ...@@ -126,7 +126,7 @@ class _RenderCheckbox extends RenderToggleable {
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
final PaintingCanvas canvas = context.canvas; final PaintingCanvas canvas = context.canvas;
// Choose a color between grey and the theme color // Choose a color between grey and the theme color
sky.Paint paint = new sky.Paint() ui.Paint paint = new ui.Paint()
..strokeWidth = _kStrokeWidth ..strokeWidth = _kStrokeWidth
..color = uncheckedColor; ..color = uncheckedColor;
...@@ -134,25 +134,25 @@ class _RenderCheckbox extends RenderToggleable { ...@@ -134,25 +134,25 @@ class _RenderCheckbox extends RenderToggleable {
// Because we have a stroke size of 2, we should have a minimum 1.0 inset. // Because we have a stroke size of 2, we should have a minimum 1.0 inset.
double inset = 2.0 - (position - _kMidpoint).abs() * 2.0; double inset = 2.0 - (position - _kMidpoint).abs() * 2.0;
double rectSize = _kEdgeSize - inset * _kStrokeWidth; double rectSize = _kEdgeSize - inset * _kStrokeWidth;
sky.Rect rect = ui.Rect rect =
new sky.Rect.fromLTWH(offset.dx + inset, offset.dy + inset, rectSize, rectSize); new ui.Rect.fromLTWH(offset.dx + inset, offset.dy + inset, rectSize, rectSize);
// Create an inner rectangle to cover inside of rectangle. This is needed to avoid // Create an inner rectangle to cover inside of rectangle. This is needed to avoid
// painting artefacts caused by overlayed paintings. // painting artefacts caused by overlayed paintings.
sky.Rect innerRect = rect.deflate(1.0); ui.Rect innerRect = rect.deflate(1.0);
sky.RRect rrect = new sky.RRect() ui.RRect rrect = new ui.RRect()
..setRectXY(rect, _kEdgeRadius, _kEdgeRadius); ..setRectXY(rect, _kEdgeRadius, _kEdgeRadius);
// Outline of the empty rrect // Outline of the empty rrect
paint.setStyle(sky.PaintingStyle.stroke); paint.setStyle(ui.PaintingStyle.stroke);
canvas.drawRRect(rrect, paint); canvas.drawRRect(rrect, paint);
// Radial gradient that changes size // Radial gradient that changes size
if (position > 0) { if (position > 0) {
paint.setStyle(sky.PaintingStyle.fill); paint.setStyle(ui.PaintingStyle.fill);
paint.setShader(new sky.Gradient.radial( paint.setShader(new ui.Gradient.radial(
new Point(_kEdgeSize / 2.0, _kEdgeSize / 2.0), new Point(_kEdgeSize / 2.0, _kEdgeSize / 2.0),
_kEdgeSize * (_kMidpoint - position) * 8.0, [ _kEdgeSize * (_kMidpoint - position) * 8.0, [
const sky.Color(0x00000000), const ui.Color(0x00000000),
uncheckedColor uncheckedColor
])); ]));
canvas.drawRect(innerRect, paint); canvas.drawRect(innerRect, paint);
...@@ -164,22 +164,22 @@ class _RenderCheckbox extends RenderToggleable { ...@@ -164,22 +164,22 @@ class _RenderCheckbox extends RenderToggleable {
// First draw a rounded rect outline then fill inner rectangle with accent color. // First draw a rounded rect outline then fill inner rectangle with accent color.
paint.color = new Color.fromARGB((t * 255).floor(), _accentColor.red, paint.color = new Color.fromARGB((t * 255).floor(), _accentColor.red,
_accentColor.green, _accentColor.blue); _accentColor.green, _accentColor.blue);
paint.setStyle(sky.PaintingStyle.stroke); paint.setStyle(ui.PaintingStyle.stroke);
canvas.drawRRect(rrect, paint); canvas.drawRRect(rrect, paint);
paint.setStyle(sky.PaintingStyle.fill); paint.setStyle(ui.PaintingStyle.fill);
canvas.drawRect(innerRect, paint); canvas.drawRect(innerRect, paint);
// White inner check // White inner check
paint.color = const sky.Color(0xFFFFFFFF); paint.color = const ui.Color(0xFFFFFFFF);
paint.setStyle(sky.PaintingStyle.stroke); paint.setStyle(ui.PaintingStyle.stroke);
sky.Path path = new sky.Path(); ui.Path path = new ui.Path();
sky.Point start = new sky.Point(_kEdgeSize * 0.15, _kEdgeSize * 0.45); ui.Point start = new ui.Point(_kEdgeSize * 0.15, _kEdgeSize * 0.45);
sky.Point mid = new sky.Point(_kEdgeSize * 0.4, _kEdgeSize * 0.7); ui.Point mid = new ui.Point(_kEdgeSize * 0.4, _kEdgeSize * 0.7);
sky.Point end = new sky.Point(_kEdgeSize * 0.85, _kEdgeSize * 0.25); ui.Point end = new ui.Point(_kEdgeSize * 0.85, _kEdgeSize * 0.25);
Point lerp(Point p1, Point p2, double t) => Point lerp(Point p1, Point p2, double t) =>
new Point(p1.x * (1.0 - t) + p2.x * t, p1.y * (1.0 - t) + p2.y * t); new Point(p1.x * (1.0 - t) + p2.x * t, p1.y * (1.0 - t) + p2.y * t);
sky.Point drawStart = lerp(start, mid, 1.0 - t); ui.Point drawStart = lerp(start, mid, 1.0 - t);
sky.Point drawEnd = lerp(mid, end, t); ui.Point drawEnd = lerp(mid, end, t);
path.moveTo(offset.dx + drawStart.x, offset.dy + drawStart.y); path.moveTo(offset.dx + drawStart.x, offset.dy + drawStart.y);
path.lineTo(offset.dx + mid.x, offset.dy + mid.y); path.lineTo(offset.dx + mid.x, offset.dy + mid.y);
path.lineTo(offset.dx + drawEnd.x, offset.dy + drawEnd.y); path.lineTo(offset.dx + drawEnd.x, offset.dy + drawEnd.y);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/painting.dart'; import 'package:flutter/painting.dart';
...@@ -49,10 +49,10 @@ class _DrawerItemState extends State<DrawerItem> { ...@@ -49,10 +49,10 @@ class _DrawerItemState extends State<DrawerItem> {
return Colors.transparent; return Colors.transparent;
} }
sky.ColorFilter _getColorFilter(ThemeData themeData) { ui.ColorFilter _getColorFilter(ThemeData themeData) {
if (config.selected) if (config.selected)
return new sky.ColorFilter.mode(themeData.primaryColor, sky.TransferMode.srcATop); return new ui.ColorFilter.mode(themeData.primaryColor, ui.TransferMode.srcATop);
return new sky.ColorFilter.mode(const Color(0x73000000), sky.TransferMode.dstIn); return new ui.ColorFilter.mode(const Color(0x73000000), ui.TransferMode.dstIn);
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
...@@ -62,7 +62,7 @@ class Icon extends StatelessComponent { ...@@ -62,7 +62,7 @@ class Icon extends StatelessComponent {
final int size; final int size;
final String type; final String type;
final IconThemeColor color; final IconThemeColor color;
final sky.ColorFilter colorFilter; final ui.ColorFilter colorFilter;
String _getColorSuffix(BuildContext context) { String _getColorSuffix(BuildContext context) {
IconThemeColor iconThemeColor = color; IconThemeColor iconThemeColor = color;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
...@@ -20,7 +20,7 @@ class IconButton extends StatelessComponent { ...@@ -20,7 +20,7 @@ class IconButton extends StatelessComponent {
final String icon; final String icon;
final IconThemeColor color; final IconThemeColor color;
final sky.ColorFilter colorFilter; final ui.ColorFilter colorFilter;
final GestureTapCallback onPressed; final GestureTapCallback onPressed;
Widget build(BuildContext context) { Widget build(BuildContext context) {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import 'dart:async'; import 'dart:async';
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
...@@ -91,7 +91,7 @@ class _InkSplash { ...@@ -91,7 +91,7 @@ class _InkSplash {
void paint(PaintingCanvas canvas) { void paint(PaintingCanvas canvas) {
int opacity = (_kSplashInitialOpacity * (1.1 - (_radius.value / _targetRadius))).floor(); int opacity = (_kSplashInitialOpacity * (1.1 - (_radius.value / _targetRadius))).floor();
sky.Paint paint = new sky.Paint()..color = new sky.Color(opacity << 24); ui.Paint paint = new ui.Paint()..color = new ui.Color(opacity << 24);
double radius = _pinnedRadius == null ? _radius.value : _pinnedRadius; double radius = _pinnedRadius == null ? _radius.value : _pinnedRadius;
canvas.drawCircle(position, radius, paint); canvas.drawCircle(position, radius, paint);
} }
...@@ -137,7 +137,7 @@ class _RenderInkWell extends RenderProxyBox { ...@@ -137,7 +137,7 @@ class _RenderInkWell extends RenderProxyBox {
TapGestureRecognizer _tap; TapGestureRecognizer _tap;
LongPressGestureRecognizer _longPress; LongPressGestureRecognizer _longPress;
void handleEvent(sky.Event event, BoxHitTestEntry entry) { void handleEvent(ui.Event event, BoxHitTestEntry entry) {
if (event.type == 'pointerdown' && (_tap != null || _longPress != null)) { if (event.type == 'pointerdown' && (_tap != null || _longPress != null)) {
_tap?.addPointer(event); _tap?.addPointer(event);
_longPress?.addPointer(event); _longPress?.addPointer(event);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/painting.dart'; import 'package:flutter/painting.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
...@@ -56,7 +56,7 @@ class _MaterialAppState extends State<MaterialApp> { ...@@ -56,7 +56,7 @@ class _MaterialAppState extends State<MaterialApp> {
super.dispose(); super.dispose();
} }
void _backHandler(sky.Event event) { void _backHandler(ui.Event event) {
assert(mounted); assert(mounted);
if (event.type == 'back') { if (event.type == 'back') {
NavigatorState navigator = _navigator.currentState; NavigatorState navigator = _navigator.currentState;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async'; import 'dart:async';
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import 'package:flutter/painting.dart'; import 'package:flutter/painting.dart';
...@@ -75,7 +75,7 @@ class PopupMenu extends StatelessComponent { ...@@ -75,7 +75,7 @@ class PopupMenu extends StatelessComponent {
variables: [width, height], variables: [width, height],
builder: (BuildContext context) { builder: (BuildContext context) {
return new CustomPaint( return new CustomPaint(
callback: (sky.Canvas canvas, Size size) { callback: (ui.Canvas canvas, Size size) {
double widthValue = width.value * size.width; double widthValue = width.value * size.width;
double heightValue = height.value * size.height; double heightValue = height.value * size.height;
painter.paint(canvas, new Rect.fromLTWH(size.width - widthValue, 0.0, widthValue, heightValue)); painter.paint(canvas, new Rect.fromLTWH(size.width - widthValue, 0.0, widthValue, heightValue));
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
...@@ -76,10 +76,10 @@ class LinearProgressIndicator extends ProgressIndicator { ...@@ -76,10 +76,10 @@ class LinearProgressIndicator extends ProgressIndicator {
double bufferValue double bufferValue
}) : super(key: key, value: value, bufferValue: bufferValue); }) : super(key: key, value: value, bufferValue: bufferValue);
void _paint(BuildContext context, double performanceValue, sky.Canvas canvas, Size size) { void _paint(BuildContext context, double performanceValue, ui.Canvas canvas, Size size) {
Paint paint = new Paint() Paint paint = new Paint()
..color = _getBackgroundColor(context) ..color = _getBackgroundColor(context)
..setStyle(sky.PaintingStyle.fill); ..setStyle(ui.PaintingStyle.fill);
canvas.drawRect(Point.origin & size, paint); canvas.drawRect(Point.origin & size, paint);
paint.color = _getValueColor(context); paint.color = _getValueColor(context);
...@@ -103,7 +103,7 @@ class LinearProgressIndicator extends ProgressIndicator { ...@@ -103,7 +103,7 @@ class LinearProgressIndicator extends ProgressIndicator {
), ),
child: new CustomPaint( child: new CustomPaint(
token: _getCustomPaintToken(performanceValue), token: _getCustomPaintToken(performanceValue),
callback: (sky.Canvas canvas, Size size) { callback: (ui.Canvas canvas, Size size) {
_paint(context, performanceValue, canvas, size); _paint(context, performanceValue, canvas, size);
} }
) )
...@@ -124,15 +124,15 @@ class CircularProgressIndicator extends ProgressIndicator { ...@@ -124,15 +124,15 @@ class CircularProgressIndicator extends ProgressIndicator {
double bufferValue double bufferValue
}) : super(key: key, value: value, bufferValue: bufferValue); }) : super(key: key, value: value, bufferValue: bufferValue);
void _paint(BuildContext context, double performanceValue, sky.Canvas canvas, Size size) { void _paint(BuildContext context, double performanceValue, ui.Canvas canvas, Size size) {
Paint paint = new Paint() Paint paint = new Paint()
..color = _getValueColor(context) ..color = _getValueColor(context)
..strokeWidth = _kCircularProgressIndicatorStrokeWidth ..strokeWidth = _kCircularProgressIndicatorStrokeWidth
..setStyle(sky.PaintingStyle.stroke); ..setStyle(ui.PaintingStyle.stroke);
if (value != null) { if (value != null) {
double angle = value.clamp(0.0, 1.0) * _kSweep; double angle = value.clamp(0.0, 1.0) * _kSweep;
sky.Path path = new sky.Path() ui.Path path = new ui.Path()
..arcTo(Point.origin & size, _kStartAngle, angle, false); ..arcTo(Point.origin & size, _kStartAngle, angle, false);
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
} else { } else {
...@@ -140,7 +140,7 @@ class CircularProgressIndicator extends ProgressIndicator { ...@@ -140,7 +140,7 @@ class CircularProgressIndicator extends ProgressIndicator {
double endAngle = startAngle + _kTwoPI * 0.75; double endAngle = startAngle + _kTwoPI * 0.75;
double arcAngle = startAngle.clamp(0.0, _kTwoPI); double arcAngle = startAngle.clamp(0.0, _kTwoPI);
double arcSweep = endAngle.clamp(0.0, _kTwoPI) - arcAngle; double arcSweep = endAngle.clamp(0.0, _kTwoPI) - arcAngle;
sky.Path path = new sky.Path() ui.Path path = new ui.Path()
..arcTo(Point.origin & size, _kStartAngle + arcAngle, arcSweep, false); ..arcTo(Point.origin & size, _kStartAngle + arcAngle, arcSweep, false);
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
} }
...@@ -154,7 +154,7 @@ class CircularProgressIndicator extends ProgressIndicator { ...@@ -154,7 +154,7 @@ class CircularProgressIndicator extends ProgressIndicator {
), ),
child: new CustomPaint( child: new CustomPaint(
token: _getCustomPaintToken(performanceValue), token: _getCustomPaintToken(performanceValue),
callback: (sky.Canvas canvas, Size size) { callback: (ui.Canvas canvas, Size size) {
_paint(context, performanceValue, canvas, size); _paint(context, performanceValue, canvas, size);
} }
) )
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async'; import 'dart:async';
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'dart:ui' show Point, Offset, Color, Paint; import 'dart:ui' show Point, Offset, Color, Paint;
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
...@@ -82,7 +82,7 @@ class RadialReaction { ...@@ -82,7 +82,7 @@ class RadialReaction {
final Paint _innerPaint = new Paint(); final Paint _innerPaint = new Paint();
/// Paint the reaction onto the given canvas at the given offset /// Paint the reaction onto the given canvas at the given offset
void paint(sky.Canvas canvas, Offset offset) { void paint(ui.Canvas canvas, Offset offset) {
_outerPaint.color = _kOuterColor.withAlpha(_roundOpacity(_outerOpacity.value * _fade.value)); _outerPaint.color = _kOuterColor.withAlpha(_roundOpacity(_outerOpacity.value * _fade.value));
canvas.drawCircle(center + offset, radius, _outerPaint); canvas.drawCircle(center + offset, radius, _outerPaint);
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'theme.dart'; import 'theme.dart';
const sky.Color _kLightOffColor = const sky.Color(0x8A000000); const ui.Color _kLightOffColor = const ui.Color(0x8A000000);
const sky.Color _kDarkOffColor = const sky.Color(0xB2FFFFFF); const ui.Color _kDarkOffColor = const ui.Color(0xB2FFFFFF);
typedef void RadioValueChanged(Object value); typedef void RadioValueChanged(Object value);
...@@ -45,18 +45,18 @@ class Radio extends StatelessComponent { ...@@ -45,18 +45,18 @@ class Radio extends StatelessComponent {
width: kDiameter, width: kDiameter,
height: kDiameter, height: kDiameter,
child: new CustomPaint( child: new CustomPaint(
callback: (sky.Canvas canvas, Size size) { callback: (ui.Canvas canvas, Size size) {
Paint paint = new Paint()..color = _getColor(context); Paint paint = new Paint()..color = _getColor(context);
// Draw the outer circle // Draw the outer circle
paint.setStyle(sky.PaintingStyle.stroke); paint.setStyle(ui.PaintingStyle.stroke);
paint.strokeWidth = 2.0; paint.strokeWidth = 2.0;
canvas.drawCircle(const Point(kOuterRadius, kOuterRadius), kOuterRadius, paint); canvas.drawCircle(const Point(kOuterRadius, kOuterRadius), kOuterRadius, paint);
// Draw the inner circle // Draw the inner circle
if (value == groupValue) { if (value == groupValue) {
paint.setStyle(sky.PaintingStyle.fill); paint.setStyle(ui.PaintingStyle.fill);
canvas.drawCircle(const Point(kOuterRadius, kOuterRadius), kInnerRadius, paint); canvas.drawCircle(const Point(kOuterRadius, kOuterRadius), kInnerRadius, paint);
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
...@@ -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 + sky.view.paddingTop; toolBarHeight = kToolBarHeight + ui.view.paddingTop;
double statusBarHeight = 0.0; double statusBarHeight = 0.0;
if (statusBar != null) if (statusBar != null)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async'; import 'dart:async';
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/painting.dart'; import 'package:flutter/painting.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -15,8 +15,8 @@ import 'theme.dart'; ...@@ -15,8 +15,8 @@ import 'theme.dart';
export 'package:flutter/rendering.dart' show ValueChanged; export 'package:flutter/rendering.dart' show ValueChanged;
const sky.Color _kThumbOffColor = const sky.Color(0xFFFAFAFA); const ui.Color _kThumbOffColor = const ui.Color(0xFFFAFAFA);
const sky.Color _kTrackOffColor = const sky.Color(0x42000000); const ui.Color _kTrackOffColor = const ui.Color(0x42000000);
const double _kSwitchWidth = 35.0; const double _kSwitchWidth = 35.0;
const double _kThumbRadius = 10.0; const double _kThumbRadius = 10.0;
const double _kSwitchHeight = _kThumbRadius * 2.0; const double _kSwitchHeight = _kThumbRadius * 2.0;
...@@ -82,8 +82,8 @@ class _RenderSwitch extends RenderToggleable { ...@@ -82,8 +82,8 @@ class _RenderSwitch extends RenderToggleable {
RadialReaction _radialReaction; RadialReaction _radialReaction;
void handleEvent(sky.Event event, BoxHitTestEntry entry) { void handleEvent(ui.Event event, BoxHitTestEntry entry) {
if (event is sky.PointerEvent) { if (event is ui.PointerEvent) {
if (event.type == 'pointerdown') if (event.type == 'pointerdown')
_showRadialReaction(entry.localPosition); _showRadialReaction(entry.localPosition);
else if (event.type == 'pointerup') else if (event.type == 'pointerup')
...@@ -112,21 +112,21 @@ class _RenderSwitch extends RenderToggleable { ...@@ -112,21 +112,21 @@ class _RenderSwitch extends RenderToggleable {
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
final PaintingCanvas canvas = context.canvas; final PaintingCanvas canvas = context.canvas;
sky.Color thumbColor = _kThumbOffColor; ui.Color thumbColor = _kThumbOffColor;
sky.Color trackColor = _kTrackOffColor; ui.Color trackColor = _kTrackOffColor;
if (value) { if (value) {
thumbColor = _thumbColor; thumbColor = _thumbColor;
trackColor = new sky.Color(_thumbColor.value & 0x80FFFFFF); trackColor = new ui.Color(_thumbColor.value & 0x80FFFFFF);
} }
// Draw the track rrect // Draw the track rrect
sky.Paint paint = new sky.Paint() ui.Paint paint = new ui.Paint()
..color = trackColor ..color = trackColor
..style = sky.PaintingStyle.fill; ..style = ui.PaintingStyle.fill;
sky.Rect rect = new sky.Rect.fromLTWH(offset.dx, ui.Rect rect = new ui.Rect.fromLTWH(offset.dx,
offset.dy + _kSwitchHeight / 2.0 - _kTrackHeight / 2.0, _kTrackWidth, offset.dy + _kSwitchHeight / 2.0 - _kTrackHeight / 2.0, _kTrackWidth,
_kTrackHeight); _kTrackHeight);
sky.RRect rrect = new sky.RRect() ui.RRect rrect = new ui.RRect()
..setRectXY(rect, _kTrackRadius, _kTrackRadius); ..setRectXY(rect, _kTrackRadius, _kTrackRadius);
canvas.drawRRect(rrect, paint); canvas.drawRRect(rrect, paint);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:newton/newton.dart'; import 'package:newton/newton.dart';
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
...@@ -312,7 +312,7 @@ class Tab extends StatelessComponent { ...@@ -312,7 +312,7 @@ class Tab extends StatelessComponent {
Widget _buildLabelIcon() { Widget _buildLabelIcon() {
assert(label.icon != null); assert(label.icon != null);
Color iconColor = selected ? selectedColor : color; Color iconColor = selected ? selectedColor : color;
sky.ColorFilter filter = new sky.ColorFilter.mode(iconColor, sky.TransferMode.srcATop); ui.ColorFilter filter = new ui.ColorFilter.mode(iconColor, ui.TransferMode.srcATop);
return new Icon(type: label.icon, size: _kTabIconSize, colorFilter: filter); return new Icon(type: label.icon, size: _kTabIconSize, colorFilter: filter);
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'dart:ui' show Point, Offset, Size, Rect, Color, Paint, Path; import 'dart:ui' show Point, Offset, Size, Rect, Color, Paint, Path;
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
...@@ -121,10 +121,10 @@ class EdgeDims { ...@@ -121,10 +121,10 @@ class EdgeDims {
if (b == null) if (b == null)
return a * (1.0 - t); return a * (1.0 - t);
return new EdgeDims.TRBL( return new EdgeDims.TRBL(
sky.lerpDouble(a.top, b.top, t), ui.lerpDouble(a.top, b.top, t),
sky.lerpDouble(a.right, b.right, t), ui.lerpDouble(a.right, b.right, t),
sky.lerpDouble(a.bottom, b.bottom, t), ui.lerpDouble(a.bottom, b.bottom, t),
sky.lerpDouble(a.left, b.left, t) ui.lerpDouble(a.left, b.left, t)
); );
} }
...@@ -257,7 +257,7 @@ class BoxShadow { ...@@ -257,7 +257,7 @@ class BoxShadow {
return new BoxShadow( return new BoxShadow(
color: Color.lerp(a.color, b.color, t), color: Color.lerp(a.color, b.color, t),
offset: Offset.lerp(a.offset, b.offset, t), offset: Offset.lerp(a.offset, b.offset, t),
blur: sky.lerpDouble(a.blur, b.blur, t) blur: ui.lerpDouble(a.blur, b.blur, t)
); );
} }
...@@ -287,7 +287,7 @@ class BoxShadow { ...@@ -287,7 +287,7 @@ class BoxShadow {
/// A 2D gradient /// A 2D gradient
abstract class Gradient { abstract class Gradient {
sky.Shader createShader(); ui.Shader createShader();
} }
/// A 2D linear gradient /// A 2D linear gradient
...@@ -297,7 +297,7 @@ class LinearGradient extends Gradient { ...@@ -297,7 +297,7 @@ class LinearGradient extends Gradient {
this.end, this.end,
this.colors, this.colors,
this.stops, this.stops,
this.tileMode: sky.TileMode.clamp this.tileMode: ui.TileMode.clamp
}) { }) {
assert(colors.length == stops.length); assert(colors.length == stops.length);
} }
...@@ -319,10 +319,10 @@ class LinearGradient extends Gradient { ...@@ -319,10 +319,10 @@ class LinearGradient extends Gradient {
final List<double> stops; final List<double> stops;
/// How this gradient should tile the plane /// How this gradient should tile the plane
final sky.TileMode tileMode; final ui.TileMode tileMode;
sky.Shader createShader() { ui.Shader createShader() {
return new sky.Gradient.linear([begin, end], this.colors, return new ui.Gradient.linear([begin, end], this.colors,
this.stops, this.tileMode); this.stops, this.tileMode);
} }
...@@ -338,7 +338,7 @@ class RadialGradient extends Gradient { ...@@ -338,7 +338,7 @@ class RadialGradient extends Gradient {
this.radius, this.radius,
this.colors, this.colors,
this.stops, this.stops,
this.tileMode: sky.TileMode.clamp this.tileMode: ui.TileMode.clamp
}); });
/// The center of the gradient /// The center of the gradient
...@@ -361,10 +361,10 @@ class RadialGradient extends Gradient { ...@@ -361,10 +361,10 @@ class RadialGradient extends Gradient {
final List<double> stops; final List<double> stops;
/// How this gradient should tile the plane /// How this gradient should tile the plane
final sky.TileMode tileMode; final ui.TileMode tileMode;
sky.Shader createShader() { ui.Shader createShader() {
return new sky.Gradient.radial(center, radius, colors, stops, tileMode); return new ui.Gradient.radial(center, radius, colors, stops, tileMode);
} }
String toString() { String toString() {
...@@ -409,10 +409,10 @@ enum ImageRepeat { ...@@ -409,10 +409,10 @@ enum ImageRepeat {
/// Paint an image into the given rectangle in the canvas /// Paint an image into the given rectangle in the canvas
void paintImage({ void paintImage({
sky.Canvas canvas, ui.Canvas canvas,
Rect rect, Rect rect,
sky.Image image, ui.Image image,
sky.ColorFilter colorFilter, ui.ColorFilter colorFilter,
fit: ImageFit.scaleDown, fit: ImageFit.scaleDown,
repeat: ImageRepeat.noRepeat, repeat: ImageRepeat.noRepeat,
double positionX: 0.5, double positionX: 0.5,
...@@ -476,7 +476,7 @@ class BackgroundImage { ...@@ -476,7 +476,7 @@ class BackgroundImage {
final ImageRepeat repeat; final ImageRepeat repeat;
/// A color filter to apply to the background image before painting it /// A color filter to apply to the background image before painting it
final sky.ColorFilter colorFilter; final ui.ColorFilter colorFilter;
BackgroundImage({ BackgroundImage({
ImageResource image, ImageResource image,
...@@ -485,9 +485,9 @@ class BackgroundImage { ...@@ -485,9 +485,9 @@ class BackgroundImage {
this.colorFilter this.colorFilter
}) : _imageResource = image; }) : _imageResource = image;
sky.Image _image; ui.Image _image;
/// The image to be painted into the background /// The image to be painted into the background
sky.Image get image => _image; ui.Image get image => _image;
ImageResource _imageResource; ImageResource _imageResource;
...@@ -513,7 +513,7 @@ class BackgroundImage { ...@@ -513,7 +513,7 @@ class BackgroundImage {
_imageResource.removeListener(_handleImageChanged); _imageResource.removeListener(_handleImageChanged);
} }
void _handleImageChanged(sky.Image resolvedImage) { void _handleImageChanged(ui.Image resolvedImage) {
if (resolvedImage == null) if (resolvedImage == null)
return; return;
_image = resolvedImage; _image = resolvedImage;
...@@ -582,7 +582,7 @@ class BoxDecoration { ...@@ -582,7 +582,7 @@ class BoxDecoration {
backgroundColor: Color.lerp(null, backgroundColor, factor), backgroundColor: Color.lerp(null, backgroundColor, factor),
backgroundImage: backgroundImage, backgroundImage: backgroundImage,
border: border, border: border,
borderRadius: sky.lerpDouble(null, borderRadius, factor), borderRadius: ui.lerpDouble(null, borderRadius, factor),
boxShadow: BoxShadow.lerpList(null, boxShadow, factor), boxShadow: BoxShadow.lerpList(null, boxShadow, factor),
gradient: gradient, gradient: gradient,
shape: shape shape: shape
...@@ -604,7 +604,7 @@ class BoxDecoration { ...@@ -604,7 +604,7 @@ class BoxDecoration {
backgroundColor: Color.lerp(a.backgroundColor, b.backgroundColor, t), backgroundColor: Color.lerp(a.backgroundColor, b.backgroundColor, t),
backgroundImage: b.backgroundImage, backgroundImage: b.backgroundImage,
border: b.border, border: b.border,
borderRadius: sky.lerpDouble(a.borderRadius, b.borderRadius, t), borderRadius: ui.lerpDouble(a.borderRadius, b.borderRadius, t),
boxShadow: BoxShadow.lerpList(a.boxShadow, b.boxShadow, t), boxShadow: BoxShadow.lerpList(a.boxShadow, b.boxShadow, t),
gradient: b.gradient, gradient: b.gradient,
shape: b.shape shape: b.shape
...@@ -697,11 +697,11 @@ class BoxPainter { ...@@ -697,11 +697,11 @@ class BoxPainter {
double shortestSide = rect.shortestSide; double shortestSide = rect.shortestSide;
// In principle, we should use shortestSide / 2.0, but we don't want to // In principle, we should use shortestSide / 2.0, but we don't want to
// run into floating point rounding errors. Instead, we just use // run into floating point rounding errors. Instead, we just use
// shortestSide and let sky.Canvas do any remaining clamping. // shortestSide and let ui.Canvas do any remaining clamping.
return _decoration.borderRadius > shortestSide ? shortestSide : _decoration.borderRadius; return _decoration.borderRadius > shortestSide ? shortestSide : _decoration.borderRadius;
} }
void _paintBackgroundColor(sky.Canvas canvas, Rect rect) { void _paintBackgroundColor(ui.Canvas canvas, Rect rect) {
if (_decoration.backgroundColor != null || if (_decoration.backgroundColor != null ||
_decoration.boxShadow != null || _decoration.boxShadow != null ||
_decoration.gradient != null) { _decoration.gradient != null) {
...@@ -717,18 +717,18 @@ class BoxPainter { ...@@ -717,18 +717,18 @@ class BoxPainter {
canvas.drawRect(rect, _backgroundPaint); canvas.drawRect(rect, _backgroundPaint);
} else { } else {
double radius = _getEffectiveBorderRadius(rect); double radius = _getEffectiveBorderRadius(rect);
canvas.drawRRect(new sky.RRect()..setRectXY(rect, radius, radius), _backgroundPaint); canvas.drawRRect(new ui.RRect()..setRectXY(rect, radius, radius), _backgroundPaint);
} }
break; break;
} }
} }
} }
void _paintBackgroundImage(sky.Canvas canvas, Rect rect) { void _paintBackgroundImage(ui.Canvas canvas, Rect rect) {
final BackgroundImage backgroundImage = _decoration.backgroundImage; final BackgroundImage backgroundImage = _decoration.backgroundImage;
if (backgroundImage == null) if (backgroundImage == null)
return; return;
sky.Image image = backgroundImage.image; ui.Image image = backgroundImage.image;
if (image == null) if (image == null)
return; return;
paintImage( paintImage(
...@@ -741,7 +741,7 @@ class BoxPainter { ...@@ -741,7 +741,7 @@ class BoxPainter {
); );
} }
void _paintBorder(sky.Canvas canvas, Rect rect) { void _paintBorder(ui.Canvas canvas, Rect rect) {
if (_decoration.border == null) if (_decoration.border == null)
return; return;
...@@ -804,19 +804,19 @@ class BoxPainter { ...@@ -804,19 +804,19 @@ class BoxPainter {
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
} }
void _paintBorderWithRadius(sky.Canvas canvas, Rect rect) { void _paintBorderWithRadius(ui.Canvas canvas, Rect rect) {
assert(_hasUniformBorder); assert(_hasUniformBorder);
assert(_decoration.shape == Shape.rectangle); assert(_decoration.shape == Shape.rectangle);
Color color = _decoration.border.top.color; Color color = _decoration.border.top.color;
double width = _decoration.border.top.width; double width = _decoration.border.top.width;
double radius = _getEffectiveBorderRadius(rect); double radius = _getEffectiveBorderRadius(rect);
sky.RRect outer = new sky.RRect()..setRectXY(rect, radius, radius); ui.RRect outer = new ui.RRect()..setRectXY(rect, radius, radius);
sky.RRect inner = new sky.RRect()..setRectXY(rect.deflate(width), radius - width, radius - width); ui.RRect inner = new ui.RRect()..setRectXY(rect.deflate(width), radius - width, radius - width);
canvas.drawDRRect(outer, inner, new Paint()..color = color); canvas.drawDRRect(outer, inner, new Paint()..color = color);
} }
void _paintBorderWithCircle(sky.Canvas canvas, Rect rect) { void _paintBorderWithCircle(ui.Canvas canvas, Rect rect) {
assert(_hasUniformBorder); assert(_hasUniformBorder);
assert(_decoration.shape == Shape.circle); assert(_decoration.shape == Shape.circle);
assert(_decoration.borderRadius == null); assert(_decoration.borderRadius == null);
...@@ -827,14 +827,14 @@ class BoxPainter { ...@@ -827,14 +827,14 @@ class BoxPainter {
Paint paint = new Paint() Paint paint = new Paint()
..color = _decoration.border.top.color ..color = _decoration.border.top.color
..strokeWidth = width ..strokeWidth = width
..setStyle(sky.PaintingStyle.stroke); ..setStyle(ui.PaintingStyle.stroke);
Point center = rect.center; Point center = rect.center;
double radius = (rect.shortestSide - width) / 2.0; double radius = (rect.shortestSide - width) / 2.0;
canvas.drawCircle(center, radius, paint); canvas.drawCircle(center, radius, paint);
} }
/// Paint the box decoration into the given location on the given canvas /// Paint the box decoration into the given location on the given canvas
void paint(sky.Canvas canvas, Rect rect) { void paint(ui.Canvas canvas, Rect rect) {
_paintBackgroundColor(canvas, rect); _paintBackgroundColor(canvas, rect);
_paintBackgroundImage(canvas, rect); _paintBackgroundImage(canvas, rect);
_paintBorder(canvas, rect); _paintBorder(canvas, rect);
......
...@@ -2,27 +2,27 @@ ...@@ -2,27 +2,27 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
/// A helper class to build a [sky.DrawLooper] for drawing shadows /// A helper class to build a [ui.DrawLooper] for drawing shadows
class ShadowDrawLooperBuilder { class ShadowDrawLooperBuilder {
var builder_ = new sky.LayerDrawLooperBuilder(); var builder_ = new ui.LayerDrawLooperBuilder();
/// Add a shadow with the given parameters /// Add a shadow with the given parameters
void addShadow(sky.Offset offset, sky.Color color, double blur) { void addShadow(ui.Offset offset, ui.Color color, double blur) {
builder_.addLayerOnTop( builder_.addLayerOnTop(
new sky.DrawLooperLayerInfo() new ui.DrawLooperLayerInfo()
..setPaintBits(sky.PaintBits.all) ..setPaintBits(ui.PaintBits.all)
..setOffset(offset) ..setOffset(offset)
..setColorMode(sky.TransferMode.src), ..setColorMode(ui.TransferMode.src),
new sky.Paint() new ui.Paint()
..color = color ..color = color
..maskFilter = new sky.MaskFilter.blur(sky.BlurStyle.normal, blur)); ..maskFilter = new ui.MaskFilter.blur(ui.BlurStyle.normal, blur));
} }
/// Returns the draw looper built for the added shadows /// Returns the draw looper built for the added shadows
sky.DrawLooper build() { ui.DrawLooper build() {
builder_.addLayerOnTop(new sky.DrawLooperLayerInfo(), new sky.Paint()); builder_.addLayerOnTop(new ui.DrawLooperLayerInfo(), new ui.Paint());
return builder_.build(); return builder_.build();
} }
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'text_style.dart'; import 'text_style.dart';
...@@ -11,14 +11,14 @@ export 'text_style.dart'; ...@@ -11,14 +11,14 @@ export 'text_style.dart';
/// An immutable span of text /// An immutable span of text
abstract class TextSpan { abstract class TextSpan {
// This class must be immutable, because we won't notice when it changes // This class must be immutable, because we won't notice when it changes
sky.Node _toDOM(sky.Document owner); ui.Node _toDOM(ui.Document owner);
String toString([String prefix = '']); String toString([String prefix = '']);
void _applyStyleToContainer(sky.Element container) { void _applyStyleToContainer(ui.Element container) {
} }
void build(sky.ParagraphBuilder builder); void build(ui.ParagraphBuilder builder);
sky.ParagraphStyle get paragraphStyle => null; ui.ParagraphStyle get paragraphStyle => null;
} }
/// An immutable span of unstyled text /// An immutable span of unstyled text
...@@ -30,11 +30,11 @@ class PlainTextSpan extends TextSpan { ...@@ -30,11 +30,11 @@ class PlainTextSpan extends TextSpan {
/// The text contained in the span /// The text contained in the span
final String text; final String text;
sky.Node _toDOM(sky.Document owner) { ui.Node _toDOM(ui.Document owner) {
return owner.createText(text); return owner.createText(text);
} }
void build(sky.ParagraphBuilder builder) { void build(ui.ParagraphBuilder builder) {
builder.addText(text); builder.addText(text);
} }
...@@ -57,8 +57,8 @@ class StyledTextSpan extends TextSpan { ...@@ -57,8 +57,8 @@ class StyledTextSpan extends TextSpan {
/// The children to which the style is applied /// The children to which the style is applied
final List<TextSpan> children; final List<TextSpan> children;
sky.Node _toDOM(sky.Document owner) { ui.Node _toDOM(ui.Document owner) {
sky.Element parent = owner.createElement('t'); ui.Element parent = owner.createElement('t');
style.applyToCSSStyle(parent.style); style.applyToCSSStyle(parent.style);
for (TextSpan child in children) { for (TextSpan child in children) {
parent.appendChild(child._toDOM(owner)); parent.appendChild(child._toDOM(owner));
...@@ -66,16 +66,16 @@ class StyledTextSpan extends TextSpan { ...@@ -66,16 +66,16 @@ class StyledTextSpan extends TextSpan {
return parent; return parent;
} }
void build(sky.ParagraphBuilder builder) { void build(ui.ParagraphBuilder builder) {
builder.pushStyle(style.textStyle); builder.pushStyle(style.textStyle);
for (TextSpan child in children) for (TextSpan child in children)
child.build(builder); child.build(builder);
builder.pop(); builder.pop();
} }
sky.ParagraphStyle get paragraphStyle => style.paragraphStyle; ui.ParagraphStyle get paragraphStyle => style.paragraphStyle;
void _applyStyleToContainer(sky.Element container) { void _applyStyleToContainer(ui.Element container) {
style.applyToContainerCSSStyle(container.style); style.applyToContainerCSSStyle(container.style);
} }
...@@ -129,10 +129,10 @@ class TextPainter { ...@@ -129,10 +129,10 @@ class TextPainter {
this.text = text; this.text = text;
} }
sky.Paragraph _paragraph; ui.Paragraph _paragraph;
final sky.Document _document = new sky.Document(); final ui.Document _document = new ui.Document();
final sky.LayoutRoot _layoutRoot = new sky.LayoutRoot(); final ui.LayoutRoot _layoutRoot = new ui.LayoutRoot();
bool _needsLayout = true; bool _needsLayout = true;
TextSpan _text; TextSpan _text;
...@@ -215,7 +215,7 @@ class TextPainter { ...@@ -215,7 +215,7 @@ class TextPainter {
/// The distance from the top of the text to the first baseline of the given type /// The distance from the top of the text to the first baseline of the given type
double computeDistanceToActualBaseline(TextBaseline baseline) { double computeDistanceToActualBaseline(TextBaseline baseline) {
assert(!_needsLayout); assert(!_needsLayout);
sky.Element root = _layoutRoot.rootElement; ui.Element root = _layoutRoot.rootElement;
switch (baseline) { switch (baseline) {
case TextBaseline.alphabetic: return root.alphabeticBaseline; case TextBaseline.alphabetic: return root.alphabeticBaseline;
case TextBaseline.ideographic: return root.ideographicBaseline; case TextBaseline.ideographic: return root.ideographicBaseline;
...@@ -231,7 +231,7 @@ class TextPainter { ...@@ -231,7 +231,7 @@ class TextPainter {
} }
/// Paint the text onto the given canvas at the given offset /// Paint the text onto the given canvas at the given offset
void paint(sky.Canvas canvas, sky.Offset offset) { void paint(ui.Canvas canvas, ui.Offset offset) {
assert(!_needsLayout && "Please call layout() before paint() to position the text before painting it." is String); assert(!_needsLayout && "Please call layout() before paint() to position the text before painting it." is String);
// TODO(ianh): Make LayoutRoot support a paint offset so we don't // TODO(ianh): Make LayoutRoot support a paint offset so we don't
// need to translate for each span of text. // need to translate for each span of text.
...@@ -246,7 +246,7 @@ class _NewTextPainter implements TextPainter { ...@@ -246,7 +246,7 @@ class _NewTextPainter implements TextPainter {
this.text = text; this.text = text;
} }
sky.Paragraph _paragraph; ui.Paragraph _paragraph;
bool _needsLayout = true; bool _needsLayout = true;
TextSpan _text; TextSpan _text;
...@@ -256,7 +256,7 @@ class _NewTextPainter implements TextPainter { ...@@ -256,7 +256,7 @@ class _NewTextPainter implements TextPainter {
if (_text == value) if (_text == value)
return; return;
_text = value; _text = value;
sky.ParagraphBuilder builder = new sky.ParagraphBuilder(); ui.ParagraphBuilder builder = new ui.ParagraphBuilder();
_text.build(builder); _text.build(builder);
_paragraph = builder.build(_text.paragraphStyle); _paragraph = builder.build(_text.paragraphStyle);
_needsLayout = true; _needsLayout = true;
...@@ -346,7 +346,7 @@ class _NewTextPainter implements TextPainter { ...@@ -346,7 +346,7 @@ class _NewTextPainter implements TextPainter {
} }
/// Paint the text onto the given canvas at the given offset /// Paint the text onto the given canvas at the given offset
void paint(sky.Canvas canvas, sky.Offset offset) { void paint(ui.Canvas canvas, ui.Offset offset) {
assert(!_needsLayout && "Please call layout() before paint() to position the text before painting it." is String); assert(!_needsLayout && "Please call layout() before paint() to position the text before painting it." is String);
_paragraph.paint(canvas, offset); _paragraph.paint(canvas, offset);
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'dart:ui' show Point, Offset, Size, Rect, Color, Paint, Path, FontWeight, FontStyle, TextAlign, TextBaseline, TextDecoration, TextDecorationStyle; import 'dart:ui' show Point, Offset, Size, Rect, Color, Paint, Path, FontWeight, FontStyle, TextAlign, TextBaseline, TextDecoration, TextDecorationStyle;
export 'dart:ui' show FontWeight, FontStyle, TextAlign, TextBaseline, TextDecoration, TextDecorationStyle; export 'dart:ui' show FontWeight, FontStyle, TextAlign, TextBaseline, TextDecoration, TextDecorationStyle;
...@@ -152,14 +152,14 @@ class TextStyle { ...@@ -152,14 +152,14 @@ class TextStyle {
return toCSS[decorationStyle]; return toCSS[decorationStyle];
} }
sky.TextStyle get textStyle => null; ui.TextStyle get textStyle => null;
sky.ParagraphStyle get paragraphStyle => null; ui.ParagraphStyle get paragraphStyle => null;
/// Program this text style into the engine /// Program this text style into the engine
/// ///
/// Note: This function will likely be removed when we refactor the interface /// Note: This function will likely be removed when we refactor the interface
/// between the framework and the engine /// between the framework and the engine
void applyToCSSStyle(sky.CSSStyleDeclaration cssStyle) { void applyToCSSStyle(ui.CSSStyleDeclaration cssStyle) {
if (color != null) { if (color != null) {
cssStyle['color'] = _colorToCSSString(color); cssStyle['color'] = _colorToCSSString(color);
} }
...@@ -201,7 +201,7 @@ class TextStyle { ...@@ -201,7 +201,7 @@ class TextStyle {
/// ///
/// Note: This function will likely be removed when we refactor the interface /// Note: This function will likely be removed when we refactor the interface
/// between the framework and the engine /// between the framework and the engine
void applyToContainerCSSStyle(sky.CSSStyleDeclaration cssStyle) { void applyToContainerCSSStyle(ui.CSSStyleDeclaration cssStyle) {
if (textAlign != null) { if (textAlign != null) {
cssStyle['text-align'] = const { cssStyle['text-align'] = const {
TextAlign.left: 'left', TextAlign.left: 'left',
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
...@@ -29,7 +29,7 @@ class _PointerState { ...@@ -29,7 +29,7 @@ class _PointerState {
Point lastPosition; Point lastPosition;
} }
typedef void EventListener(sky.Event event); typedef void EventListener(ui.Event event);
/// A hit test entry used by [FlutterBinding] /// A hit test entry used by [FlutterBinding]
class BindingHitTestEntry extends HitTestEntry { class BindingHitTestEntry extends HitTestEntry {
...@@ -46,9 +46,9 @@ class FlutterBinding extends HitTestTarget { ...@@ -46,9 +46,9 @@ class FlutterBinding extends HitTestTarget {
assert(_instance == null); assert(_instance == null);
_instance = this; _instance = this;
sky.view.setEventCallback(_handleEvent); ui.view.setEventCallback(_handleEvent);
sky.view.setMetricsChangedCallback(_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();
...@@ -72,7 +72,7 @@ class FlutterBinding extends HitTestTarget { ...@@ -72,7 +72,7 @@ class FlutterBinding extends HitTestTarget {
RenderView _renderView; RenderView _renderView;
ViewConstraints _createConstraints() { ViewConstraints _createConstraints() {
return new ViewConstraints(size: new Size(sky.view.width, sky.view.height)); return new ViewConstraints(size: new Size(ui.view.width, ui.view.height));
} }
void _handleMetricsChanged() { void _handleMetricsChanged() {
_renderView.rootConstraints = _createConstraints(); _renderView.rootConstraints = _createConstraints();
...@@ -94,8 +94,8 @@ class FlutterBinding extends HitTestTarget { ...@@ -94,8 +94,8 @@ class FlutterBinding extends HitTestTarget {
/// Stops calling listener for every event that isn't localized to a given view coordinate /// Stops calling listener for every event that isn't localized to a given view coordinate
bool removeEventListener(EventListener listener) => _eventListeners.remove(listener); bool removeEventListener(EventListener listener) => _eventListeners.remove(listener);
void _handleEvent(sky.Event event) { void _handleEvent(ui.Event event) {
if (event is sky.PointerEvent) { if (event is ui.PointerEvent) {
_handlePointerEvent(event); _handlePointerEvent(event);
} else { } else {
for (EventListener listener in _eventListeners) for (EventListener listener in _eventListeners)
...@@ -111,7 +111,7 @@ class FlutterBinding extends HitTestTarget { ...@@ -111,7 +111,7 @@ class FlutterBinding extends HitTestTarget {
/// to hit-test them on each movement. /// to hit-test them on each movement.
Map<int, _PointerState> _stateForPointer = new Map<int, _PointerState>(); Map<int, _PointerState> _stateForPointer = new Map<int, _PointerState>();
void _handlePointerEvent(sky.PointerEvent event) { void _handlePointerEvent(ui.PointerEvent event) {
Point position = new Point(event.x, event.y); Point position = new Point(event.x, event.y);
_PointerState state = _stateForPointer[event.pointer]; _PointerState state = _stateForPointer[event.pointer];
...@@ -155,15 +155,15 @@ class FlutterBinding extends HitTestTarget { ...@@ -155,15 +155,15 @@ class FlutterBinding extends HitTestTarget {
} }
/// Dispatch the given event to the path of the given hit test result /// Dispatch the given event to the path of the given hit test result
void dispatchEvent(sky.Event event, HitTestResult result) { void dispatchEvent(ui.Event event, HitTestResult result) {
assert(result != null); assert(result != null);
for (HitTestEntry entry in result.path) for (HitTestEntry entry in result.path)
entry.target.handleEvent(event, entry); entry.target.handleEvent(event, entry);
} }
void handleEvent(sky.Event e, BindingHitTestEntry entry) { void handleEvent(ui.Event e, BindingHitTestEntry entry) {
if (e is sky.PointerEvent) { if (e is ui.PointerEvent) {
sky.PointerEvent event = e; ui.PointerEvent event = e;
pointerRouter.route(event); pointerRouter.route(event);
if (event.type == 'pointerdown') if (event.type == 'pointerdown')
GestureArena.instance.close(event.pointer); GestureArena.instance.close(event.pointer);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/painting.dart'; import 'package:flutter/painting.dart';
import 'package:vector_math/vector_math_64.dart'; import 'package:vector_math/vector_math_64.dart';
...@@ -226,10 +226,10 @@ class BoxConstraints extends Constraints { ...@@ -226,10 +226,10 @@ class BoxConstraints extends Constraints {
if (b == null) if (b == null)
return a * (1.0 - t); return a * (1.0 - t);
return new BoxConstraints( return new BoxConstraints(
minWidth: sky.lerpDouble(a.minWidth, b.minWidth, t), minWidth: ui.lerpDouble(a.minWidth, b.minWidth, t),
maxWidth: sky.lerpDouble(a.maxWidth, b.maxWidth, t), maxWidth: ui.lerpDouble(a.maxWidth, b.maxWidth, t),
minHeight: sky.lerpDouble(a.minHeight, b.minHeight, t), minHeight: ui.lerpDouble(a.minHeight, b.minHeight, t),
maxHeight: sky.lerpDouble(a.maxHeight, b.maxHeight, t) maxHeight: ui.lerpDouble(a.maxHeight, b.maxHeight, t)
); );
} }
...@@ -598,14 +598,14 @@ abstract class RenderBox extends RenderObject { ...@@ -598,14 +598,14 @@ abstract class RenderBox extends RenderObject {
} }
void debugPaintSize(PaintingContext context, Offset offset) { void debugPaintSize(PaintingContext context, Offset offset) {
Paint paint = new Paint(); Paint paint = new Paint();
paint.setStyle(sky.PaintingStyle.stroke); paint.setStyle(ui.PaintingStyle.stroke);
paint.strokeWidth = 1.0; paint.strokeWidth = 1.0;
paint.color = debugPaintSizeColor; paint.color = debugPaintSizeColor;
context.canvas.drawRect(offset & size, paint); context.canvas.drawRect(offset & size, paint);
} }
void debugPaintBaselines(PaintingContext context, Offset offset) { void debugPaintBaselines(PaintingContext context, Offset offset) {
Paint paint = new Paint(); Paint paint = new Paint();
paint.setStyle(sky.PaintingStyle.stroke); paint.setStyle(ui.PaintingStyle.stroke);
paint.strokeWidth = 0.25; paint.strokeWidth = 0.25;
Path path; Path path;
// ideographic baseline // ideographic baseline
......
...@@ -2,31 +2,31 @@ ...@@ -2,31 +2,31 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
/// Causes each RenderBox to paint a box around its bounds. /// Causes each RenderBox to paint a box around its bounds.
bool debugPaintSizeEnabled = false; bool debugPaintSizeEnabled = false;
/// The color to use when painting RenderObject bounds. /// The color to use when painting RenderObject bounds.
sky.Color debugPaintSizeColor = const sky.Color(0xFF00FFFF); ui.Color debugPaintSizeColor = const ui.Color(0xFF00FFFF);
/// Causes each RenderBox to paint a line at each of its baselines. /// Causes each RenderBox to paint a line at each of its baselines.
bool debugPaintBaselinesEnabled = false; bool debugPaintBaselinesEnabled = false;
/// The color to use when painting alphabetic baselines. /// The color to use when painting alphabetic baselines.
sky.Color debugPaintAlphabeticBaselineColor = const sky.Color(0xFF00FF00); ui.Color debugPaintAlphabeticBaselineColor = const ui.Color(0xFF00FF00);
/// The color ot use when painting ideographic baselines. /// The color ot use when painting ideographic baselines.
sky.Color debugPaintIdeographicBaselineColor = const sky.Color(0xFFFFD000); ui.Color debugPaintIdeographicBaselineColor = const ui.Color(0xFFFFD000);
/// Causes each Layer to paint a box around its bounds. /// Causes each Layer to paint a box around its bounds.
bool debugPaintLayerBordersEnabled = false; bool debugPaintLayerBordersEnabled = false;
/// The color to use when painting Layer borders. /// The color to use when painting Layer borders.
sky.Color debugPaintLayerBordersColor = const sky.Color(0xFFFF9800); ui.Color debugPaintLayerBordersColor = const ui.Color(0xFFFF9800);
/// Causes RenderObjects to paint warnings when painting outside their bounds. /// Causes RenderObjects to paint warnings when painting outside their bounds.
bool debugPaintBoundsEnabled = false; bool debugPaintBoundsEnabled = false;
/// The color to use when painting RenderError boxes in checked mode. /// The color to use when painting RenderError boxes in checked mode.
sky.Color debugErrorBoxColor = const sky.Color(0xFFFF0000); ui.Color debugErrorBoxColor = const ui.Color(0xFFFF0000);
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
/// An object that can handle events. /// An object that can handle events.
abstract class HitTestTarget { abstract class HitTestTarget {
/// Override this function to receive events. /// Override this function to receive events.
void handleEvent(sky.Event event, HitTestEntry entry); void handleEvent(ui.Event event, HitTestEntry entry);
} }
/// Data collected during a hit test about a specific [HitTestTarget]. /// Data collected during a hit test about a specific [HitTestTarget].
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/painting.dart'; import 'package:flutter/painting.dart';
...@@ -15,10 +15,10 @@ import 'object.dart'; ...@@ -15,10 +15,10 @@ import 'object.dart';
/// constraints and preserves the image's intrinisc aspect ratio. /// constraints and preserves the image's intrinisc aspect ratio.
class RenderImage extends RenderBox { class RenderImage extends RenderBox {
RenderImage({ RenderImage({
sky.Image image, ui.Image image,
double width, double width,
double height, double height,
sky.ColorFilter colorFilter, ui.ColorFilter colorFilter,
fit: ImageFit.scaleDown, fit: ImageFit.scaleDown,
repeat: ImageRepeat.noRepeat repeat: ImageRepeat.noRepeat
}) : _image = image, }) : _image = image,
...@@ -28,10 +28,10 @@ class RenderImage extends RenderBox { ...@@ -28,10 +28,10 @@ class RenderImage extends RenderBox {
_fit = fit, _fit = fit,
_repeat = repeat; _repeat = repeat;
sky.Image _image; ui.Image _image;
/// The image to display /// The image to display
sky.Image get image => _image; ui.Image get image => _image;
void set image (sky.Image value) { void set image (ui.Image value) {
if (value == _image) if (value == _image)
return; return;
_image = value; _image = value;
...@@ -60,10 +60,10 @@ class RenderImage extends RenderBox { ...@@ -60,10 +60,10 @@ class RenderImage extends RenderBox {
markNeedsLayout(); markNeedsLayout();
} }
sky.ColorFilter _colorFilter; ui.ColorFilter _colorFilter;
/// If non-null, apply this color filter to the image before painint. /// If non-null, apply this color filter to the image before painint.
sky.ColorFilter get colorFilter => _colorFilter; ui.ColorFilter get colorFilter => _colorFilter;
void set colorFilter (sky.ColorFilter value) { void set colorFilter (ui.ColorFilter value) {
if (value == _colorFilter) if (value == _colorFilter)
return; return;
_colorFilter = value; _colorFilter = value;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'dart:ui' show Point, Offset, Size, Rect, Color, Paint, Path; import 'dart:ui' show Point, Offset, Size, Rect, Color, Paint, Path;
import 'package:vector_math/vector_math_64.dart'; import 'package:vector_math/vector_math_64.dart';
...@@ -62,7 +62,7 @@ abstract class Layer { ...@@ -62,7 +62,7 @@ abstract class Layer {
/// ///
/// The layerOffset is the accumulated offset of this layer's parent from the /// The layerOffset is the accumulated offset of this layer's parent from the
/// origin of the builder's coordinate system. /// origin of the builder's coordinate system.
void addToScene(sky.SceneBuilder builder, Offset layerOffset); void addToScene(ui.SceneBuilder builder, Offset layerOffset);
} }
/// A composited layer containing a [Picture] /// A composited layer containing a [Picture]
...@@ -79,9 +79,9 @@ class PictureLayer extends Layer { ...@@ -79,9 +79,9 @@ class PictureLayer extends Layer {
/// The picture recorded for this layer /// The picture recorded for this layer
/// ///
/// The picture's coodinate system matches this layer's coodinate system /// The picture's coodinate system matches this layer's coodinate system
sky.Picture picture; ui.Picture picture;
void addToScene(sky.SceneBuilder builder, Offset layerOffset) { void addToScene(ui.SceneBuilder builder, Offset layerOffset) {
builder.addPicture(offset + layerOffset, picture, paintBounds); builder.addPicture(offset + layerOffset, picture, paintBounds);
} }
...@@ -105,7 +105,7 @@ class StatisticsLayer extends Layer { ...@@ -105,7 +105,7 @@ class StatisticsLayer extends Layer {
final int rasterizerThreshold; final int rasterizerThreshold;
void addToScene(sky.SceneBuilder builder, Offset layerOffset) { void addToScene(ui.SceneBuilder builder, Offset layerOffset) {
assert(optionsMask != null); assert(optionsMask != null);
builder.addStatistics(optionsMask, paintBounds.shift(layerOffset)); builder.addStatistics(optionsMask, paintBounds.shift(layerOffset));
builder.setRasterizerTracingThreshold(rasterizerThreshold); builder.setRasterizerTracingThreshold(rasterizerThreshold);
...@@ -194,12 +194,12 @@ class ContainerLayer extends Layer { ...@@ -194,12 +194,12 @@ class ContainerLayer extends Layer {
_lastChild = null; _lastChild = null;
} }
void addToScene(sky.SceneBuilder builder, Offset layerOffset) { void addToScene(ui.SceneBuilder builder, Offset layerOffset) {
addChildrenToScene(builder, offset + layerOffset); addChildrenToScene(builder, offset + layerOffset);
} }
/// Uploads all of this layer's children to the engine /// Uploads all of this layer's children to the engine
void addChildrenToScene(sky.SceneBuilder builder, Offset layerOffset) { void addChildrenToScene(ui.SceneBuilder builder, Offset layerOffset) {
Layer child = _firstChild; Layer child = _firstChild;
while (child != null) { while (child != null) {
child.addToScene(builder, layerOffset); child.addToScene(builder, layerOffset);
...@@ -218,7 +218,7 @@ class ClipRectLayer extends ContainerLayer { ...@@ -218,7 +218,7 @@ class ClipRectLayer extends ContainerLayer {
// TODO(abarth): Why is the rectangle in the parent's coordinate system // TODO(abarth): Why is the rectangle in the parent's coordinate system
// instead of in the coordinate system of this layer? // instead of in the coordinate system of this layer?
void addToScene(sky.SceneBuilder builder, Offset layerOffset) { void addToScene(ui.SceneBuilder builder, Offset layerOffset) {
builder.pushClipRect(clipRect.shift(layerOffset)); builder.pushClipRect(clipRect.shift(layerOffset));
addChildrenToScene(builder, offset + layerOffset); addChildrenToScene(builder, offset + layerOffset);
builder.pop(); builder.pop();
...@@ -235,11 +235,11 @@ class ClipRRectLayer extends ContainerLayer { ...@@ -235,11 +235,11 @@ class ClipRRectLayer extends ContainerLayer {
// TODO(abarth): Remove. // TODO(abarth): Remove.
/// The rounded-rect to clip in the parent's coordinate system /// The rounded-rect to clip in the parent's coordinate system
sky.RRect clipRRect; ui.RRect clipRRect;
// TODO(abarth): Why is the rounded-rect in the parent's coordinate system // TODO(abarth): Why is the rounded-rect in the parent's coordinate system
// instead of in the coordinate system of this layer? // instead of in the coordinate system of this layer?
void addToScene(sky.SceneBuilder builder, Offset layerOffset) { void addToScene(ui.SceneBuilder builder, Offset layerOffset) {
builder.pushClipRRect(clipRRect.shift(layerOffset), bounds.shift(layerOffset)); builder.pushClipRRect(clipRRect.shift(layerOffset), bounds.shift(layerOffset));
addChildrenToScene(builder, offset + layerOffset); addChildrenToScene(builder, offset + layerOffset);
builder.pop(); builder.pop();
...@@ -260,7 +260,7 @@ class ClipPathLayer extends ContainerLayer { ...@@ -260,7 +260,7 @@ class ClipPathLayer extends ContainerLayer {
// TODO(abarth): Why is the path in the parent's coordinate system instead of // TODO(abarth): Why is the path in the parent's coordinate system instead of
// in the coordinate system of this layer? // in the coordinate system of this layer?
void addToScene(sky.SceneBuilder builder, Offset layerOffset) { void addToScene(ui.SceneBuilder builder, Offset layerOffset) {
builder.pushClipPath(clipPath.shift(layerOffset), bounds.shift(layerOffset)); builder.pushClipPath(clipPath.shift(layerOffset), bounds.shift(layerOffset));
addChildrenToScene(builder, offset + layerOffset); addChildrenToScene(builder, offset + layerOffset);
builder.pop(); builder.pop();
...@@ -275,7 +275,7 @@ class TransformLayer extends ContainerLayer { ...@@ -275,7 +275,7 @@ class TransformLayer extends ContainerLayer {
/// The matrix to apply /// The matrix to apply
Matrix4 transform; Matrix4 transform;
void addToScene(sky.SceneBuilder builder, Offset layerOffset) { void addToScene(ui.SceneBuilder builder, Offset layerOffset) {
Matrix4 offsetTransform = new Matrix4.identity(); Matrix4 offsetTransform = new Matrix4.identity();
offsetTransform.translate(offset.dx + layerOffset.dx, offset.dy + layerOffset.dy); offsetTransform.translate(offset.dx + layerOffset.dx, offset.dy + layerOffset.dy);
builder.pushTransform((offsetTransform * transform).storage); builder.pushTransform((offsetTransform * transform).storage);
...@@ -298,7 +298,7 @@ class OpacityLayer extends ContainerLayer { ...@@ -298,7 +298,7 @@ class OpacityLayer extends ContainerLayer {
/// transparent and 255 is fully opaque. /// transparent and 255 is fully opaque.
int alpha; int alpha;
void addToScene(sky.SceneBuilder builder, Offset layerOffset) { void addToScene(ui.SceneBuilder builder, Offset layerOffset) {
builder.pushOpacity(alpha, bounds?.shift(layerOffset)); builder.pushOpacity(alpha, bounds?.shift(layerOffset));
addChildrenToScene(builder, offset + layerOffset); addChildrenToScene(builder, offset + layerOffset);
builder.pop(); builder.pop();
...@@ -322,9 +322,9 @@ class ColorFilterLayer extends ContainerLayer { ...@@ -322,9 +322,9 @@ class ColorFilterLayer extends ContainerLayer {
Color color; Color color;
/// The transfer mode to use to combine [color] with the children's painting /// The transfer mode to use to combine [color] with the children's painting
sky.TransferMode transferMode; ui.TransferMode transferMode;
void addToScene(sky.SceneBuilder builder, Offset layerOffset) { void addToScene(ui.SceneBuilder builder, Offset layerOffset) {
builder.pushColorFilter(color, transferMode, bounds.shift(offset)); builder.pushColorFilter(color, transferMode, bounds.shift(offset));
addChildrenToScene(builder, offset + layerOffset); addChildrenToScene(builder, offset + layerOffset);
builder.pop(); builder.pop();
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'dart:ui' show Point, Offset, Size, Rect, Color, Paint, Path; import 'dart:ui' show Point, Offset, Size, Rect, Color, Paint, Path;
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
...@@ -17,7 +17,7 @@ import 'node.dart'; ...@@ -17,7 +17,7 @@ import 'node.dart';
export 'dart:ui' show Point, Offset, Size, Rect, Color, Paint, Path; export 'dart:ui' show Point, Offset, Size, Rect, Color, Paint, Path;
export 'hit_test.dart' show HitTestTarget, HitTestEntry, HitTestResult; export 'hit_test.dart' show HitTestTarget, HitTestEntry, HitTestResult;
typedef sky.Shader ShaderCallback(Rect bounds); typedef ui.Shader ShaderCallback(Rect bounds);
/// Base class for data associated with a [RenderObject] by its parent /// Base class for data associated with a [RenderObject] by its parent
/// ///
...@@ -38,9 +38,9 @@ class ParentData { ...@@ -38,9 +38,9 @@ class ParentData {
} }
/// Obsolete class that will be removed eventually /// Obsolete class that will be removed eventually
class PaintingCanvas extends sky.Canvas { class PaintingCanvas extends ui.Canvas {
PaintingCanvas(sky.PictureRecorder recorder, Rect bounds) : super(recorder, bounds); PaintingCanvas(ui.PictureRecorder recorder, Rect bounds) : super(recorder, bounds);
// TODO(ianh): Just use sky.Canvas everywhere instead // TODO(ianh): Just use ui.Canvas everywhere instead
} }
/// A place to paint /// A place to paint
...@@ -76,7 +76,7 @@ class PaintingContext { ...@@ -76,7 +76,7 @@ class PaintingContext {
ContainerLayer get containerLayer => _containerLayer; ContainerLayer get containerLayer => _containerLayer;
PictureLayer _currentLayer; PictureLayer _currentLayer;
sky.PictureRecorder _recorder; ui.PictureRecorder _recorder;
PaintingCanvas _canvas; PaintingCanvas _canvas;
/// The canvas on which to paint /// The canvas on which to paint
/// ///
...@@ -90,7 +90,7 @@ class PaintingContext { ...@@ -90,7 +90,7 @@ class PaintingContext {
assert(_recorder == null); assert(_recorder == null);
assert(_canvas == null); assert(_canvas == null);
_currentLayer = new PictureLayer(paintBounds: paintBounds); _currentLayer = new PictureLayer(paintBounds: paintBounds);
_recorder = new sky.PictureRecorder(); _recorder = new ui.PictureRecorder();
_canvas = new PaintingCanvas(_recorder, paintBounds); _canvas = new PaintingCanvas(_recorder, paintBounds);
_containerLayer.append(_currentLayer); _containerLayer.append(_currentLayer);
} }
...@@ -186,7 +186,7 @@ class PaintingContext { ...@@ -186,7 +186,7 @@ class PaintingContext {
/// compositing layer. Otherwise, the clip will be applied by the canvas. /// compositing layer. Otherwise, the clip will be applied by the canvas.
/// ///
/// Note: clipRRect is in the parent's coordinate space /// Note: clipRRect is in the parent's coordinate space
void paintChildWithClipRRect(RenderObject child, Point childPosition, Rect bounds, sky.RRect clipRRect) { void paintChildWithClipRRect(RenderObject child, Point childPosition, Rect bounds, ui.RRect clipRRect) {
assert(debugCanPaintChild(child)); assert(debugCanPaintChild(child));
final Offset childOffset = childPosition.toOffset(); final Offset childOffset = childPosition.toOffset();
if (!child.needsCompositing) { if (!child.needsCompositing) {
...@@ -246,7 +246,7 @@ class PaintingContext { ...@@ -246,7 +246,7 @@ class PaintingContext {
static Paint _getPaintForAlpha(int alpha) { static Paint _getPaintForAlpha(int alpha) {
return new Paint() return new Paint()
..color = new Color.fromARGB(alpha, 0, 0, 0) ..color = new Color.fromARGB(alpha, 0, 0, 0)
..setTransferMode(sky.TransferMode.srcOver) ..setTransferMode(ui.TransferMode.srcOver)
..isAntiAlias = false; ..isAntiAlias = false;
} }
...@@ -276,9 +276,9 @@ class PaintingContext { ...@@ -276,9 +276,9 @@ class PaintingContext {
} }
} }
static Paint _getPaintForColorFilter(Color color, sky.TransferMode transferMode) { static Paint _getPaintForColorFilter(Color color, ui.TransferMode transferMode) {
return new Paint() return new Paint()
..colorFilter = new sky.ColorFilter.mode(color, transferMode) ..colorFilter = new ui.ColorFilter.mode(color, transferMode)
..isAntiAlias = false; ..isAntiAlias = false;
} }
...@@ -294,7 +294,7 @@ class PaintingContext { ...@@ -294,7 +294,7 @@ class PaintingContext {
Point childPosition, Point childPosition,
Rect bounds, Rect bounds,
Color color, Color color,
sky.TransferMode transferMode) { ui.TransferMode transferMode) {
assert(debugCanPaintChild(child)); assert(debugCanPaintChild(child));
final Offset childOffset = childPosition.toOffset(); final Offset childOffset = childPosition.toOffset();
if (!child.needsCompositing) { if (!child.needsCompositing) {
...@@ -315,7 +315,7 @@ class PaintingContext { ...@@ -315,7 +315,7 @@ class PaintingContext {
static Paint _getPaintForShaderMask(Rect bounds, static Paint _getPaintForShaderMask(Rect bounds,
ShaderCallback shaderCallback, ShaderCallback shaderCallback,
sky.TransferMode transferMode) { ui.TransferMode transferMode) {
return new Paint() return new Paint()
..transferMode = transferMode ..transferMode = transferMode
..shader = shaderCallback(bounds); ..shader = shaderCallback(bounds);
...@@ -325,7 +325,7 @@ class PaintingContext { ...@@ -325,7 +325,7 @@ class PaintingContext {
Point childPosition, Point childPosition,
Rect bounds, Rect bounds,
ShaderCallback shaderCallback, ShaderCallback shaderCallback,
sky.TransferMode transferMode) { ui.TransferMode transferMode) {
assert(debugCanPaintChild(child)); assert(debugCanPaintChild(child));
final Offset childOffset = childPosition.toOffset(); final Offset childOffset = childPosition.toOffset();
if (!child.needsCompositing) { if (!child.needsCompositing) {
...@@ -628,7 +628,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { ...@@ -628,7 +628,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
/// ///
/// See [FlutterBinding] for an example of how this function is used. /// See [FlutterBinding] for an example of how this function is used.
static void flushLayout() { static void flushLayout() {
sky.tracing.begin('RenderObject.flushLayout'); ui.tracing.begin('RenderObject.flushLayout');
_debugDoingLayout = true; _debugDoingLayout = true;
try { try {
// TODO(ianh): assert that we're not allowing previously dirty nodes to redirty themeselves // TODO(ianh): assert that we're not allowing previously dirty nodes to redirty themeselves
...@@ -642,7 +642,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { ...@@ -642,7 +642,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
} }
} finally { } finally {
_debugDoingLayout = false; _debugDoingLayout = false;
sky.tracing.end('RenderObject.flushLayout'); ui.tracing.end('RenderObject.flushLayout');
} }
} }
void _layoutWithoutResize() { void _layoutWithoutResize() {
...@@ -949,7 +949,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { ...@@ -949,7 +949,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
/// ///
/// See [FlutterBinding] for an example of how this function is used. /// See [FlutterBinding] for an example of how this function is used.
static void flushPaint() { static void flushPaint() {
sky.tracing.begin('RenderObject.flushPaint'); ui.tracing.begin('RenderObject.flushPaint');
_debugDoingPaint = true; _debugDoingPaint = true;
try { try {
List<RenderObject> dirtyNodes = _nodesNeedingPaint; List<RenderObject> dirtyNodes = _nodesNeedingPaint;
...@@ -963,7 +963,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { ...@@ -963,7 +963,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
assert(_nodesNeedingPaint.length == 0); assert(_nodesNeedingPaint.length == 0);
} finally { } finally {
_debugDoingPaint = false; _debugDoingPaint = false;
sky.tracing.end('RenderObject.flushPaint'); ui.tracing.end('RenderObject.flushPaint');
} }
} }
...@@ -1069,7 +1069,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { ...@@ -1069,7 +1069,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
// EVENTS // EVENTS
/// Override this function to handle events that hit this render object /// Override this function to handle events that hit this render object
void handleEvent(sky.Event event, HitTestEntry entry) { void handleEvent(ui.Event event, HitTestEntry entry) {
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/painting.dart'; import 'package:flutter/painting.dart';
import 'package:vector_math/vector_math_64.dart'; import 'package:vector_math/vector_math_64.dart';
...@@ -627,7 +627,7 @@ class RenderOpacity extends RenderProxyBox { ...@@ -627,7 +627,7 @@ class RenderOpacity extends RenderProxyBox {
/// Note: This class is relatively expensive because it requires painting the /// Note: This class is relatively expensive because it requires painting the
/// child into an intermediate buffer. /// child into an intermediate buffer.
class RenderColorFilter extends RenderProxyBox { class RenderColorFilter extends RenderProxyBox {
RenderColorFilter({ RenderBox child, Color color, sky.TransferMode transferMode }) RenderColorFilter({ RenderBox child, Color color, ui.TransferMode transferMode })
: _color = color, _transferMode = transferMode, super(child) { : _color = color, _transferMode = transferMode, super(child) {
} }
...@@ -643,9 +643,9 @@ class RenderColorFilter extends RenderProxyBox { ...@@ -643,9 +643,9 @@ class RenderColorFilter extends RenderProxyBox {
} }
/// The transfer mode to use when combining the child's painting and the [color] /// The transfer mode to use when combining the child's painting and the [color]
sky.TransferMode get transferMode => _transferMode; ui.TransferMode get transferMode => _transferMode;
sky.TransferMode _transferMode; ui.TransferMode _transferMode;
void set transferMode (sky.TransferMode newTransferMode) { void set transferMode (ui.TransferMode newTransferMode) {
assert(newTransferMode != null); assert(newTransferMode != null);
if (_transferMode == newTransferMode) if (_transferMode == newTransferMode)
return; return;
...@@ -660,7 +660,7 @@ class RenderColorFilter extends RenderProxyBox { ...@@ -660,7 +660,7 @@ class RenderColorFilter extends RenderProxyBox {
} }
class RenderShaderMask extends RenderProxyBox { class RenderShaderMask extends RenderProxyBox {
RenderShaderMask({ RenderBox child, ShaderCallback shaderCallback, sky.TransferMode transferMode }) RenderShaderMask({ RenderBox child, ShaderCallback shaderCallback, ui.TransferMode transferMode })
: _shaderCallback = shaderCallback, _transferMode = transferMode, super(child) { : _shaderCallback = shaderCallback, _transferMode = transferMode, super(child) {
} }
...@@ -674,9 +674,9 @@ class RenderShaderMask extends RenderProxyBox { ...@@ -674,9 +674,9 @@ class RenderShaderMask extends RenderProxyBox {
markNeedsPaint(); markNeedsPaint();
} }
sky.TransferMode get transferMode => _transferMode; ui.TransferMode get transferMode => _transferMode;
sky.TransferMode _transferMode; ui.TransferMode _transferMode;
void set transferMode (sky.TransferMode newTransferMode) { void set transferMode (ui.TransferMode newTransferMode) {
assert(newTransferMode != null); assert(newTransferMode != null);
if (_transferMode == newTransferMode) if (_transferMode == newTransferMode)
return; return;
...@@ -745,7 +745,7 @@ class RenderClipRRect extends RenderProxyBox { ...@@ -745,7 +745,7 @@ class RenderClipRRect extends RenderProxyBox {
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
if (child != null) { if (child != null) {
Rect rect = offset & size; Rect rect = offset & size;
sky.RRect rrect = new sky.RRect()..setRectXY(rect, xRadius, yRadius); ui.RRect rrect = new ui.RRect()..setRectXY(rect, xRadius, yRadius);
context.paintChildWithClipRRect(child, offset.toPoint(), rect, rrect); context.paintChildWithClipRRect(child, offset.toPoint(), rect, rrect);
} }
} }
...@@ -1056,7 +1056,7 @@ class RenderCustomPaint extends RenderProxyBox { ...@@ -1056,7 +1056,7 @@ class RenderCustomPaint extends RenderProxyBox {
} }
} }
typedef void PointerEventListener(sky.PointerEvent e); typedef void PointerEventListener(ui.PointerEvent e);
/// Invokes the callbacks in response to pointer events. /// Invokes the callbacks in response to pointer events.
class RenderPointerListener extends RenderProxyBox { class RenderPointerListener extends RenderProxyBox {
...@@ -1073,7 +1073,7 @@ class RenderPointerListener extends RenderProxyBox { ...@@ -1073,7 +1073,7 @@ class RenderPointerListener extends RenderProxyBox {
PointerEventListener onPointerUp; PointerEventListener onPointerUp;
PointerEventListener onPointerCancel; PointerEventListener onPointerCancel;
void handleEvent(sky.Event event, HitTestEntry entry) { void handleEvent(ui.Event event, HitTestEntry entry) {
if (onPointerDown != null && event.type == 'pointerdown') if (onPointerDown != null && event.type == 'pointerdown')
return onPointerDown(event); return onPointerDown(event);
if (onPointerMove != null && event.type == 'pointermove') if (onPointerMove != null && event.type == 'pointermove')
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
...@@ -37,7 +37,7 @@ abstract class RenderToggleable extends RenderConstrainedBox { ...@@ -37,7 +37,7 @@ abstract class RenderToggleable extends RenderConstrainedBox {
double get position => _performance.value; double get position => _performance.value;
void handleEvent(sky.Event event, BoxHitTestEntry entry) { void handleEvent(ui.Event event, BoxHitTestEntry entry) {
if (event.type == 'pointerdown') if (event.type == 'pointerdown')
_tap.addPointer(event); _tap.addPointer(event);
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import 'package:vector_math/vector_math_64.dart'; import 'package:vector_math/vector_math_64.dart';
...@@ -60,7 +60,7 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox> ...@@ -60,7 +60,7 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
} }
Matrix4 get _logicalToDeviceTransform { Matrix4 get _logicalToDeviceTransform {
double devicePixelRatio = sky.view.devicePixelRatio; double devicePixelRatio = ui.view.devicePixelRatio;
return new Matrix4.diagonal3Values(devicePixelRatio, devicePixelRatio, 1.0); return new Matrix4.diagonal3Values(devicePixelRatio, devicePixelRatio, 1.0);
} }
...@@ -114,15 +114,15 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox> ...@@ -114,15 +114,15 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
/// ///
/// Actually causes the output of the rendering pipeline to appear on screen. /// Actually causes the output of the rendering pipeline to appear on screen.
void compositeFrame() { void compositeFrame() {
sky.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 * sky.view.devicePixelRatio); Rect bounds = Point.origin & (size * ui.view.devicePixelRatio);
sky.SceneBuilder builder = new sky.SceneBuilder(bounds); ui.SceneBuilder builder = new ui.SceneBuilder(bounds);
layer.addToScene(builder, Offset.zero); layer.addToScene(builder, Offset.zero);
sky.view.scene = builder.build(); ui.view.scene = builder.build();
} finally { } finally {
sky.tracing.end('RenderView.compositeFrame'); ui.tracing.end('RenderView.compositeFrame');
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:vector_math/vector_math_64.dart'; import 'package:vector_math/vector_math_64.dart';
...@@ -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 = sky.view.devicePixelRatio; double devicePixelRatio = ui.view.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,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async'; import 'dart:async';
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'dart:ui_internals' as internals; import 'dart:ui_internals' as internals;
import 'dart:typed_data'; import 'dart:typed_data';
...@@ -68,7 +68,7 @@ class MojoAssetBundle extends AssetBundle { ...@@ -68,7 +68,7 @@ class MojoAssetBundle extends AssetBundle {
_imageCache = null; _imageCache = null;
} }
Future<sky.Image> _fetchImage(String key) async { Future<ui.Image> _fetchImage(String key) async {
return await decodeImageFromDataPipe(await load(key)); return await decodeImageFromDataPipe(await load(key));
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import 'dart:async'; import 'dart:async';
import 'dart:collection'; import 'dart:collection';
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:mojo/mojo/url_response.mojom.dart'; import 'package:mojo/mojo/url_response.mojom.dart';
...@@ -12,7 +12,7 @@ import 'fetch.dart'; ...@@ -12,7 +12,7 @@ import 'fetch.dart';
import 'image_decoder.dart'; import 'image_decoder.dart';
import 'image_resource.dart'; import 'image_resource.dart';
Future<sky.Image> _fetchImage(String url) async { Future<ui.Image> _fetchImage(String url) async {
UrlResponse response = await fetchUrl(url); UrlResponse response = await fetchUrl(url);
if (response.statusCode >= 400) { if (response.statusCode >= 400) {
print("Failed (${response.statusCode}) to load image ${url}"); print("Failed (${response.statusCode}) to load image ${url}");
......
...@@ -3,14 +3,14 @@ ...@@ -3,14 +3,14 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async'; import 'dart:async';
import 'dart:ui' as sky; import 'dart:ui' as ui;
/// A callback for when the image is available. /// A callback for when the image is available.
typedef void ImageListener(sky.Image image); typedef void ImageListener(ui.Image image);
/// A handle to an image resource /// A handle to an image resource
/// ///
/// ImageResource represents a handle to a [sky.Image] object. The underlying /// ImageResource represents a handle to a [ui.Image] object. The underlying
/// image object might change over time, either because the image is animating /// image object might change over time, either because the image is animating
/// or because the underlying image resource was mutated. /// or because the underlying image resource was mutated.
class ImageResource { class ImageResource {
...@@ -19,17 +19,17 @@ class ImageResource { ...@@ -19,17 +19,17 @@ class ImageResource {
} }
bool _resolved = false; bool _resolved = false;
Future<sky.Image> _futureImage; Future<ui.Image> _futureImage;
sky.Image _image; ui.Image _image;
final List<ImageListener> _listeners = new List<ImageListener>(); final List<ImageListener> _listeners = new List<ImageListener>();
/// The first concrete [sky.Image] object represented by this handle. /// The first concrete [ui.Image] object represented by this handle.
/// ///
/// Instead of receivingly only the first image, most clients will want to /// Instead of receivingly only the first image, most clients will want to
/// [addListener] to be notified whenever a a concrete image is available. /// [addListener] to be notified whenever a a concrete image is available.
Future<sky.Image> get first => _futureImage; Future<ui.Image> get first => _futureImage;
/// Adds a listener callback that is called whenever a concrete [sky.Image] /// Adds a listener callback that is called whenever a concrete [ui.Image]
/// object is available. Note: If a concrete image is available currently, /// object is available. Note: If a concrete image is available currently,
/// this object will call the listener synchronously. /// this object will call the listener synchronously.
void addListener(ImageListener listener) { void addListener(ImageListener listener) {
...@@ -38,12 +38,12 @@ class ImageResource { ...@@ -38,12 +38,12 @@ class ImageResource {
listener(_image); listener(_image);
} }
/// Stop listening for new concrete [sky.Image] objects. /// Stop listening for new concrete [ui.Image] objects.
void removeListener(ImageListener listener) { void removeListener(ImageListener listener) {
_listeners.remove(listener); _listeners.remove(listener);
} }
void _handleImageLoaded(sky.Image image) { void _handleImageLoaded(ui.Image image) {
_image = image; _image = image;
_resolved = true; _resolved = true;
_notifyListeners(); _notifyListeners();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
...@@ -61,7 +61,7 @@ class ColorFilter extends OneChildRenderObjectWidget { ...@@ -61,7 +61,7 @@ class ColorFilter extends OneChildRenderObjectWidget {
} }
final Color color; final Color color;
final sky.TransferMode transferMode; final ui.TransferMode transferMode;
RenderColorFilter createRenderObject() => new RenderColorFilter(color: color, transferMode: transferMode); RenderColorFilter createRenderObject() => new RenderColorFilter(color: color, transferMode: transferMode);
...@@ -75,7 +75,7 @@ class ShaderMask extends OneChildRenderObjectWidget { ...@@ -75,7 +75,7 @@ class ShaderMask extends OneChildRenderObjectWidget {
ShaderMask({ ShaderMask({
Key key, Key key,
this.shaderCallback, this.shaderCallback,
this.transferMode: sky.TransferMode.modulate, this.transferMode: ui.TransferMode.modulate,
Widget child Widget child
}) : super(key: key, child: child) { }) : super(key: key, child: child) {
assert(shaderCallback != null); assert(shaderCallback != null);
...@@ -83,7 +83,7 @@ class ShaderMask extends OneChildRenderObjectWidget { ...@@ -83,7 +83,7 @@ class ShaderMask extends OneChildRenderObjectWidget {
} }
final ShaderCallback shaderCallback; final ShaderCallback shaderCallback;
final sky.TransferMode transferMode; final ui.TransferMode transferMode;
RenderShaderMask createRenderObject() { RenderShaderMask createRenderObject() {
return new RenderShaderMask( return new RenderShaderMask(
...@@ -813,10 +813,10 @@ class Image extends LeafRenderObjectWidget { ...@@ -813,10 +813,10 @@ class Image extends LeafRenderObjectWidget {
this.repeat: ImageRepeat.noRepeat this.repeat: ImageRepeat.noRepeat
}) : super(key: key); }) : super(key: key);
final sky.Image image; final ui.Image image;
final double width; final double width;
final double height; final double height;
final sky.ColorFilter colorFilter; final ui.ColorFilter colorFilter;
final ImageFit fit; final ImageFit fit;
final ImageRepeat repeat; final ImageRepeat repeat;
...@@ -854,7 +854,7 @@ class ImageListener extends StatefulComponent { ...@@ -854,7 +854,7 @@ class ImageListener extends StatefulComponent {
final ImageResource image; final ImageResource image;
final double width; final double width;
final double height; final double height;
final sky.ColorFilter colorFilter; final ui.ColorFilter colorFilter;
final ImageFit fit; final ImageFit fit;
final ImageRepeat repeat; final ImageRepeat repeat;
...@@ -867,9 +867,9 @@ class _ImageListenerState extends State<ImageListener> { ...@@ -867,9 +867,9 @@ class _ImageListenerState extends State<ImageListener> {
config.image.addListener(_handleImageChanged); config.image.addListener(_handleImageChanged);
} }
sky.Image _resolvedImage; ui.Image _resolvedImage;
void _handleImageChanged(sky.Image resolvedImage) { void _handleImageChanged(ui.Image resolvedImage) {
setState(() { setState(() {
_resolvedImage = resolvedImage; _resolvedImage = resolvedImage;
}); });
...@@ -913,7 +913,7 @@ class NetworkImage extends StatelessComponent { ...@@ -913,7 +913,7 @@ class NetworkImage extends StatelessComponent {
final String src; final String src;
final double width; final double width;
final double height; final double height;
final sky.ColorFilter colorFilter; final ui.ColorFilter colorFilter;
final ImageFit fit; final ImageFit fit;
final ImageRepeat repeat; final ImageRepeat repeat;
...@@ -945,7 +945,7 @@ class AssetImage extends StatelessComponent { ...@@ -945,7 +945,7 @@ class AssetImage extends StatelessComponent {
final AssetBundle bundle; final AssetBundle bundle;
final double width; final double width;
final double height; final double height;
final sky.ColorFilter colorFilter; final ui.ColorFilter colorFilter;
final ImageFit fit; final ImageFit fit;
final ImageRepeat repeat; final ImageRepeat repeat;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
...@@ -164,7 +164,7 @@ class _DismissableState extends State<Dismissable> { ...@@ -164,7 +164,7 @@ class _DismissableState extends State<Dismissable> {
_fadePerformance.progress = _dragExtent.abs() / (_size.width * _kDismissCardThreshold); _fadePerformance.progress = _dragExtent.abs() / (_size.width * _kDismissCardThreshold);
} }
bool _isFlingGesture(sky.Offset velocity) { bool _isFlingGesture(ui.Offset velocity) {
double vx = velocity.dx; double vx = velocity.dx;
double vy = velocity.dy; double vy = velocity.dy;
if (_directionIsYAxis) { if (_directionIsYAxis) {
...@@ -193,7 +193,7 @@ class _DismissableState extends State<Dismissable> { ...@@ -193,7 +193,7 @@ class _DismissableState extends State<Dismissable> {
return false; return false;
} }
void _handleDragEnd(sky.Offset velocity) { void _handleDragEnd(ui.Offset velocity) {
if (!_isActive || _fadePerformance.isAnimating) if (!_isActive || _fadePerformance.isAnimating)
return; return;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:collection'; import 'dart:collection';
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -69,7 +69,7 @@ class Draggable extends StatefulComponent { ...@@ -69,7 +69,7 @@ class Draggable extends StatefulComponent {
class _DraggableState extends State<Draggable> { class _DraggableState extends State<Draggable> {
DragRoute _route; DragRoute _route;
void _startDrag(sky.PointerEvent event) { void _startDrag(ui.PointerEvent event) {
if (_route != null) if (_route != null)
return; // TODO(ianh): once we switch to using gestures, just hand the gesture to the route so it can do everything itself. then we can have multiple drags at the same time. return; // TODO(ianh): once we switch to using gestures, just hand the gesture to the route so it can do everything itself. then we can have multiple drags at the same time.
final Point point = new Point(event.x, event.y); final Point point = new Point(event.x, event.y);
...@@ -97,7 +97,7 @@ class _DraggableState extends State<Draggable> { ...@@ -97,7 +97,7 @@ class _DraggableState extends State<Draggable> {
config.navigator.push(_route); config.navigator.push(_route);
} }
void _updateDrag(sky.PointerEvent event) { void _updateDrag(ui.PointerEvent event) {
if (_route != null) { if (_route != null) {
config.navigator.setState(() { config.navigator.setState(() {
_route.update(new Point(event.x, event.y)); _route.update(new Point(event.x, event.y));
...@@ -105,14 +105,14 @@ class _DraggableState extends State<Draggable> { ...@@ -105,14 +105,14 @@ class _DraggableState extends State<Draggable> {
} }
} }
void _cancelDrag(sky.PointerEvent event) { void _cancelDrag(ui.PointerEvent event) {
if (_route != null) { if (_route != null) {
config.navigator.popRoute(_route, DragEndKind.canceled); config.navigator.popRoute(_route, DragEndKind.canceled);
assert(_route == null); assert(_route == null);
} }
} }
void _drop(sky.PointerEvent event) { void _drop(ui.PointerEvent event) {
if (_route != null) { if (_route != null) {
_route.update(new Point(event.x, event.y)); _route.update(new Point(event.x, event.y));
config.navigator.popRoute(_route, DragEndKind.dropped); config.navigator.popRoute(_route, DragEndKind.dropped);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -187,7 +187,7 @@ class _GestureDetectorState extends State<GestureDetector> { ...@@ -187,7 +187,7 @@ class _GestureDetectorState extends State<GestureDetector> {
return null; return null;
} }
void _handlePointerDown(sky.PointerEvent event) { void _handlePointerDown(ui.PointerEvent event) {
if (_tap != null) if (_tap != null)
_tap.addPointer(event); _tap.addPointer(event);
if (_showPress != null) if (_showPress != null)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import 'dart:async'; import 'dart:async';
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:newton/newton.dart'; import 'package:newton/newton.dart';
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
...@@ -200,7 +200,7 @@ abstract class ScrollableState<T extends Scrollable> extends State<T> { ...@@ -200,7 +200,7 @@ abstract class ScrollableState<T extends Scrollable> extends State<T> {
return _startToEndAnimation(); return _startToEndAnimation();
} }
double _scrollVelocity(sky.Offset velocity) { double _scrollVelocity(ui.Offset velocity) {
double scrollVelocity = config.scrollDirection == ScrollDirection.horizontal double scrollVelocity = config.scrollDirection == ScrollDirection.horizontal
? -velocity.dx ? -velocity.dx
: -velocity.dy; : -velocity.dy;
...@@ -616,7 +616,7 @@ class PageableListState<T> extends ScrollableListState<T, PageableList<T>> { ...@@ -616,7 +616,7 @@ class PageableListState<T> extends ScrollableListState<T, PageableList<T>> {
.clamp(scrollBehavior.minScrollOffset, scrollBehavior.maxScrollOffset); .clamp(scrollBehavior.minScrollOffset, scrollBehavior.maxScrollOffset);
} }
Future fling(sky.Offset velocity) { Future fling(ui.Offset velocity) {
double scrollVelocity = _scrollVelocity(velocity); double scrollVelocity = _scrollVelocity(velocity);
double newScrollOffset = _snapScrollOffset(scrollOffset + scrollVelocity.sign * config.itemExtent) double newScrollOffset = _snapScrollOffset(scrollOffset + scrollVelocity.sign * config.itemExtent)
.clamp(_snapScrollOffset(scrollOffset - config.itemExtent / 2.0), .clamp(_snapScrollOffset(scrollOffset - config.itemExtent / 2.0),
......
...@@ -15,7 +15,7 @@ class EffectLine extends Node { ...@@ -15,7 +15,7 @@ class EffectLine extends Node {
EffectLine({ EffectLine({
this.texture: null, this.texture: null,
this.transferMode: sky.TransferMode.dstOver, this.transferMode: ui.TransferMode.dstOver,
List<Point> points, List<Point> points,
this.widthMode : EffectLineWidthMode.linear, this.widthMode : EffectLineWidthMode.linear,
this.minWidth: 10.0, this.minWidth: 10.0,
...@@ -47,7 +47,7 @@ class EffectLine extends Node { ...@@ -47,7 +47,7 @@ class EffectLine extends Node {
final Texture texture; final Texture texture;
final sky.TransferMode transferMode; final ui.TransferMode transferMode;
final EffectLineWidthMode widthMode; final EffectLineWidthMode widthMode;
final double minWidth; final double minWidth;
......
...@@ -8,18 +8,18 @@ class ImageMap { ...@@ -8,18 +8,18 @@ class ImageMap {
ImageMap(AssetBundle bundle) : _bundle = bundle; ImageMap(AssetBundle bundle) : _bundle = bundle;
final AssetBundle _bundle; final AssetBundle _bundle;
final Map<String, sky.Image> _images = new Map<String, sky.Image>(); final Map<String, ui.Image> _images = new Map<String, ui.Image>();
Future<List<sky.Image>> load(List<String> urls) { Future<List<ui.Image>> load(List<String> urls) {
return Future.wait(urls.map(_loadImage)); return Future.wait(urls.map(_loadImage));
} }
Future<sky.Image> _loadImage(String url) async { Future<ui.Image> _loadImage(String url) async {
sky.Image image = await _bundle.loadImage(url).first; ui.Image image = await _bundle.loadImage(url).first;
_images[url] = image; _images[url] = image;
return image; return image;
} }
sky.Image getImage(String url) => _images[url]; ui.Image getImage(String url) => _images[url];
sky.Image operator [](String url) => _images[url]; ui.Image operator [](String url) => _images[url];
} }
...@@ -22,7 +22,7 @@ class Layer extends Node with SpritePaint { ...@@ -22,7 +22,7 @@ class Layer extends Node with SpritePaint {
Layer([Rect this.layerRect = null]); Layer([Rect this.layerRect = null]);
Paint _cachedPaint = new Paint() Paint _cachedPaint = new Paint()
..filterQuality = sky.FilterQuality.low ..filterQuality = ui.FilterQuality.low
..isAntiAlias = false; ..isAntiAlias = false;
void _prePaint(PaintingCanvas canvas, Matrix4 matrix) { void _prePaint(PaintingCanvas canvas, Matrix4 matrix) {
......
...@@ -144,7 +144,7 @@ class ParticleSystem extends Node { ...@@ -144,7 +144,7 @@ class ParticleSystem extends Node {
/// The transfer mode used to draw the particle system. Default is /// The transfer mode used to draw the particle system. Default is
/// [TransferMode.plus]. /// [TransferMode.plus].
sky.TransferMode transferMode; ui.TransferMode transferMode;
List<_Particle> _particles; List<_Particle> _particles;
...@@ -152,7 +152,7 @@ class ParticleSystem extends Node { ...@@ -152,7 +152,7 @@ class ParticleSystem extends Node {
int _numEmittedParticles = 0; int _numEmittedParticles = 0;
static Paint _paint = new Paint() static Paint _paint = new Paint()
..filterQuality = sky.FilterQuality.low ..filterQuality = ui.FilterQuality.low
..isAntiAlias = false; ..isAntiAlias = false;
ParticleSystem(this.texture, ParticleSystem(this.texture,
...@@ -184,7 +184,7 @@ class ParticleSystem extends Node { ...@@ -184,7 +184,7 @@ class ParticleSystem extends Node {
this.redVar: 0, this.redVar: 0,
this.greenVar: 0, this.greenVar: 0,
this.blueVar: 0, this.blueVar: 0,
this.transferMode: sky.TransferMode.plus, this.transferMode: ui.TransferMode.plus,
this.numParticlesToEmit: 0, this.numParticlesToEmit: 0,
this.autoRemoveOnFinish: true}) { this.autoRemoveOnFinish: true}) {
_particles = new List<_Particle>(); _particles = new List<_Particle>();
...@@ -359,7 +359,7 @@ class ParticleSystem extends Node { ...@@ -359,7 +359,7 @@ class ParticleSystem extends Node {
void paint(PaintingCanvas canvas) { void paint(PaintingCanvas canvas) {
List<sky.RSTransform> transforms = []; List<ui.RSTransform> transforms = [];
List<Rect> rects = []; List<Rect> rects = [];
List<Color> colors = []; List<Color> colors = [];
...@@ -388,7 +388,7 @@ class ParticleSystem extends Node { ...@@ -388,7 +388,7 @@ class ParticleSystem extends Node {
double ay = rect.height / 2; double ay = rect.height / 2;
double tx = particle.pos[0] + -scos * ax + ssin * ay; double tx = particle.pos[0] + -scos * ax + ssin * ay;
double ty = particle.pos[1] + -ssin * ax - scos * ay; double ty = particle.pos[1] + -ssin * ax - scos * ay;
sky.RSTransform transform = new sky.RSTransform(scos, ssin, tx, ty); ui.RSTransform transform = new ui.RSTransform(scos, ssin, tx, ty);
transforms.add(transform); transforms.add(transform);
// Color // Color
...@@ -411,7 +411,7 @@ class ParticleSystem extends Node { ...@@ -411,7 +411,7 @@ class ParticleSystem extends Node {
} }
canvas.drawAtlas(texture.image, transforms, rects, colors, canvas.drawAtlas(texture.image, transforms, rects, colors,
sky.TransferMode.modulate, null, _paint); ui.TransferMode.modulate, null, _paint);
} }
} }
......
...@@ -137,7 +137,7 @@ class PhysicsNode extends Node { ...@@ -137,7 +137,7 @@ class PhysicsNode extends Node {
void paintDebug(PaintingCanvas canvas) { void paintDebug(PaintingCanvas canvas) {
Paint shapePaint = new Paint(); Paint shapePaint = new Paint();
shapePaint.setStyle(sky.PaintingStyle.stroke); shapePaint.setStyle(ui.PaintingStyle.stroke);
shapePaint.strokeWidth = 1.0; shapePaint.strokeWidth = 1.0;
for (box2d.Body body = b2World.bodyList; body != null; body = body.getNext()) { for (box2d.Body body = b2World.bodyList; body != null; body = body.getNext()) {
......
...@@ -8,7 +8,7 @@ import 'dart:async'; ...@@ -8,7 +8,7 @@ import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:typed_data'; import 'dart:typed_data';
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:box2d/box2d.dart' as box2d; import 'package:box2d/box2d.dart' as box2d;
import 'package:mojo/core.dart'; import 'package:mojo/core.dart';
......
...@@ -17,7 +17,7 @@ class Sprite extends NodeWithSize with SpritePaint { ...@@ -17,7 +17,7 @@ class Sprite extends NodeWithSize with SpritePaint {
bool constrainProportions = false; bool constrainProportions = false;
Paint _cachedPaint = new Paint() Paint _cachedPaint = new Paint()
..filterQuality = sky.FilterQuality.low ..filterQuality = ui.FilterQuality.low
..isAntiAlias = false; ..isAntiAlias = false;
/// Creates a new sprite from the provided [texture]. /// Creates a new sprite from the provided [texture].
...@@ -35,7 +35,7 @@ class Sprite extends NodeWithSize with SpritePaint { ...@@ -35,7 +35,7 @@ class Sprite extends NodeWithSize with SpritePaint {
/// Creates a new sprite from the provided [image]. /// Creates a new sprite from the provided [image].
/// ///
/// var mySprite = new Sprite.fromImage(myImage); /// var mySprite = new Sprite.fromImage(myImage);
Sprite.fromImage(sky.Image image) : super(Size.zero) { Sprite.fromImage(ui.Image image) : super(Size.zero) {
assert(image != null); assert(image != null);
texture = new Texture(image); texture = new Texture(image);
...@@ -107,13 +107,13 @@ abstract class SpritePaint { ...@@ -107,13 +107,13 @@ abstract class SpritePaint {
/// ///
/// // Add the colors of the sprite with the colors of the background /// // Add the colors of the sprite with the colors of the background
/// mySprite.transferMode = TransferMode.plusMode; /// mySprite.transferMode = TransferMode.plusMode;
sky.TransferMode transferMode; ui.TransferMode transferMode;
void _updatePaint(Paint paint) { void _updatePaint(Paint paint) {
paint.color = new Color.fromARGB((255.0*_opacity).toInt(), 255, 255, 255); paint.color = new Color.fromARGB((255.0*_opacity).toInt(), 255, 255, 255);
if (colorOverlay != null) { if (colorOverlay != null) {
paint.colorFilter = new sky.ColorFilter.mode(colorOverlay, sky.TransferMode.srcATop); paint.colorFilter = new ui.ColorFilter.mode(colorOverlay, ui.TransferMode.srcATop);
} }
if (transferMode != null) { if (transferMode != null) {
......
...@@ -185,11 +185,11 @@ class SpriteBox extends RenderBox { ...@@ -185,11 +185,11 @@ class SpriteBox extends RenderBox {
} }
} }
void handleEvent(sky.Event event, _SpriteBoxHitTestEntry entry) { void handleEvent(ui.Event event, _SpriteBoxHitTestEntry entry) {
if (!attached) if (!attached)
return; return;
if (event is sky.PointerEvent) { if (event is ui.PointerEvent) {
if (event.type == 'pointerdown') { if (event.type == 'pointerdown') {
// Build list of event targets // Build list of event targets
......
...@@ -8,7 +8,7 @@ part of skysprites; ...@@ -8,7 +8,7 @@ part of skysprites;
/// the sprite sheet definition are used to reference the different textures. /// the sprite sheet definition are used to reference the different textures.
class SpriteSheet { class SpriteSheet {
sky.Image _image; ui.Image _image;
Map<String, Texture> _textures = new Map(); Map<String, Texture> _textures = new Map();
/// Creates a new sprite sheet from an [_image] and a sprite sheet [jsonDefinition]. /// Creates a new sprite sheet from an [_image] and a sprite sheet [jsonDefinition].
...@@ -65,7 +65,7 @@ class SpriteSheet { ...@@ -65,7 +65,7 @@ class SpriteSheet {
/// The image used by the sprite sheet. /// The image used by the sprite sheet.
/// ///
/// var spriteSheetImage = mySpriteSheet.image; /// var spriteSheetImage = mySpriteSheet.image;
sky.Image get image => _image; ui.Image get image => _image;
/// Returns a texture by its name. /// Returns a texture by its name.
/// ///
......
...@@ -7,7 +7,7 @@ class Texture { ...@@ -7,7 +7,7 @@ class Texture {
/// The image that this texture is a part of. /// The image that this texture is a part of.
/// ///
/// var textureImage = myTexture.image; /// var textureImage = myTexture.image;
final sky.Image image; final ui.Image image;
/// The logical size of the texture, before being trimmed by the texture packer. /// The logical size of the texture, before being trimmed by the texture packer.
/// ///
...@@ -51,7 +51,7 @@ class Texture { ...@@ -51,7 +51,7 @@ class Texture {
/// Creates a new texture from an [Image] object. /// Creates a new texture from an [Image] object.
/// ///
/// var myTexture = new Texture(myImage); /// var myTexture = new Texture(myImage);
Texture(sky.Image image) : Texture(ui.Image image) :
size = new Size(image.width.toDouble(), image.height.toDouble()), size = new Size(image.width.toDouble(), image.height.toDouble()),
image = image, image = image,
trimmed = false, trimmed = false,
......
...@@ -38,8 +38,8 @@ class TexturedLinePainter { ...@@ -38,8 +38,8 @@ class TexturedLinePainter {
_cachedPaint = new Paint(); _cachedPaint = new Paint();
} else { } else {
Matrix4 matrix = new Matrix4.identity(); Matrix4 matrix = new Matrix4.identity();
sky.ImageShader shader = new sky.ImageShader(texture.image, ui.ImageShader shader = new ui.ImageShader(texture.image,
sky.TileMode.repeated, sky.TileMode.repeated, matrix.storage); ui.TileMode.repeated, ui.TileMode.repeated, matrix.storage);
_cachedPaint = new Paint(); _cachedPaint = new Paint();
_cachedPaint.setShader(shader); _cachedPaint.setShader(shader);
...@@ -77,7 +77,7 @@ class TexturedLinePainter { ...@@ -77,7 +77,7 @@ class TexturedLinePainter {
bool removeArtifacts = true; bool removeArtifacts = true;
sky.TransferMode transferMode = sky.TransferMode.srcOver; ui.TransferMode transferMode = ui.TransferMode.srcOver;
Paint _cachedPaint = new Paint(); Paint _cachedPaint = new Paint();
...@@ -169,7 +169,7 @@ class TexturedLinePainter { ...@@ -169,7 +169,7 @@ class TexturedLinePainter {
lastMiter = currentMiter; lastMiter = currentMiter;
} }
canvas.drawVertices(sky.VertexMode.triangles, vertices, textureCoordinates, verticeColors, sky.TransferMode.modulate, indicies, _cachedPaint); canvas.drawVertices(ui.VertexMode.triangles, vertices, textureCoordinates, verticeColors, ui.TransferMode.modulate, indicies, _cachedPaint);
} }
double _xPosForStop(double stop) { double _xPosForStop(double stop) {
......
...@@ -14,7 +14,7 @@ class VirtualJoystick extends NodeWithSize { ...@@ -14,7 +14,7 @@ class VirtualJoystick extends NodeWithSize {
_paintControl = new Paint() _paintControl = new Paint()
..color=new Color(0xffffffff) ..color=new Color(0xffffffff)
..strokeWidth = 1.0 ..strokeWidth = 1.0
..setStyle(sky.PaintingStyle.stroke); ..setStyle(ui.PaintingStyle.stroke);
} }
Point _value = Point.origin; Point _value = Point.origin;
......
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'dart:ui' show Rect, Color, Paint; import 'dart:ui' show Rect, Color, Paint;
import 'package:test/test.dart'; import 'package:test/test.dart';
...@@ -6,8 +6,8 @@ import 'package:vector_math/vector_math_64.dart'; ...@@ -6,8 +6,8 @@ import 'package:vector_math/vector_math_64.dart';
void main() { void main() {
sky.PictureRecorder recorder = new sky.PictureRecorder(); ui.PictureRecorder recorder = new ui.PictureRecorder();
sky.Canvas canvas = new sky.Canvas(recorder, new Rect.fromLTRB(0.0, 0.0, 100.0, 100.0)); ui.Canvas canvas = new ui.Canvas(recorder, new Rect.fromLTRB(0.0, 0.0, 100.0, 100.0));
test("matrix access should work", () { test("matrix access should work", () {
// Matrix equality doesn't work! // Matrix equality doesn't work!
......
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:test/test.dart'; import 'package:test/test.dart';
void main() { void main() {
test('should be settable using "style" attribute', () { test('should be settable using "style" attribute', () {
sky.LayoutRoot layoutRoot = new sky.LayoutRoot(); ui.LayoutRoot layoutRoot = new ui.LayoutRoot();
var document = new sky.Document(); var document = new ui.Document();
var foo = document.createElement('foo'); var foo = document.createElement('foo');
layoutRoot.rootElement = foo; layoutRoot.rootElement = foo;
...@@ -16,8 +16,8 @@ void main() { ...@@ -16,8 +16,8 @@ void main() {
}); });
test('should not crash when setting style to null', () { test('should not crash when setting style to null', () {
sky.LayoutRoot layoutRoot = new sky.LayoutRoot(); ui.LayoutRoot layoutRoot = new ui.LayoutRoot();
var document = new sky.Document(); var document = new ui.Document();
var foo = document.createElement('foo'); var foo = document.createElement('foo');
layoutRoot.rootElement = foo; layoutRoot.rootElement = foo;
......
import 'dart:ui' as sky; import 'dart:ui' as ui;
export 'dart:ui' show Point; export 'dart:ui' show Point;
class TestPointerEvent extends sky.PointerEvent { class TestPointerEvent extends ui.PointerEvent {
TestPointerEvent({ TestPointerEvent({
this.type, this.type,
this.pointer, this.pointer,
...@@ -64,9 +64,9 @@ class TestPointer { ...@@ -64,9 +64,9 @@ class TestPointer {
int pointer; int pointer;
bool isDown = false; bool isDown = false;
sky.Point location; ui.Point location;
sky.PointerEvent down([sky.Point newLocation = sky.Point.origin ]) { ui.PointerEvent down([ui.Point newLocation = ui.Point.origin ]) {
assert(!isDown); assert(!isDown);
isDown = true; isDown = true;
location = newLocation; location = newLocation;
...@@ -78,9 +78,9 @@ class TestPointer { ...@@ -78,9 +78,9 @@ class TestPointer {
); );
} }
sky.PointerEvent move([sky.Point newLocation = sky.Point.origin ]) { ui.PointerEvent move([ui.Point newLocation = ui.Point.origin ]) {
assert(isDown); assert(isDown);
sky.Offset delta = newLocation - location; ui.Offset delta = newLocation - location;
location = newLocation; location = newLocation;
return new TestPointerEvent( return new TestPointerEvent(
type: 'pointermove', type: 'pointermove',
...@@ -92,7 +92,7 @@ class TestPointer { ...@@ -92,7 +92,7 @@ class TestPointer {
); );
} }
sky.PointerEvent up() { ui.PointerEvent up() {
assert(isDown); assert(isDown);
isDown = false; isDown = false;
return new TestPointerEvent( return new TestPointerEvent(
...@@ -103,7 +103,7 @@ class TestPointer { ...@@ -103,7 +103,7 @@ class TestPointer {
); );
} }
sky.PointerEvent cancel() { ui.PointerEvent cancel() {
assert(isDown); assert(isDown);
isDown = false; isDown = false;
return new TestPointerEvent( return new TestPointerEvent(
......
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:test/test.dart'; import 'package:test/test.dart';
void main() { void main() {
test("createText(null) shouldn't crash", () { test("createText(null) shouldn't crash", () {
var doc = new sky.Document(); var doc = new ui.Document();
doc.createText(null); doc.createText(null);
}); });
} }
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
...@@ -8,7 +8,7 @@ import '../engine/mock_events.dart'; ...@@ -8,7 +8,7 @@ import '../engine/mock_events.dart';
void main() { void main() {
test('Should route pointers', () { test('Should route pointers', () {
bool callbackRan = false; bool callbackRan = false;
void callback(sky.PointerEvent event) { void callback(ui.PointerEvent event) {
callbackRan = true; callbackRan = true;
} }
......
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
...@@ -12,14 +12,14 @@ void main() { ...@@ -12,14 +12,14 @@ void main() {
TapGestureRecognizer tap = new TapGestureRecognizer(router: router); TapGestureRecognizer tap = new TapGestureRecognizer(router: router);
bool didStartScale = false; bool didStartScale = false;
sky.Point updatedFocalPoint; ui.Point updatedFocalPoint;
scale.onStart = (sky.Point focalPoint) { scale.onStart = (ui.Point focalPoint) {
didStartScale = true; didStartScale = true;
updatedFocalPoint = focalPoint; updatedFocalPoint = focalPoint;
}; };
double updatedScale; double updatedScale;
scale.onUpdate = (double scale, sky.Point focalPoint) { scale.onUpdate = (double scale, ui.Point focalPoint) {
updatedScale = scale; updatedScale = scale;
updatedFocalPoint = focalPoint; updatedFocalPoint = focalPoint;
}; };
...@@ -36,7 +36,7 @@ void main() { ...@@ -36,7 +36,7 @@ void main() {
TestPointer pointer1 = new TestPointer(1); TestPointer pointer1 = new TestPointer(1);
sky.PointerEvent down = pointer1.down(new Point(10.0, 10.0)); ui.PointerEvent down = pointer1.down(new Point(10.0, 10.0));
scale.addPointer(down); scale.addPointer(down);
tap.addPointer(down); tap.addPointer(down);
...@@ -58,7 +58,7 @@ void main() { ...@@ -58,7 +58,7 @@ void main() {
router.route(pointer1.move(new Point(20.0, 30.0))); router.route(pointer1.move(new Point(20.0, 30.0)));
expect(didStartScale, isTrue); expect(didStartScale, isTrue);
didStartScale = false; didStartScale = false;
expect(updatedFocalPoint, new sky.Point(20.0, 30.0)); expect(updatedFocalPoint, new ui.Point(20.0, 30.0));
updatedFocalPoint = null; updatedFocalPoint = null;
expect(updatedScale, 1.0); expect(updatedScale, 1.0);
updatedScale = null; updatedScale = null;
...@@ -67,7 +67,7 @@ void main() { ...@@ -67,7 +67,7 @@ void main() {
// Two-finger scaling // Two-finger scaling
TestPointer pointer2 = new TestPointer(2); TestPointer pointer2 = new TestPointer(2);
sky.PointerEvent down2 = pointer2.down(new Point(10.0, 20.0)); ui.PointerEvent down2 = pointer2.down(new Point(10.0, 20.0));
scale.addPointer(down2); scale.addPointer(down2);
tap.addPointer(down2); tap.addPointer(down2);
GestureArena.instance.close(2); GestureArena.instance.close(2);
...@@ -83,7 +83,7 @@ void main() { ...@@ -83,7 +83,7 @@ void main() {
router.route(pointer2.move(new Point(0.0, 10.0))); router.route(pointer2.move(new Point(0.0, 10.0)));
expect(didStartScale, isTrue); expect(didStartScale, isTrue);
didStartScale = false; didStartScale = false;
expect(updatedFocalPoint, new sky.Point(10.0, 20.0)); expect(updatedFocalPoint, new ui.Point(10.0, 20.0));
updatedFocalPoint = null; updatedFocalPoint = null;
expect(updatedScale, 2.0); expect(updatedScale, 2.0);
updatedScale = null; updatedScale = null;
...@@ -92,7 +92,7 @@ void main() { ...@@ -92,7 +92,7 @@ void main() {
// Zoom out // Zoom out
router.route(pointer2.move(new Point(15.0, 25.0))); router.route(pointer2.move(new Point(15.0, 25.0)));
expect(updatedFocalPoint, new sky.Point(17.5, 27.5)); expect(updatedFocalPoint, new ui.Point(17.5, 27.5));
updatedFocalPoint = null; updatedFocalPoint = null;
expect(updatedScale, 0.5); expect(updatedScale, 0.5);
updatedScale = null; updatedScale = null;
...@@ -100,7 +100,7 @@ void main() { ...@@ -100,7 +100,7 @@ void main() {
// Three-finger scaling // Three-finger scaling
TestPointer pointer3 = new TestPointer(3); TestPointer pointer3 = new TestPointer(3);
sky.PointerEvent down3 = pointer3.down(new Point(25.0, 35.0)); ui.PointerEvent down3 = pointer3.down(new Point(25.0, 35.0));
scale.addPointer(down3); scale.addPointer(down3);
tap.addPointer(down3); tap.addPointer(down3);
GestureArena.instance.close(3); GestureArena.instance.close(3);
...@@ -116,7 +116,7 @@ void main() { ...@@ -116,7 +116,7 @@ void main() {
router.route(pointer3.move(new Point(55.0, 65.0))); router.route(pointer3.move(new Point(55.0, 65.0)));
expect(didStartScale, isTrue); expect(didStartScale, isTrue);
didStartScale = false; didStartScale = false;
expect(updatedFocalPoint, new sky.Point(30.0, 40.0)); expect(updatedFocalPoint, new ui.Point(30.0, 40.0));
updatedFocalPoint = null; updatedFocalPoint = null;
expect(updatedScale, 5.0); expect(updatedScale, 5.0);
updatedScale = null; updatedScale = null;
...@@ -128,7 +128,7 @@ void main() { ...@@ -128,7 +128,7 @@ void main() {
router.route(pointer2.move(new Point(20.0, 30.0))); router.route(pointer2.move(new Point(20.0, 30.0)));
router.route(pointer3.move(new Point(15.0, 25.0))); router.route(pointer3.move(new Point(15.0, 25.0)));
expect(didStartScale, isFalse); expect(didStartScale, isFalse);
expect(updatedFocalPoint, new sky.Point(20.0, 30.0)); expect(updatedFocalPoint, new ui.Point(20.0, 30.0));
updatedFocalPoint = null; updatedFocalPoint = null;
expect(updatedScale, 1.0); expect(updatedScale, 1.0);
updatedScale = null; updatedScale = null;
...@@ -147,7 +147,7 @@ void main() { ...@@ -147,7 +147,7 @@ void main() {
router.route(pointer3.move(new Point(10.0, 20.0))); router.route(pointer3.move(new Point(10.0, 20.0)));
expect(didStartScale, isTrue); expect(didStartScale, isTrue);
didStartScale = false; didStartScale = false;
expect(updatedFocalPoint, new sky.Point(15.0, 25.0)); expect(updatedFocalPoint, new ui.Point(15.0, 25.0));
updatedFocalPoint = null; updatedFocalPoint = null;
expect(updatedScale, 2.0); expect(updatedScale, 2.0);
updatedScale = null; updatedScale = null;
...@@ -164,7 +164,7 @@ void main() { ...@@ -164,7 +164,7 @@ void main() {
router.route(pointer3.move(new Point(0.0, 0.0))); router.route(pointer3.move(new Point(0.0, 0.0)));
expect(didStartScale, isTrue); expect(didStartScale, isTrue);
didStartScale = false; didStartScale = false;
expect(updatedFocalPoint, new sky.Point(0.0, 0.0)); expect(updatedFocalPoint, new ui.Point(0.0, 0.0));
updatedFocalPoint = null; updatedFocalPoint = null;
expect(updatedScale, 1.0); expect(updatedScale, 1.0);
updatedScale = null; updatedScale = null;
......
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
...@@ -16,13 +16,13 @@ void main() { ...@@ -16,13 +16,13 @@ void main() {
didStartPan = true; didStartPan = true;
}; };
sky.Offset updatedScrollDelta; ui.Offset updatedScrollDelta;
pan.onUpdate = (sky.Offset offset) { pan.onUpdate = (ui.Offset offset) {
updatedScrollDelta = offset; updatedScrollDelta = offset;
}; };
bool didEndPan = false; bool didEndPan = false;
pan.onEnd = (sky.Offset velocity) { pan.onEnd = (ui.Offset velocity) {
didEndPan = true; didEndPan = true;
}; };
...@@ -32,7 +32,7 @@ void main() { ...@@ -32,7 +32,7 @@ void main() {
}; };
TestPointer pointer = new TestPointer(5); TestPointer pointer = new TestPointer(5);
sky.PointerEvent down = pointer.down(new Point(10.0, 10.0)); ui.PointerEvent down = pointer.down(new Point(10.0, 10.0));
pan.addPointer(down); pan.addPointer(down);
tap.addPointer(down); tap.addPointer(down);
GestureArena.instance.close(5); GestureArena.instance.close(5);
...@@ -50,14 +50,14 @@ void main() { ...@@ -50,14 +50,14 @@ void main() {
router.route(pointer.move(new Point(20.0, 20.0))); router.route(pointer.move(new Point(20.0, 20.0)));
expect(didStartPan, isTrue); expect(didStartPan, isTrue);
didStartPan = false; didStartPan = false;
expect(updatedScrollDelta, new sky.Offset(10.0, 10.0)); expect(updatedScrollDelta, new ui.Offset(10.0, 10.0));
updatedScrollDelta = null; updatedScrollDelta = null;
expect(didEndPan, isFalse); expect(didEndPan, isFalse);
expect(didTap, isFalse); expect(didTap, isFalse);
router.route(pointer.move(new Point(20.0, 25.0))); router.route(pointer.move(new Point(20.0, 25.0)));
expect(didStartPan, isFalse); expect(didStartPan, isFalse);
expect(updatedScrollDelta, new sky.Offset(0.0, 5.0)); expect(updatedScrollDelta, new ui.Offset(0.0, 5.0));
updatedScrollDelta = null; updatedScrollDelta = null;
expect(didEndPan, isFalse); expect(didEndPan, isFalse);
expect(didTap, isFalse); expect(didTap, isFalse);
......
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
import 'rendering_tester.dart'; import 'rendering_tester.dart';
class SquareImage implements sky.Image { class SquareImage implements ui.Image {
int get width => 10; int get width => 10;
int get height => 10; int get height => 10;
} }
class WideImage implements sky.Image { class WideImage implements ui.Image {
int get width => 20; int get width => 20;
int get height => 10; int get height => 10;
} }
class TallImage implements sky.Image { class TallImage implements ui.Image {
int get width => 10; int get width => 10;
int get height => 20; int get height => 20;
} }
......
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/painting.dart'; import 'package:flutter/painting.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
...@@ -6,7 +6,7 @@ import 'package:test/test.dart'; ...@@ -6,7 +6,7 @@ import 'package:test/test.dart';
import 'widget_tester.dart'; import 'widget_tester.dart';
sky.Shader createShader(Rect bounds) { ui.Shader createShader(Rect bounds) {
return new LinearGradient( return new LinearGradient(
begin: Point.origin, begin: Point.origin,
end: new Point(0.0, bounds.height), end: new Point(0.0, bounds.height),
......
import 'dart:ui' as sky; import 'dart:ui' as ui;
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -159,13 +159,13 @@ class WidgetTester { ...@@ -159,13 +159,13 @@ class WidgetTester {
_dispatchEvent(p.up(), result); _dispatchEvent(p.up(), result);
} }
void dispatchEvent(sky.Event event, Point location) { void dispatchEvent(ui.Event event, Point location) {
_dispatchEvent(event, _hitTest(location)); _dispatchEvent(event, _hitTest(location));
} }
HitTestResult _hitTest(Point location) => WidgetFlutterBinding.instance.hitTest(location); HitTestResult _hitTest(Point location) => WidgetFlutterBinding.instance.hitTest(location);
void _dispatchEvent(sky.Event event, HitTestResult result) { void _dispatchEvent(ui.Event event, HitTestResult result) {
WidgetFlutterBinding.instance.dispatchEvent(event, result); WidgetFlutterBinding.instance.dispatchEvent(event, result);
} }
......
...@@ -14,7 +14,7 @@ import 'package:yaml/yaml.dart' as yaml; ...@@ -14,7 +14,7 @@ import 'package:yaml/yaml.dart' as yaml;
import 'version.dart'; import 'version.dart';
import 'pipe_to_file.dart'; import 'pipe_to_file.dart';
const String kManifestFile = 'sky.yaml'; const String kManifestFile = 'ui.yaml';
const String kBundleFile = 'app.skyx'; const String kBundleFile = 'app.skyx';
UpdateServiceProxy _initUpdateService() { UpdateServiceProxy _initUpdateService() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment