Import dart:ui as ui (instead of as sky)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
|
||||
@@ -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<int, Touch> 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);
|
||||
}
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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());
|
||||
|
||||
|
||||
@@ -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)];
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user