diff --git a/examples/game/lib/explosions.dart b/examples/game/lib/explosions.dart index 73c5bec8787..3abdcf5336f 100644 --- a/examples/game/lib/explosions.dart +++ b/examples/game/lib/explosions.dart @@ -49,7 +49,7 @@ class ExplosionBig extends Explosion { // Add ring Sprite sprtRing = new Sprite(sheet["explosion_ring.png"]); - sprtRing.transferMode = sky.TransferMode.plus; + sprtRing.transferMode = ui.TransferMode.plus; addChild(sprtRing); Action scale = new ActionTween( (a) => sprtRing.scale = a, 0.2, 1.0, 0.75); @@ -63,7 +63,7 @@ class ExplosionBig extends Explosion { Sprite sprtFlare = new Sprite(sheet["explosion_flare.png"]); sprtFlare.pivot = new Point(0.3, 1.0); sprtFlare.scaleX = 0.3; - sprtFlare.transferMode = sky.TransferMode.plus; + sprtFlare.transferMode = ui.TransferMode.plus; sprtFlare.rotation = randomDouble() * 360.0; addChild(sprtFlare); @@ -86,7 +86,7 @@ class ExplosionMini extends Explosion { Sprite star = new Sprite(sheet["star_0.png"]); star.scale = 0.5; star.colorOverlay = new Color(0xff95f4fb); - star.transferMode = sky.TransferMode.plus; + star.transferMode = ui.TransferMode.plus; addChild(star); double rotationStart = randomDouble() * 90.0; diff --git a/examples/game/lib/game_demo.dart b/examples/game/lib/game_demo.dart index 95862c79414..ceb7b22c2ae 100644 --- a/examples/game/lib/game_demo.dart +++ b/examples/game/lib/game_demo.dart @@ -2,7 +2,7 @@ library game; import 'dart:async'; import 'dart:math' as math; -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/rendering.dart'; import 'package:skysprites/skysprites.dart'; diff --git a/examples/game/lib/game_demo_node.dart b/examples/game/lib/game_demo_node.dart index 8ad670c152e..c597e9a9ac8 100644 --- a/examples/game/lib/game_demo_node.dart +++ b/examples/game/lib/game_demo_node.dart @@ -26,7 +26,7 @@ class GameDemoNode extends NodeWithSize { addChild(_starField); // Add nebula - _nebula = new RepeatedImage(_images["assets/nebula.png"], sky.TransferMode.plus); + _nebula = new RepeatedImage(_images["assets/nebula.png"], ui.TransferMode.plus); addChild(_nebula); // Setup game screen, it will always be anchored to the bottom of the screen diff --git a/examples/game/lib/game_objects.dart b/examples/game/lib/game_objects.dart index 356eb5a1703..e10510c2daf 100644 --- a/examples/game/lib/game_objects.dart +++ b/examples/game/lib/game_objects.dart @@ -16,7 +16,7 @@ abstract class GameObject extends Node { Paint _paintDebug = new Paint() ..color=new Color(0xffff0000) ..strokeWidth = 1.0 - ..setStyle(sky.PaintingStyle.stroke); + ..setStyle(ui.PaintingStyle.stroke); bool collidingWith(GameObject obj) { return (GameMath.distanceBetweenPoints(position, obj.position) @@ -111,7 +111,7 @@ class Ship extends GameObject { _sprtShield = new Sprite(f.sheet["shield.png"]); _sprtShield.scale = 0.35; - _sprtShield.transferMode = sky.TransferMode.plus; + _sprtShield.transferMode = ui.TransferMode.plus; addChild(_sprtShield); radius = 20.0; @@ -188,7 +188,7 @@ class Laser extends GameObject { Sprite sprt = new Sprite(f.sheet["explosion_particle.png"]); sprt.scale = 0.5; sprt.colorOverlay = laserColor; - sprt.transferMode = sky.TransferMode.plus; + sprt.transferMode = ui.TransferMode.plus; addChild(sprt); sprites.add(sprt); } diff --git a/examples/game/lib/power_bar.dart b/examples/game/lib/power_bar.dart index 53a41062617..dc435d6d2b2 100644 --- a/examples/game/lib/power_bar.dart +++ b/examples/game/lib/power_bar.dart @@ -10,7 +10,7 @@ class PowerBar extends NodeWithSize { Paint _paintOutline = new Paint() ..color = new Color(0xffffffff) ..strokeWidth = 1.0 - ..setStyle(sky.PaintingStyle.stroke); + ..setStyle(ui.PaintingStyle.stroke); void paint(PaintingCanvas canvas) { applyTransformForPivot(canvas); diff --git a/examples/game/lib/repeated_image.dart b/examples/game/lib/repeated_image.dart index 23010129f7f..5602b0dc027 100644 --- a/examples/game/lib/repeated_image.dart +++ b/examples/game/lib/repeated_image.dart @@ -4,7 +4,7 @@ class RepeatedImage extends Node { Sprite _sprt0; Sprite _sprt1; - RepeatedImage(sky.Image image, [sky.TransferMode mode = null]) { + RepeatedImage(ui.Image image, [ui.TransferMode mode = null]) { _sprt0 = new Sprite.fromImage(image); _sprt0.size = new Size(1024.0, 1024.0); _sprt0.pivot = Point.origin; diff --git a/examples/game/lib/star_field.dart b/examples/game/lib/star_field.dart index 25a138f615a..8d8f886a308 100644 --- a/examples/game/lib/star_field.dart +++ b/examples/game/lib/star_field.dart @@ -1,7 +1,7 @@ part of game; class StarField extends NodeWithSize { - sky.Image _image; + ui.Image _image; SpriteSheet _spriteSheet; int _numStars; bool _autoScroll; @@ -15,9 +15,9 @@ class StarField extends NodeWithSize { Size _paddedSize = Size.zero; Paint _paint = new Paint() - ..filterQuality = sky.FilterQuality.low + ..filterQuality = ui.FilterQuality.low ..isAntiAlias = false - ..transferMode = sky.TransferMode.plus; + ..transferMode = ui.TransferMode.plus; StarField(this._spriteSheet, this._numStars, [this._autoScroll = false]) : super(Size.zero) { _image = _spriteSheet.image; @@ -48,9 +48,9 @@ class StarField extends NodeWithSize { void paint(PaintingCanvas canvas) { // Create a transform for each star - List transforms = []; + List transforms = []; for (int i = 0; i < _numStars; i++) { - sky.RSTransform transform = new sky.RSTransform( + ui.RSTransform transform = new ui.RSTransform( _starScales[i], 0.0, _starPositions[i].x - _padding, @@ -60,7 +60,7 @@ class StarField extends NodeWithSize { } // 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) { diff --git a/examples/game/test_performance.dart b/examples/game/test_performance.dart index 2d570229765..3e90fee3d02 100644 --- a/examples/game/test_performance.dart +++ b/examples/game/test_performance.dart @@ -1,4 +1,4 @@ -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'dart:math' as math; import 'package:flutter/material.dart'; @@ -202,7 +202,7 @@ class TestPerformanceAtlas extends PerformanceTest { double rotation = 0.0; List rects = []; Paint cachedPaint = new Paint() - ..filterQuality = sky.FilterQuality.low + ..filterQuality = ui.FilterQuality.low ..isAntiAlias = false; TestPerformanceAtlas() { @@ -216,7 +216,7 @@ class TestPerformanceAtlas extends PerformanceTest { void paint(PaintingCanvas canvas) { // Setup transforms - List transforms = []; + List transforms = []; for (int x = 0; x < grid; x++) { for (int y = 0; y < grid; y++) { @@ -238,12 +238,12 @@ class TestPerformanceAtlas extends PerformanceTest { 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 ssin = math.sin(convertDegrees2Radians(rot)) * scale; double tx = x + -scos * ax + ssin * 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 { double rotation = 0.0; List rects = []; Paint cachedPaint = new Paint() - ..filterQuality = sky.FilterQuality.low + ..filterQuality = ui.FilterQuality.low ..isAntiAlias = false; TestPerformanceAtlas2() { @@ -269,7 +269,7 @@ class TestPerformanceAtlas2 extends PerformanceTest { void paint(PaintingCanvas canvas) { // Setup transforms - List transforms = []; + List transforms = []; for (int x = 12; x < grid - 12; x++) { for (int y = 0; y < grid; y++) { @@ -291,11 +291,11 @@ class TestPerformanceAtlas2 extends PerformanceTest { 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 ssin = math.sin(convertDegrees2Radians(rot)) * scale; double tx = x + -scos * ax + ssin * ay; double ty = y + -ssin * ax - scos * ay; - return new sky.RSTransform(scos, ssin, tx, ty); + return new ui.RSTransform(scos, ssin, tx, ty); } } diff --git a/examples/mine_digger/lib/main.dart b/examples/mine_digger/lib/main.dart index b17c6a9340a..1fe6f7e0cc5 100644 --- a/examples/mine_digger/lib/main.dart +++ b/examples/mine_digger/lib/main.dart @@ -1,7 +1,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'dart:math'; import 'package:flutter/material.dart'; @@ -85,7 +85,7 @@ class MineDiggerState extends State { } PointerEventListener _pointerDownHandlerFor(int posX, int posY) { - return (sky.PointerEvent event) { + return (ui.PointerEvent event) { if (event.buttons == 1) { probe(posX, posY); } else if (event.buttons == 2) { @@ -190,7 +190,7 @@ class MineDiggerState extends State { ); } - void handleToolbarPointerDown(sky.PointerEvent event) { + void handleToolbarPointerDown(ui.PointerEvent event) { setState(() { resetGame(); }); diff --git a/examples/raw/baseline.dart b/examples/raw/baseline.dart index ef6d84c2a2f..234803ab700 100644 --- a/examples/raw/baseline.dart +++ b/examples/raw/baseline.dart @@ -2,20 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'dart:typed_data'; -void drawText(sky.Canvas canvas, String lh) { - sky.Paint paint = new sky.Paint(); +void drawText(ui.Canvas canvas, String lh) { + ui.Paint paint = new ui.Paint(); // offset down canvas.translate(0.0, 100.0); // set up the text - sky.Document document = new sky.Document(); - sky.Text arabic = document.createText("مرحبا"); - sky.Text english = document.createText(" Hello"); - sky.Element block = document.createElement('div'); + ui.Document document = new ui.Document(); + ui.Text arabic = document.createText("مرحبا"); + ui.Text english = document.createText(" Hello"); + ui.Element block = document.createElement('div'); block.style['display'] = 'paragraph'; block.style['font-family'] = 'monospace'; block.style['font-size'] = '50px'; @@ -23,21 +23,21 @@ void drawText(sky.Canvas canvas, String lh) { block.style['color'] = '#0000A0'; block.appendChild(arabic); block.appendChild(english); - sky.LayoutRoot layoutRoot = new sky.LayoutRoot(); + ui.LayoutRoot layoutRoot = new ui.LayoutRoot(); 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(); // 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.lineTo(block.maxContentWidth, 0.0); path.moveTo(0.0, block.alphabeticBaseline); path.lineTo(block.maxContentWidth, block.alphabeticBaseline); path.moveTo(0.0, block.height); path.lineTo(block.maxContentWidth, block.height); - paint.color = const sky.Color(0xFFFF9000); - paint.setStyle(sky.PaintingStyle.stroke); + paint.color = const ui.Color(0xFFFF9000); + paint.setStyle(ui.PaintingStyle.stroke); paint.strokeWidth = 3.0; canvas.drawPath(path, paint); @@ -45,14 +45,14 @@ void drawText(sky.Canvas canvas, String lh) { layoutRoot.paint(canvas); } -sky.Picture paint(sky.Rect paintBounds) { - sky.PictureRecorder recorder = new sky.PictureRecorder(); - sky.Canvas canvas = new sky.Canvas(recorder, paintBounds); +ui.Picture paint(ui.Rect paintBounds) { + ui.PictureRecorder recorder = new ui.PictureRecorder(); + ui.Canvas canvas = new ui.Canvas(recorder, paintBounds); - sky.Paint paint = new sky.Paint(); - paint.color = const sky.Color(0xFFFFFFFF); - paint.setStyle(sky.PaintingStyle.fill); - canvas.drawRect(new sky.Rect.fromLTRB(0.0, 0.0, sky.view.width, sky.view.height), paint); + ui.Paint paint = new ui.Paint(); + paint.color = const ui.Color(0xFFFFFFFF); + paint.setStyle(ui.PaintingStyle.fill); + canvas.drawRect(new ui.Rect.fromLTRB(0.0, 0.0, ui.view.width, ui.view.height), paint); canvas.translate(10.0, 0.0); drawText(canvas, '1.0'); @@ -61,29 +61,29 @@ sky.Picture paint(sky.Rect paintBounds) { return recorder.endRecording(); } -sky.Scene composite(sky.Picture picture, sky.Rect paintBounds) { - final double devicePixelRatio = sky.view.devicePixelRatio; - sky.Rect sceneBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width * devicePixelRatio, sky.view.height * devicePixelRatio); +ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) { + final double devicePixelRatio = ui.view.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) ..[0] = devicePixelRatio ..[5] = devicePixelRatio ..[10] = 1.0 ..[15] = 1.0; - sky.SceneBuilder sceneBuilder = new sky.SceneBuilder(sceneBounds) + ui.SceneBuilder sceneBuilder = new ui.SceneBuilder(sceneBounds) ..pushTransform(deviceTransform) - ..addPicture(sky.Offset.zero, picture, paintBounds) + ..addPicture(ui.Offset.zero, picture, paintBounds) ..pop(); return sceneBuilder.build(); } void beginFrame(double timeStamp) { - sky.Rect paintBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width, sky.view.height); - sky.Picture picture = paint(paintBounds); - sky.Scene scene = composite(picture, paintBounds); - sky.view.scene = scene; + ui.Rect paintBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width, ui.view.height); + ui.Picture picture = paint(paintBounds); + ui.Scene scene = composite(picture, paintBounds); + ui.view.scene = scene; } void main() { - sky.view.setFrameCallback(beginFrame); - sky.view.scheduleFrame(); + ui.view.setFrameCallback(beginFrame); + ui.view.scheduleFrame(); } diff --git a/examples/raw/hello_world.dart b/examples/raw/hello_world.dart index 66b56630af0..7275b03fb05 100644 --- a/examples/raw/hello_world.dart +++ b/examples/raw/hello_world.dart @@ -2,56 +2,56 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'dart:typed_data'; -sky.Color color; +ui.Color color; -sky.Picture paint(sky.Rect paintBounds) { - sky.PictureRecorder recorder = new sky.PictureRecorder(); - sky.Canvas canvas = new sky.Canvas(recorder, paintBounds); - sky.Size size = paintBounds.size; +ui.Picture paint(ui.Rect paintBounds) { + ui.PictureRecorder recorder = new ui.PictureRecorder(); + ui.Canvas canvas = new ui.Canvas(recorder, paintBounds); + ui.Size size = paintBounds.size; double radius = size.shortestSide * 0.45; - sky.Paint paint = new sky.Paint() + ui.Paint paint = new ui.Paint() ..color = color; - canvas.drawCircle(size.center(sky.Point.origin), radius, paint); + canvas.drawCircle(size.center(ui.Point.origin), radius, paint); return recorder.endRecording(); } -sky.Scene composite(sky.Picture picture, sky.Rect paintBounds) { - final double devicePixelRatio = sky.view.devicePixelRatio; - sky.Rect sceneBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width * devicePixelRatio, sky.view.height * devicePixelRatio); +ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) { + final double devicePixelRatio = ui.view.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) ..[0] = devicePixelRatio ..[5] = devicePixelRatio ..[10] = 1.0 ..[15] = 1.0; - sky.SceneBuilder sceneBuilder = new sky.SceneBuilder(sceneBounds) + ui.SceneBuilder sceneBuilder = new ui.SceneBuilder(sceneBounds) ..pushTransform(deviceTransform) - ..addPicture(sky.Offset.zero, picture, paintBounds) + ..addPicture(ui.Offset.zero, picture, paintBounds) ..pop(); return sceneBuilder.build(); } void beginFrame(double timeStamp) { - sky.Rect paintBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width, sky.view.height); - sky.Picture picture = paint(paintBounds); - sky.Scene scene = composite(picture, paintBounds); - sky.view.scene = scene; + ui.Rect paintBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width, ui.view.height); + ui.Picture picture = paint(paintBounds); + ui.Scene scene = composite(picture, paintBounds); + ui.view.scene = scene; } -bool handleEvent(sky.Event event) { +bool handleEvent(ui.Event event) { if (event.type == 'pointerdown') { - color = new sky.Color.fromARGB(255, 0, 0, 255); - sky.view.scheduleFrame(); + color = new ui.Color.fromARGB(255, 0, 0, 255); + ui.view.scheduleFrame(); return true; } if (event.type == 'pointerup') { - color = new sky.Color.fromARGB(255, 0, 255, 0); - sky.view.scheduleFrame(); + color = new ui.Color.fromARGB(255, 0, 255, 0); + ui.view.scheduleFrame(); return true; } @@ -65,8 +65,8 @@ bool handleEvent(sky.Event event) { void main() { print('Hello, world'); - color = new sky.Color.fromARGB(255, 0, 255, 0); - sky.view.setFrameCallback(beginFrame); - sky.view.setEventCallback(handleEvent); - sky.view.scheduleFrame(); + color = new ui.Color.fromARGB(255, 0, 255, 0); + ui.view.setFrameCallback(beginFrame); + ui.view.setEventCallback(handleEvent); + ui.view.scheduleFrame(); } diff --git a/examples/raw/mutating-dom.dart b/examples/raw/mutating-dom.dart index 01785847333..8ce1586d075 100644 --- a/examples/raw/mutating-dom.dart +++ b/examples/raw/mutating-dom.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'dart:math' as math; -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'dart:typed_data'; const kMaxIterations = 100; @@ -14,9 +14,9 @@ void report(String s) { // print("$s\n"); } -sky.LayoutRoot layoutRoot = new sky.LayoutRoot(); -sky.Document document = new sky.Document(); -sky.Element root; +ui.LayoutRoot layoutRoot = new ui.LayoutRoot(); +ui.Document document = new ui.Document(); +ui.Element root; math.Random random = new math.Random(); bool pickThis(double odds) { @@ -29,19 +29,19 @@ String generateCharacter(int min, int max) { return result; } -String colorToCSSString(sky.Color color) { +String colorToCSSString(ui.Color color) { 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 int iterationsLeft = kMaxIterations; - sky.Node node = root; - sky.Node other = null; + ui.Node node = root; + ui.Node other = null; while (node != null && iterationsLeft > 0) { iterationsLeft -= 1; - if (node is sky.Element && pickThis(0.4)) { - node = (node as sky.Element).firstChild; + if (node is ui.Element && pickThis(0.4)) { + node = (node as ui.Element).firstChild; } else if (node.nextSibling != null && pickThis(0.5)) { node = node.nextSibling; } else if (other == null && node != root && pickThis(0.1)) { @@ -57,7 +57,7 @@ void mutate(sky.Canvas canvas) { } else if (node != root && pickThis(0.001)) { report("remove()"); node.remove(); - } else if (node is sky.Element) { + } else if (node is ui.Element) { if (pickThis(0.1)) { report("appending a new text node (ASCII)"); node.appendChild(document.createText(generateCharacter(0x20, 0x7F))); @@ -80,7 +80,7 @@ void mutate(sky.Canvas canvas) { break; } else if (pickThis(0.1)) { 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; } else if (pickThis(0.1)) { report("styling: font-size"); @@ -148,12 +148,12 @@ void mutate(sky.Canvas canvas) { break; } else if (pickThis(0.1)) { 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; } } else { - assert(node is sky.Text); - final sky.Text text = node; + assert(node is ui.Text); + final ui.Text text = node; if (pickThis(0.1)) { report("appending a new text node (ASCII)"); text.appendData(generateCharacter(0x20, 0x7F)); @@ -182,8 +182,8 @@ void mutate(sky.Canvas canvas) { node = root; int count = 1; while (node != null) { - if (node is sky.Element && node.firstChild != null) { - node = (node as sky.Element).firstChild; + if (node is ui.Element && node.firstChild != null) { + node = (node as ui.Element).firstChild; count += 1; } else { while (node != null && node.nextSibling == null) @@ -202,40 +202,40 @@ void mutate(sky.Canvas canvas) { // draw the result report("recording..."); - layoutRoot.maxWidth = sky.view.width; + layoutRoot.maxWidth = ui.view.width; layoutRoot.layout(); layoutRoot.paint(canvas); report("painting..."); } -sky.Picture paint(sky.Rect paintBounds) { - sky.PictureRecorder recorder = new sky.PictureRecorder(); - sky.Canvas canvas = new sky.Canvas(recorder, paintBounds); +ui.Picture paint(ui.Rect paintBounds) { + ui.PictureRecorder recorder = new ui.PictureRecorder(); + ui.Canvas canvas = new ui.Canvas(recorder, paintBounds); mutate(canvas); return recorder.endRecording(); } -sky.Scene composite(sky.Picture picture, sky.Rect paintBounds) { - final double devicePixelRatio = sky.view.devicePixelRatio; - sky.Rect sceneBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width * devicePixelRatio, sky.view.height * devicePixelRatio); +ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) { + final double devicePixelRatio = ui.view.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) ..[0] = devicePixelRatio ..[5] = devicePixelRatio ..[10] = 1.0 ..[15] = 1.0; - sky.SceneBuilder sceneBuilder = new sky.SceneBuilder(sceneBounds) + ui.SceneBuilder sceneBuilder = new ui.SceneBuilder(sceneBounds) ..pushTransform(deviceTransform) - ..addPicture(sky.Offset.zero, picture, paintBounds) + ..addPicture(ui.Offset.zero, picture, paintBounds) ..pop(); return sceneBuilder.build(); } void beginFrame(double timeStamp) { - sky.Rect paintBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width, sky.view.height); - sky.Picture picture = paint(paintBounds); - sky.Scene scene = composite(picture, paintBounds); - sky.view.scene = scene; - sky.view.scheduleFrame(); + ui.Rect paintBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width, ui.view.height); + ui.Picture picture = paint(paintBounds); + ui.Scene scene = composite(picture, paintBounds); + ui.view.scene = scene; + ui.view.scheduleFrame(); } void main() { @@ -243,6 +243,6 @@ void main() { root.style['display'] = 'paragraph'; root.style['color'] = '#FFFFFF'; layoutRoot.rootElement = root; - sky.view.setFrameCallback(beginFrame); - sky.view.scheduleFrame(); + ui.view.setFrameCallback(beginFrame); + ui.view.scheduleFrame(); } diff --git a/examples/raw/painting.dart b/examples/raw/painting.dart index 41273a0b8b5..d02e9583f47 100644 --- a/examples/raw/painting.dart +++ b/examples/raw/painting.dart @@ -2,34 +2,34 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'dart:math' as math; import 'dart:typed_data'; -sky.Picture paint(sky.Rect paintBounds) { - sky.PictureRecorder recorder = new sky.PictureRecorder(); - sky.Canvas canvas = new sky.Canvas(recorder, paintBounds); - sky.Size size = paintBounds.size; +ui.Picture paint(ui.Rect paintBounds) { + ui.PictureRecorder recorder = new ui.PictureRecorder(); + ui.Canvas canvas = new ui.Canvas(recorder, paintBounds); + ui.Size size = paintBounds.size; - sky.Paint paint = new sky.Paint(); - sky.Point mid = size.center(sky.Point.origin); + ui.Paint paint = new ui.Paint(); + ui.Point mid = size.center(ui.Point.origin); 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.translate(-mid.x/2.0, sky.view.height*2.0); + canvas.translate(-mid.x/2.0, ui.view.height*2.0); 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); - 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); - sky.Gradient yellowBlue = new sky.Gradient.linear( - [new sky.Point(-radius, -radius), new sky.Point(0.0, 0.0)], - [const sky.Color(0xFFFFFF00), const sky.Color(0xFF0000FF)]); - canvas.drawRect(new sky.Rect.fromLTRB(-radius, -radius, radius, radius), - new sky.Paint()..setShader(yellowBlue)); + ui.Gradient yellowBlue = new ui.Gradient.linear( + [new ui.Point(-radius, -radius), new ui.Point(0.0, 0.0)], + [const ui.Color(0xFFFFFF00), const ui.Color(0xFF0000FF)]); + canvas.drawRect(new ui.Rect.fromLTRB(-radius, -radius, radius, radius), + new ui.Paint()..setShader(yellowBlue)); // Scale x and y by 0.5. var scaleMatrix = new Float64List.fromList([ @@ -39,70 +39,70 @@ sky.Picture paint(sky.Rect paintBounds) { 0.0, 0.0, 0.0, 1.0, ]); canvas.concat(scaleMatrix); - paint.color = const sky.Color.fromARGB(128, 0, 255, 0); - canvas.drawCircle(sky.Point.origin, radius, paint); + paint.color = const ui.Color.fromARGB(128, 0, 255, 0); + canvas.drawCircle(ui.Point.origin, radius, paint); canvas.restore(); canvas.translate(0.0, 50.0); - var builder = new sky.LayerDrawLooperBuilder() + var builder = new ui.LayerDrawLooperBuilder() ..addLayerOnTop( - new sky.DrawLooperLayerInfo() - ..setOffset(const sky.Offset(150.0, 0.0)) - ..setColorMode(sky.TransferMode.src) - ..setPaintBits(sky.PaintBits.all), - new sky.Paint() - ..color = const sky.Color.fromARGB(128, 255, 255, 0) - ..colorFilter = new sky.ColorFilter.mode( - const sky.Color.fromARGB(128, 0, 0, 255), sky.TransferMode.srcIn) - ..maskFilter = new sky.MaskFilter.blur( - sky.BlurStyle.normal, 3.0, highQuality: true)) + new ui.DrawLooperLayerInfo() + ..setOffset(const ui.Offset(150.0, 0.0)) + ..setColorMode(ui.TransferMode.src) + ..setPaintBits(ui.PaintBits.all), + new ui.Paint() + ..color = const ui.Color.fromARGB(128, 255, 255, 0) + ..colorFilter = new ui.ColorFilter.mode( + const ui.Color.fromARGB(128, 0, 0, 255), ui.TransferMode.srcIn) + ..maskFilter = new ui.MaskFilter.blur( + ui.BlurStyle.normal, 3.0, highQuality: true)) ..addLayerOnTop( - new sky.DrawLooperLayerInfo() - ..setOffset(const sky.Offset(75.0, 75.0)) - ..setColorMode(sky.TransferMode.src) - ..setPaintBits(sky.PaintBits.shader), - new sky.Paint() - ..shader = new sky.Gradient.radial( - new sky.Point(0.0, 0.0), radius/3.0, - [const sky.Color(0xFFFFFF00), const sky.Color(0xFFFF0000)], - null, sky.TileMode.mirror) - // Since we're don't set sky.PaintBits.maskFilter, this has no effect. - ..maskFilter = new sky.MaskFilter.blur( - sky.BlurStyle.normal, 50.0, highQuality: true)) + new ui.DrawLooperLayerInfo() + ..setOffset(const ui.Offset(75.0, 75.0)) + ..setColorMode(ui.TransferMode.src) + ..setPaintBits(ui.PaintBits.shader), + new ui.Paint() + ..shader = new ui.Gradient.radial( + new ui.Point(0.0, 0.0), radius/3.0, + [const ui.Color(0xFFFFFF00), const ui.Color(0xFFFF0000)], + null, ui.TileMode.mirror) + // Since we're don't set ui.PaintBits.maskFilter, this has no effect. + ..maskFilter = new ui.MaskFilter.blur( + ui.BlurStyle.normal, 50.0, highQuality: true)) ..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. - 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(); - canvas.drawCircle(sky.Point.origin, radius, paint); + canvas.drawCircle(ui.Point.origin, radius, paint); return recorder.endRecording(); } -sky.Scene composite(sky.Picture picture, sky.Rect paintBounds) { - final double devicePixelRatio = sky.view.devicePixelRatio; - sky.Rect sceneBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width * devicePixelRatio, sky.view.height * devicePixelRatio); +ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) { + final double devicePixelRatio = ui.view.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) ..[0] = devicePixelRatio ..[5] = devicePixelRatio ..[10] = 1.0 ..[15] = 1.0; - sky.SceneBuilder sceneBuilder = new sky.SceneBuilder(sceneBounds) + ui.SceneBuilder sceneBuilder = new ui.SceneBuilder(sceneBounds) ..pushTransform(deviceTransform) - ..addPicture(sky.Offset.zero, picture, paintBounds) + ..addPicture(ui.Offset.zero, picture, paintBounds) ..pop(); return sceneBuilder.build(); } void beginFrame(double timeStamp) { - sky.Rect paintBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width, sky.view.height); - sky.Picture picture = paint(paintBounds); - sky.Scene scene = composite(picture, paintBounds); - sky.view.scene = scene; + ui.Rect paintBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width, ui.view.height); + ui.Picture picture = paint(paintBounds); + ui.Scene scene = composite(picture, paintBounds); + ui.view.scene = scene; } void main() { - sky.view.setFrameCallback(beginFrame); - sky.view.scheduleFrame(); + ui.view.setFrameCallback(beginFrame); + ui.view.scheduleFrame(); } diff --git a/examples/raw/shadow.dart b/examples/raw/shadow.dart index 453cbb52625..eedeb0a096f 100644 --- a/examples/raw/shadow.dart +++ b/examples/raw/shadow.dart @@ -2,63 +2,63 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'dart:typed_data'; -sky.Picture paint(sky.Rect paintBounds) { - sky.PictureRecorder recorder = new sky.PictureRecorder(); - sky.Canvas canvas = new sky.Canvas(recorder, paintBounds); +ui.Picture paint(ui.Rect paintBounds) { + ui.PictureRecorder recorder = new ui.PictureRecorder(); + ui.Canvas canvas = new ui.Canvas(recorder, paintBounds); double size = 100.0; canvas.translate(size + 10.0, size + 10.0); - sky.Paint paint = new sky.Paint(); - paint.color = const sky.Color.fromARGB(255, 0, 255, 0); - var builder = new sky.LayerDrawLooperBuilder() + ui.Paint paint = new ui.Paint(); + paint.color = const ui.Color.fromARGB(255, 0, 255, 0); + var builder = new ui.LayerDrawLooperBuilder() // Shadow layer. ..addLayerOnTop( - new sky.DrawLooperLayerInfo() - ..setPaintBits(sky.PaintBits.all) - ..setOffset(const sky.Offset(5.0, 5.0)) - ..setColorMode(sky.TransferMode.src), - new sky.Paint() - ..color = const sky.Color.fromARGB(128, 55, 55, 55) - ..maskFilter = new sky.MaskFilter.blur(sky.BlurStyle.normal, 5.0) + new ui.DrawLooperLayerInfo() + ..setPaintBits(ui.PaintBits.all) + ..setOffset(const ui.Offset(5.0, 5.0)) + ..setColorMode(ui.TransferMode.src), + new ui.Paint() + ..color = const ui.Color.fromARGB(128, 55, 55, 55) + ..maskFilter = new ui.MaskFilter.blur(ui.BlurStyle.normal, 5.0) ) // Main layer. - ..addLayerOnTop(new sky.DrawLooperLayerInfo(), new sky.Paint()); + ..addLayerOnTop(new ui.DrawLooperLayerInfo(), new ui.Paint()); paint.drawLooper = builder.build(); canvas.drawPaint( - new sky.Paint()..color = const sky.Color.fromARGB(255, 255, 255, 255)); - canvas.drawRect(new sky.Rect.fromLTRB(-size, -size, size, size), paint); + new ui.Paint()..color = const ui.Color.fromARGB(255, 255, 255, 255)); + canvas.drawRect(new ui.Rect.fromLTRB(-size, -size, size, size), paint); return recorder.endRecording(); } -sky.Scene composite(sky.Picture picture, sky.Rect paintBounds) { - final double devicePixelRatio = sky.view.devicePixelRatio; - sky.Rect sceneBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width * devicePixelRatio, sky.view.height * devicePixelRatio); +ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) { + final double devicePixelRatio = ui.view.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) ..[0] = devicePixelRatio ..[5] = devicePixelRatio ..[10] = 1.0 ..[15] = 1.0; - sky.SceneBuilder sceneBuilder = new sky.SceneBuilder(sceneBounds) + ui.SceneBuilder sceneBuilder = new ui.SceneBuilder(sceneBounds) ..pushTransform(deviceTransform) - ..addPicture(sky.Offset.zero, picture, paintBounds) + ..addPicture(ui.Offset.zero, picture, paintBounds) ..pop(); return sceneBuilder.build(); } void beginFrame(double timeStamp) { - sky.Rect paintBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width, sky.view.height); - sky.Picture picture = paint(paintBounds); - sky.Scene scene = composite(picture, paintBounds); - sky.view.scene = scene; + ui.Rect paintBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width, ui.view.height); + ui.Picture picture = paint(paintBounds); + ui.Scene scene = composite(picture, paintBounds); + ui.view.scene = scene; } void main() { - sky.view.setFrameCallback(beginFrame); - sky.view.scheduleFrame(); + ui.view.setFrameCallback(beginFrame); + ui.view.scheduleFrame(); } diff --git a/examples/raw/spinning_arabic.dart b/examples/raw/spinning_arabic.dart index 09d1e0f2030..1e722fcd9c3 100644 --- a/examples/raw/spinning_arabic.dart +++ b/examples/raw/spinning_arabic.dart @@ -3,20 +3,20 @@ // found in the LICENSE file. import 'dart:math' as math; -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'dart:typed_data'; double timeBase = null; -sky.LayoutRoot layoutRoot = new sky.LayoutRoot(); +ui.LayoutRoot layoutRoot = new ui.LayoutRoot(); -sky.Picture paint(sky.Rect paintBounds, double delta) { - sky.PictureRecorder recorder = new sky.PictureRecorder(); - sky.Canvas canvas = new sky.Canvas(recorder, paintBounds); +ui.Picture paint(ui.Rect paintBounds, double delta) { + ui.PictureRecorder recorder = new ui.PictureRecorder(); + 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.drawRect(new sky.Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0), - new sky.Paint()..color = const sky.Color.fromARGB(255, 0, 255, 0)); + canvas.drawRect(new ui.Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0), + new ui.Paint()..color = const ui.Color.fromARGB(255, 0, 255, 0)); double sin = math.sin(delta / 200); layoutRoot.maxWidth = 150.0 + (50 * sin); @@ -28,17 +28,17 @@ sky.Picture paint(sky.Rect paintBounds, double delta) { return recorder.endRecording(); } -sky.Scene composite(sky.Picture picture, sky.Rect paintBounds) { - final double devicePixelRatio = sky.view.devicePixelRatio; - sky.Rect sceneBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width * devicePixelRatio, sky.view.height * devicePixelRatio); +ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) { + final double devicePixelRatio = ui.view.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) ..[0] = devicePixelRatio ..[5] = devicePixelRatio ..[10] = 1.0 ..[15] = 1.0; - sky.SceneBuilder sceneBuilder = new sky.SceneBuilder(sceneBounds) + ui.SceneBuilder sceneBuilder = new ui.SceneBuilder(sceneBounds) ..pushTransform(deviceTransform) - ..addPicture(sky.Offset.zero, picture, paintBounds) + ..addPicture(ui.Offset.zero, picture, paintBounds) ..pop(); return sceneBuilder.build(); } @@ -47,15 +47,15 @@ void beginFrame(double timeStamp) { if (timeBase == null) timeBase = timeStamp; double delta = timeStamp - timeBase; - sky.Rect paintBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width, sky.view.height); - sky.Picture picture = paint(paintBounds, delta); - sky.Scene scene = composite(picture, paintBounds); - sky.view.scene = scene; - sky.view.scheduleFrame(); + ui.Rect paintBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width, ui.view.height); + ui.Picture picture = paint(paintBounds, delta); + ui.Scene scene = composite(picture, paintBounds); + ui.view.scene = scene; + ui.view.scheduleFrame(); } void main() { - var document = new sky.Document(); + var document = new ui.Document(); var arabic = document.createText("هذا هو قليلا طويلة من النص الذي يجب التفاف ."); var more = document.createText(" و أكثر قليلا لجعله أطول. "); var block = document.createElement('p'); @@ -68,6 +68,6 @@ void main() { layoutRoot.rootElement = block; - sky.view.setFrameCallback(beginFrame); - sky.view.scheduleFrame(); + ui.view.setFrameCallback(beginFrame); + ui.view.scheduleFrame(); } diff --git a/examples/raw/spinning_image.dart b/examples/raw/spinning_image.dart index b9fe9b450be..cd2973bdc5f 100644 --- a/examples/raw/spinning_image.dart +++ b/examples/raw/spinning_image.dart @@ -3,29 +3,29 @@ // found in the LICENSE file. import 'dart:math' as math; -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'dart:typed_data'; import 'package:flutter/services.dart'; 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 url2 = "http://i2.kym-cdn.com/photos/images/facebook/000/581/296/c09.jpg"; -sky.Picture paint(sky.Rect paintBounds, double delta) { - sky.PictureRecorder recorder = new sky.PictureRecorder(); - sky.Canvas canvas = new sky.Canvas(recorder, paintBounds); +ui.Picture paint(ui.Rect paintBounds, double delta) { + ui.PictureRecorder recorder = new ui.PictureRecorder(); + ui.Canvas canvas = new ui.Canvas(recorder, paintBounds); canvas.translate(paintBounds.width / 2.0, paintBounds.height / 2.0); canvas.rotate(math.PI * delta / 1800); 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 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 canvas.rotate(math.PI * delta / 1800); @@ -33,25 +33,25 @@ sky.Picture paint(sky.Rect paintBounds, double delta) { var w = image.width.toDouble(); var h = image.width.toDouble(); canvas.drawImageRect(image, - new sky.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 * 0.25, h * 0.25, w * 0.75, h * 0.75), + new ui.Rect.fromLTRB(-w / 4.0, -h / 4.0, w / 4.0, h / 4.0), paint); } return recorder.endRecording(); } -sky.Scene composite(sky.Picture picture, sky.Rect paintBounds) { - final double devicePixelRatio = sky.view.devicePixelRatio; - sky.Rect sceneBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width * devicePixelRatio, sky.view.height * devicePixelRatio); +ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) { + final double devicePixelRatio = ui.view.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) ..[0] = devicePixelRatio ..[5] = devicePixelRatio ..[10] = 1.0 ..[15] = 1.0; - sky.SceneBuilder sceneBuilder = new sky.SceneBuilder(sceneBounds) + ui.SceneBuilder sceneBuilder = new ui.SceneBuilder(sceneBounds) ..pushTransform(deviceTransform) - ..addPicture(sky.Offset.zero, picture, paintBounds) + ..addPicture(ui.Offset.zero, picture, paintBounds) ..pop(); return sceneBuilder.build(); } @@ -60,11 +60,11 @@ void beginFrame(double timeStamp) { if (timeBase == null) timeBase = timeStamp; double delta = timeStamp - timeBase; - sky.Rect paintBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width, sky.view.height); - sky.Picture picture = paint(paintBounds, delta); - sky.Scene scene = composite(picture, paintBounds); - sky.view.scene = scene; - sky.view.scheduleFrame(); + ui.Rect paintBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width, ui.view.height); + ui.Picture picture = paint(paintBounds, delta); + ui.Scene scene = composite(picture, paintBounds); + ui.view.scene = scene; + ui.view.scheduleFrame(); } @@ -72,13 +72,13 @@ void handleImageLoad(result) { if (result != image) { print("${result.width}x${result.width} image loaded!"); image = result; - sky.view.scheduleFrame(); + ui.view.scheduleFrame(); } else { print("Existing image was loaded again"); } } -bool handleEvent(sky.Event event) { +bool handleEvent(ui.Event event) { if (event.type == "pointerdown") { return true; } @@ -93,6 +93,6 @@ bool handleEvent(sky.Event event) { void main() { imageCache.load(url1).first.then(handleImageLoad); - sky.view.setEventCallback(handleEvent); - sky.view.setFrameCallback(beginFrame); + ui.view.setEventCallback(handleEvent); + ui.view.setFrameCallback(beginFrame); } diff --git a/examples/raw/spinning_square.dart b/examples/raw/spinning_square.dart index 1cb85c884cc..8a98bbd8394 100644 --- a/examples/raw/spinning_square.dart +++ b/examples/raw/spinning_square.dart @@ -3,46 +3,46 @@ // found in the LICENSE file. import 'dart:math' as math; -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'dart:typed_data'; double timeBase = null; void beginFrame(double timeStamp) { - sky.tracing.begin('beginFrame'); + ui.tracing.begin('beginFrame'); if (timeBase == null) timeBase = timeStamp; double delta = timeStamp - timeBase; // paint - sky.Rect paintBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width, sky.view.height); - sky.PictureRecorder recorder = new sky.PictureRecorder(); - sky.Canvas canvas = new sky.Canvas(recorder, paintBounds); + ui.Rect paintBounds = new ui.Rect.fromLTWH(0.0, 0.0, ui.view.width, ui.view.height); + ui.PictureRecorder recorder = new ui.PictureRecorder(); + ui.Canvas canvas = new ui.Canvas(recorder, paintBounds); canvas.translate(paintBounds.width / 2.0, paintBounds.height / 2.0); canvas.rotate(math.PI * delta / 1800); - canvas.drawRect(new sky.Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0), - new sky.Paint()..color = const sky.Color.fromARGB(255, 0, 255, 0)); - sky.Picture picture = recorder.endRecording(); + canvas.drawRect(new ui.Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0), + new ui.Paint()..color = const ui.Color.fromARGB(255, 0, 255, 0)); + ui.Picture picture = recorder.endRecording(); // composite - final double devicePixelRatio = sky.view.devicePixelRatio; - sky.Rect sceneBounds = new sky.Rect.fromLTWH(0.0, 0.0, sky.view.width * devicePixelRatio, sky.view.height * devicePixelRatio); + final double devicePixelRatio = ui.view.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) ..[0] = devicePixelRatio ..[5] = devicePixelRatio ..[10] = 1.0 ..[15] = 1.0; - sky.SceneBuilder sceneBuilder = new sky.SceneBuilder(sceneBounds) + ui.SceneBuilder sceneBuilder = new ui.SceneBuilder(sceneBounds) ..pushTransform(deviceTransform) - ..addPicture(sky.Offset.zero, picture, paintBounds) + ..addPicture(ui.Offset.zero, picture, paintBounds) ..pop(); - sky.view.scene = sceneBuilder.build(); + ui.view.scene = sceneBuilder.build(); - sky.tracing.end('beginFrame'); - sky.view.scheduleFrame(); + ui.tracing.end('beginFrame'); + ui.view.scheduleFrame(); } void main() { - sky.view.setFrameCallback(beginFrame); - sky.view.scheduleFrame(); + ui.view.setFrameCallback(beginFrame); + ui.view.scheduleFrame(); } diff --git a/examples/rendering/baseline.dart b/examples/rendering/baseline.dart index a3838e7ecf5..11da5f1a207 100644 --- a/examples/rendering/baseline.dart +++ b/examples/rendering/baseline.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/rendering.dart'; @@ -50,7 +50,7 @@ RenderBox getBox(double lh) { path.lineTo(w, h); Paint paint = new Paint(); paint.color = const Color(0xFFFF9000); - paint.setStyle(sky.PaintingStyle.stroke); + paint.setStyle(ui.PaintingStyle.stroke); paint.strokeWidth = 3.0; canvas.drawPath(path, paint); } diff --git a/examples/rendering/borders.dart b/examples/rendering/borders.dart index 52b642e9490..452970d912c 100644 --- a/examples/rendering/borders.dart +++ b/examples/rendering/borders.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/rendering.dart'; @@ -15,7 +15,7 @@ void main() { additionalConstraints: new BoxConstraints.tightFor(height: 100.0), child: new RenderDecoratedBox( decoration: new BoxDecoration( - backgroundColor: new sky.Color(0xFFFFFF00) + backgroundColor: new ui.Color(0xFFFFFF00) ) ) ) @@ -27,12 +27,12 @@ void main() { child: new RenderDecoratedBox( decoration: new BoxDecoration( border: new Border( - top: new BorderSide(color: new sky.Color(0xFFF00000), width: 5.0), - right: new BorderSide(color: new sky.Color(0xFFFF9000), width: 10.0), - bottom: new BorderSide(color: new sky.Color(0xFFFFF000), width: 15.0), - left: new BorderSide(color: new sky.Color(0xFF00FF00), width: 20.0) + top: new BorderSide(color: new ui.Color(0xFFF00000), width: 5.0), + right: new BorderSide(color: new ui.Color(0xFFFF9000), width: 10.0), + bottom: new BorderSide(color: new ui.Color(0xFFFFF000), width: 15.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() { additionalConstraints: new BoxConstraints.tightFor(height: 100.0), child: new RenderDecoratedBox( decoration: new BoxDecoration( - backgroundColor: new sky.Color(0xFFFFFF00) + backgroundColor: new ui.Color(0xFFFFFF00) ) ) ) @@ -54,7 +54,7 @@ void main() { additionalConstraints: new BoxConstraints.tightFor(height: 100.0), child: new RenderDecoratedBox( decoration: new BoxDecoration( - backgroundColor: new sky.Color(0xFFFFFF00) + backgroundColor: new ui.Color(0xFFFFFF00) ) ) ) @@ -65,7 +65,7 @@ void main() { additionalConstraints: new BoxConstraints.tightFor(height: 100.0), child: new RenderDecoratedBox( decoration: new BoxDecoration( - backgroundColor: new sky.Color(0xFFFFFF00) + backgroundColor: new ui.Color(0xFFFFFF00) ) ) ) diff --git a/examples/rendering/flex.dart b/examples/rendering/flex.dart index 2abaf26719a..164220c4df8 100644 --- a/examples/rendering/flex.dart +++ b/examples/rendering/flex.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/rendering.dart'; import 'solid_color_box.dart'; @@ -11,24 +11,24 @@ RenderBox buildFlexExample() { RenderFlex flexRoot = new RenderFlex(direction: FlexDirection.vertical); RenderDecoratedBox root = new RenderDecoratedBox( - decoration: new BoxDecoration(backgroundColor: const sky.Color(0xFF000000)), + decoration: new BoxDecoration(backgroundColor: const ui.Color(0xFF000000)), 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); parent.add(child); child.parentData.flex = flex; } // Yellow bar at top - addFlexChildSolidColor(flexRoot, const sky.Color(0xFFFFFF00), flex: 1); + addFlexChildSolidColor(flexRoot, const ui.Color(0xFFFFFF00), flex: 1); // 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( - 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)); @@ -36,11 +36,11 @@ RenderBox buildFlexExample() { var row = new RenderFlex(direction: FlexDirection.horizontal); // Purple and blue cells - addFlexChildSolidColor(row, const sky.Color(0x77FF00FF), flex: 1); - addFlexChildSolidColor(row, const sky.Color(0xFF0000FF), flex: 2); + addFlexChildSolidColor(row, const ui.Color(0x77FF00FF), flex: 1); + addFlexChildSolidColor(row, const ui.Color(0xFF0000FF), flex: 2); var decoratedRow = new RenderDecoratedBox( - decoration: new BoxDecoration(backgroundColor: const sky.Color(0xFF333333)), + decoration: new BoxDecoration(backgroundColor: const ui.Color(0xFF333333)), child: row ); diff --git a/examples/rendering/interactive_flex.dart b/examples/rendering/interactive_flex.dart index 79134675ca1..ce50fd92046 100644 --- a/examples/rendering/interactive_flex.dart +++ b/examples/rendering/interactive_flex.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'dart:math' as math; import 'package:flutter/services.dart'; @@ -19,7 +19,7 @@ class Touch { class RenderImageGrow extends RenderImage { 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); double _growth = 0.0; @@ -35,7 +35,7 @@ RenderImageGrow image; Map touches = new Map(); void handleEvent(event) { - if (event is sky.PointerEvent) { + if (event is ui.PointerEvent) { if (event.type == 'pointermove') image.growth = math.max(0.0, image.growth + event.x - touches[event.pointer].x); touches[event.pointer] = new Touch(event.x, event.y); @@ -59,7 +59,7 @@ void main() { // Resizeable image 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; }); @@ -99,5 +99,5 @@ Pancetta meatball tongue tenderloin rump tail jowl boudin."""; updateTaskDescription('Interactive Flex', topColor); new FlutterBinding(root: root); - sky.view.setEventCallback(handleEvent); + ui.view.setEventCallback(handleEvent); } diff --git a/examples/rendering/sector_layout.dart b/examples/rendering/sector_layout.dart index 9e4a9889a41..912127ad0ae 100644 --- a/examples/rendering/sector_layout.dart +++ b/examples/rendering/sector_layout.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'dart:math' as math; -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/rendering.dart'; @@ -528,7 +528,7 @@ class RenderSolidColor extends RenderDecoratedSector { deltaTheta = constraints.constrainDeltaTheta(desiredDeltaTheta); } - void handleEvent(sky.Event event, HitTestEntry entry) { + void handleEvent(ui.Event event, HitTestEntry entry) { if (event.type == 'pointerdown') decoration = new BoxDecoration(backgroundColor: const Color(0xFFFF0000)); else if (event.type == 'pointerup') diff --git a/examples/rendering/solid_color_box.dart b/examples/rendering/solid_color_box.dart index 689631796a9..acd6a6300f4 100644 --- a/examples/rendering/solid_color_box.dart +++ b/examples/rendering/solid_color_box.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/rendering.dart'; @@ -42,7 +42,7 @@ class RenderSolidColorBox extends RenderDecoratedBox { size = constraints.constrain(desiredSize); } - void handleEvent(sky.Event event, BoxHitTestEntry entry) { + void handleEvent(ui.Event event, BoxHitTestEntry entry) { if (event.type == 'pointerdown') decoration = new BoxDecoration(backgroundColor: const Color(0xFFFF0000)); else if (event.type == 'pointerup') diff --git a/examples/rendering/spinning_flex.dart b/examples/rendering/spinning_flex.dart index ea9ba7651c7..c6d21ce168e 100644 --- a/examples/rendering/spinning_flex.dart +++ b/examples/rendering/spinning_flex.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/animation.dart'; import 'package:flutter/rendering.dart'; @@ -15,15 +15,15 @@ RenderTransform transformBox; void main() { 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); parent.add(child); child.parentData.flex = flex; } - addFlexChildSolidColor(flexRoot, const sky.Color(0xFFFF00FF), flex: 1); - addFlexChildSolidColor(flexRoot, const sky.Color(0xFFFFFF00), flex: 2); - addFlexChildSolidColor(flexRoot, const sky.Color(0xFF00FFFF), flex: 1); + addFlexChildSolidColor(flexRoot, const ui.Color(0xFFFF00FF), flex: 1); + addFlexChildSolidColor(flexRoot, const ui.Color(0xFFFFFF00), flex: 2); + addFlexChildSolidColor(flexRoot, const ui.Color(0xFF00FFFF), flex: 1); transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.identity()); diff --git a/examples/rendering/touch_demo.dart b/examples/rendering/touch_demo.dart index 9a6ec804810..5c227851108 100644 --- a/examples/rendering/touch_demo.dart +++ b/examples/rendering/touch_demo.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; @@ -24,7 +24,7 @@ class Dot { 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); radius = 5 + (95 * event.pressure); } @@ -39,8 +39,8 @@ class RenderTouchDemo extends RenderBox { RenderTouchDemo(); - void handleEvent(sky.Event event, BoxHitTestEntry entry) { - if (event is sky.PointerEvent) { + void handleEvent(ui.Event event, BoxHitTestEntry entry) { + if (event is ui.PointerEvent) { switch (event.type) { case 'pointerdown': Color color = kColors[event.pointer.remainder(kColors.length)]; diff --git a/examples/rendering/transform.dart b/examples/rendering/transform.dart index d34758fd3ee..664b0325bf1 100644 --- a/examples/rendering/transform.dart +++ b/examples/rendering/transform.dart @@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/rendering.dart'; void main() { RenderDecoratedBox green = new RenderDecoratedBox( - decoration: new BoxDecoration(backgroundColor: const sky.Color(0xFF00FF00)) + decoration: new BoxDecoration(backgroundColor: const ui.Color(0xFF00FF00)) ); 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 ); diff --git a/examples/stocks/lib/main.dart b/examples/stocks/lib/main.dart index 35c7baf6c54..314a3b57a56 100644 --- a/examples/stocks/lib/main.dart +++ b/examples/stocks/lib/main.dart @@ -6,7 +6,7 @@ library stocks; import 'dart:async'; import 'dart:math' as math; -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; diff --git a/examples/stocks/lib/stock_arrow.dart b/examples/stocks/lib/stock_arrow.dart index a1f56b56dfe..f745c242bb1 100644 --- a/examples/stocks/lib/stock_arrow.dart +++ b/examples/stocks/lib/stock_arrow.dart @@ -25,7 +25,7 @@ class StockArrow extends StatelessComponent { // TODO(jackson): This should change colors with the theme Color color = _colorForPercentChange(percentChange); 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.strokeWidth = 1.0; const double padding = 2.0; @@ -49,11 +49,11 @@ class StockArrow extends StatelessComponent { path.lineTo(centerX + w, arrowY + h); path.lineTo(centerX - w, arrowY + h); path.close(); - paint.setStyle(sky.PaintingStyle.fill); + paint.setStyle(ui.PaintingStyle.fill); canvas.drawPath(path, paint); // 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); }); diff --git a/examples/stocks/lib/stock_menu.dart b/examples/stocks/lib/stock_menu.dart index c55e6465892..1a1ca9af4e0 100644 --- a/examples/stocks/lib/stock_menu.dart +++ b/examples/stocks/lib/stock_menu.dart @@ -12,8 +12,8 @@ Future showStockMenu(NavigatorState navigator, { bool autorefresh, ValueChanged switch (await showMenu( navigator: navigator, position: new MenuPosition( - right: sky.view.paddingRight + _kMenuMargin, - top: sky.view.paddingTop + _kMenuMargin + right: ui.view.paddingRight + _kMenuMargin, + top: ui.view.paddingTop + _kMenuMargin ), builder: (NavigatorState navigator) { return [ diff --git a/examples/widgets/card_collection.dart b/examples/widgets/card_collection.dart index 6cbb9889c1f..fd2d17a0470 100644 --- a/examples/widgets/card_collection.dart +++ b/examples/widgets/card_collection.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/material.dart'; import 'package:flutter/painting.dart'; @@ -299,7 +299,7 @@ class CardCollectionState extends State { }); } - sky.Shader _createShader(Rect bounds) { + ui.Shader _createShader(Rect bounds) { return new LinearGradient( begin: Point.origin, end: new Point(0.0, bounds.height), diff --git a/examples/widgets/overlay_geometry.dart b/examples/widgets/overlay_geometry.dart index 872a2533f65..ffde8ff1fd8 100644 --- a/examples/widgets/overlay_geometry.dart +++ b/examples/widgets/overlay_geometry.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; @@ -31,14 +31,14 @@ class Marker extends StatelessComponent { final double size; final MarkerType type; - void paintMarker(sky.Canvas canvas, _) { + void paintMarker(ui.Canvas canvas, _) { Paint paint = new Paint()..color = const Color(0x8000FF00); - paint.setStyle(sky.PaintingStyle.fill); + paint.setStyle(ui.PaintingStyle.fill); double r = size / 2.0; canvas.drawCircle(new Point(r, r), r, paint); paint.color = const Color(0xFFFFFFFF); - paint.setStyle(sky.PaintingStyle.stroke); + paint.setStyle(ui.PaintingStyle.stroke); paint.strokeWidth = 1.0; if (type == MarkerType.topLeft) { canvas.drawLine(new Point(r, r), new Point(r + r - 1.0, r), paint); @@ -103,7 +103,7 @@ class OverlayGeometryAppState extends State { }); } - void handlePointerDown(GlobalKey target, sky.PointerEvent event) { + void handlePointerDown(GlobalKey target, ui.PointerEvent event) { setState(() { markers[MarkerType.touch] = new Point(event.x, event.y); final RenderBox box = target.currentContext.findRenderObject(); diff --git a/examples/widgets/spinning_mixed.dart b/examples/widgets/spinning_mixed.dart index b59c6e3c743..3246c4c7536 100644 --- a/examples/widgets/spinning_mixed.dart +++ b/examples/widgets/spinning_mixed.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/animation.dart'; import 'package:flutter/material.dart'; @@ -11,7 +11,7 @@ import 'package:flutter/rendering.dart'; import '../rendering/solid_color_box.dart'; // 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); parent.add(child); child.parentData.flex = flex; @@ -81,9 +81,9 @@ void main() { new RenderBoxToWidgetAdapter(proxy, builder); // adds itself to proxy 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); - 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()); RenderPadding root = new RenderPadding(padding: new EdgeDims.all(80.0), child: transformBox); diff --git a/packages/flutter/lib/src/animation/scheduler.dart b/packages/flutter/lib/src/animation/scheduler.dart index 5b8b4b9aaac..064762ded60 100644 --- a/packages/flutter/lib/src/animation/scheduler.dart +++ b/packages/flutter/lib/src/animation/scheduler.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'dart:collection'; -import 'dart:ui' as sky; +import 'dart:ui' as ui; /// Slows down animations by this factor to help in development. double timeDilation = 1.0; @@ -20,7 +20,7 @@ typedef void SchedulerCallback(Duration timeStamp); class Scheduler { /// Requires clients to use the [scheduler] singleton Scheduler._() { - sky.view.setFrameCallback(beginFrame); + ui.view.setFrameCallback(beginFrame); } bool _haveScheduledVisualUpdate = false; @@ -88,7 +88,7 @@ class Scheduler { void ensureVisualUpdate() { if (_haveScheduledVisualUpdate) return; - sky.view.scheduleFrame(); + ui.view.scheduleFrame(); _haveScheduledVisualUpdate = true; } } diff --git a/packages/flutter/lib/src/animation/scroll_behavior.dart b/packages/flutter/lib/src/animation/scroll_behavior.dart index b5be81572c0..23656e6c069 100644 --- a/packages/flutter/lib/src/animation/scroll_behavior.dart +++ b/packages/flutter/lib/src/animation/scroll_behavior.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'dart:math' as math; -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:newton/newton.dart'; @@ -109,11 +109,11 @@ Simulation _createFlingScrollSimulation(double position, double velocity, double // scrolling less than one logical pixel per frame. We're essentially // normalizing by the devicePixelRatio so that the threshold has the // 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 // 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); ScrollSimulation simulation = @@ -124,7 +124,7 @@ Simulation _createFlingScrollSimulation(double position, double velocity, double Simulation _createSnapScrollSimulation(double startOffset, double endOffset, double velocity) { 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); } diff --git a/packages/flutter/lib/src/gestures/drag.dart b/packages/flutter/lib/src/gestures/drag.dart index b130441ffd9..473b410c0c5 100644 --- a/packages/flutter/lib/src/gestures/drag.dart +++ b/packages/flutter/lib/src/gestures/drag.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'arena.dart'; import 'recognizer.dart'; @@ -16,17 +16,17 @@ enum DragState { typedef void GestureDragStartCallback(); typedef void GestureDragUpdateCallback(double delta); -typedef void GestureDragEndCallback(sky.Offset velocity); +typedef void GestureDragEndCallback(ui.Offset velocity); typedef void GesturePanStartCallback(); -typedef void GesturePanUpdateCallback(sky.Offset delta); -typedef void GesturePanEndCallback(sky.Offset velocity); +typedef void GesturePanUpdateCallback(ui.Offset delta); +typedef void GesturePanEndCallback(ui.Offset velocity); typedef void _GesturePolymorphicUpdateCallback(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; return velocity.isValid && velocitySquared > kMinFlingVelocity * kMinFlingVelocity && @@ -45,12 +45,12 @@ abstract class _DragGestureRecognizer extends GestureRecogniz T _pendingDragDelta; T get _initialPendingDragDelta; - T _getDragDelta(sky.PointerEvent event); + T _getDragDelta(ui.PointerEvent event); 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); if (_state == DragState.ready) { _state = DragState.possible; @@ -58,7 +58,7 @@ abstract class _DragGestureRecognizer extends GestureRecogniz } } - void handleEvent(sky.PointerEvent event) { + void handleEvent(ui.PointerEvent event) { assert(_state != DragState.ready); if (event.type == 'pointermove') { _velocityTracker.addPosition(_eventTime(event), event.pointer, event.x, event.y); @@ -96,10 +96,10 @@ abstract class _DragGestureRecognizer extends GestureRecogniz bool wasAccepted = (_state == DragState.accepted); _state = DragState.ready; if (wasAccepted && onEnd != null) { - sky.GestureVelocity gestureVelocity = _velocityTracker.getVelocity(pointer); - sky.Offset velocity = sky.Offset.zero; + ui.GestureVelocity gestureVelocity = _velocityTracker.getVelocity(pointer); + ui.Offset velocity = ui.Offset.zero; if (_isFlingGesture(gestureVelocity)) - velocity = new sky.Offset(gestureVelocity.x, gestureVelocity.y); + velocity = new ui.Offset(gestureVelocity.x, gestureVelocity.y); onEnd(velocity); } _velocityTracker.reset(); @@ -120,7 +120,7 @@ class VerticalDragGestureRecognizer extends _DragGestureRecognizer { }) : super(router: router, onStart: onStart, onUpdate: onUpdate, onEnd: onEnd); 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; } @@ -133,11 +133,11 @@ class HorizontalDragGestureRecognizer extends _DragGestureRecognizer { }) : super(router: router, onStart: onStart, onUpdate: onUpdate, onEnd: onEnd); 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; } -class PanGestureRecognizer extends _DragGestureRecognizer { +class PanGestureRecognizer extends _DragGestureRecognizer { PanGestureRecognizer({ PointerRouter router, GesturePanStartCallback onStart, @@ -145,8 +145,8 @@ class PanGestureRecognizer extends _DragGestureRecognizer { GesturePanEndCallback onEnd }) : super(router: router, onStart: onStart, onUpdate: onUpdate, onEnd: onEnd); - sky.Offset get _initialPendingDragDelta => sky.Offset.zero; - sky.Offset _getDragDelta(sky.PointerEvent event) => new sky.Offset(event.dx, event.dy); + ui.Offset get _initialPendingDragDelta => ui.Offset.zero; + ui.Offset _getDragDelta(ui.PointerEvent event) => new ui.Offset(event.dx, event.dy); bool get _hasSufficientPendingDragDeltaToAccept { return _pendingDragDelta.distance > kPanSlop; } diff --git a/packages/flutter/lib/src/gestures/long_press.dart b/packages/flutter/lib/src/gestures/long_press.dart index 4ffd3482237..4dd278601ba 100644 --- a/packages/flutter/lib/src/gestures/long_press.dart +++ b/packages/flutter/lib/src/gestures/long_press.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'arena.dart'; import 'constants.dart'; @@ -22,7 +22,7 @@ class LongPressGestureRecognizer extends PrimaryPointerGestureRecognizer { onLongPress(); } - void handlePrimaryPointer(sky.PointerEvent event) { + void handlePrimaryPointer(ui.PointerEvent event) { if (event.type == 'pointerup') resolve(GestureDisposition.rejected); } diff --git a/packages/flutter/lib/src/gestures/pointer_router.dart b/packages/flutter/lib/src/gestures/pointer_router.dart index 6918b3dc807..d774bb1b5e6 100644 --- a/packages/flutter/lib/src/gestures/pointer_router.dart +++ b/packages/flutter/lib/src/gestures/pointer_router.dart @@ -2,18 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; -/// A callback that receives a [sky.PointerEvent] -typedef void PointerRoute(sky.PointerEvent event); +/// A callback that receives a [ui.PointerEvent] +typedef void PointerRoute(ui.PointerEvent event); -/// A routing table for [sky.PointerEvent] events. +/// A routing table for [ui.PointerEvent] events. class PointerRouter { final Map> _routeMap = new Map>(); /// 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. void addRoute(int pointer, PointerRoute route) { List routes = _routeMap.putIfAbsent(pointer, () => new List()); @@ -23,7 +23,7 @@ class PointerRouter { /// 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. void removeRoute(int pointer, PointerRoute route) { assert(_routeMap.containsKey(pointer)); @@ -37,7 +37,7 @@ class PointerRouter { /// Call the routes registed for this pointer event. /// /// 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 routes = _routeMap[event.pointer]; if (routes == null) return; diff --git a/packages/flutter/lib/src/gestures/recognizer.dart b/packages/flutter/lib/src/gestures/recognizer.dart index 7c73f1988d3..a2fca88a5f0 100644 --- a/packages/flutter/lib/src/gestures/recognizer.dart +++ b/packages/flutter/lib/src/gestures/recognizer.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'arena.dart'; import 'constants.dart'; @@ -22,9 +22,9 @@ abstract class GestureRecognizer extends GestureArenaMember { final Set _trackedPointers = new Set(); /// 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 rejectGesture(int pointer) { } void didStopTrackingLastPointer(int pointer); @@ -58,7 +58,7 @@ abstract class GestureRecognizer extends GestureArenaMember { didStopTrackingLastPointer(pointer); } - void stopTrackingIfPointerNoLongerDown(sky.PointerEvent event) { + void stopTrackingIfPointerNoLongerDown(ui.PointerEvent event) { if (event.type == 'pointerup' || event.type == 'pointercancel') stopTrackingPointer(event.pointer); } @@ -71,8 +71,8 @@ enum GestureRecognizerState { defunct } -sky.Point _getPoint(sky.PointerEvent event) { - return new sky.Point(event.x, event.y); +ui.Point _getPoint(ui.PointerEvent event) { + return new ui.Point(event.x, event.y); } abstract class PrimaryPointerGestureRecognizer extends GestureRecognizer { @@ -83,10 +83,10 @@ abstract class PrimaryPointerGestureRecognizer extends GestureRecognizer { GestureRecognizerState state = GestureRecognizerState.ready; int primaryPointer; - sky.Point initialPosition; + ui.Point initialPosition; Timer _timer; - void addPointer(sky.PointerEvent event) { + void addPointer(ui.PointerEvent event) { startTrackingPointer(event.pointer); if (state == GestureRecognizerState.ready) { state = GestureRecognizerState.possible; @@ -97,7 +97,7 @@ abstract class PrimaryPointerGestureRecognizer extends GestureRecognizer { } } - void handleEvent(sky.PointerEvent event) { + void handleEvent(ui.PointerEvent event) { assert(state != GestureRecognizerState.ready); if (state == GestureRecognizerState.possible && event.pointer == primaryPointer) { // TODO(abarth): Maybe factor the slop handling out into a separate class? @@ -110,7 +110,7 @@ abstract class PrimaryPointerGestureRecognizer extends GestureRecognizer { } /// 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. /// @@ -143,8 +143,8 @@ abstract class PrimaryPointerGestureRecognizer extends GestureRecognizer { } } - double _getDistance(sky.PointerEvent event) { - sky.Offset offset = _getPoint(event) - initialPosition; + double _getDistance(ui.PointerEvent event) { + ui.Offset offset = _getPoint(event) - initialPosition; return offset.distance; } diff --git a/packages/flutter/lib/src/gestures/scale.dart b/packages/flutter/lib/src/gestures/scale.dart index dd0dfa094a2..8898f6ec782 100644 --- a/packages/flutter/lib/src/gestures/scale.dart +++ b/packages/flutter/lib/src/gestures/scale.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'arena.dart'; import 'recognizer.dart'; @@ -15,8 +15,8 @@ enum ScaleState { started } -typedef void GestureScaleStartCallback(sky.Point focalPoint); -typedef void GestureScaleUpdateCallback(double scale, sky.Point focalPoint); +typedef void GestureScaleStartCallback(ui.Point focalPoint); +typedef void GestureScaleUpdateCallback(double scale, ui.Point focalPoint); typedef void GestureScaleEndCallback(); class ScaleGestureRecognizer extends GestureRecognizer { @@ -31,21 +31,21 @@ class ScaleGestureRecognizer extends GestureRecognizer { double _initialSpan; double _currentSpan; - Map _pointerLocations; + Map _pointerLocations; double get _scaleFactor => _initialSpan > 0.0 ? _currentSpan / _initialSpan : 1.0; - void addPointer(sky.PointerEvent event) { + void addPointer(ui.PointerEvent event) { startTrackingPointer(event.pointer); if (_state == ScaleState.ready) { _state = ScaleState.possible; _initialSpan = 0.0; _currentSpan = 0.0; - _pointerLocations = new Map(); + _pointerLocations = new Map(); } } - void handleEvent(sky.PointerEvent event) { + void handleEvent(ui.PointerEvent event) { assert(_state != ScaleState.ready); bool configChanged = false; switch(event.type) { @@ -55,10 +55,10 @@ class ScaleGestureRecognizer extends GestureRecognizer { break; case 'pointerdown': configChanged = true; - _pointerLocations[event.pointer] = new sky.Point(event.x, event.y); + _pointerLocations[event.pointer] = new ui.Point(event.x, event.y); break; case 'pointermove': - _pointerLocations[event.pointer] = new sky.Point(event.x, event.y); + _pointerLocations[event.pointer] = new ui.Point(event.x, event.y); break; } @@ -71,10 +71,10 @@ class ScaleGestureRecognizer extends GestureRecognizer { int count = _pointerLocations.keys.length; // Compute the focal point - sky.Point focalPoint = sky.Point.origin; + ui.Point focalPoint = ui.Point.origin; for (int pointer in _pointerLocations.keys) 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 double totalDeviation = 0.0; diff --git a/packages/flutter/lib/src/gestures/show_press.dart b/packages/flutter/lib/src/gestures/show_press.dart index 754aaa2ea1b..d3602c2f69b 100644 --- a/packages/flutter/lib/src/gestures/show_press.dart +++ b/packages/flutter/lib/src/gestures/show_press.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'arena.dart'; import 'constants.dart'; @@ -23,7 +23,7 @@ class ShowPressGestureRecognizer extends PrimaryPointerGestureRecognizer { onShowPress(); } - void handlePrimaryPointer(sky.PointerEvent event) { + void handlePrimaryPointer(ui.PointerEvent event) { if (event.type == 'pointerup') resolve(GestureDisposition.rejected); } diff --git a/packages/flutter/lib/src/gestures/tap.dart b/packages/flutter/lib/src/gestures/tap.dart index 0c32edadbd6..5d028a842b4 100644 --- a/packages/flutter/lib/src/gestures/tap.dart +++ b/packages/flutter/lib/src/gestures/tap.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'arena.dart'; import 'recognizer.dart'; @@ -17,7 +17,7 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer { GestureTapCallback onTapDown; GestureTapCallback onTapCancel; - void handlePrimaryPointer(sky.PointerEvent event) { + void handlePrimaryPointer(ui.PointerEvent event) { if (event.type == 'pointerdown') { if (onTapDown != null) onTapDown(); diff --git a/packages/flutter/lib/src/material/checkbox.dart b/packages/flutter/lib/src/material/checkbox.dart index 1c42cf32efc..df7ee5ce57a 100644 --- a/packages/flutter/lib/src/material/checkbox.dart +++ b/packages/flutter/lib/src/material/checkbox.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; @@ -12,8 +12,8 @@ import 'theme.dart'; export 'package:flutter/rendering.dart' show ValueChanged; const double _kMidpoint = 0.5; -const sky.Color _kLightUncheckedColor = const sky.Color(0x8A000000); -const sky.Color _kDarkUncheckedColor = const sky.Color(0xB2FFFFFF); +const ui.Color _kLightUncheckedColor = const ui.Color(0x8A000000); +const ui.Color _kDarkUncheckedColor = const ui.Color(0xB2FFFFFF); const double _kEdgeSize = 18.0; const double _kEdgeRadius = 1.0; const double _kStrokeWidth = 2.0; @@ -126,7 +126,7 @@ class _RenderCheckbox extends RenderToggleable { void paint(PaintingContext context, Offset offset) { final PaintingCanvas canvas = context.canvas; // Choose a color between grey and the theme color - sky.Paint paint = new sky.Paint() + ui.Paint paint = new ui.Paint() ..strokeWidth = _kStrokeWidth ..color = uncheckedColor; @@ -134,25 +134,25 @@ class _RenderCheckbox extends RenderToggleable { // 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 rectSize = _kEdgeSize - inset * _kStrokeWidth; - sky.Rect rect = - new sky.Rect.fromLTWH(offset.dx + inset, offset.dy + inset, rectSize, rectSize); + ui.Rect rect = + 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 // painting artefacts caused by overlayed paintings. - sky.Rect innerRect = rect.deflate(1.0); - sky.RRect rrect = new sky.RRect() + ui.Rect innerRect = rect.deflate(1.0); + ui.RRect rrect = new ui.RRect() ..setRectXY(rect, _kEdgeRadius, _kEdgeRadius); // Outline of the empty rrect - paint.setStyle(sky.PaintingStyle.stroke); + paint.setStyle(ui.PaintingStyle.stroke); canvas.drawRRect(rrect, paint); // Radial gradient that changes size if (position > 0) { - paint.setStyle(sky.PaintingStyle.fill); - paint.setShader(new sky.Gradient.radial( + paint.setStyle(ui.PaintingStyle.fill); + paint.setShader(new ui.Gradient.radial( new Point(_kEdgeSize / 2.0, _kEdgeSize / 2.0), _kEdgeSize * (_kMidpoint - position) * 8.0, [ - const sky.Color(0x00000000), + const ui.Color(0x00000000), uncheckedColor ])); canvas.drawRect(innerRect, paint); @@ -164,22 +164,22 @@ class _RenderCheckbox extends RenderToggleable { // First draw a rounded rect outline then fill inner rectangle with accent color. paint.color = new Color.fromARGB((t * 255).floor(), _accentColor.red, _accentColor.green, _accentColor.blue); - paint.setStyle(sky.PaintingStyle.stroke); + paint.setStyle(ui.PaintingStyle.stroke); canvas.drawRRect(rrect, paint); - paint.setStyle(sky.PaintingStyle.fill); + paint.setStyle(ui.PaintingStyle.fill); canvas.drawRect(innerRect, paint); // White inner check - paint.color = const sky.Color(0xFFFFFFFF); - paint.setStyle(sky.PaintingStyle.stroke); - sky.Path path = new sky.Path(); - sky.Point start = new sky.Point(_kEdgeSize * 0.15, _kEdgeSize * 0.45); - sky.Point mid = new sky.Point(_kEdgeSize * 0.4, _kEdgeSize * 0.7); - sky.Point end = new sky.Point(_kEdgeSize * 0.85, _kEdgeSize * 0.25); + paint.color = const ui.Color(0xFFFFFFFF); + paint.setStyle(ui.PaintingStyle.stroke); + ui.Path path = new ui.Path(); + ui.Point start = new ui.Point(_kEdgeSize * 0.15, _kEdgeSize * 0.45); + ui.Point mid = new ui.Point(_kEdgeSize * 0.4, _kEdgeSize * 0.7); + ui.Point end = new ui.Point(_kEdgeSize * 0.85, _kEdgeSize * 0.25); 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); - sky.Point drawStart = lerp(start, mid, 1.0 - t); - sky.Point drawEnd = lerp(mid, end, t); + ui.Point drawStart = lerp(start, mid, 1.0 - t); + ui.Point drawEnd = lerp(mid, end, t); path.moveTo(offset.dx + drawStart.x, offset.dy + drawStart.y); path.lineTo(offset.dx + mid.x, offset.dy + mid.y); path.lineTo(offset.dx + drawEnd.x, offset.dy + drawEnd.y); diff --git a/packages/flutter/lib/src/material/drawer_item.dart b/packages/flutter/lib/src/material/drawer_item.dart index c5659c5910c..6723b15f1e4 100644 --- a/packages/flutter/lib/src/material/drawer_item.dart +++ b/packages/flutter/lib/src/material/drawer_item.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/gestures.dart'; import 'package:flutter/painting.dart'; @@ -49,10 +49,10 @@ class _DrawerItemState extends State { return Colors.transparent; } - sky.ColorFilter _getColorFilter(ThemeData themeData) { + ui.ColorFilter _getColorFilter(ThemeData themeData) { if (config.selected) - return new sky.ColorFilter.mode(themeData.primaryColor, sky.TransferMode.srcATop); - return new sky.ColorFilter.mode(const Color(0x73000000), sky.TransferMode.dstIn); + return new ui.ColorFilter.mode(themeData.primaryColor, ui.TransferMode.srcATop); + return new ui.ColorFilter.mode(const Color(0x73000000), ui.TransferMode.dstIn); } Widget build(BuildContext context) { diff --git a/packages/flutter/lib/src/material/icon.dart b/packages/flutter/lib/src/material/icon.dart index d991cd43d4a..223dc78de55 100644 --- a/packages/flutter/lib/src/material/icon.dart +++ b/packages/flutter/lib/src/material/icon.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; @@ -62,7 +62,7 @@ class Icon extends StatelessComponent { final int size; final String type; final IconThemeColor color; - final sky.ColorFilter colorFilter; + final ui.ColorFilter colorFilter; String _getColorSuffix(BuildContext context) { IconThemeColor iconThemeColor = color; diff --git a/packages/flutter/lib/src/material/icon_button.dart b/packages/flutter/lib/src/material/icon_button.dart index 292bc823e53..7e8abf63344 100644 --- a/packages/flutter/lib/src/material/icon_button.dart +++ b/packages/flutter/lib/src/material/icon_button.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/gestures.dart'; import 'package:flutter/widgets.dart'; @@ -20,7 +20,7 @@ class IconButton extends StatelessComponent { final String icon; final IconThemeColor color; - final sky.ColorFilter colorFilter; + final ui.ColorFilter colorFilter; final GestureTapCallback onPressed; Widget build(BuildContext context) { diff --git a/packages/flutter/lib/src/material/ink_well.dart b/packages/flutter/lib/src/material/ink_well.dart index 9bb4feddbce..4780f7579df 100644 --- a/packages/flutter/lib/src/material/ink_well.dart +++ b/packages/flutter/lib/src/material/ink_well.dart @@ -4,7 +4,7 @@ import 'dart:async'; import 'dart:math' as math; -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/animation.dart'; import 'package:flutter/gestures.dart'; @@ -91,7 +91,7 @@ class _InkSplash { void paint(PaintingCanvas canvas) { 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; canvas.drawCircle(position, radius, paint); } @@ -137,7 +137,7 @@ class _RenderInkWell extends RenderProxyBox { TapGestureRecognizer _tap; LongPressGestureRecognizer _longPress; - void handleEvent(sky.Event event, BoxHitTestEntry entry) { + void handleEvent(ui.Event event, BoxHitTestEntry entry) { if (event.type == 'pointerdown' && (_tap != null || _longPress != null)) { _tap?.addPointer(event); _longPress?.addPointer(event); diff --git a/packages/flutter/lib/src/material/material_app.dart b/packages/flutter/lib/src/material/material_app.dart index afa81b9a28a..06fa88f3cfa 100644 --- a/packages/flutter/lib/src/material/material_app.dart +++ b/packages/flutter/lib/src/material/material_app.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/painting.dart'; import 'package:flutter/services.dart'; @@ -56,7 +56,7 @@ class _MaterialAppState extends State { super.dispose(); } - void _backHandler(sky.Event event) { + void _backHandler(ui.Event event) { assert(mounted); if (event.type == 'back') { NavigatorState navigator = _navigator.currentState; diff --git a/packages/flutter/lib/src/material/popup_menu.dart b/packages/flutter/lib/src/material/popup_menu.dart index 750d01dcce9..65bf342b096 100644 --- a/packages/flutter/lib/src/material/popup_menu.dart +++ b/packages/flutter/lib/src/material/popup_menu.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/animation.dart'; import 'package:flutter/painting.dart'; @@ -75,7 +75,7 @@ class PopupMenu extends StatelessComponent { variables: [width, height], builder: (BuildContext context) { return new CustomPaint( - callback: (sky.Canvas canvas, Size size) { + callback: (ui.Canvas canvas, Size size) { double widthValue = width.value * size.width; double heightValue = height.value * size.height; painter.paint(canvas, new Rect.fromLTWH(size.width - widthValue, 0.0, widthValue, heightValue)); diff --git a/packages/flutter/lib/src/material/progress_indicator.dart b/packages/flutter/lib/src/material/progress_indicator.dart index c7d0e8c39fa..46d31717a23 100644 --- a/packages/flutter/lib/src/material/progress_indicator.dart +++ b/packages/flutter/lib/src/material/progress_indicator.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'dart:math' as math; -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/animation.dart'; import 'package:flutter/widgets.dart'; @@ -76,10 +76,10 @@ class LinearProgressIndicator extends ProgressIndicator { double 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() ..color = _getBackgroundColor(context) - ..setStyle(sky.PaintingStyle.fill); + ..setStyle(ui.PaintingStyle.fill); canvas.drawRect(Point.origin & size, paint); paint.color = _getValueColor(context); @@ -103,7 +103,7 @@ class LinearProgressIndicator extends ProgressIndicator { ), child: new CustomPaint( token: _getCustomPaintToken(performanceValue), - callback: (sky.Canvas canvas, Size size) { + callback: (ui.Canvas canvas, Size size) { _paint(context, performanceValue, canvas, size); } ) @@ -124,15 +124,15 @@ class CircularProgressIndicator extends ProgressIndicator { double 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() ..color = _getValueColor(context) ..strokeWidth = _kCircularProgressIndicatorStrokeWidth - ..setStyle(sky.PaintingStyle.stroke); + ..setStyle(ui.PaintingStyle.stroke); if (value != null) { 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); canvas.drawPath(path, paint); } else { @@ -140,7 +140,7 @@ class CircularProgressIndicator extends ProgressIndicator { double endAngle = startAngle + _kTwoPI * 0.75; double arcAngle = startAngle.clamp(0.0, _kTwoPI); 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); canvas.drawPath(path, paint); } @@ -154,7 +154,7 @@ class CircularProgressIndicator extends ProgressIndicator { ), child: new CustomPaint( token: _getCustomPaintToken(performanceValue), - callback: (sky.Canvas canvas, Size size) { + callback: (ui.Canvas canvas, Size size) { _paint(context, performanceValue, canvas, size); } ) diff --git a/packages/flutter/lib/src/material/radial_reaction.dart b/packages/flutter/lib/src/material/radial_reaction.dart index 409cd647c17..35538fa79ff 100644 --- a/packages/flutter/lib/src/material/radial_reaction.dart +++ b/packages/flutter/lib/src/material/radial_reaction.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'dart:ui' show Point, Offset, Color, Paint; import 'package:flutter/animation.dart'; @@ -82,7 +82,7 @@ class RadialReaction { final Paint _innerPaint = new Paint(); /// 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)); canvas.drawCircle(center + offset, radius, _outerPaint); diff --git a/packages/flutter/lib/src/material/radio.dart b/packages/flutter/lib/src/material/radio.dart index e44f8098970..e2e65d80d3d 100644 --- a/packages/flutter/lib/src/material/radio.dart +++ b/packages/flutter/lib/src/material/radio.dart @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/widgets.dart'; import 'theme.dart'; -const sky.Color _kLightOffColor = const sky.Color(0x8A000000); -const sky.Color _kDarkOffColor = const sky.Color(0xB2FFFFFF); +const ui.Color _kLightOffColor = const ui.Color(0x8A000000); +const ui.Color _kDarkOffColor = const ui.Color(0xB2FFFFFF); typedef void RadioValueChanged(Object value); @@ -45,18 +45,18 @@ class Radio extends StatelessComponent { width: kDiameter, height: kDiameter, child: new CustomPaint( - callback: (sky.Canvas canvas, Size size) { + callback: (ui.Canvas canvas, Size size) { Paint paint = new Paint()..color = _getColor(context); // Draw the outer circle - paint.setStyle(sky.PaintingStyle.stroke); + paint.setStyle(ui.PaintingStyle.stroke); paint.strokeWidth = 2.0; canvas.drawCircle(const Point(kOuterRadius, kOuterRadius), kOuterRadius, paint); // Draw the inner circle if (value == groupValue) { - paint.setStyle(sky.PaintingStyle.fill); + paint.setStyle(ui.PaintingStyle.fill); canvas.drawCircle(const Point(kOuterRadius, kOuterRadius), kInnerRadius, paint); } } diff --git a/packages/flutter/lib/src/material/scaffold.dart b/packages/flutter/lib/src/material/scaffold.dart index 55a7af32b16..a33e754c353 100644 --- a/packages/flutter/lib/src/material/scaffold.dart +++ b/packages/flutter/lib/src/material/scaffold.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; @@ -28,7 +28,7 @@ class Scaffold extends StatelessComponent { Widget build(BuildContext context) { double toolBarHeight = 0.0; if (toolBar != null) - toolBarHeight = kToolBarHeight + sky.view.paddingTop; + toolBarHeight = kToolBarHeight + ui.view.paddingTop; double statusBarHeight = 0.0; if (statusBar != null) diff --git a/packages/flutter/lib/src/material/switch.dart b/packages/flutter/lib/src/material/switch.dart index 5bf21945413..9b6573dd045 100644 --- a/packages/flutter/lib/src/material/switch.dart +++ b/packages/flutter/lib/src/material/switch.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/painting.dart'; import 'package:flutter/rendering.dart'; @@ -15,8 +15,8 @@ import 'theme.dart'; export 'package:flutter/rendering.dart' show ValueChanged; -const sky.Color _kThumbOffColor = const sky.Color(0xFFFAFAFA); -const sky.Color _kTrackOffColor = const sky.Color(0x42000000); +const ui.Color _kThumbOffColor = const ui.Color(0xFFFAFAFA); +const ui.Color _kTrackOffColor = const ui.Color(0x42000000); const double _kSwitchWidth = 35.0; const double _kThumbRadius = 10.0; const double _kSwitchHeight = _kThumbRadius * 2.0; @@ -82,8 +82,8 @@ class _RenderSwitch extends RenderToggleable { RadialReaction _radialReaction; - void handleEvent(sky.Event event, BoxHitTestEntry entry) { - if (event is sky.PointerEvent) { + void handleEvent(ui.Event event, BoxHitTestEntry entry) { + if (event is ui.PointerEvent) { if (event.type == 'pointerdown') _showRadialReaction(entry.localPosition); else if (event.type == 'pointerup') @@ -112,21 +112,21 @@ class _RenderSwitch extends RenderToggleable { void paint(PaintingContext context, Offset offset) { final PaintingCanvas canvas = context.canvas; - sky.Color thumbColor = _kThumbOffColor; - sky.Color trackColor = _kTrackOffColor; + ui.Color thumbColor = _kThumbOffColor; + ui.Color trackColor = _kTrackOffColor; if (value) { thumbColor = _thumbColor; - trackColor = new sky.Color(_thumbColor.value & 0x80FFFFFF); + trackColor = new ui.Color(_thumbColor.value & 0x80FFFFFF); } // Draw the track rrect - sky.Paint paint = new sky.Paint() + ui.Paint paint = new ui.Paint() ..color = trackColor - ..style = sky.PaintingStyle.fill; - sky.Rect rect = new sky.Rect.fromLTWH(offset.dx, + ..style = ui.PaintingStyle.fill; + ui.Rect rect = new ui.Rect.fromLTWH(offset.dx, offset.dy + _kSwitchHeight / 2.0 - _kTrackHeight / 2.0, _kTrackWidth, _kTrackHeight); - sky.RRect rrect = new sky.RRect() + ui.RRect rrect = new ui.RRect() ..setRectXY(rect, _kTrackRadius, _kTrackRadius); canvas.drawRRect(rrect, paint); diff --git a/packages/flutter/lib/src/material/tabs.dart b/packages/flutter/lib/src/material/tabs.dart index 543aebddbdf..982efcf7ea8 100644 --- a/packages/flutter/lib/src/material/tabs.dart +++ b/packages/flutter/lib/src/material/tabs.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'dart:math' as math; -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:newton/newton.dart'; import 'package:flutter/animation.dart'; @@ -312,7 +312,7 @@ class Tab extends StatelessComponent { Widget _buildLabelIcon() { assert(label.icon != null); 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); } diff --git a/packages/flutter/lib/src/painting/box_painter.dart b/packages/flutter/lib/src/painting/box_painter.dart index 110aa4421e6..959394f2669 100644 --- a/packages/flutter/lib/src/painting/box_painter.dart +++ b/packages/flutter/lib/src/painting/box_painter.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. 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 'package:flutter/services.dart'; @@ -121,10 +121,10 @@ class EdgeDims { if (b == null) return a * (1.0 - t); return new EdgeDims.TRBL( - sky.lerpDouble(a.top, b.top, t), - sky.lerpDouble(a.right, b.right, t), - sky.lerpDouble(a.bottom, b.bottom, t), - sky.lerpDouble(a.left, b.left, t) + ui.lerpDouble(a.top, b.top, t), + ui.lerpDouble(a.right, b.right, t), + ui.lerpDouble(a.bottom, b.bottom, t), + ui.lerpDouble(a.left, b.left, t) ); } @@ -257,7 +257,7 @@ class BoxShadow { return new BoxShadow( color: Color.lerp(a.color, b.color, 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 { /// A 2D gradient abstract class Gradient { - sky.Shader createShader(); + ui.Shader createShader(); } /// A 2D linear gradient @@ -297,7 +297,7 @@ class LinearGradient extends Gradient { this.end, this.colors, this.stops, - this.tileMode: sky.TileMode.clamp + this.tileMode: ui.TileMode.clamp }) { assert(colors.length == stops.length); } @@ -319,10 +319,10 @@ class LinearGradient extends Gradient { final List stops; /// How this gradient should tile the plane - final sky.TileMode tileMode; + final ui.TileMode tileMode; - sky.Shader createShader() { - return new sky.Gradient.linear([begin, end], this.colors, + ui.Shader createShader() { + return new ui.Gradient.linear([begin, end], this.colors, this.stops, this.tileMode); } @@ -338,7 +338,7 @@ class RadialGradient extends Gradient { this.radius, this.colors, this.stops, - this.tileMode: sky.TileMode.clamp + this.tileMode: ui.TileMode.clamp }); /// The center of the gradient @@ -361,10 +361,10 @@ class RadialGradient extends Gradient { final List stops; /// How this gradient should tile the plane - final sky.TileMode tileMode; + final ui.TileMode tileMode; - sky.Shader createShader() { - return new sky.Gradient.radial(center, radius, colors, stops, tileMode); + ui.Shader createShader() { + return new ui.Gradient.radial(center, radius, colors, stops, tileMode); } String toString() { @@ -409,10 +409,10 @@ enum ImageRepeat { /// Paint an image into the given rectangle in the canvas void paintImage({ - sky.Canvas canvas, + ui.Canvas canvas, Rect rect, - sky.Image image, - sky.ColorFilter colorFilter, + ui.Image image, + ui.ColorFilter colorFilter, fit: ImageFit.scaleDown, repeat: ImageRepeat.noRepeat, double positionX: 0.5, @@ -476,7 +476,7 @@ class BackgroundImage { final ImageRepeat repeat; /// A color filter to apply to the background image before painting it - final sky.ColorFilter colorFilter; + final ui.ColorFilter colorFilter; BackgroundImage({ ImageResource image, @@ -485,9 +485,9 @@ class BackgroundImage { this.colorFilter }) : _imageResource = image; - sky.Image _image; + ui.Image _image; /// The image to be painted into the background - sky.Image get image => _image; + ui.Image get image => _image; ImageResource _imageResource; @@ -513,7 +513,7 @@ class BackgroundImage { _imageResource.removeListener(_handleImageChanged); } - void _handleImageChanged(sky.Image resolvedImage) { + void _handleImageChanged(ui.Image resolvedImage) { if (resolvedImage == null) return; _image = resolvedImage; @@ -582,7 +582,7 @@ class BoxDecoration { backgroundColor: Color.lerp(null, backgroundColor, factor), backgroundImage: backgroundImage, border: border, - borderRadius: sky.lerpDouble(null, borderRadius, factor), + borderRadius: ui.lerpDouble(null, borderRadius, factor), boxShadow: BoxShadow.lerpList(null, boxShadow, factor), gradient: gradient, shape: shape @@ -604,7 +604,7 @@ class BoxDecoration { backgroundColor: Color.lerp(a.backgroundColor, b.backgroundColor, t), backgroundImage: b.backgroundImage, 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), gradient: b.gradient, shape: b.shape @@ -697,11 +697,11 @@ class BoxPainter { double shortestSide = rect.shortestSide; // In principle, we should use shortestSide / 2.0, but we don't want to // 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; } - void _paintBackgroundColor(sky.Canvas canvas, Rect rect) { + void _paintBackgroundColor(ui.Canvas canvas, Rect rect) { if (_decoration.backgroundColor != null || _decoration.boxShadow != null || _decoration.gradient != null) { @@ -717,18 +717,18 @@ class BoxPainter { canvas.drawRect(rect, _backgroundPaint); } else { 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; } } } - void _paintBackgroundImage(sky.Canvas canvas, Rect rect) { + void _paintBackgroundImage(ui.Canvas canvas, Rect rect) { final BackgroundImage backgroundImage = _decoration.backgroundImage; if (backgroundImage == null) return; - sky.Image image = backgroundImage.image; + ui.Image image = backgroundImage.image; if (image == null) return; paintImage( @@ -741,7 +741,7 @@ class BoxPainter { ); } - void _paintBorder(sky.Canvas canvas, Rect rect) { + void _paintBorder(ui.Canvas canvas, Rect rect) { if (_decoration.border == null) return; @@ -804,19 +804,19 @@ class BoxPainter { canvas.drawPath(path, paint); } - void _paintBorderWithRadius(sky.Canvas canvas, Rect rect) { + void _paintBorderWithRadius(ui.Canvas canvas, Rect rect) { assert(_hasUniformBorder); assert(_decoration.shape == Shape.rectangle); Color color = _decoration.border.top.color; double width = _decoration.border.top.width; double radius = _getEffectiveBorderRadius(rect); - sky.RRect outer = new sky.RRect()..setRectXY(rect, radius, radius); - sky.RRect inner = new sky.RRect()..setRectXY(rect.deflate(width), radius - width, radius - width); + ui.RRect outer = new ui.RRect()..setRectXY(rect, radius, radius); + ui.RRect inner = new ui.RRect()..setRectXY(rect.deflate(width), radius - width, radius - width); 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(_decoration.shape == Shape.circle); assert(_decoration.borderRadius == null); @@ -827,14 +827,14 @@ class BoxPainter { Paint paint = new Paint() ..color = _decoration.border.top.color ..strokeWidth = width - ..setStyle(sky.PaintingStyle.stroke); + ..setStyle(ui.PaintingStyle.stroke); Point center = rect.center; double radius = (rect.shortestSide - width) / 2.0; canvas.drawCircle(center, radius, paint); } /// 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); _paintBackgroundImage(canvas, rect); _paintBorder(canvas, rect); diff --git a/packages/flutter/lib/src/painting/shadows.dart b/packages/flutter/lib/src/painting/shadows.dart index b50341c9a72..d0ad34638e6 100644 --- a/packages/flutter/lib/src/painting/shadows.dart +++ b/packages/flutter/lib/src/painting/shadows.dart @@ -2,27 +2,27 @@ // Use of this source code is governed by a BSD-style license that can be // 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 { - var builder_ = new sky.LayerDrawLooperBuilder(); + var builder_ = new ui.LayerDrawLooperBuilder(); /// 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( - new sky.DrawLooperLayerInfo() - ..setPaintBits(sky.PaintBits.all) + new ui.DrawLooperLayerInfo() + ..setPaintBits(ui.PaintBits.all) ..setOffset(offset) - ..setColorMode(sky.TransferMode.src), - new sky.Paint() + ..setColorMode(ui.TransferMode.src), + new ui.Paint() ..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 - sky.DrawLooper build() { - builder_.addLayerOnTop(new sky.DrawLooperLayerInfo(), new sky.Paint()); + ui.DrawLooper build() { + builder_.addLayerOnTop(new ui.DrawLooperLayerInfo(), new ui.Paint()); return builder_.build(); } } diff --git a/packages/flutter/lib/src/painting/text_painter.dart b/packages/flutter/lib/src/painting/text_painter.dart index cf9ac739d2f..733a42b8b88 100644 --- a/packages/flutter/lib/src/painting/text_painter.dart +++ b/packages/flutter/lib/src/painting/text_painter.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'text_style.dart'; @@ -11,14 +11,14 @@ export 'text_style.dart'; /// An immutable span of text abstract class TextSpan { // 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 = '']); - void _applyStyleToContainer(sky.Element container) { + void _applyStyleToContainer(ui.Element container) { } - void build(sky.ParagraphBuilder builder); - sky.ParagraphStyle get paragraphStyle => null; + void build(ui.ParagraphBuilder builder); + ui.ParagraphStyle get paragraphStyle => null; } /// An immutable span of unstyled text @@ -30,11 +30,11 @@ class PlainTextSpan extends TextSpan { /// The text contained in the span final String text; - sky.Node _toDOM(sky.Document owner) { + ui.Node _toDOM(ui.Document owner) { return owner.createText(text); } - void build(sky.ParagraphBuilder builder) { + void build(ui.ParagraphBuilder builder) { builder.addText(text); } @@ -57,8 +57,8 @@ class StyledTextSpan extends TextSpan { /// The children to which the style is applied final List children; - sky.Node _toDOM(sky.Document owner) { - sky.Element parent = owner.createElement('t'); + ui.Node _toDOM(ui.Document owner) { + ui.Element parent = owner.createElement('t'); style.applyToCSSStyle(parent.style); for (TextSpan child in children) { parent.appendChild(child._toDOM(owner)); @@ -66,16 +66,16 @@ class StyledTextSpan extends TextSpan { return parent; } - void build(sky.ParagraphBuilder builder) { + void build(ui.ParagraphBuilder builder) { builder.pushStyle(style.textStyle); for (TextSpan child in children) child.build(builder); 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); } @@ -129,10 +129,10 @@ class TextPainter { this.text = text; } - sky.Paragraph _paragraph; + ui.Paragraph _paragraph; - final sky.Document _document = new sky.Document(); - final sky.LayoutRoot _layoutRoot = new sky.LayoutRoot(); + final ui.Document _document = new ui.Document(); + final ui.LayoutRoot _layoutRoot = new ui.LayoutRoot(); bool _needsLayout = true; TextSpan _text; @@ -215,7 +215,7 @@ class TextPainter { /// The distance from the top of the text to the first baseline of the given type double computeDistanceToActualBaseline(TextBaseline baseline) { assert(!_needsLayout); - sky.Element root = _layoutRoot.rootElement; + ui.Element root = _layoutRoot.rootElement; switch (baseline) { case TextBaseline.alphabetic: return root.alphabeticBaseline; case TextBaseline.ideographic: return root.ideographicBaseline; @@ -231,7 +231,7 @@ class TextPainter { } /// 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); // TODO(ianh): Make LayoutRoot support a paint offset so we don't // need to translate for each span of text. @@ -246,7 +246,7 @@ class _NewTextPainter implements TextPainter { this.text = text; } - sky.Paragraph _paragraph; + ui.Paragraph _paragraph; bool _needsLayout = true; TextSpan _text; @@ -256,7 +256,7 @@ class _NewTextPainter implements TextPainter { if (_text == value) return; _text = value; - sky.ParagraphBuilder builder = new sky.ParagraphBuilder(); + ui.ParagraphBuilder builder = new ui.ParagraphBuilder(); _text.build(builder); _paragraph = builder.build(_text.paragraphStyle); _needsLayout = true; @@ -346,7 +346,7 @@ class _NewTextPainter implements TextPainter { } /// 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); _paragraph.paint(canvas, offset); } diff --git a/packages/flutter/lib/src/painting/text_style.dart b/packages/flutter/lib/src/painting/text_style.dart index 74097aca0c5..43ffa44967d 100644 --- a/packages/flutter/lib/src/painting/text_style.dart +++ b/packages/flutter/lib/src/painting/text_style.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // 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; export 'dart:ui' show FontWeight, FontStyle, TextAlign, TextBaseline, TextDecoration, TextDecorationStyle; @@ -152,14 +152,14 @@ class TextStyle { return toCSS[decorationStyle]; } - sky.TextStyle get textStyle => null; - sky.ParagraphStyle get paragraphStyle => null; + ui.TextStyle get textStyle => null; + ui.ParagraphStyle get paragraphStyle => null; /// Program this text style into the engine /// /// Note: This function will likely be removed when we refactor the interface /// between the framework and the engine - void applyToCSSStyle(sky.CSSStyleDeclaration cssStyle) { + void applyToCSSStyle(ui.CSSStyleDeclaration cssStyle) { if (color != null) { cssStyle['color'] = _colorToCSSString(color); } @@ -201,7 +201,7 @@ class TextStyle { /// /// Note: This function will likely be removed when we refactor the interface /// between the framework and the engine - void applyToContainerCSSStyle(sky.CSSStyleDeclaration cssStyle) { + void applyToContainerCSSStyle(ui.CSSStyleDeclaration cssStyle) { if (textAlign != null) { cssStyle['text-align'] = const { TextAlign.left: 'left', diff --git a/packages/flutter/lib/src/rendering/binding.dart b/packages/flutter/lib/src/rendering/binding.dart index d2a6526bf33..7de8a4ebe7c 100644 --- a/packages/flutter/lib/src/rendering/binding.dart +++ b/packages/flutter/lib/src/rendering/binding.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/animation.dart'; import 'package:flutter/gestures.dart'; @@ -29,7 +29,7 @@ class _PointerState { Point lastPosition; } -typedef void EventListener(sky.Event event); +typedef void EventListener(ui.Event event); /// A hit test entry used by [FlutterBinding] class BindingHitTestEntry extends HitTestEntry { @@ -46,9 +46,9 @@ class FlutterBinding extends HitTestTarget { assert(_instance == null); _instance = this; - sky.view.setEventCallback(_handleEvent); + ui.view.setEventCallback(_handleEvent); - sky.view.setMetricsChangedCallback(_handleMetricsChanged); + ui.view.setMetricsChangedCallback(_handleMetricsChanged); if (renderViewOverride == null) { _renderView = new RenderView(child: root); _renderView.attach(); @@ -72,7 +72,7 @@ class FlutterBinding extends HitTestTarget { RenderView _renderView; 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() { _renderView.rootConstraints = _createConstraints(); @@ -94,8 +94,8 @@ class FlutterBinding extends HitTestTarget { /// Stops calling listener for every event that isn't localized to a given view coordinate bool removeEventListener(EventListener listener) => _eventListeners.remove(listener); - void _handleEvent(sky.Event event) { - if (event is sky.PointerEvent) { + void _handleEvent(ui.Event event) { + if (event is ui.PointerEvent) { _handlePointerEvent(event); } else { for (EventListener listener in _eventListeners) @@ -111,7 +111,7 @@ class FlutterBinding extends HitTestTarget { /// to hit-test them on each movement. Map _stateForPointer = new Map(); - void _handlePointerEvent(sky.PointerEvent event) { + void _handlePointerEvent(ui.PointerEvent event) { Point position = new Point(event.x, event.y); _PointerState state = _stateForPointer[event.pointer]; @@ -155,15 +155,15 @@ class FlutterBinding extends HitTestTarget { } /// 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); for (HitTestEntry entry in result.path) entry.target.handleEvent(event, entry); } - void handleEvent(sky.Event e, BindingHitTestEntry entry) { - if (e is sky.PointerEvent) { - sky.PointerEvent event = e; + void handleEvent(ui.Event e, BindingHitTestEntry entry) { + if (e is ui.PointerEvent) { + ui.PointerEvent event = e; pointerRouter.route(event); if (event.type == 'pointerdown') GestureArena.instance.close(event.pointer); diff --git a/packages/flutter/lib/src/rendering/box.dart b/packages/flutter/lib/src/rendering/box.dart index 3a3c52d7e1e..288610e548d 100644 --- a/packages/flutter/lib/src/rendering/box.dart +++ b/packages/flutter/lib/src/rendering/box.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'dart:math' as math; -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/painting.dart'; import 'package:vector_math/vector_math_64.dart'; @@ -226,10 +226,10 @@ class BoxConstraints extends Constraints { if (b == null) return a * (1.0 - t); return new BoxConstraints( - minWidth: sky.lerpDouble(a.minWidth, b.minWidth, t), - maxWidth: sky.lerpDouble(a.maxWidth, b.maxWidth, t), - minHeight: sky.lerpDouble(a.minHeight, b.minHeight, t), - maxHeight: sky.lerpDouble(a.maxHeight, b.maxHeight, t) + minWidth: ui.lerpDouble(a.minWidth, b.minWidth, t), + maxWidth: ui.lerpDouble(a.maxWidth, b.maxWidth, t), + minHeight: ui.lerpDouble(a.minHeight, b.minHeight, t), + maxHeight: ui.lerpDouble(a.maxHeight, b.maxHeight, t) ); } @@ -598,14 +598,14 @@ abstract class RenderBox extends RenderObject { } void debugPaintSize(PaintingContext context, Offset offset) { Paint paint = new Paint(); - paint.setStyle(sky.PaintingStyle.stroke); + paint.setStyle(ui.PaintingStyle.stroke); paint.strokeWidth = 1.0; paint.color = debugPaintSizeColor; context.canvas.drawRect(offset & size, paint); } void debugPaintBaselines(PaintingContext context, Offset offset) { Paint paint = new Paint(); - paint.setStyle(sky.PaintingStyle.stroke); + paint.setStyle(ui.PaintingStyle.stroke); paint.strokeWidth = 0.25; Path path; // ideographic baseline diff --git a/packages/flutter/lib/src/rendering/debug.dart b/packages/flutter/lib/src/rendering/debug.dart index 0e1e05090ab..cf2df69323d 100644 --- a/packages/flutter/lib/src/rendering/debug.dart +++ b/packages/flutter/lib/src/rendering/debug.dart @@ -2,31 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // 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. bool debugPaintSizeEnabled = false; /// 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. bool debugPaintBaselinesEnabled = false; /// 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. -sky.Color debugPaintIdeographicBaselineColor = const sky.Color(0xFFFFD000); +ui.Color debugPaintIdeographicBaselineColor = const ui.Color(0xFFFFD000); /// Causes each Layer to paint a box around its bounds. bool debugPaintLayerBordersEnabled = false; /// 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. bool debugPaintBoundsEnabled = false; /// 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); diff --git a/packages/flutter/lib/src/rendering/hit_test.dart b/packages/flutter/lib/src/rendering/hit_test.dart index a54feb16eb3..6103624010c 100644 --- a/packages/flutter/lib/src/rendering/hit_test.dart +++ b/packages/flutter/lib/src/rendering/hit_test.dart @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; /// An object that can handle events. abstract class HitTestTarget { /// 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]. diff --git a/packages/flutter/lib/src/rendering/image.dart b/packages/flutter/lib/src/rendering/image.dart index eda96186634..e5e7356a832 100644 --- a/packages/flutter/lib/src/rendering/image.dart +++ b/packages/flutter/lib/src/rendering/image.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/painting.dart'; @@ -15,10 +15,10 @@ import 'object.dart'; /// constraints and preserves the image's intrinisc aspect ratio. class RenderImage extends RenderBox { RenderImage({ - sky.Image image, + ui.Image image, double width, double height, - sky.ColorFilter colorFilter, + ui.ColorFilter colorFilter, fit: ImageFit.scaleDown, repeat: ImageRepeat.noRepeat }) : _image = image, @@ -28,10 +28,10 @@ class RenderImage extends RenderBox { _fit = fit, _repeat = repeat; - sky.Image _image; + ui.Image _image; /// The image to display - sky.Image get image => _image; - void set image (sky.Image value) { + ui.Image get image => _image; + void set image (ui.Image value) { if (value == _image) return; _image = value; @@ -60,10 +60,10 @@ class RenderImage extends RenderBox { markNeedsLayout(); } - sky.ColorFilter _colorFilter; + ui.ColorFilter _colorFilter; /// If non-null, apply this color filter to the image before painint. - sky.ColorFilter get colorFilter => _colorFilter; - void set colorFilter (sky.ColorFilter value) { + ui.ColorFilter get colorFilter => _colorFilter; + void set colorFilter (ui.ColorFilter value) { if (value == _colorFilter) return; _colorFilter = value; diff --git a/packages/flutter/lib/src/rendering/layer.dart b/packages/flutter/lib/src/rendering/layer.dart index 9afdad87986..0434fd83329 100644 --- a/packages/flutter/lib/src/rendering/layer.dart +++ b/packages/flutter/lib/src/rendering/layer.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // 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 'package:vector_math/vector_math_64.dart'; @@ -62,7 +62,7 @@ abstract class Layer { /// /// The layerOffset is the accumulated offset of this layer's parent from the /// 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] @@ -79,9 +79,9 @@ class PictureLayer extends Layer { /// The picture recorded for this layer /// /// 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); } @@ -105,7 +105,7 @@ class StatisticsLayer extends Layer { final int rasterizerThreshold; - void addToScene(sky.SceneBuilder builder, Offset layerOffset) { + void addToScene(ui.SceneBuilder builder, Offset layerOffset) { assert(optionsMask != null); builder.addStatistics(optionsMask, paintBounds.shift(layerOffset)); builder.setRasterizerTracingThreshold(rasterizerThreshold); @@ -194,12 +194,12 @@ class ContainerLayer extends Layer { _lastChild = null; } - void addToScene(sky.SceneBuilder builder, Offset layerOffset) { + void addToScene(ui.SceneBuilder builder, Offset layerOffset) { addChildrenToScene(builder, offset + layerOffset); } /// 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; while (child != null) { child.addToScene(builder, layerOffset); @@ -218,7 +218,7 @@ class ClipRectLayer extends ContainerLayer { // TODO(abarth): Why is the rectangle in the parent's coordinate system // 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)); addChildrenToScene(builder, offset + layerOffset); builder.pop(); @@ -235,11 +235,11 @@ class ClipRRectLayer extends ContainerLayer { // TODO(abarth): Remove. /// 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 // 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)); addChildrenToScene(builder, offset + layerOffset); builder.pop(); @@ -260,7 +260,7 @@ class ClipPathLayer extends ContainerLayer { // TODO(abarth): Why is the path in the parent's coordinate system instead of // 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)); addChildrenToScene(builder, offset + layerOffset); builder.pop(); @@ -275,7 +275,7 @@ class TransformLayer extends ContainerLayer { /// The matrix to apply Matrix4 transform; - void addToScene(sky.SceneBuilder builder, Offset layerOffset) { + void addToScene(ui.SceneBuilder builder, Offset layerOffset) { Matrix4 offsetTransform = new Matrix4.identity(); offsetTransform.translate(offset.dx + layerOffset.dx, offset.dy + layerOffset.dy); builder.pushTransform((offsetTransform * transform).storage); @@ -298,7 +298,7 @@ class OpacityLayer extends ContainerLayer { /// transparent and 255 is fully opaque. int alpha; - void addToScene(sky.SceneBuilder builder, Offset layerOffset) { + void addToScene(ui.SceneBuilder builder, Offset layerOffset) { builder.pushOpacity(alpha, bounds?.shift(layerOffset)); addChildrenToScene(builder, offset + layerOffset); builder.pop(); @@ -322,9 +322,9 @@ class ColorFilterLayer extends ContainerLayer { Color color; /// 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)); addChildrenToScene(builder, offset + layerOffset); builder.pop(); diff --git a/packages/flutter/lib/src/rendering/object.dart b/packages/flutter/lib/src/rendering/object.dart index a08076585e6..f3b1e30d98f 100644 --- a/packages/flutter/lib/src/rendering/object.dart +++ b/packages/flutter/lib/src/rendering/object.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. 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 'package:flutter/animation.dart'; @@ -17,7 +17,7 @@ import 'node.dart'; export 'dart:ui' show Point, Offset, Size, Rect, Color, Paint, Path; 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 /// @@ -38,9 +38,9 @@ class ParentData { } /// Obsolete class that will be removed eventually -class PaintingCanvas extends sky.Canvas { - PaintingCanvas(sky.PictureRecorder recorder, Rect bounds) : super(recorder, bounds); - // TODO(ianh): Just use sky.Canvas everywhere instead +class PaintingCanvas extends ui.Canvas { + PaintingCanvas(ui.PictureRecorder recorder, Rect bounds) : super(recorder, bounds); + // TODO(ianh): Just use ui.Canvas everywhere instead } /// A place to paint @@ -76,7 +76,7 @@ class PaintingContext { ContainerLayer get containerLayer => _containerLayer; PictureLayer _currentLayer; - sky.PictureRecorder _recorder; + ui.PictureRecorder _recorder; PaintingCanvas _canvas; /// The canvas on which to paint /// @@ -90,7 +90,7 @@ class PaintingContext { assert(_recorder == null); assert(_canvas == null); _currentLayer = new PictureLayer(paintBounds: paintBounds); - _recorder = new sky.PictureRecorder(); + _recorder = new ui.PictureRecorder(); _canvas = new PaintingCanvas(_recorder, paintBounds); _containerLayer.append(_currentLayer); } @@ -186,7 +186,7 @@ class PaintingContext { /// compositing layer. Otherwise, the clip will be applied by the canvas. /// /// 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)); final Offset childOffset = childPosition.toOffset(); if (!child.needsCompositing) { @@ -246,7 +246,7 @@ class PaintingContext { static Paint _getPaintForAlpha(int alpha) { return new Paint() ..color = new Color.fromARGB(alpha, 0, 0, 0) - ..setTransferMode(sky.TransferMode.srcOver) + ..setTransferMode(ui.TransferMode.srcOver) ..isAntiAlias = false; } @@ -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() - ..colorFilter = new sky.ColorFilter.mode(color, transferMode) + ..colorFilter = new ui.ColorFilter.mode(color, transferMode) ..isAntiAlias = false; } @@ -294,7 +294,7 @@ class PaintingContext { Point childPosition, Rect bounds, Color color, - sky.TransferMode transferMode) { + ui.TransferMode transferMode) { assert(debugCanPaintChild(child)); final Offset childOffset = childPosition.toOffset(); if (!child.needsCompositing) { @@ -315,7 +315,7 @@ class PaintingContext { static Paint _getPaintForShaderMask(Rect bounds, ShaderCallback shaderCallback, - sky.TransferMode transferMode) { + ui.TransferMode transferMode) { return new Paint() ..transferMode = transferMode ..shader = shaderCallback(bounds); @@ -325,7 +325,7 @@ class PaintingContext { Point childPosition, Rect bounds, ShaderCallback shaderCallback, - sky.TransferMode transferMode) { + ui.TransferMode transferMode) { assert(debugCanPaintChild(child)); final Offset childOffset = childPosition.toOffset(); if (!child.needsCompositing) { @@ -628,7 +628,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { /// /// See [FlutterBinding] for an example of how this function is used. static void flushLayout() { - sky.tracing.begin('RenderObject.flushLayout'); + ui.tracing.begin('RenderObject.flushLayout'); _debugDoingLayout = true; try { // 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 { } } finally { _debugDoingLayout = false; - sky.tracing.end('RenderObject.flushLayout'); + ui.tracing.end('RenderObject.flushLayout'); } } void _layoutWithoutResize() { @@ -949,7 +949,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { /// /// See [FlutterBinding] for an example of how this function is used. static void flushPaint() { - sky.tracing.begin('RenderObject.flushPaint'); + ui.tracing.begin('RenderObject.flushPaint'); _debugDoingPaint = true; try { List dirtyNodes = _nodesNeedingPaint; @@ -963,7 +963,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { assert(_nodesNeedingPaint.length == 0); } finally { _debugDoingPaint = false; - sky.tracing.end('RenderObject.flushPaint'); + ui.tracing.end('RenderObject.flushPaint'); } } @@ -1069,7 +1069,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { // EVENTS /// 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) { } diff --git a/packages/flutter/lib/src/rendering/proxy_box.dart b/packages/flutter/lib/src/rendering/proxy_box.dart index 24dc33bf9a1..42ae88854c8 100644 --- a/packages/flutter/lib/src/rendering/proxy_box.dart +++ b/packages/flutter/lib/src/rendering/proxy_box.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/painting.dart'; import 'package:vector_math/vector_math_64.dart'; @@ -627,7 +627,7 @@ class RenderOpacity extends RenderProxyBox { /// Note: This class is relatively expensive because it requires painting the /// child into an intermediate buffer. 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) { } @@ -643,9 +643,9 @@ class RenderColorFilter extends RenderProxyBox { } /// The transfer mode to use when combining the child's painting and the [color] - sky.TransferMode get transferMode => _transferMode; - sky.TransferMode _transferMode; - void set transferMode (sky.TransferMode newTransferMode) { + ui.TransferMode get transferMode => _transferMode; + ui.TransferMode _transferMode; + void set transferMode (ui.TransferMode newTransferMode) { assert(newTransferMode != null); if (_transferMode == newTransferMode) return; @@ -660,7 +660,7 @@ class RenderColorFilter 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) { } @@ -674,9 +674,9 @@ class RenderShaderMask extends RenderProxyBox { markNeedsPaint(); } - sky.TransferMode get transferMode => _transferMode; - sky.TransferMode _transferMode; - void set transferMode (sky.TransferMode newTransferMode) { + ui.TransferMode get transferMode => _transferMode; + ui.TransferMode _transferMode; + void set transferMode (ui.TransferMode newTransferMode) { assert(newTransferMode != null); if (_transferMode == newTransferMode) return; @@ -745,7 +745,7 @@ class RenderClipRRect extends RenderProxyBox { void paint(PaintingContext context, Offset offset) { if (child != null) { 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); } } @@ -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. class RenderPointerListener extends RenderProxyBox { @@ -1073,7 +1073,7 @@ class RenderPointerListener extends RenderProxyBox { PointerEventListener onPointerUp; PointerEventListener onPointerCancel; - void handleEvent(sky.Event event, HitTestEntry entry) { + void handleEvent(ui.Event event, HitTestEntry entry) { if (onPointerDown != null && event.type == 'pointerdown') return onPointerDown(event); if (onPointerMove != null && event.type == 'pointermove') diff --git a/packages/flutter/lib/src/rendering/toggleable.dart b/packages/flutter/lib/src/rendering/toggleable.dart index f5df71db1ec..959eba22cd6 100644 --- a/packages/flutter/lib/src/rendering/toggleable.dart +++ b/packages/flutter/lib/src/rendering/toggleable.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/animation.dart'; import 'package:flutter/gestures.dart'; @@ -37,7 +37,7 @@ abstract class RenderToggleable extends RenderConstrainedBox { double get position => _performance.value; - void handleEvent(sky.Event event, BoxHitTestEntry entry) { + void handleEvent(ui.Event event, BoxHitTestEntry entry) { if (event.type == 'pointerdown') _tap.addPointer(event); } diff --git a/packages/flutter/lib/src/rendering/view.dart b/packages/flutter/lib/src/rendering/view.dart index 9e8a07bfd1d..7b0d3548ef4 100644 --- a/packages/flutter/lib/src/rendering/view.dart +++ b/packages/flutter/lib/src/rendering/view.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/animation.dart'; import 'package:vector_math/vector_math_64.dart'; @@ -60,7 +60,7 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin } Matrix4 get _logicalToDeviceTransform { - double devicePixelRatio = sky.view.devicePixelRatio; + double devicePixelRatio = ui.view.devicePixelRatio; return new Matrix4.diagonal3Values(devicePixelRatio, devicePixelRatio, 1.0); } @@ -114,15 +114,15 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin /// /// Actually causes the output of the rendering pipeline to appear on screen. void compositeFrame() { - sky.tracing.begin('RenderView.compositeFrame'); + ui.tracing.begin('RenderView.compositeFrame'); try { (layer as TransformLayer).transform = _logicalToDeviceTransform; - Rect bounds = Point.origin & (size * sky.view.devicePixelRatio); - sky.SceneBuilder builder = new sky.SceneBuilder(bounds); + Rect bounds = Point.origin & (size * ui.view.devicePixelRatio); + ui.SceneBuilder builder = new ui.SceneBuilder(bounds); layer.addToScene(builder, Offset.zero); - sky.view.scene = builder.build(); + ui.view.scene = builder.build(); } finally { - sky.tracing.end('RenderView.compositeFrame'); + ui.tracing.end('RenderView.compositeFrame'); } } diff --git a/packages/flutter/lib/src/rendering/viewport.dart b/packages/flutter/lib/src/rendering/viewport.dart index c27d4e148df..eccce14a547 100644 --- a/packages/flutter/lib/src/rendering/viewport.dart +++ b/packages/flutter/lib/src/rendering/viewport.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:vector_math/vector_math_64.dart'; @@ -136,7 +136,7 @@ class RenderViewport extends RenderBox with RenderObjectWithChildMixin _fetchImage(String key) async { + Future _fetchImage(String key) async { return await decodeImageFromDataPipe(await load(key)); } diff --git a/packages/flutter/lib/src/services/image_cache.dart b/packages/flutter/lib/src/services/image_cache.dart index 19c823caf0c..f7076c82c8b 100644 --- a/packages/flutter/lib/src/services/image_cache.dart +++ b/packages/flutter/lib/src/services/image_cache.dart @@ -4,7 +4,7 @@ import 'dart:async'; import 'dart:collection'; -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:mojo/mojo/url_response.mojom.dart'; @@ -12,7 +12,7 @@ import 'fetch.dart'; import 'image_decoder.dart'; import 'image_resource.dart'; -Future _fetchImage(String url) async { +Future _fetchImage(String url) async { UrlResponse response = await fetchUrl(url); if (response.statusCode >= 400) { print("Failed (${response.statusCode}) to load image ${url}"); diff --git a/packages/flutter/lib/src/services/image_resource.dart b/packages/flutter/lib/src/services/image_resource.dart index 2f887d6a76e..0ac5e2f1cf8 100644 --- a/packages/flutter/lib/src/services/image_resource.dart +++ b/packages/flutter/lib/src/services/image_resource.dart @@ -3,14 +3,14 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:ui' as sky; +import 'dart:ui' as ui; /// 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 /// -/// 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 /// or because the underlying image resource was mutated. class ImageResource { @@ -19,17 +19,17 @@ class ImageResource { } bool _resolved = false; - Future _futureImage; - sky.Image _image; + Future _futureImage; + ui.Image _image; final List _listeners = new List(); - /// 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 /// [addListener] to be notified whenever a a concrete image is available. - Future get first => _futureImage; + Future 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, /// this object will call the listener synchronously. void addListener(ImageListener listener) { @@ -38,12 +38,12 @@ class ImageResource { listener(_image); } - /// Stop listening for new concrete [sky.Image] objects. + /// Stop listening for new concrete [ui.Image] objects. void removeListener(ImageListener listener) { _listeners.remove(listener); } - void _handleImageLoaded(sky.Image image) { + void _handleImageLoaded(ui.Image image) { _image = image; _resolved = true; _notifyListeners(); diff --git a/packages/flutter/lib/src/widgets/basic.dart b/packages/flutter/lib/src/widgets/basic.dart index afde446e3e9..23f3576025c 100644 --- a/packages/flutter/lib/src/widgets/basic.dart +++ b/packages/flutter/lib/src/widgets/basic.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; @@ -61,7 +61,7 @@ class ColorFilter extends OneChildRenderObjectWidget { } final Color color; - final sky.TransferMode transferMode; + final ui.TransferMode transferMode; RenderColorFilter createRenderObject() => new RenderColorFilter(color: color, transferMode: transferMode); @@ -75,7 +75,7 @@ class ShaderMask extends OneChildRenderObjectWidget { ShaderMask({ Key key, this.shaderCallback, - this.transferMode: sky.TransferMode.modulate, + this.transferMode: ui.TransferMode.modulate, Widget child }) : super(key: key, child: child) { assert(shaderCallback != null); @@ -83,7 +83,7 @@ class ShaderMask extends OneChildRenderObjectWidget { } final ShaderCallback shaderCallback; - final sky.TransferMode transferMode; + final ui.TransferMode transferMode; RenderShaderMask createRenderObject() { return new RenderShaderMask( @@ -813,10 +813,10 @@ class Image extends LeafRenderObjectWidget { this.repeat: ImageRepeat.noRepeat }) : super(key: key); - final sky.Image image; + final ui.Image image; final double width; final double height; - final sky.ColorFilter colorFilter; + final ui.ColorFilter colorFilter; final ImageFit fit; final ImageRepeat repeat; @@ -854,7 +854,7 @@ class ImageListener extends StatefulComponent { final ImageResource image; final double width; final double height; - final sky.ColorFilter colorFilter; + final ui.ColorFilter colorFilter; final ImageFit fit; final ImageRepeat repeat; @@ -867,9 +867,9 @@ class _ImageListenerState extends State { config.image.addListener(_handleImageChanged); } - sky.Image _resolvedImage; + ui.Image _resolvedImage; - void _handleImageChanged(sky.Image resolvedImage) { + void _handleImageChanged(ui.Image resolvedImage) { setState(() { _resolvedImage = resolvedImage; }); @@ -913,7 +913,7 @@ class NetworkImage extends StatelessComponent { final String src; final double width; final double height; - final sky.ColorFilter colorFilter; + final ui.ColorFilter colorFilter; final ImageFit fit; final ImageRepeat repeat; @@ -945,7 +945,7 @@ class AssetImage extends StatelessComponent { final AssetBundle bundle; final double width; final double height; - final sky.ColorFilter colorFilter; + final ui.ColorFilter colorFilter; final ImageFit fit; final ImageRepeat repeat; diff --git a/packages/flutter/lib/src/widgets/dismissable.dart b/packages/flutter/lib/src/widgets/dismissable.dart index 6659d61ec13..69f76a8a988 100644 --- a/packages/flutter/lib/src/widgets/dismissable.dart +++ b/packages/flutter/lib/src/widgets/dismissable.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/animation.dart'; @@ -164,7 +164,7 @@ class _DismissableState extends State { _fadePerformance.progress = _dragExtent.abs() / (_size.width * _kDismissCardThreshold); } - bool _isFlingGesture(sky.Offset velocity) { + bool _isFlingGesture(ui.Offset velocity) { double vx = velocity.dx; double vy = velocity.dy; if (_directionIsYAxis) { @@ -193,7 +193,7 @@ class _DismissableState extends State { return false; } - void _handleDragEnd(sky.Offset velocity) { + void _handleDragEnd(ui.Offset velocity) { if (!_isActive || _fadePerformance.isAnimating) return; diff --git a/packages/flutter/lib/src/widgets/drag_target.dart b/packages/flutter/lib/src/widgets/drag_target.dart index 8ea0cb8e37e..e0f9ce5d372 100644 --- a/packages/flutter/lib/src/widgets/drag_target.dart +++ b/packages/flutter/lib/src/widgets/drag_target.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'dart:collection'; -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/animation.dart'; import 'package:flutter/rendering.dart'; @@ -69,7 +69,7 @@ class Draggable extends StatefulComponent { class _DraggableState extends State { DragRoute _route; - void _startDrag(sky.PointerEvent event) { + void _startDrag(ui.PointerEvent event) { 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. final Point point = new Point(event.x, event.y); @@ -97,7 +97,7 @@ class _DraggableState extends State { config.navigator.push(_route); } - void _updateDrag(sky.PointerEvent event) { + void _updateDrag(ui.PointerEvent event) { if (_route != null) { config.navigator.setState(() { _route.update(new Point(event.x, event.y)); @@ -105,14 +105,14 @@ class _DraggableState extends State { } } - void _cancelDrag(sky.PointerEvent event) { + void _cancelDrag(ui.PointerEvent event) { if (_route != null) { config.navigator.popRoute(_route, DragEndKind.canceled); assert(_route == null); } } - void _drop(sky.PointerEvent event) { + void _drop(ui.PointerEvent event) { if (_route != null) { _route.update(new Point(event.x, event.y)); config.navigator.popRoute(_route, DragEndKind.dropped); diff --git a/packages/flutter/lib/src/widgets/gesture_detector.dart b/packages/flutter/lib/src/widgets/gesture_detector.dart index 288ae057632..534148ae4ae 100644 --- a/packages/flutter/lib/src/widgets/gesture_detector.dart +++ b/packages/flutter/lib/src/widgets/gesture_detector.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/gestures.dart'; import 'package:flutter/rendering.dart'; @@ -187,7 +187,7 @@ class _GestureDetectorState extends State { return null; } - void _handlePointerDown(sky.PointerEvent event) { + void _handlePointerDown(ui.PointerEvent event) { if (_tap != null) _tap.addPointer(event); if (_showPress != null) diff --git a/packages/flutter/lib/src/widgets/scrollable.dart b/packages/flutter/lib/src/widgets/scrollable.dart index 0ae33f9a7e3..310dd57a407 100644 --- a/packages/flutter/lib/src/widgets/scrollable.dart +++ b/packages/flutter/lib/src/widgets/scrollable.dart @@ -4,7 +4,7 @@ import 'dart:async'; import 'dart:math' as math; -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:newton/newton.dart'; import 'package:flutter/animation.dart'; @@ -200,7 +200,7 @@ abstract class ScrollableState extends State { return _startToEndAnimation(); } - double _scrollVelocity(sky.Offset velocity) { + double _scrollVelocity(ui.Offset velocity) { double scrollVelocity = config.scrollDirection == ScrollDirection.horizontal ? -velocity.dx : -velocity.dy; @@ -616,7 +616,7 @@ class PageableListState extends ScrollableListState> { .clamp(scrollBehavior.minScrollOffset, scrollBehavior.maxScrollOffset); } - Future fling(sky.Offset velocity) { + Future fling(ui.Offset velocity) { double scrollVelocity = _scrollVelocity(velocity); double newScrollOffset = _snapScrollOffset(scrollOffset + scrollVelocity.sign * config.itemExtent) .clamp(_snapScrollOffset(scrollOffset - config.itemExtent / 2.0), diff --git a/packages/flutter_sprites/lib/effect_line.dart b/packages/flutter_sprites/lib/effect_line.dart index 211e15d0579..91f0bb67fc2 100644 --- a/packages/flutter_sprites/lib/effect_line.dart +++ b/packages/flutter_sprites/lib/effect_line.dart @@ -15,7 +15,7 @@ class EffectLine extends Node { EffectLine({ this.texture: null, - this.transferMode: sky.TransferMode.dstOver, + this.transferMode: ui.TransferMode.dstOver, List points, this.widthMode : EffectLineWidthMode.linear, this.minWidth: 10.0, @@ -47,7 +47,7 @@ class EffectLine extends Node { final Texture texture; - final sky.TransferMode transferMode; + final ui.TransferMode transferMode; final EffectLineWidthMode widthMode; final double minWidth; diff --git a/packages/flutter_sprites/lib/image_map.dart b/packages/flutter_sprites/lib/image_map.dart index 3de956c630c..6392204ddf6 100644 --- a/packages/flutter_sprites/lib/image_map.dart +++ b/packages/flutter_sprites/lib/image_map.dart @@ -8,18 +8,18 @@ class ImageMap { ImageMap(AssetBundle bundle) : _bundle = bundle; final AssetBundle _bundle; - final Map _images = new Map(); + final Map _images = new Map(); - Future> load(List urls) { + Future> load(List urls) { return Future.wait(urls.map(_loadImage)); } - Future _loadImage(String url) async { - sky.Image image = await _bundle.loadImage(url).first; + Future _loadImage(String url) async { + ui.Image image = await _bundle.loadImage(url).first; _images[url] = image; return image; } - sky.Image getImage(String url) => _images[url]; - sky.Image operator [](String url) => _images[url]; + ui.Image getImage(String url) => _images[url]; + ui.Image operator [](String url) => _images[url]; } diff --git a/packages/flutter_sprites/lib/layer.dart b/packages/flutter_sprites/lib/layer.dart index 85f934992fc..3d8b08543cd 100644 --- a/packages/flutter_sprites/lib/layer.dart +++ b/packages/flutter_sprites/lib/layer.dart @@ -22,7 +22,7 @@ class Layer extends Node with SpritePaint { Layer([Rect this.layerRect = null]); Paint _cachedPaint = new Paint() - ..filterQuality = sky.FilterQuality.low + ..filterQuality = ui.FilterQuality.low ..isAntiAlias = false; void _prePaint(PaintingCanvas canvas, Matrix4 matrix) { diff --git a/packages/flutter_sprites/lib/particle_system.dart b/packages/flutter_sprites/lib/particle_system.dart index fc8bb0bc0a5..e7b8d1d458b 100644 --- a/packages/flutter_sprites/lib/particle_system.dart +++ b/packages/flutter_sprites/lib/particle_system.dart @@ -144,7 +144,7 @@ class ParticleSystem extends Node { /// The transfer mode used to draw the particle system. Default is /// [TransferMode.plus]. - sky.TransferMode transferMode; + ui.TransferMode transferMode; List<_Particle> _particles; @@ -152,7 +152,7 @@ class ParticleSystem extends Node { int _numEmittedParticles = 0; static Paint _paint = new Paint() - ..filterQuality = sky.FilterQuality.low + ..filterQuality = ui.FilterQuality.low ..isAntiAlias = false; ParticleSystem(this.texture, @@ -184,7 +184,7 @@ class ParticleSystem extends Node { this.redVar: 0, this.greenVar: 0, this.blueVar: 0, - this.transferMode: sky.TransferMode.plus, + this.transferMode: ui.TransferMode.plus, this.numParticlesToEmit: 0, this.autoRemoveOnFinish: true}) { _particles = new List<_Particle>(); @@ -359,7 +359,7 @@ class ParticleSystem extends Node { void paint(PaintingCanvas canvas) { - List transforms = []; + List transforms = []; List rects = []; List colors = []; @@ -388,7 +388,7 @@ class ParticleSystem extends Node { double ay = rect.height / 2; double tx = particle.pos[0] + -scos * ax + ssin * 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); // Color @@ -411,7 +411,7 @@ class ParticleSystem extends Node { } canvas.drawAtlas(texture.image, transforms, rects, colors, - sky.TransferMode.modulate, null, _paint); + ui.TransferMode.modulate, null, _paint); } } diff --git a/packages/flutter_sprites/lib/physics_node.dart b/packages/flutter_sprites/lib/physics_node.dart index 57811e75cf3..659fff346a8 100644 --- a/packages/flutter_sprites/lib/physics_node.dart +++ b/packages/flutter_sprites/lib/physics_node.dart @@ -137,7 +137,7 @@ class PhysicsNode extends Node { void paintDebug(PaintingCanvas canvas) { Paint shapePaint = new Paint(); - shapePaint.setStyle(sky.PaintingStyle.stroke); + shapePaint.setStyle(ui.PaintingStyle.stroke); shapePaint.strokeWidth = 1.0; for (box2d.Body body = b2World.bodyList; body != null; body = body.getNext()) { diff --git a/packages/flutter_sprites/lib/skysprites.dart b/packages/flutter_sprites/lib/skysprites.dart index 62b2669e7a8..7bdd6274d81 100644 --- a/packages/flutter_sprites/lib/skysprites.dart +++ b/packages/flutter_sprites/lib/skysprites.dart @@ -8,7 +8,7 @@ import 'dart:async'; import 'dart:convert'; import 'dart:math' as math; import 'dart:typed_data'; -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:box2d/box2d.dart' as box2d; import 'package:mojo/core.dart'; diff --git a/packages/flutter_sprites/lib/sprite.dart b/packages/flutter_sprites/lib/sprite.dart index ded78e7443c..f1d30a63db6 100644 --- a/packages/flutter_sprites/lib/sprite.dart +++ b/packages/flutter_sprites/lib/sprite.dart @@ -17,7 +17,7 @@ class Sprite extends NodeWithSize with SpritePaint { bool constrainProportions = false; Paint _cachedPaint = new Paint() - ..filterQuality = sky.FilterQuality.low + ..filterQuality = ui.FilterQuality.low ..isAntiAlias = false; /// Creates a new sprite from the provided [texture]. @@ -35,7 +35,7 @@ class Sprite extends NodeWithSize with SpritePaint { /// Creates a new sprite from the provided [image]. /// /// 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); texture = new Texture(image); @@ -107,13 +107,13 @@ abstract class SpritePaint { /// /// // Add the colors of the sprite with the colors of the background /// mySprite.transferMode = TransferMode.plusMode; - sky.TransferMode transferMode; + ui.TransferMode transferMode; void _updatePaint(Paint paint) { paint.color = new Color.fromARGB((255.0*_opacity).toInt(), 255, 255, 255); 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) { diff --git a/packages/flutter_sprites/lib/sprite_box.dart b/packages/flutter_sprites/lib/sprite_box.dart index 90f88c3b0e9..8c1d06be33b 100644 --- a/packages/flutter_sprites/lib/sprite_box.dart +++ b/packages/flutter_sprites/lib/sprite_box.dart @@ -185,11 +185,11 @@ class SpriteBox extends RenderBox { } } - void handleEvent(sky.Event event, _SpriteBoxHitTestEntry entry) { + void handleEvent(ui.Event event, _SpriteBoxHitTestEntry entry) { if (!attached) return; - if (event is sky.PointerEvent) { + if (event is ui.PointerEvent) { if (event.type == 'pointerdown') { // Build list of event targets diff --git a/packages/flutter_sprites/lib/spritesheet.dart b/packages/flutter_sprites/lib/spritesheet.dart index 7ec88fc67c2..cbf3b507011 100644 --- a/packages/flutter_sprites/lib/spritesheet.dart +++ b/packages/flutter_sprites/lib/spritesheet.dart @@ -8,7 +8,7 @@ part of skysprites; /// the sprite sheet definition are used to reference the different textures. class SpriteSheet { - sky.Image _image; + ui.Image _image; Map _textures = new Map(); /// Creates a new sprite sheet from an [_image] and a sprite sheet [jsonDefinition]. @@ -65,7 +65,7 @@ class SpriteSheet { /// The image used by the sprite sheet. /// /// var spriteSheetImage = mySpriteSheet.image; - sky.Image get image => _image; + ui.Image get image => _image; /// Returns a texture by its name. /// diff --git a/packages/flutter_sprites/lib/texture.dart b/packages/flutter_sprites/lib/texture.dart index 40f41c6725b..f690ae2f28e 100644 --- a/packages/flutter_sprites/lib/texture.dart +++ b/packages/flutter_sprites/lib/texture.dart @@ -7,7 +7,7 @@ class Texture { /// The image that this texture is a part of. /// /// 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. /// @@ -51,7 +51,7 @@ class Texture { /// Creates a new texture from an [Image] object. /// /// var myTexture = new Texture(myImage); - Texture(sky.Image image) : + Texture(ui.Image image) : size = new Size(image.width.toDouble(), image.height.toDouble()), image = image, trimmed = false, diff --git a/packages/flutter_sprites/lib/textured_line.dart b/packages/flutter_sprites/lib/textured_line.dart index bf857d97c0c..d35d960b4bb 100644 --- a/packages/flutter_sprites/lib/textured_line.dart +++ b/packages/flutter_sprites/lib/textured_line.dart @@ -38,8 +38,8 @@ class TexturedLinePainter { _cachedPaint = new Paint(); } else { Matrix4 matrix = new Matrix4.identity(); - sky.ImageShader shader = new sky.ImageShader(texture.image, - sky.TileMode.repeated, sky.TileMode.repeated, matrix.storage); + ui.ImageShader shader = new ui.ImageShader(texture.image, + ui.TileMode.repeated, ui.TileMode.repeated, matrix.storage); _cachedPaint = new Paint(); _cachedPaint.setShader(shader); @@ -77,7 +77,7 @@ class TexturedLinePainter { bool removeArtifacts = true; - sky.TransferMode transferMode = sky.TransferMode.srcOver; + ui.TransferMode transferMode = ui.TransferMode.srcOver; Paint _cachedPaint = new Paint(); @@ -169,7 +169,7 @@ class TexturedLinePainter { 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) { diff --git a/packages/flutter_sprites/lib/virtual_joystick.dart b/packages/flutter_sprites/lib/virtual_joystick.dart index cf03531e27b..1977f9f8631 100644 --- a/packages/flutter_sprites/lib/virtual_joystick.dart +++ b/packages/flutter_sprites/lib/virtual_joystick.dart @@ -14,7 +14,7 @@ class VirtualJoystick extends NodeWithSize { _paintControl = new Paint() ..color=new Color(0xffffffff) ..strokeWidth = 1.0 - ..setStyle(sky.PaintingStyle.stroke); + ..setStyle(ui.PaintingStyle.stroke); } Point _value = Point.origin; diff --git a/packages/unit/test/engine/canvas_test.dart b/packages/unit/test/engine/canvas_test.dart index 31daaba3718..d8fe0506906 100644 --- a/packages/unit/test/engine/canvas_test.dart +++ b/packages/unit/test/engine/canvas_test.dart @@ -1,4 +1,4 @@ -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'dart:ui' show Rect, Color, Paint; import 'package:test/test.dart'; @@ -6,8 +6,8 @@ import 'package:vector_math/vector_math_64.dart'; void main() { - sky.PictureRecorder recorder = new sky.PictureRecorder(); - sky.Canvas canvas = new sky.Canvas(recorder, new Rect.fromLTRB(0.0, 0.0, 100.0, 100.0)); + ui.PictureRecorder recorder = new ui.PictureRecorder(); + ui.Canvas canvas = new ui.Canvas(recorder, new Rect.fromLTRB(0.0, 0.0, 100.0, 100.0)); test("matrix access should work", () { // Matrix equality doesn't work! diff --git a/packages/unit/test/engine/inline_style_test.dart b/packages/unit/test/engine/inline_style_test.dart index d8d0d6ec620..54ba7d5edc3 100644 --- a/packages/unit/test/engine/inline_style_test.dart +++ b/packages/unit/test/engine/inline_style_test.dart @@ -1,11 +1,11 @@ -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:test/test.dart'; void main() { test('should be settable using "style" attribute', () { - sky.LayoutRoot layoutRoot = new sky.LayoutRoot(); - var document = new sky.Document(); + ui.LayoutRoot layoutRoot = new ui.LayoutRoot(); + var document = new ui.Document(); var foo = document.createElement('foo'); layoutRoot.rootElement = foo; @@ -16,8 +16,8 @@ void main() { }); test('should not crash when setting style to null', () { - sky.LayoutRoot layoutRoot = new sky.LayoutRoot(); - var document = new sky.Document(); + ui.LayoutRoot layoutRoot = new ui.LayoutRoot(); + var document = new ui.Document(); var foo = document.createElement('foo'); layoutRoot.rootElement = foo; diff --git a/packages/unit/test/engine/mock_events.dart b/packages/unit/test/engine/mock_events.dart index 7604b0f9afa..53ddc9ea8e2 100644 --- a/packages/unit/test/engine/mock_events.dart +++ b/packages/unit/test/engine/mock_events.dart @@ -1,8 +1,8 @@ -import 'dart:ui' as sky; +import 'dart:ui' as ui; export 'dart:ui' show Point; -class TestPointerEvent extends sky.PointerEvent { +class TestPointerEvent extends ui.PointerEvent { TestPointerEvent({ this.type, this.pointer, @@ -64,9 +64,9 @@ class TestPointer { int pointer; 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); isDown = true; location = newLocation; @@ -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); - sky.Offset delta = newLocation - location; + ui.Offset delta = newLocation - location; location = newLocation; return new TestPointerEvent( type: 'pointermove', @@ -92,7 +92,7 @@ class TestPointer { ); } - sky.PointerEvent up() { + ui.PointerEvent up() { assert(isDown); isDown = false; return new TestPointerEvent( @@ -103,7 +103,7 @@ class TestPointer { ); } - sky.PointerEvent cancel() { + ui.PointerEvent cancel() { assert(isDown); isDown = false; return new TestPointerEvent( diff --git a/packages/unit/test/engine/text_test.dart b/packages/unit/test/engine/text_test.dart index dcd92dfadc9..b336df6411f 100644 --- a/packages/unit/test/engine/text_test.dart +++ b/packages/unit/test/engine/text_test.dart @@ -1,10 +1,10 @@ -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:test/test.dart'; void main() { test("createText(null) shouldn't crash", () { - var doc = new sky.Document(); + var doc = new ui.Document(); doc.createText(null); }); } diff --git a/packages/unit/test/gestures/pointer_router_test.dart b/packages/unit/test/gestures/pointer_router_test.dart index 6c158968568..65f00838f42 100644 --- a/packages/unit/test/gestures/pointer_router_test.dart +++ b/packages/unit/test/gestures/pointer_router_test.dart @@ -1,4 +1,4 @@ -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/gestures.dart'; import 'package:test/test.dart'; @@ -8,7 +8,7 @@ import '../engine/mock_events.dart'; void main() { test('Should route pointers', () { bool callbackRan = false; - void callback(sky.PointerEvent event) { + void callback(ui.PointerEvent event) { callbackRan = true; } diff --git a/packages/unit/test/gestures/scale_test.dart b/packages/unit/test/gestures/scale_test.dart index be19bada547..9acec2c7a32 100644 --- a/packages/unit/test/gestures/scale_test.dart +++ b/packages/unit/test/gestures/scale_test.dart @@ -1,4 +1,4 @@ -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/gestures.dart'; import 'package:test/test.dart'; @@ -12,14 +12,14 @@ void main() { TapGestureRecognizer tap = new TapGestureRecognizer(router: router); bool didStartScale = false; - sky.Point updatedFocalPoint; - scale.onStart = (sky.Point focalPoint) { + ui.Point updatedFocalPoint; + scale.onStart = (ui.Point focalPoint) { didStartScale = true; updatedFocalPoint = focalPoint; }; double updatedScale; - scale.onUpdate = (double scale, sky.Point focalPoint) { + scale.onUpdate = (double scale, ui.Point focalPoint) { updatedScale = scale; updatedFocalPoint = focalPoint; }; @@ -36,7 +36,7 @@ void main() { 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); tap.addPointer(down); @@ -58,7 +58,7 @@ void main() { router.route(pointer1.move(new Point(20.0, 30.0))); expect(didStartScale, isTrue); didStartScale = false; - expect(updatedFocalPoint, new sky.Point(20.0, 30.0)); + expect(updatedFocalPoint, new ui.Point(20.0, 30.0)); updatedFocalPoint = null; expect(updatedScale, 1.0); updatedScale = null; @@ -67,7 +67,7 @@ void main() { // Two-finger scaling 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); tap.addPointer(down2); GestureArena.instance.close(2); @@ -83,7 +83,7 @@ void main() { router.route(pointer2.move(new Point(0.0, 10.0))); expect(didStartScale, isTrue); didStartScale = false; - expect(updatedFocalPoint, new sky.Point(10.0, 20.0)); + expect(updatedFocalPoint, new ui.Point(10.0, 20.0)); updatedFocalPoint = null; expect(updatedScale, 2.0); updatedScale = null; @@ -92,7 +92,7 @@ void main() { // Zoom out 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; expect(updatedScale, 0.5); updatedScale = null; @@ -100,7 +100,7 @@ void main() { // Three-finger scaling 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); tap.addPointer(down3); GestureArena.instance.close(3); @@ -116,7 +116,7 @@ void main() { router.route(pointer3.move(new Point(55.0, 65.0))); expect(didStartScale, isTrue); didStartScale = false; - expect(updatedFocalPoint, new sky.Point(30.0, 40.0)); + expect(updatedFocalPoint, new ui.Point(30.0, 40.0)); updatedFocalPoint = null; expect(updatedScale, 5.0); updatedScale = null; @@ -128,7 +128,7 @@ void main() { router.route(pointer2.move(new Point(20.0, 30.0))); router.route(pointer3.move(new Point(15.0, 25.0))); expect(didStartScale, isFalse); - expect(updatedFocalPoint, new sky.Point(20.0, 30.0)); + expect(updatedFocalPoint, new ui.Point(20.0, 30.0)); updatedFocalPoint = null; expect(updatedScale, 1.0); updatedScale = null; @@ -147,7 +147,7 @@ void main() { router.route(pointer3.move(new Point(10.0, 20.0))); expect(didStartScale, isTrue); didStartScale = false; - expect(updatedFocalPoint, new sky.Point(15.0, 25.0)); + expect(updatedFocalPoint, new ui.Point(15.0, 25.0)); updatedFocalPoint = null; expect(updatedScale, 2.0); updatedScale = null; @@ -164,7 +164,7 @@ void main() { router.route(pointer3.move(new Point(0.0, 0.0))); expect(didStartScale, isTrue); didStartScale = false; - expect(updatedFocalPoint, new sky.Point(0.0, 0.0)); + expect(updatedFocalPoint, new ui.Point(0.0, 0.0)); updatedFocalPoint = null; expect(updatedScale, 1.0); updatedScale = null; diff --git a/packages/unit/test/gestures/scroll_test.dart b/packages/unit/test/gestures/scroll_test.dart index e29adafc765..e382ab37e5b 100644 --- a/packages/unit/test/gestures/scroll_test.dart +++ b/packages/unit/test/gestures/scroll_test.dart @@ -1,4 +1,4 @@ -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/gestures.dart'; import 'package:test/test.dart'; @@ -16,13 +16,13 @@ void main() { didStartPan = true; }; - sky.Offset updatedScrollDelta; - pan.onUpdate = (sky.Offset offset) { + ui.Offset updatedScrollDelta; + pan.onUpdate = (ui.Offset offset) { updatedScrollDelta = offset; }; bool didEndPan = false; - pan.onEnd = (sky.Offset velocity) { + pan.onEnd = (ui.Offset velocity) { didEndPan = true; }; @@ -32,7 +32,7 @@ void main() { }; 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); tap.addPointer(down); GestureArena.instance.close(5); @@ -50,14 +50,14 @@ void main() { router.route(pointer.move(new Point(20.0, 20.0))); expect(didStartPan, isTrue); didStartPan = false; - expect(updatedScrollDelta, new sky.Offset(10.0, 10.0)); + expect(updatedScrollDelta, new ui.Offset(10.0, 10.0)); updatedScrollDelta = null; expect(didEndPan, isFalse); expect(didTap, isFalse); router.route(pointer.move(new Point(20.0, 25.0))); expect(didStartPan, isFalse); - expect(updatedScrollDelta, new sky.Offset(0.0, 5.0)); + expect(updatedScrollDelta, new ui.Offset(0.0, 5.0)); updatedScrollDelta = null; expect(didEndPan, isFalse); expect(didTap, isFalse); diff --git a/packages/unit/test/rendering/image_test.dart b/packages/unit/test/rendering/image_test.dart index 2ee22468b6e..b794f84a18d 100644 --- a/packages/unit/test/rendering/image_test.dart +++ b/packages/unit/test/rendering/image_test.dart @@ -1,21 +1,21 @@ -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/rendering.dart'; import 'package:test/test.dart'; import 'rendering_tester.dart'; -class SquareImage implements sky.Image { +class SquareImage implements ui.Image { int get width => 10; int get height => 10; } -class WideImage implements sky.Image { +class WideImage implements ui.Image { int get width => 20; int get height => 10; } -class TallImage implements sky.Image { +class TallImage implements ui.Image { int get width => 10; int get height => 20; } diff --git a/packages/unit/test/widget/shader_mask_test.dart b/packages/unit/test/widget/shader_mask_test.dart index 379ff9b5720..aa465abaa52 100644 --- a/packages/unit/test/widget/shader_mask_test.dart +++ b/packages/unit/test/widget/shader_mask_test.dart @@ -1,4 +1,4 @@ -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/painting.dart'; import 'package:flutter/widgets.dart'; @@ -6,7 +6,7 @@ import 'package:test/test.dart'; import 'widget_tester.dart'; -sky.Shader createShader(Rect bounds) { +ui.Shader createShader(Rect bounds) { return new LinearGradient( begin: Point.origin, end: new Point(0.0, bounds.height), diff --git a/packages/unit/test/widget/widget_tester.dart b/packages/unit/test/widget/widget_tester.dart index 284afb000b5..5d6e57f4bd7 100644 --- a/packages/unit/test/widget/widget_tester.dart +++ b/packages/unit/test/widget/widget_tester.dart @@ -1,4 +1,4 @@ -import 'dart:ui' as sky; +import 'dart:ui' as ui; import 'package:flutter/animation.dart'; import 'package:flutter/rendering.dart'; @@ -159,13 +159,13 @@ class WidgetTester { _dispatchEvent(p.up(), result); } - void dispatchEvent(sky.Event event, Point location) { + void dispatchEvent(ui.Event event, Point location) { _dispatchEvent(event, _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); } diff --git a/packages/updater/lib/main.dart b/packages/updater/lib/main.dart index 5d0b0a6fcd6..9a748eb6e1a 100644 --- a/packages/updater/lib/main.dart +++ b/packages/updater/lib/main.dart @@ -14,7 +14,7 @@ import 'package:yaml/yaml.dart' as yaml; import 'version.dart'; import 'pipe_to_file.dart'; -const String kManifestFile = 'sky.yaml'; +const String kManifestFile = 'ui.yaml'; const String kBundleFile = 'app.skyx'; UpdateServiceProxy _initUpdateService() {