Clean up imports and exports.

Each layer is supposed to reexport the parts of the previous layer
that are part of its API.

- In painting.dart, export from dart:ui all the Canvas-related APIs
  that make sense to be used at higher levels, e.g. PaintingStyle.

- Delete painting/shadows.dart. It was dead code.

- In rendering/object.dart, export all of painting.dart.

- In widgets/basic.dart, export all of painting.dart and
  animation.dart. Some classes in animation/ are renamed to make this
  less disruptive and confusing to the namespace.

- Split out Stocks back into an import model rather than a part model,
  so that it's easier to manage its dependencies on a per-file basis.

- Move Ticker to scheduler library.

- Remove as many redundant imports as possible now.

- Some minor nit picking cleanup in various files.
This commit is contained in:
Ian Hickson
2016-02-10 18:11:03 -08:00
parent 75bc0277ff
commit a94999ba50
123 changed files with 346 additions and 492 deletions

View File

@@ -10,12 +10,10 @@ import 'dart:collection';
import 'dart:convert';
import 'dart:math' as math;
import 'dart:typed_data';
import 'dart:ui' as ui;
import 'dart:ui' as ui show Image;
import 'package:box2d/box2d.dart' as box2d;
import 'package:flutter/animation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/painting.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart';

View File

@@ -15,7 +15,7 @@ class EffectLine extends Node {
EffectLine({
this.texture: null,
this.transferMode: ui.TransferMode.dstOver,
this.transferMode: TransferMode.dstOver,
List<Point> points,
this.widthMode : EffectLineWidthMode.linear,
this.minWidth: 10.0,
@@ -38,8 +38,8 @@ class EffectLine extends Node {
_colorSequence = colorSequence;
if (_colorSequence == null) {
_colorSequence = new ColorSequence.fromStartAndEndColor(
new Color(0xffffffff),
new Color(0xffffffff)
const Color(0xffffffff),
const Color(0xffffffff)
);
}
@@ -51,7 +51,7 @@ class EffectLine extends Node {
final Texture texture;
final ui.TransferMode transferMode;
final TransferMode transferMode;
final EffectLineWidthMode widthMode;
final double minWidth;

View File

@@ -22,7 +22,7 @@ class Layer extends Node with SpritePaint {
Layer([this.layerRect = null]);
Paint _cachedPaint = new Paint()
..filterQuality = ui.FilterQuality.low
..filterQuality = FilterQuality.low
..isAntiAlias = false;
void _prePaint(Canvas canvas, Matrix4 matrix) {

View File

@@ -144,7 +144,7 @@ class ParticleSystem extends Node {
/// The transfer mode used to draw the particle system. Default is
/// [TransferMode.plus].
ui.TransferMode transferMode;
TransferMode transferMode;
List<_Particle> _particles;
@@ -154,7 +154,7 @@ class ParticleSystem extends Node {
double opacity = 1.0;
static Paint _paint = new Paint()
..filterQuality = ui.FilterQuality.low
..filterQuality = FilterQuality.low
..isAntiAlias = false;
ParticleSystem(this.texture,
@@ -186,7 +186,7 @@ class ParticleSystem extends Node {
this.redVar: 0,
this.greenVar: 0,
this.blueVar: 0,
this.transferMode: ui.TransferMode.plus,
this.transferMode: TransferMode.plus,
this.numParticlesToEmit: 0,
this.autoRemoveOnFinish: true}) {
_particles = new List<_Particle>();
@@ -362,7 +362,7 @@ class ParticleSystem extends Node {
void paint(Canvas canvas) {
if (opacity == 0.0) return;
List<ui.RSTransform> transforms = <ui.RSTransform>[];
List<RSTransform> transforms = <RSTransform>[];
List<Rect> rects = <Rect>[];
List<Color> colors = <Color>[];
@@ -391,7 +391,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;
ui.RSTransform transform = new ui.RSTransform(scos, ssin, tx, ty);
RSTransform transform = new RSTransform(scos, ssin, tx, ty);
transforms.add(transform);
// Color
@@ -417,7 +417,7 @@ class ParticleSystem extends Node {
}
canvas.drawAtlas(texture.image, transforms, rects, colors,
ui.TransferMode.modulate, null, _paint);
TransferMode.modulate, null, _paint);
}
}

View File

@@ -43,7 +43,7 @@ class _PhysicsDebugDraw extends box2d.DebugDraw {
void drawCircle(Vector2 center, num radius, box2d.Color3i color, [Vector2 axis]) {
Paint paint = new Paint()
..color = _toColor(color)
..style = ui.PaintingStyle.stroke
..style = PaintingStyle.stroke
..strokeWidth = 1.0;
canvas.drawCircle(_toPoint(center), _scale(radius), paint);

View File

@@ -17,7 +17,7 @@ class Sprite extends NodeWithSize with SpritePaint {
bool constrainProportions = false;
Paint _cachedPaint = new Paint()
..filterQuality = ui.FilterQuality.low
..filterQuality = FilterQuality.low
..isAntiAlias = false;
/// Creates a new sprite from the provided [texture].
@@ -107,13 +107,13 @@ abstract class SpritePaint {
///
/// // Add the colors of the sprite with the colors of the background
/// mySprite.transferMode = TransferMode.plusMode;
ui.TransferMode transferMode;
TransferMode transferMode;
void _updatePaint(Paint paint) {
paint.color = new Color.fromARGB((255.0*_opacity).toInt(), 255, 255, 255);
if (colorOverlay != null) {
paint.colorFilter = new ColorFilter.mode(colorOverlay, ui.TransferMode.srcATop);
paint.colorFilter = new ColorFilter.mode(colorOverlay, TransferMode.srcATop);
}
if (transferMode != null) {

View File

@@ -38,8 +38,8 @@ class TexturedLinePainter {
_cachedPaint = new Paint();
} else {
Matrix4 matrix = new Matrix4.identity();
ui.ImageShader shader = new ui.ImageShader(texture.image,
ui.TileMode.repeated, ui.TileMode.repeated, matrix.storage);
ImageShader shader = new ImageShader(texture.image,
TileMode.repeated, TileMode.repeated, matrix.storage);
_cachedPaint = new Paint()
..shader = shader;
@@ -77,7 +77,7 @@ class TexturedLinePainter {
bool removeArtifacts = true;
ui.TransferMode transferMode = ui.TransferMode.srcOver;
TransferMode transferMode = TransferMode.srcOver;
Paint _cachedPaint = new Paint();
@@ -169,7 +169,7 @@ class TexturedLinePainter {
lastMiter = currentMiter;
}
canvas.drawVertices(ui.VertexMode.triangles, vertices, textureCoordinates, verticeColors, ui.TransferMode.modulate, indicies, _cachedPaint);
canvas.drawVertices(VertexMode.triangles, vertices, textureCoordinates, verticeColors, TransferMode.modulate, indicies, _cachedPaint);
}
double _xPosForStop(double stop) {

View File

@@ -14,7 +14,7 @@ class VirtualJoystick extends NodeWithSize {
_paintControl = new Paint()
..color=new Color(0xffffffff)
..strokeWidth = 1.0
..style = ui.PaintingStyle.stroke;
..style = PaintingStyle.stroke;
}
Point _value = Point.origin;