Commit a94999ba authored by Ian Hickson's avatar Ian Hickson

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.
parent 75bc0277
...@@ -6,7 +6,6 @@ library fitness; ...@@ -6,7 +6,6 @@ library fitness;
import 'package:playfair/playfair.dart' as playfair; import 'package:playfair/playfair.dart' as playfair;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';
import 'package:gcm/gcm.dart' as gcm; import 'package:gcm/gcm.dart' as gcm;
import 'user_data.dart'; import 'user_data.dart';
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/animation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class ProgressIndicatorDemo extends StatefulComponent { class ProgressIndicatorDemo extends StatefulComponent {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async'; import 'dart:async';
import 'dart:ui' as ui; import 'dart:ui' as ui show Image;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_sprites/flutter_sprites.dart'; import 'package:flutter_sprites/flutter_sprites.dart';
......
...@@ -3,10 +3,7 @@ ...@@ -3,10 +3,7 @@
import 'dart:math'; import 'dart:math';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
// Classic minesweeper-inspired game. The mouse controls are standard // Classic minesweeper-inspired game. The mouse controls are standard
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
class _BaselinePainter extends CustomPainter { class _BaselinePainter extends CustomPainter {
...@@ -29,7 +27,7 @@ class _BaselinePainter extends CustomPainter { ...@@ -29,7 +27,7 @@ class _BaselinePainter extends CustomPainter {
path.lineTo(w, h); path.lineTo(w, h);
paint = new Paint() paint = new Paint()
..color = const Color(0xFFFF9000) ..color = const Color(0xFFFF9000)
..style = ui.PaintingStyle.stroke ..style = PaintingStyle.stroke
..strokeWidth = 1.5; ..strokeWidth = 1.5;
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
...@@ -39,7 +37,7 @@ class _BaselinePainter extends CustomPainter { ...@@ -39,7 +37,7 @@ class _BaselinePainter extends CustomPainter {
path.lineTo(w, baseline); path.lineTo(w, baseline);
paint = new Paint() paint = new Paint()
..color = const Color(0xFF00FF90) ..color = const Color(0xFF00FF90)
..style = ui.PaintingStyle.stroke ..style = PaintingStyle.stroke
..strokeWidth = 1.5; ..strokeWidth = 1.5;
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
} }
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
void main() { void main() {
...@@ -15,7 +13,7 @@ void main() { ...@@ -15,7 +13,7 @@ void main() {
additionalConstraints: new BoxConstraints.tightFor(height: 100.0), additionalConstraints: new BoxConstraints.tightFor(height: 100.0),
child: new RenderDecoratedBox( child: new RenderDecoratedBox(
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: new ui.Color(0xFFFFFF00) backgroundColor: const Color(0xFFFFFF00)
) )
) )
) )
...@@ -27,12 +25,12 @@ void main() { ...@@ -27,12 +25,12 @@ void main() {
child: new RenderDecoratedBox( child: new RenderDecoratedBox(
decoration: new BoxDecoration( decoration: new BoxDecoration(
border: new Border( border: new Border(
top: new BorderSide(color: new ui.Color(0xFFF00000), width: 5.0), top: new BorderSide(color: const Color(0xFFF00000), width: 5.0),
right: new BorderSide(color: new ui.Color(0xFFFF9000), width: 10.0), right: new BorderSide(color: const Color(0xFFFF9000), width: 10.0),
bottom: new BorderSide(color: new ui.Color(0xFFFFF000), width: 15.0), bottom: new BorderSide(color: const Color(0xFFFFF000), width: 15.0),
left: new BorderSide(color: new ui.Color(0xFF00FF00), width: 20.0) left: new BorderSide(color: const Color(0xFF00FF00), width: 20.0)
), ),
backgroundColor: new ui.Color(0xFFDDDDDD) backgroundColor: const Color(0xFFDDDDDD)
) )
) )
) )
...@@ -43,7 +41,7 @@ void main() { ...@@ -43,7 +41,7 @@ void main() {
additionalConstraints: new BoxConstraints.tightFor(height: 100.0), additionalConstraints: new BoxConstraints.tightFor(height: 100.0),
child: new RenderDecoratedBox( child: new RenderDecoratedBox(
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: new ui.Color(0xFFFFFF00) backgroundColor: const Color(0xFFFFFF00)
) )
) )
) )
...@@ -54,7 +52,7 @@ void main() { ...@@ -54,7 +52,7 @@ void main() {
additionalConstraints: new BoxConstraints.tightFor(height: 100.0), additionalConstraints: new BoxConstraints.tightFor(height: 100.0),
child: new RenderDecoratedBox( child: new RenderDecoratedBox(
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: new ui.Color(0xFFFFFF00) backgroundColor: const Color(0xFFFFFF00)
) )
) )
) )
...@@ -65,7 +63,7 @@ void main() { ...@@ -65,7 +63,7 @@ void main() {
additionalConstraints: new BoxConstraints.tightFor(height: 100.0), additionalConstraints: new BoxConstraints.tightFor(height: 100.0),
child: new RenderDecoratedBox( child: new RenderDecoratedBox(
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: new ui.Color(0xFFFFFF00) backgroundColor: const Color(0xFFFFFF00)
) )
) )
) )
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'lib/solid_color_box.dart'; import 'lib/solid_color_box.dart';
...@@ -11,11 +9,11 @@ RenderBox buildFlexExample() { ...@@ -11,11 +9,11 @@ RenderBox buildFlexExample() {
RenderFlex flexRoot = new RenderFlex(direction: FlexDirection.vertical); RenderFlex flexRoot = new RenderFlex(direction: FlexDirection.vertical);
RenderDecoratedBox root = new RenderDecoratedBox( RenderDecoratedBox root = new RenderDecoratedBox(
decoration: new BoxDecoration(backgroundColor: const ui.Color(0xFF000000)), decoration: new BoxDecoration(backgroundColor: const Color(0xFF000000)),
child: flexRoot child: flexRoot
); );
void addFlexChildSolidColor(RenderFlex parent, ui.Color backgroundColor, { int flex: 0 }) { void addFlexChildSolidColor(RenderFlex parent, Color backgroundColor, { int flex: 0 }) {
RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor); RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor);
parent.add(child); parent.add(child);
final FlexParentData childParentData = child.parentData; final FlexParentData childParentData = child.parentData;
...@@ -23,13 +21,13 @@ RenderBox buildFlexExample() { ...@@ -23,13 +21,13 @@ RenderBox buildFlexExample() {
} }
// Yellow bar at top // Yellow bar at top
addFlexChildSolidColor(flexRoot, const ui.Color(0xFFFFFF00), flex: 1); addFlexChildSolidColor(flexRoot, const Color(0xFFFFFF00), flex: 1);
// Turquoise box // Turquoise box
flexRoot.add(new RenderSolidColorBox(const ui.Color(0x7700FFFF), desiredSize: new ui.Size(100.0, 100.0))); flexRoot.add(new RenderSolidColorBox(const Color(0x7700FFFF), desiredSize: new Size(100.0, 100.0)));
var renderDecoratedBlock = new RenderDecoratedBox( var renderDecoratedBlock = new RenderDecoratedBox(
decoration: new BoxDecoration(backgroundColor: const ui.Color(0xFFFFFFFF)) decoration: new BoxDecoration(backgroundColor: const Color(0xFFFFFFFF))
); );
flexRoot.add(new RenderPadding(padding: const EdgeDims.all(10.0), child: renderDecoratedBlock)); flexRoot.add(new RenderPadding(padding: const EdgeDims.all(10.0), child: renderDecoratedBlock));
...@@ -37,11 +35,11 @@ RenderBox buildFlexExample() { ...@@ -37,11 +35,11 @@ RenderBox buildFlexExample() {
var row = new RenderFlex(direction: FlexDirection.horizontal); var row = new RenderFlex(direction: FlexDirection.horizontal);
// Purple and blue cells // Purple and blue cells
addFlexChildSolidColor(row, const ui.Color(0x77FF00FF), flex: 1); addFlexChildSolidColor(row, const Color(0x77FF00FF), flex: 1);
addFlexChildSolidColor(row, const ui.Color(0xFF0000FF), flex: 2); addFlexChildSolidColor(row, const Color(0xFF0000FF), flex: 2);
var decoratedRow = new RenderDecoratedBox( var decoratedRow = new RenderDecoratedBox(
decoration: new BoxDecoration(backgroundColor: const ui.Color(0xFF333333)), decoration: new BoxDecoration(backgroundColor: const Color(0xFF333333)),
child: row child: row
); );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui; import 'dart:ui' as ui show Image, window;
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:typed_data'; import 'dart:typed_data';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'lib/solid_color_box.dart'; import 'lib/solid_color_box.dart';
...@@ -14,16 +12,16 @@ RenderTransform transformBox; ...@@ -14,16 +12,16 @@ RenderTransform transformBox;
void main() { void main() {
RenderFlex flexRoot = new RenderFlex(direction: FlexDirection.vertical); RenderFlex flexRoot = new RenderFlex(direction: FlexDirection.vertical);
void addFlexChildSolidColor(RenderFlex parent, ui.Color backgroundColor, { int flex: 0 }) { void addFlexChildSolidColor(RenderFlex parent, Color backgroundColor, { int flex: 0 }) {
RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor); RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor);
parent.add(child); parent.add(child);
final FlexParentData childParentData = child.parentData; final FlexParentData childParentData = child.parentData;
childParentData.flex = flex; childParentData.flex = flex;
} }
addFlexChildSolidColor(flexRoot, const ui.Color(0xFFFF00FF), flex: 1); addFlexChildSolidColor(flexRoot, const Color(0xFFFF00FF), flex: 1);
addFlexChildSolidColor(flexRoot, const ui.Color(0xFFFFFF00), flex: 2); addFlexChildSolidColor(flexRoot, const Color(0xFFFFFF00), flex: 2);
addFlexChildSolidColor(flexRoot, const ui.Color(0xFF00FFFF), flex: 1); addFlexChildSolidColor(flexRoot, const Color(0xFF00FFFF), flex: 1);
transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.identity()); transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.identity());
......
...@@ -2,16 +2,14 @@ ...@@ -2,16 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
void main() { void main() {
RenderDecoratedBox green = new RenderDecoratedBox( RenderDecoratedBox green = new RenderDecoratedBox(
decoration: new BoxDecoration(backgroundColor: const ui.Color(0xFF00FF00)) decoration: new BoxDecoration(backgroundColor: const Color(0xFF00FF00))
); );
RenderConstrainedBox box = new RenderConstrainedBox( RenderConstrainedBox box = new RenderConstrainedBox(
additionalConstraints: new BoxConstraints.tight(const ui.Size(200.0, 200.0)), additionalConstraints: new BoxConstraints.tight(const Size(200.0, 200.0)),
child: green child: green
); );
......
...@@ -5,29 +5,18 @@ ...@@ -5,29 +5,18 @@
library stocks; library stocks;
import 'dart:async'; import 'dart:async';
import 'dart:collection';
import 'dart:math' as math;
import 'dart:ui' as ui;
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/painting.dart'; import 'package:flutter/rendering.dart' show debugPaintSizeEnabled;
import 'package:flutter/rendering.dart';
import 'package:flutter/scheduler.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'stock_data.dart';
import 'i18n/stock_messages_all.dart'; import 'i18n/stock_messages_all.dart';
import 'stock_data.dart';
part 'stock_arrow.dart'; import 'stock_home.dart';
part 'stock_home.dart'; import 'stock_settings.dart';
part 'stock_list.dart'; import 'stock_strings.dart';
part 'stock_menu.dart'; import 'stock_symbol_viewer.dart';
part 'stock_row.dart'; import 'stock_types.dart';
part 'stock_settings.dart';
part 'stock_strings.dart';
part 'stock_symbol_viewer.dart';
part 'stock_types.dart';
class StocksApp extends StatefulComponent { class StocksApp extends StatefulComponent {
StocksAppState createState() => new StocksAppState(); StocksAppState createState() => new StocksAppState();
...@@ -94,7 +83,7 @@ class StocksAppState extends State<StocksApp> { ...@@ -94,7 +83,7 @@ class StocksAppState extends State<StocksApp> {
return null; return null;
} }
Future<LocaleQueryData> _onLocaleChanged(ui.Locale locale) async { Future<LocaleQueryData> _onLocaleChanged(Locale locale) async {
String localeString = locale.toString(); String localeString = locale.toString();
await initializeMessages(localeString); await initializeMessages(localeString);
Intl.defaultLocale = localeString; Intl.defaultLocale = localeString;
......
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
part of stocks; import 'dart:math' as math;
import 'package:flutter/material.dart';
class StockArrowPainter extends CustomPainter { class StockArrowPainter extends CustomPainter {
StockArrowPainter({ this.color, this.percentChange }); StockArrowPainter({ this.color, this.percentChange });
...@@ -34,11 +36,11 @@ class StockArrowPainter extends CustomPainter { ...@@ -34,11 +36,11 @@ class StockArrowPainter extends CustomPainter {
path.lineTo(centerX + w, arrowY + h); path.lineTo(centerX + w, arrowY + h);
path.lineTo(centerX - w, arrowY + h); path.lineTo(centerX - w, arrowY + h);
path.close(); path.close();
paint.style = ui.PaintingStyle.fill; paint.style = PaintingStyle.fill;
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
// Draw a circle that circumscribes the arrow. // Draw a circle that circumscribes the arrow.
paint.style = ui.PaintingStyle.stroke; paint.style = PaintingStyle.stroke;
canvas.drawCircle(new Point(centerX, centerY), r, paint); canvas.drawCircle(new Point(centerX, centerY), r, paint);
} }
......
...@@ -2,7 +2,17 @@ ...@@ -2,7 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
part of stocks; import 'dart:collection';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart' show debugDumpRenderTree, debugDumpLayerTree, debugDumpSemanticsTree;
import 'stock_data.dart';
import 'stock_list.dart';
import 'stock_menu.dart';
import 'stock_strings.dart';
import 'stock_symbol_viewer.dart';
import 'stock_types.dart';
typedef void ModeUpdater(StockMode mode); typedef void ModeUpdater(StockMode mode);
......
...@@ -2,7 +2,10 @@ ...@@ -2,7 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
part of stocks; import 'package:flutter/material.dart';
import 'stock_data.dart';
import 'stock_row.dart';
class StockList extends StatelessComponent { class StockList extends StatelessComponent {
StockList({ Key key, this.keySalt, this.stocks, this.onOpen, this.onShow, this.onAction }) : super(key: key); StockList({ Key key, this.keySalt, this.stocks, this.onOpen, this.onShow, this.onAction }) : super(key: key);
......
...@@ -2,7 +2,11 @@ ...@@ -2,7 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
part of stocks; import 'dart:async';
import 'dart:ui' as ui show window;
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart' show timeDilation;
enum _MenuItems { autorefresh, autorefreshCheckbox, refresh, speedUp, speedDown } enum _MenuItems { autorefresh, autorefreshCheckbox, refresh, speedUp, speedDown }
......
...@@ -2,7 +2,10 @@ ...@@ -2,7 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
part of stocks; import 'package:flutter/material.dart';
import 'stock_data.dart';
import 'stock_arrow.dart';
enum StockRowPartKind { arrow } enum StockRowPartKind { arrow }
......
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
part of stocks; import 'package:flutter/material.dart';
import 'stock_types.dart';
class StockSettings extends StatefulComponent { class StockSettings extends StatefulComponent {
const StockSettings(this.configuration, this.updater); const StockSettings(this.configuration, this.updater);
......
part of stocks; // Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:intl/intl.dart';
import 'package:flutter/widgets.dart';
// Wrappers for strings that are shown in the UI. The strings can be // Wrappers for strings that are shown in the UI. The strings can be
// translated for different locales using the Dart intl package. // translated for different locales using the Dart intl package.
......
...@@ -2,7 +2,11 @@ ...@@ -2,7 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
part of stocks; import 'package:flutter/material.dart';
import 'stock_data.dart';
import 'stock_arrow.dart';
import 'stock_row.dart';
class StockSymbolView extends StatelessComponent { class StockSymbolView extends StatelessComponent {
StockSymbolView({ this.stock }); StockSymbolView({ this.stock });
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
part of stocks;
enum StockMode { optimistic, pessimistic } enum StockMode { optimistic, pessimistic }
enum BackupMode { enabled, disabled } enum BackupMode { enabled, disabled }
......
...@@ -2,11 +2,8 @@ ...@@ -2,11 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/painting.dart'; import 'package:flutter/rendering.dart' show debugDumpRenderTree;
import 'package:flutter/rendering.dart';
class CardModel { class CardModel {
CardModel(this.value, this.height) { CardModel(this.value, this.height) {
...@@ -394,7 +391,7 @@ class CardCollectionState extends State<CardCollection> { ...@@ -394,7 +391,7 @@ class CardCollectionState extends State<CardCollection> {
}); });
} }
ui.Shader _createShader(Rect bounds) { Shader _createShader(Rect bounds) {
return new LinearGradient( return new LinearGradient(
begin: bounds.topLeft, begin: bounds.topLeft,
end: bounds.bottomLeft, end: bounds.bottomLeft,
......
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as ui;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';
import 'package:flutter/rendering.dart';
class ExampleDragTarget extends StatefulComponent { class ExampleDragTarget extends StatefulComponent {
ExampleDragTargetState createState() => new ExampleDragTargetState(); ExampleDragTargetState createState() => new ExampleDragTargetState();
...@@ -144,7 +141,7 @@ class DashOutlineCirclePainter extends CustomPainter { ...@@ -144,7 +141,7 @@ class DashOutlineCirclePainter extends CustomPainter {
final double radius = size.shortestSide / 2.0; final double radius = size.shortestSide / 2.0;
final Paint paint = new Paint() final Paint paint = new Paint()
..color = const Color(0xFF000000) ..color = const Color(0xFF000000)
..style = ui.PaintingStyle.stroke ..style = PaintingStyle.stroke
..strokeWidth = radius / 10.0; ..strokeWidth = radius / 10.0;
final Path path = new Path(); final Path path = new Path();
final Rect box = Point.origin & size; final Rect box = Point.origin & size;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a // for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file. // BSD-style license that can be found in the LICENSE file.
import 'dart:ui' as ui; import 'dart:ui' as ui show window;
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/animation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
const double _kHeight = 150.0; const double _kHeight = 150.0;
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/painting.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
void main() { void main() {
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui;
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -36,7 +34,7 @@ class _MarkerPainter extends CustomPainter { ...@@ -36,7 +34,7 @@ class _MarkerPainter extends CustomPainter {
paint paint
..color = const Color(0xFFFFFFFF) ..color = const Color(0xFFFFFFFF)
..style = ui.PaintingStyle.stroke ..style = PaintingStyle.stroke
..strokeWidth = 1.0; ..strokeWidth = 1.0;
if (type == MarkerType.topLeft) { if (type == MarkerType.topLeft) {
canvas.drawLine(new Point(r, r), new Point(r + r - 1.0, r), paint); canvas.drawLine(new Point(r, r), new Point(r + r - 1.0, r), paint);
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';
class CardModel { class CardModel {
CardModel(this.value, this.size, this.color); CardModel(this.value, this.size, this.color);
......
// Copyright (c) 2016, the Flutter project authors. Please see the AUTHORS file // Copyright (c) 2016, the Flutter project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a // for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file. // BSD-style license that can be found in the LICENSE file.
import 'dart:ui' as ui;
import 'dart:ui' as ui show window;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
......
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/animation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
final List<Map<int, Color>> _kColors = <Map<int, Color>>[ final List<Map<int, Color>> _kColors = <Map<int, Color>>[
Colors.amber, Colors.amber,
......
...@@ -2,15 +2,13 @@ ...@@ -2,15 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter_rendering_examples/solid_color_box.dart'; import 'package:flutter_rendering_examples/solid_color_box.dart';
// Solid colour, RenderObject version // Solid colour, RenderObject version
void addFlexChildSolidColor(RenderFlex parent, ui.Color backgroundColor, { int flex: 0 }) { void addFlexChildSolidColor(RenderFlex parent, Color backgroundColor, { int flex: 0 }) {
RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor); RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor);
parent.add(child); parent.add(child);
FlexParentData childParentData = child.parentData; FlexParentData childParentData = child.parentData;
...@@ -92,9 +90,9 @@ void main() { ...@@ -92,9 +90,9 @@ void main() {
attachWidgetTreeToRenderTree(proxy); attachWidgetTreeToRenderTree(proxy);
RenderFlex flexRoot = new RenderFlex(direction: FlexDirection.vertical); RenderFlex flexRoot = new RenderFlex(direction: FlexDirection.vertical);
addFlexChildSolidColor(flexRoot, const ui.Color(0xFFFF00FF), flex: 1); addFlexChildSolidColor(flexRoot, const Color(0xFFFF00FF), flex: 1);
flexRoot.add(proxy); flexRoot.add(proxy);
addFlexChildSolidColor(flexRoot, const ui.Color(0xFF0000FF), flex: 1); addFlexChildSolidColor(flexRoot, const Color(0xFF0000FF), flex: 1);
transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.identity()); transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.identity());
RenderPadding root = new RenderPadding(padding: new EdgeDims.all(80.0), child: transformBox); RenderPadding root = new RenderPadding(padding: new EdgeDims.all(80.0), child: transformBox);
......
...@@ -15,5 +15,4 @@ export 'src/animation/animations.dart'; ...@@ -15,5 +15,4 @@ export 'src/animation/animations.dart';
export 'src/animation/curves.dart'; export 'src/animation/curves.dart';
export 'src/animation/forces.dart'; export 'src/animation/forces.dart';
export 'src/animation/listener_helpers.dart'; export 'src/animation/listener_helpers.dart';
export 'src/animation/ticker.dart';
export 'src/animation/tween.dart'; export 'src/animation/tween.dart';
...@@ -17,7 +17,6 @@ export 'src/painting/box_painter.dart'; ...@@ -17,7 +17,6 @@ export 'src/painting/box_painter.dart';
export 'src/painting/colors.dart'; export 'src/painting/colors.dart';
export 'src/painting/decoration.dart'; export 'src/painting/decoration.dart';
export 'src/painting/edge_dims.dart'; export 'src/painting/edge_dims.dart';
export 'src/painting/shadows.dart';
export 'src/painting/text_editing.dart'; export 'src/painting/text_editing.dart';
export 'src/painting/text_painter.dart'; export 'src/painting/text_painter.dart';
export 'src/painting/text_style.dart'; export 'src/painting/text_style.dart';
......
...@@ -12,3 +12,4 @@ ...@@ -12,3 +12,4 @@
library scheduler; library scheduler;
export 'src/scheduler/scheduler.dart'; export 'src/scheduler/scheduler.dart';
export 'src/scheduler/ticker.dart';
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' show Color, Size, Rect, VoidCallback, lerpDouble; import 'dart:ui' show Color, Size, Rect, VoidCallback;
/// The direction in which an animation is running. /// The direction in which an animation is running.
enum AnimationDirection { enum AnimationDirection {
......
...@@ -3,15 +3,15 @@ ...@@ -3,15 +3,15 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async'; import 'dart:async';
import 'dart:ui' show VoidCallback, lerpDouble; import 'dart:ui' as ui show lerpDouble;
import 'package:flutter/scheduler.dart';
import 'package:newton/newton.dart'; import 'package:newton/newton.dart';
import 'animation.dart'; import 'animation.dart';
import 'curves.dart'; import 'curves.dart';
import 'forces.dart'; import 'forces.dart';
import 'listener_helpers.dart'; import 'listener_helpers.dart';
import 'ticker.dart';
/// A controller for an animation. /// A controller for an animation.
/// ///
...@@ -20,7 +20,7 @@ import 'ticker.dart'; ...@@ -20,7 +20,7 @@ import 'ticker.dart';
/// bounds of the animation and can drive an animation using a physics /// bounds of the animation and can drive an animation using a physics
/// simulation. /// simulation.
class AnimationController extends Animation<double> class AnimationController extends Animation<double>
with EagerListenerMixin, LocalListenersMixin, LocalAnimationStatusListenersMixin { with AnimationEagerListenerMixin, AnimationLocalListenersMixin, AnimationLocalStatusListenersMixin {
/// Creates an animation controller. /// Creates an animation controller.
/// ///
...@@ -257,7 +257,7 @@ class _RepeatingSimulation extends Simulation { ...@@ -257,7 +257,7 @@ class _RepeatingSimulation extends Simulation {
double x(double timeInSeconds) { double x(double timeInSeconds) {
assert(timeInSeconds >= 0.0); assert(timeInSeconds >= 0.0);
final double t = (timeInSeconds / _periodInSeconds) % 1.0; final double t = (timeInSeconds / _periodInSeconds) % 1.0;
return lerpDouble(min, max, t); return ui.lerpDouble(min, max, t);
} }
double dx(double timeInSeconds) => 1.0; double dx(double timeInSeconds) => 1.0;
......
...@@ -63,7 +63,7 @@ class AlwaysStoppedAnimation extends Animation<double> { ...@@ -63,7 +63,7 @@ class AlwaysStoppedAnimation extends Animation<double> {
/// Implements most of the [Animation] interface, by deferring its behavior to a /// Implements most of the [Animation] interface, by deferring its behavior to a
/// given [parent] Animation. To implement an [Animation] that proxies to a /// given [parent] Animation. To implement an [Animation] that proxies to a
/// parent, this class plus implementing "T get value" is all that is necessary. /// parent, this class plus implementing "T get value" is all that is necessary.
abstract class ProxyAnimatedMixin<T> { abstract class AnimationWithParentMixin<T> {
/// The animation whose value this animation will proxy. /// The animation whose value this animation will proxy.
/// ///
/// This animation must remain the same for the lifetime of this object. If /// This animation must remain the same for the lifetime of this object. If
...@@ -87,7 +87,7 @@ abstract class ProxyAnimatedMixin<T> { ...@@ -87,7 +87,7 @@ abstract class ProxyAnimatedMixin<T> {
/// object, and then later change the animation from which the proxy receieves /// object, and then later change the animation from which the proxy receieves
/// its value. /// its value.
class ProxyAnimation extends Animation<double> class ProxyAnimation extends Animation<double>
with LazyListenerMixin, LocalListenersMixin, LocalAnimationStatusListenersMixin { with AnimationLazyListenerMixin, AnimationLocalListenersMixin, AnimationLocalStatusListenersMixin {
ProxyAnimation([Animation<double> animation]) { ProxyAnimation([Animation<double> animation]) {
_parent = animation; _parent = animation;
if (_parent == null) { if (_parent == null) {
...@@ -158,7 +158,7 @@ class ProxyAnimation extends Animation<double> ...@@ -158,7 +158,7 @@ class ProxyAnimation extends Animation<double>
/// 0.0 because the tween does not change the status or direction of the /// 0.0 because the tween does not change the status or direction of the
/// animation. /// animation.
class ReverseAnimation extends Animation<double> class ReverseAnimation extends Animation<double>
with LazyListenerMixin, LocalAnimationStatusListenersMixin { with AnimationLazyListenerMixin, AnimationLocalStatusListenersMixin {
ReverseAnimation(this.parent); ReverseAnimation(this.parent);
/// The animation whose value and direction this animation is reversing. /// The animation whose value and direction this animation is reversing.
...@@ -211,7 +211,7 @@ class ReverseAnimation extends Animation<double> ...@@ -211,7 +211,7 @@ class ReverseAnimation extends Animation<double>
/// [CurvedAnimation] is useful when you wish to apply a [Curve] and you already /// [CurvedAnimation] is useful when you wish to apply a [Curve] and you already
/// have the underlying animation object. If you don't yet have an animation and /// have the underlying animation object. If you don't yet have an animation and
/// want to apply a [Curve] to a [Tween], consider using [CurveTween]. /// want to apply a [Curve] to a [Tween], consider using [CurveTween].
class CurvedAnimation extends Animation<double> with ProxyAnimatedMixin<double> { class CurvedAnimation extends Animation<double> with AnimationWithParentMixin<double> {
CurvedAnimation({ CurvedAnimation({
this.parent, this.parent,
this.curve: Curves.linear, this.curve: Curves.linear,
...@@ -283,7 +283,7 @@ enum _TrainHoppingMode { minimize, maximize } ...@@ -283,7 +283,7 @@ enum _TrainHoppingMode { minimize, maximize }
/// removed, it exposes a [dispose()] method. Call this method to shut this /// removed, it exposes a [dispose()] method. Call this method to shut this
/// object down. /// object down.
class TrainHoppingAnimation extends Animation<double> class TrainHoppingAnimation extends Animation<double>
with EagerListenerMixin, LocalListenersMixin, LocalAnimationStatusListenersMixin { with AnimationEagerListenerMixin, AnimationLocalListenersMixin, AnimationLocalStatusListenersMixin {
TrainHoppingAnimation(this._currentTrain, this._nextTrain, { this.onSwitchedTrain }) { TrainHoppingAnimation(this._currentTrain, this._nextTrain, { this.onSwitchedTrain }) {
assert(_currentTrain != null); assert(_currentTrain != null);
if (_nextTrain != null) { if (_nextTrain != null) {
......
...@@ -12,7 +12,7 @@ abstract class _ListenerMixin { ...@@ -12,7 +12,7 @@ abstract class _ListenerMixin {
} }
/// A mixin that helps listen to another object only when this object has registered listeners. /// A mixin that helps listen to another object only when this object has registered listeners.
abstract class LazyListenerMixin implements _ListenerMixin { abstract class AnimationLazyListenerMixin implements _ListenerMixin {
int _listenerCounter = 0; int _listenerCounter = 0;
void didRegisterListener() { void didRegisterListener() {
assert(_listenerCounter >= 0); assert(_listenerCounter >= 0);
...@@ -33,7 +33,7 @@ abstract class LazyListenerMixin implements _ListenerMixin { ...@@ -33,7 +33,7 @@ abstract class LazyListenerMixin implements _ListenerMixin {
/// A mixin that replaces the didRegisterListener/didUnregisterListener contract /// A mixin that replaces the didRegisterListener/didUnregisterListener contract
/// with a dispose contract. /// with a dispose contract.
abstract class EagerListenerMixin implements _ListenerMixin { abstract class AnimationEagerListenerMixin implements _ListenerMixin {
void didRegisterListener() { } void didRegisterListener() { }
void didUnregisterListener() { } void didUnregisterListener() { }
...@@ -43,7 +43,7 @@ abstract class EagerListenerMixin implements _ListenerMixin { ...@@ -43,7 +43,7 @@ abstract class EagerListenerMixin implements _ListenerMixin {
/// A mixin that implements the addListener/removeListener protocol and notifies /// A mixin that implements the addListener/removeListener protocol and notifies
/// all the registered listeners when notifyListeners is invoked. /// all the registered listeners when notifyListeners is invoked.
abstract class LocalListenersMixin extends _ListenerMixin { abstract class AnimationLocalListenersMixin extends _ListenerMixin {
final List<VoidCallback> _listeners = <VoidCallback>[]; final List<VoidCallback> _listeners = <VoidCallback>[];
void addListener(VoidCallback listener) { void addListener(VoidCallback listener) {
didRegisterListener(); didRegisterListener();
...@@ -63,7 +63,7 @@ abstract class LocalListenersMixin extends _ListenerMixin { ...@@ -63,7 +63,7 @@ abstract class LocalListenersMixin extends _ListenerMixin {
/// A mixin that implements the addStatusListener/removeStatusListener protocol /// A mixin that implements the addStatusListener/removeStatusListener protocol
/// and notifies all the registered listeners when notifyStatusListeners is /// and notifies all the registered listeners when notifyStatusListeners is
/// invoked. /// invoked.
abstract class LocalAnimationStatusListenersMixin extends _ListenerMixin { abstract class AnimationLocalStatusListenersMixin extends _ListenerMixin {
final List<AnimationStatusListener> _statusListeners = <AnimationStatusListener>[]; final List<AnimationStatusListener> _statusListeners = <AnimationStatusListener>[];
void addStatusListener(AnimationStatusListener listener) { void addStatusListener(AnimationStatusListener listener) {
didRegisterListener(); didRegisterListener();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' show Color, Size, Rect, VoidCallback, lerpDouble; import 'dart:ui' show Color, Size, Rect, VoidCallback;
import 'animation.dart'; import 'animation.dart';
import 'animations.dart'; import 'animations.dart';
...@@ -28,7 +28,7 @@ abstract class Animatable<T> { ...@@ -28,7 +28,7 @@ abstract class Animatable<T> {
} }
} }
class _AnimatedEvaluation<T> extends Animation<T> with ProxyAnimatedMixin<double> { class _AnimatedEvaluation<T> extends Animation<T> with AnimationWithParentMixin<double> {
_AnimatedEvaluation(this.parent, this._evaluatable); _AnimatedEvaluation(this.parent, this._evaluatable);
/// The animation from which this value is derived. /// The animation from which this value is derived.
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:typed_data'; import 'dart:typed_data';
import 'dart:ui' as ui; import 'dart:ui' as ui show window;
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:mojo/bindings.dart' as mojo_bindings; import 'package:mojo/bindings.dart' as mojo_bindings;
......
...@@ -4,9 +4,6 @@ ...@@ -4,9 +4,6 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/animation.dart';
import 'package:flutter/painting.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'colors.dart'; import 'colors.dart';
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui; import 'dart:ui' as ui show Gradient;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
...@@ -122,23 +122,24 @@ class _RenderCheckbox extends RenderToggleable { ...@@ -122,23 +122,24 @@ class _RenderCheckbox extends RenderToggleable {
// Create an inner rectangle to cover inside of rectangle. This is needed to avoid // Create an inner rectangle to cover inside of rectangle. This is needed to avoid
// painting artefacts caused by overlayed paintings. // painting artefacts caused by overlayed paintings.
Rect innerRect = rect.deflate(1.0); Rect innerRect = rect.deflate(1.0);
ui.RRect rrect = new ui.RRect.fromRectXY( RRect rrect = new RRect.fromRectXY(rect, _kEdgeRadius, _kEdgeRadius);
rect, _kEdgeRadius, _kEdgeRadius);
// Outline of the empty rrect // Outline of the empty rrect
paint.style = ui.PaintingStyle.stroke; paint.style = PaintingStyle.stroke;
canvas.drawRRect(rrect, paint); canvas.drawRRect(rrect, paint);
// Radial gradient that changes size // Radial gradient that changes size
if (!position.isDismissed) { if (!position.isDismissed) {
paint paint
..style = ui.PaintingStyle.fill ..style = PaintingStyle.fill
..shader = new ui.Gradient.radial( ..shader = new ui.Gradient.radial(
new Point(_kEdgeSize / 2.0, _kEdgeSize / 2.0), new Point(_kEdgeSize / 2.0, _kEdgeSize / 2.0),
_kEdgeSize * (_kMidpoint - position.value) * 8.0, <Color>[ _kEdgeSize * (_kMidpoint - position.value) * 8.0,
const Color(0x00000000), <Color>[
inactiveColor const Color(0x00000000),
]); inactiveColor
]
);
canvas.drawRect(innerRect, paint); canvas.drawRect(innerRect, paint);
} }
...@@ -149,24 +150,22 @@ class _RenderCheckbox extends RenderToggleable { ...@@ -149,24 +150,22 @@ class _RenderCheckbox extends RenderToggleable {
// First draw a rounded rect outline then fill inner rectangle with the active color // First draw a rounded rect outline then fill inner rectangle with the active color
paint paint
..color = activeColor.withAlpha((t * 255).floor()) ..color = activeColor.withAlpha((t * 255).floor())
..style = ui.PaintingStyle.stroke; ..style = PaintingStyle.stroke;
canvas.drawRRect(rrect, paint); canvas.drawRRect(rrect, paint);
paint.style = ui.PaintingStyle.fill; paint.style = PaintingStyle.fill;
canvas.drawRect(innerRect, paint); canvas.drawRect(innerRect, paint);
} }
// White inner check // White inner check
paint paint
..color = const Color(0xFFFFFFFF) ..color = const Color(0xFFFFFFFF)
..style = ui.PaintingStyle.stroke; ..style = PaintingStyle.stroke;
Path path = new Path(); Path path = new Path();
Point start = new Point(_kEdgeSize * 0.15, _kEdgeSize * 0.45); Point start = new Point(_kEdgeSize * 0.15, _kEdgeSize * 0.45);
Point mid = new Point(_kEdgeSize * 0.4, _kEdgeSize * 0.7); Point mid = new Point(_kEdgeSize * 0.4, _kEdgeSize * 0.7);
Point end = new Point(_kEdgeSize * 0.85, _kEdgeSize * 0.25); Point end = new Point(_kEdgeSize * 0.85, _kEdgeSize * 0.25);
Point lerp(Point p1, Point p2, double t) => Point drawStart = Point.lerp(start, mid, 1.0 - t);
new Point(p1.x * (1.0 - t) + p2.x * t, p1.y * (1.0 - t) + p2.y * t); Point drawEnd = Point.lerp(mid, end, t);
Point drawStart = lerp(start, mid, 1.0 - t);
Point drawEnd = lerp(mid, end, t);
path.moveTo(offsetX + drawStart.x, offsetY + drawStart.y); path.moveTo(offsetX + drawStart.x, offsetY + drawStart.y);
path.lineTo(offsetX + mid.x, offsetY + mid.y); path.lineTo(offsetX + mid.x, offsetY + mid.y);
path.lineTo(offsetX + drawEnd.x, offsetY + drawEnd.y); path.lineTo(offsetX + drawEnd.x, offsetY + drawEnd.y);
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/painting.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'constants.dart'; import 'constants.dart';
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/animation.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'colors.dart'; import 'colors.dart';
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/animation.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'colors.dart'; import 'colors.dart';
......
...@@ -4,9 +4,6 @@ ...@@ -4,9 +4,6 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/animation.dart';
import 'package:flutter/painting.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'debug.dart'; import 'debug.dart';
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
import 'dart:math' as math; import 'dart:math' as math;
import 'package:flutter/animation.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'debug.dart'; import 'debug.dart';
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/animation.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'icon_theme.dart'; import 'icon_theme.dart';
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui; import 'dart:ui' as ui show lerpDouble;
import 'dart:ui' show hashValues;
enum IconThemeColor { white, black } enum IconThemeColor { white, black }
...@@ -28,7 +29,7 @@ class IconThemeData { ...@@ -28,7 +29,7 @@ class IconThemeData {
return color == typedOther.color && opacity == typedOther.opacity; return color == typedOther.color && opacity == typedOther.opacity;
} }
int get hashCode => ui.hashValues(color, opacity); int get hashCode => hashValues(color, opacity);
String toString() => '$color'; String toString() => '$color';
} }
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/animation.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:sky_services/editing/editing.mojom.dart' as mojom; import 'package:sky_services/editing/editing.mojom.dart' as mojom;
...@@ -13,7 +11,6 @@ import 'debug.dart'; ...@@ -13,7 +11,6 @@ import 'debug.dart';
import 'icon.dart'; import 'icon.dart';
import 'theme.dart'; import 'theme.dart';
export 'package:flutter/rendering.dart' show ValueChanged;
export 'package:sky_services/editing/editing.mojom.dart' show KeyboardType; export 'package:sky_services/editing/editing.mojom.dart' show KeyboardType;
/// A material design text input field. /// A material design text input field.
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
import 'dart:math' as math; import 'dart:math' as math;
import 'package:flutter/animation.dart';
import 'package:flutter/painting.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:vector_math/vector_math_64.dart'; import 'package:vector_math/vector_math_64.dart';
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async'; import 'dart:async';
import 'dart:ui' as ui; import 'dart:ui' as ui show WindowPadding, window;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
...@@ -12,6 +12,8 @@ import 'package:flutter/widgets.dart'; ...@@ -12,6 +12,8 @@ import 'package:flutter/widgets.dart';
import 'page.dart'; import 'page.dart';
import 'theme.dart'; import 'theme.dart';
export 'dart:ui' show Locale;
const TextStyle _errorTextStyle = const TextStyle( const TextStyle _errorTextStyle = const TextStyle(
color: const Color(0xD0FF0000), color: const Color(0xD0FF0000),
fontFamily: 'monospace', fontFamily: 'monospace',
...@@ -38,7 +40,7 @@ class RouteArguments { ...@@ -38,7 +40,7 @@ class RouteArguments {
} }
typedef Widget RouteBuilder(RouteArguments args); typedef Widget RouteBuilder(RouteArguments args);
typedef Future<LocaleQueryData> LocaleChangedCallback(ui.Locale locale); typedef Future<LocaleQueryData> LocaleChangedCallback(Locale locale);
class MaterialApp extends StatefulComponent { class MaterialApp extends StatefulComponent {
MaterialApp({ MaterialApp({
...@@ -152,7 +154,7 @@ class _MaterialAppState extends State<MaterialApp> implements BindingObserver { ...@@ -152,7 +154,7 @@ class _MaterialAppState extends State<MaterialApp> implements BindingObserver {
}); });
} }
void didChangeLocale(ui.Locale locale) { void didChangeLocale(Locale locale) {
if (config.onLocaleChanged != null) { if (config.onLocaleChanged != null) {
config.onLocaleChanged(locale).then((LocaleQueryData data) { config.onLocaleChanged(locale).then((LocaleQueryData data) {
if (mounted) if (mounted)
...@@ -161,7 +163,7 @@ class _MaterialAppState extends State<MaterialApp> implements BindingObserver { ...@@ -161,7 +163,7 @@ class _MaterialAppState extends State<MaterialApp> implements BindingObserver {
} }
} }
void didChangeAppLifecycleState(ui.AppLifecycleState state) { } void didChangeAppLifecycleState(AppLifecycleState state) { }
final HeroController _heroController = new HeroController(); final HeroController _heroController = new HeroController();
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/animation.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
class _MaterialPageTransition extends AnimatedComponent { class _MaterialPageTransition extends AnimatedComponent {
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/animation.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'ink_well.dart'; import 'ink_well.dart';
......
...@@ -3,9 +3,7 @@ ...@@ -3,9 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as ui;
import 'package:flutter/animation.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'theme.dart'; import 'theme.dart';
...@@ -86,7 +84,7 @@ class _LinearProgressIndicatorPainter extends CustomPainter { ...@@ -86,7 +84,7 @@ class _LinearProgressIndicatorPainter extends CustomPainter {
void paint(Canvas canvas, Size size) { void paint(Canvas canvas, Size size) {
Paint paint = new Paint() Paint paint = new Paint()
..color = backgroundColor ..color = backgroundColor
..style = ui.PaintingStyle.fill; ..style = PaintingStyle.fill;
canvas.drawRect(Point.origin & size, paint); canvas.drawRect(Point.origin & size, paint);
paint.color = valueColor; paint.color = valueColor;
...@@ -155,7 +153,7 @@ class _CircularProgressIndicatorPainter extends CustomPainter { ...@@ -155,7 +153,7 @@ class _CircularProgressIndicatorPainter extends CustomPainter {
Paint paint = new Paint() Paint paint = new Paint()
..color = valueColor ..color = valueColor
..strokeWidth = _kCircularProgressIndicatorStrokeWidth ..strokeWidth = _kCircularProgressIndicatorStrokeWidth
..style = ui.PaintingStyle.stroke; ..style = PaintingStyle.stroke;
if (value != null) { if (value != null) {
double angle = value.clamp(0.0, 1.0) * _kSweep; double angle = value.clamp(0.0, 1.0) * _kSweep;
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
...@@ -116,13 +114,13 @@ class _RenderRadio extends RenderToggleable { ...@@ -116,13 +114,13 @@ class _RenderRadio extends RenderToggleable {
// Outer circle // Outer circle
Paint paint = new Paint() Paint paint = new Paint()
..color = Color.lerp(inactiveColor, radioColor, position.value) ..color = Color.lerp(inactiveColor, radioColor, position.value)
..style = ui.PaintingStyle.stroke ..style = PaintingStyle.stroke
..strokeWidth = 2.0; ..strokeWidth = 2.0;
canvas.drawCircle(center, _kOuterRadius, paint); canvas.drawCircle(center, _kOuterRadius, paint);
// Inner circle // Inner circle
if (!position.isDismissed) { if (!position.isDismissed) {
paint.style = ui.PaintingStyle.fill; paint.style = PaintingStyle.fill;
canvas.drawCircle(center, _kInnerRadius * position.value, paint); canvas.drawCircle(center, _kInnerRadius * position.value, paint);
} }
} }
......
...@@ -6,8 +6,6 @@ import 'dart:async'; ...@@ -6,8 +6,6 @@ import 'dart:async';
import 'dart:collection'; import 'dart:collection';
import 'dart:math' as math; import 'dart:math' as math;
import 'package:flutter/animation.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'bottom_sheet.dart'; import 'bottom_sheet.dart';
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/animation.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
const double _kMinScrollbarThumbLength = 18.0; const double _kMinScrollbarThumbLength = 18.0;
......
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/animation.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/painting.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/animation.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'flat_button.dart'; import 'flat_button.dart';
......
...@@ -2,10 +2,7 @@ ...@@ -2,10 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui;
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/painting.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
...@@ -194,13 +191,13 @@ class _RenderSwitch extends RenderToggleable { ...@@ -194,13 +191,13 @@ class _RenderSwitch extends RenderToggleable {
size.width - 2.0 * trackHorizontalPadding, size.width - 2.0 * trackHorizontalPadding,
_kTrackHeight _kTrackHeight
); );
ui.RRect trackRRect = new ui.RRect.fromRectXY( RRect trackRRect = new RRect.fromRectXY(trackRect, _kTrackRadius, _kTrackRadius);
trackRect, _kTrackRadius, _kTrackRadius);
canvas.drawRRect(trackRRect, paint); canvas.drawRRect(trackRRect, paint);
Offset thumbOffset = new Offset( Offset thumbOffset = new Offset(
offset.dx + kRadialReactionRadius + position.value * _trackInnerLength, offset.dx + kRadialReactionRadius + position.value * _trackInnerLength,
offset.dy + size.height / 2.0); offset.dy + size.height / 2.0
);
paintRadialReaction(canvas, thumbOffset); paintRadialReaction(canvas, thumbOffset);
......
...@@ -6,7 +6,6 @@ import 'dart:async'; ...@@ -6,7 +6,6 @@ import 'dart:async';
import 'dart:math' as math; import 'dart:math' as math;
import 'package:newton/newton.dart'; import 'package:newton/newton.dart';
import 'package:flutter/animation.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/animation.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'theme_data.dart'; import 'theme_data.dart';
......
...@@ -4,10 +4,7 @@ ...@@ -4,10 +4,7 @@
import 'dart:math' as math; import 'dart:math' as math;
import 'package:flutter/animation.dart'; import 'package:flutter/services.dart' show HapticFeedbackType, userFeedback;
import 'package:flutter/painting.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'colors.dart'; import 'colors.dart';
......
...@@ -5,9 +5,6 @@ ...@@ -5,9 +5,6 @@
import 'dart:async'; import 'dart:async';
import 'dart:math' as math; import 'dart:math' as math;
import 'package:flutter/animation.dart';
import 'package:flutter/painting.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'colors.dart'; import 'colors.dart';
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/animation.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'colors.dart'; import 'colors.dart';
......
...@@ -3,21 +3,51 @@ ...@@ -3,21 +3,51 @@
// found in the LICENSE file. // found in the LICENSE file.
export 'dart:ui' show export 'dart:ui' show
BlurStyle,
Canvas, Canvas,
Color, Color,
ColorFilter, ColorFilter,
FilterQuality,
FontStyle, FontStyle,
FontWeight, FontWeight,
ImageShader,
LayerDrawLooperBuilder,
MaskFilter,
Offset, Offset,
Paint, Paint,
PaintingStyle,
Path, Path,
Point, Point,
RRect,
RSTransform,
Rect, Rect,
Shader,
Size, Size,
StrokeCap,
TextAlign, TextAlign,
TextBaseline, TextBaseline,
TextDecoration, TextDecoration,
TextDecorationStyle, TextDecorationStyle,
TextDirection,
TileMode,
TransferMode,
VertexMode,
VoidCallback, VoidCallback,
hashValues, hashValues,
hashList; hashList;
// Intentionally not exported:
// - Image, decodeImageFromDataPipe, decodeImageFromList:
// We use ui.* to make it very explicit that these are low-level image APIs.
// Generally, higher layers provide more reasonable APIs around images.
// - lerpDouble:
// Hopefully this will eventually become Double.lerp.
// - Paragraph, ParagraphBuilder, ParagraphStyle, TextBox:
// These are low-level text primitives. Use this package's TextPainter API.
// - Picture, PictureRecorder, Scene, SceneBuilder:
// These are low-level primitives. Generally, the rendering layer makes these moot.
// - Gradient:
// Use this package's higher-level Gradient API instead.
// - window, WindowPadding
// These are generally wrapped by other APIs so we always refer to them directly
// as ui.* to avoid making them seem like high-level APIs.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as ui; import 'dart:ui' as ui show Image, Gradient, lerpDouble;
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
...@@ -238,7 +238,7 @@ class BoxShadow { ...@@ -238,7 +238,7 @@ class BoxShadow {
/// A 2D gradient. /// A 2D gradient.
abstract class Gradient { abstract class Gradient {
const Gradient(); const Gradient();
ui.Shader createShader(); Shader createShader();
} }
/// A 2D linear gradient. /// A 2D linear gradient.
...@@ -248,7 +248,7 @@ class LinearGradient extends Gradient { ...@@ -248,7 +248,7 @@ class LinearGradient extends Gradient {
this.end, this.end,
this.colors, this.colors,
this.stops, this.stops,
this.tileMode: ui.TileMode.clamp this.tileMode: TileMode.clamp
}); });
/// The point at which stop 0.0 of the gradient is placed. /// The point at which stop 0.0 of the gradient is placed.
...@@ -269,9 +269,9 @@ class LinearGradient extends Gradient { ...@@ -269,9 +269,9 @@ class LinearGradient extends Gradient {
final List<double> stops; final List<double> stops;
/// How this gradient should tile the plane. /// How this gradient should tile the plane.
final ui.TileMode tileMode; final TileMode tileMode;
ui.Shader createShader() { Shader createShader() {
return new ui.Gradient.linear(<Point>[begin, end], this.colors, this.stops, this.tileMode); return new ui.Gradient.linear(<Point>[begin, end], this.colors, this.stops, this.tileMode);
} }
...@@ -320,7 +320,7 @@ class RadialGradient extends Gradient { ...@@ -320,7 +320,7 @@ class RadialGradient extends Gradient {
this.radius, this.radius,
this.colors, this.colors,
this.stops, this.stops,
this.tileMode: ui.TileMode.clamp this.tileMode: TileMode.clamp
}); });
/// The center of the gradient. /// The center of the gradient.
...@@ -343,9 +343,9 @@ class RadialGradient extends Gradient { ...@@ -343,9 +343,9 @@ class RadialGradient extends Gradient {
final List<double> stops; final List<double> stops;
/// How this gradient should tile the plane. /// How this gradient should tile the plane.
final ui.TileMode tileMode; final TileMode tileMode;
ui.Shader createShader() { Shader createShader() {
return new ui.Gradient.radial(center, radius, colors, stops, tileMode); return new ui.Gradient.radial(center, radius, colors, stops, tileMode);
} }
...@@ -869,7 +869,7 @@ class BoxDecoration extends Decoration { ...@@ -869,7 +869,7 @@ class BoxDecoration extends Decoration {
double shortestSide = rect.shortestSide; double shortestSide = rect.shortestSide;
// In principle, we should use shortestSide / 2.0, but we don't want to // In principle, we should use shortestSide / 2.0, but we don't want to
// run into floating point rounding errors. Instead, we just use // run into floating point rounding errors. Instead, we just use
// shortestSide and let ui.Canvas do any remaining clamping. // shortestSide and let Canvas do any remaining clamping.
return borderRadius > shortestSide ? shortestSide : borderRadius; return borderRadius > shortestSide ? shortestSide : borderRadius;
} }
...@@ -879,7 +879,7 @@ class BoxDecoration extends Decoration { ...@@ -879,7 +879,7 @@ class BoxDecoration extends Decoration {
switch (shape) { switch (shape) {
case BoxShape.rectangle: case BoxShape.rectangle:
if (borderRadius != null) { if (borderRadius != null) {
ui.RRect bounds = new ui.RRect.fromRectXY(Point.origin & size, borderRadius, borderRadius); RRect bounds = new RRect.fromRectXY(Point.origin & size, borderRadius, borderRadius);
return bounds.contains(position); return bounds.contains(position);
} }
return true; return true;
...@@ -938,7 +938,7 @@ class _BoxDecorationPainter extends BoxPainter { ...@@ -938,7 +938,7 @@ class _BoxDecorationPainter extends BoxPainter {
return hasUniformWidth; return hasUniformWidth;
} }
void _paintBox(ui.Canvas canvas, Rect rect, Paint paint) { void _paintBox(Canvas canvas, Rect rect, Paint paint) {
switch (_decoration.shape) { switch (_decoration.shape) {
case BoxShape.circle: case BoxShape.circle:
assert(_decoration.borderRadius == null); assert(_decoration.borderRadius == null);
...@@ -951,30 +951,30 @@ class _BoxDecorationPainter extends BoxPainter { ...@@ -951,30 +951,30 @@ class _BoxDecorationPainter extends BoxPainter {
canvas.drawRect(rect, paint); canvas.drawRect(rect, paint);
} else { } else {
double radius = _decoration.getEffectiveBorderRadius(rect); double radius = _decoration.getEffectiveBorderRadius(rect);
canvas.drawRRect(new ui.RRect.fromRectXY(rect, radius, radius), paint); canvas.drawRRect(new RRect.fromRectXY(rect, radius, radius), paint);
} }
break; break;
} }
} }
void _paintShadows(ui.Canvas canvas, Rect rect) { void _paintShadows(Canvas canvas, Rect rect) {
if (_decoration.boxShadow == null) if (_decoration.boxShadow == null)
return; return;
for (BoxShadow boxShadow in _decoration.boxShadow) { for (BoxShadow boxShadow in _decoration.boxShadow) {
final Paint paint = new Paint() final Paint paint = new Paint()
..color = boxShadow.color ..color = boxShadow.color
..maskFilter = new ui.MaskFilter.blur(ui.BlurStyle.normal, boxShadow._blurSigma); ..maskFilter = new MaskFilter.blur(BlurStyle.normal, boxShadow._blurSigma);
final Rect bounds = rect.shift(boxShadow.offset).inflate(boxShadow.spreadRadius); final Rect bounds = rect.shift(boxShadow.offset).inflate(boxShadow.spreadRadius);
_paintBox(canvas, bounds, paint); _paintBox(canvas, bounds, paint);
} }
} }
void _paintBackgroundColor(ui.Canvas canvas, Rect rect) { void _paintBackgroundColor(Canvas canvas, Rect rect) {
if (_decoration.backgroundColor != null || _decoration.gradient != null) if (_decoration.backgroundColor != null || _decoration.gradient != null)
_paintBox(canvas, rect, _backgroundPaint); _paintBox(canvas, rect, _backgroundPaint);
} }
void _paintBackgroundImage(ui.Canvas canvas, Rect rect) { void _paintBackgroundImage(Canvas canvas, Rect rect) {
final BackgroundImage backgroundImage = _decoration.backgroundImage; final BackgroundImage backgroundImage = _decoration.backgroundImage;
if (backgroundImage == null) if (backgroundImage == null)
return; return;
...@@ -993,7 +993,7 @@ class _BoxDecorationPainter extends BoxPainter { ...@@ -993,7 +993,7 @@ class _BoxDecorationPainter extends BoxPainter {
); );
} }
void _paintBorder(ui.Canvas canvas, Rect rect) { void _paintBorder(Canvas canvas, Rect rect) {
if (_decoration.border == null) if (_decoration.border == null)
return; return;
...@@ -1056,19 +1056,19 @@ class _BoxDecorationPainter extends BoxPainter { ...@@ -1056,19 +1056,19 @@ class _BoxDecorationPainter extends BoxPainter {
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
} }
void _paintBorderWithRadius(ui.Canvas canvas, Rect rect) { void _paintBorderWithRadius(Canvas canvas, Rect rect) {
assert(_hasUniformBorder); assert(_hasUniformBorder);
assert(_decoration.shape == BoxShape.rectangle); assert(_decoration.shape == BoxShape.rectangle);
Color color = _decoration.border.top.color; Color color = _decoration.border.top.color;
double width = _decoration.border.top.width; double width = _decoration.border.top.width;
double radius = _decoration.getEffectiveBorderRadius(rect); double radius = _decoration.getEffectiveBorderRadius(rect);
ui.RRect outer = new ui.RRect.fromRectXY(rect, radius, radius); RRect outer = new RRect.fromRectXY(rect, radius, radius);
ui.RRect inner = new ui.RRect.fromRectXY(rect.deflate(width), radius - width, radius - width); RRect inner = new RRect.fromRectXY(rect.deflate(width), radius - width, radius - width);
canvas.drawDRRect(outer, inner, new Paint()..color = color); canvas.drawDRRect(outer, inner, new Paint()..color = color);
} }
void _paintBorderWithCircle(ui.Canvas canvas, Rect rect) { void _paintBorderWithCircle(Canvas canvas, Rect rect) {
assert(_hasUniformBorder); assert(_hasUniformBorder);
assert(_decoration.shape == BoxShape.circle); assert(_decoration.shape == BoxShape.circle);
assert(_decoration.borderRadius == null); assert(_decoration.borderRadius == null);
...@@ -1078,14 +1078,14 @@ class _BoxDecorationPainter extends BoxPainter { ...@@ -1078,14 +1078,14 @@ class _BoxDecorationPainter extends BoxPainter {
Paint paint = new Paint() Paint paint = new Paint()
..color = _decoration.border.top.color ..color = _decoration.border.top.color
..strokeWidth = width ..strokeWidth = width
..style = ui.PaintingStyle.stroke; ..style = PaintingStyle.stroke;
Point center = rect.center; Point center = rect.center;
double radius = (rect.shortestSide - width) / 2.0; double radius = (rect.shortestSide - width) / 2.0;
canvas.drawCircle(center, radius, paint); canvas.drawCircle(center, radius, paint);
} }
/// Paint the box decoration into the given location on the given canvas /// Paint the box decoration into the given location on the given canvas
void paint(ui.Canvas canvas, Rect rect) { void paint(Canvas canvas, Rect rect) {
_paintShadows(canvas, rect); _paintShadows(canvas, rect);
_paintBackgroundColor(canvas, rect); _paintBackgroundColor(canvas, rect);
_paintBackgroundImage(canvas, rect); _paintBackgroundImage(canvas, rect);
......
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui; import 'basic_types.dart';
import 'edge_dims.dart'; import 'edge_dims.dart';
export 'edge_dims.dart' show EdgeDims; export 'edge_dims.dart' show EdgeDims;
...@@ -16,14 +15,14 @@ abstract class Decoration { ...@@ -16,14 +15,14 @@ abstract class Decoration {
EdgeDims get padding => null; EdgeDims get padding => null;
Decoration lerpFrom(Decoration a, double t) => this; Decoration lerpFrom(Decoration a, double t) => this;
Decoration lerpTo(Decoration b, double t) => b; Decoration lerpTo(Decoration b, double t) => b;
bool hitTest(ui.Size size, ui.Point position) => true; bool hitTest(Size size, Point position) => true;
bool get needsListeners => false; bool get needsListeners => false;
void addChangeListener(ui.VoidCallback listener) { assert(false); } void addChangeListener(VoidCallback listener) { assert(false); }
void removeChangeListener(ui.VoidCallback listener) { assert(false); } void removeChangeListener(VoidCallback listener) { assert(false); }
BoxPainter createBoxPainter(); BoxPainter createBoxPainter();
String toString([String prefix = '']) => '$prefix$runtimeType'; String toString([String prefix = '']) => '$prefix$runtimeType';
} }
abstract class BoxPainter { abstract class BoxPainter {
void paint(ui.Canvas canvas, ui.Rect rect); void paint(Canvas canvas, Rect rect);
} }
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui; import 'dart:ui' as ui show lerpDouble;
import 'dart:ui' show hashValues;
import 'basic_types.dart';
/// An immutable set of offsets in each of the four cardinal directions. /// An immutable set of offsets in each of the four cardinal directions.
/// ///
...@@ -50,13 +51,13 @@ class EdgeDims { ...@@ -50,13 +51,13 @@ class EdgeDims {
double get vertical => top + bottom; double get vertical => top + bottom;
/// The size that this EdgeDims would occupy with an empty interior. /// The size that this EdgeDims would occupy with an empty interior.
ui.Size get collapsedSize => new ui.Size(horizontal, vertical); Size get collapsedSize => new Size(horizontal, vertical);
/// An EdgeDims with top and bottom as well as left and right flipped. /// An EdgeDims with top and bottom as well as left and right flipped.
EdgeDims get flipped => new EdgeDims.TRBL(bottom, left, top, right); EdgeDims get flipped => new EdgeDims.TRBL(bottom, left, top, right);
ui.Rect inflateRect(ui.Rect rect) { Rect inflateRect(Rect rect) {
return new ui.Rect.fromLTRB(rect.left - left, rect.top - top, rect.right + right, rect.bottom + bottom); return new Rect.fromLTRB(rect.left - left, rect.top - top, rect.right + right, rect.bottom + bottom);
} }
EdgeDims operator -(EdgeDims other) { EdgeDims operator -(EdgeDims other) {
......
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:ui' as ui;
/// A helper class to build a [ui.DrawLooper] for drawing shadows
class ShadowDrawLooperBuilder {
ui.LayerDrawLooperBuilder _builder = new ui.LayerDrawLooperBuilder();
/// Adds a shadow with the given parameters.
void addShadow(ui.Offset offset, ui.Color color, double blur) {
_builder.addLayerOnTop(
new ui.DrawLooperLayerInfo()
..setPaintBits(ui.PaintBits.all)
..setOffset(offset)
..setColorMode(ui.TransferMode.src),
new ui.Paint()
..color = color
..maskFilter = new ui.MaskFilter.blur(ui.BlurStyle.normal, blur)
);
}
/// Returns the draw looper built for the added shadows
ui.DrawLooper build() {
_builder.addLayerOnTop(new ui.DrawLooperLayerInfo(), new ui.Paint());
return _builder.build();
}
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui; import 'dart:ui' as ui show Paragraph, ParagraphBuilder, ParagraphStyle, TextBox;
import 'basic_types.dart'; import 'basic_types.dart';
import 'text_editing.dart'; import 'text_editing.dart';
...@@ -212,7 +212,7 @@ class TextPainter { ...@@ -212,7 +212,7 @@ class TextPainter {
} }
/// Paints the text onto the given canvas at the given offset. /// Paints the text onto the given canvas at the given offset.
void paint(ui.Canvas canvas, ui.Offset offset) { void paint(Canvas canvas, Offset offset) {
assert(!_needsLayout && "Please call layout() before paint() to position the text before painting it." is String); assert(!_needsLayout && "Please call layout() before paint() to position the text before painting it." is String);
_paragraph.paint(canvas, offset); _paragraph.paint(canvas, offset);
} }
...@@ -223,7 +223,7 @@ class TextPainter { ...@@ -223,7 +223,7 @@ class TextPainter {
return null; return null;
ui.TextBox box = boxes[0]; ui.TextBox box = boxes[0];
double caretEnd = box.end; double caretEnd = box.end;
double dx = box.direction == ui.TextDirection.rtl ? caretEnd : caretEnd - caretPrototype.width; double dx = box.direction == TextDirection.rtl ? caretEnd : caretEnd - caretPrototype.width;
return new Offset(dx, 0.0); return new Offset(dx, 0.0);
} }
...@@ -233,7 +233,7 @@ class TextPainter { ...@@ -233,7 +233,7 @@ class TextPainter {
return null; return null;
ui.TextBox box = boxes[0]; ui.TextBox box = boxes[0];
double caretStart = box.start; double caretStart = box.start;
double dx = box.direction == ui.TextDirection.rtl ? caretStart - caretPrototype.width : caretStart; double dx = box.direction == TextDirection.rtl ? caretStart - caretPrototype.width : caretStart;
return new Offset(dx, 0.0); return new Offset(dx, 0.0);
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui; import 'dart:ui' as ui show ParagraphStyle, TextStyle, lerpDouble;
import 'basic_types.dart'; import 'basic_types.dart';
......
...@@ -2,19 +2,6 @@ ...@@ -2,19 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
export 'dart:ui' show
Canvas,
Color,
ColorFilter,
Offset,
Paint,
Path,
Point,
Rect,
Size,
TransferMode,
VoidCallback;
typedef void ValueChanged<T>(T value); typedef void ValueChanged<T>(T value);
/// A BitField over an enum (or other class whose values implement "index"). /// A BitField over an enum (or other class whose values implement "index").
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui; import 'dart:ui' as ui show window;
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/scheduler.dart'; import 'package:flutter/scheduler.dart';
......
...@@ -3,19 +3,15 @@ ...@@ -3,19 +3,15 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as ui; import 'dart:ui' as ui show lerpDouble;
import 'dart:ui' show hashValues;
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/painting.dart';
import 'package:vector_math/vector_math_64.dart'; import 'package:vector_math/vector_math_64.dart';
import 'debug.dart'; import 'debug.dart';
import 'object.dart'; import 'object.dart';
export 'package:flutter/painting.dart' show EdgeDims, FractionalOffset, TextBaseline;
// This class should only be used in debug builds // This class should only be used in debug builds
class _DebugSize extends Size { class _DebugSize extends Size {
_DebugSize(Size source, this._owner, this._canBeUsedByParent): super.copy(source); _DebugSize(Size source, this._owner, this._canBeUsedByParent): super.copy(source);
...@@ -837,7 +833,7 @@ abstract class RenderBox extends RenderObject { ...@@ -837,7 +833,7 @@ abstract class RenderBox extends RenderObject {
void debugPaintSize(PaintingContext context, Offset offset) { void debugPaintSize(PaintingContext context, Offset offset) {
assert(() { assert(() {
Paint paint = new Paint() Paint paint = new Paint()
..style = ui.PaintingStyle.stroke ..style = PaintingStyle.stroke
..strokeWidth = 1.0 ..strokeWidth = 1.0
..color = debugPaintSizeColor; ..color = debugPaintSizeColor;
context.canvas.drawRect((offset & size).deflate(0.5), paint); context.canvas.drawRect((offset & size).deflate(0.5), paint);
...@@ -847,7 +843,7 @@ abstract class RenderBox extends RenderObject { ...@@ -847,7 +843,7 @@ abstract class RenderBox extends RenderObject {
void debugPaintBaselines(PaintingContext context, Offset offset) { void debugPaintBaselines(PaintingContext context, Offset offset) {
assert(() { assert(() {
Paint paint = new Paint() Paint paint = new Paint()
..style = ui.PaintingStyle.stroke ..style = PaintingStyle.stroke
..strokeWidth = 0.25; ..strokeWidth = 0.25;
Path path; Path path;
// ideographic baseline // ideographic baseline
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert' show JSON; import 'dart:convert' show JSON;
import 'dart:developer' as developer; import 'dart:developer' as developer;
import 'dart:ui' as ui;
import 'package:flutter/painting.dart'; import 'package:flutter/painting.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -18,35 +17,35 @@ export 'package:flutter/services.dart' show debugPrint; ...@@ -18,35 +17,35 @@ export 'package:flutter/services.dart' show debugPrint;
bool debugPaintSizeEnabled = false; bool debugPaintSizeEnabled = false;
/// The color to use when painting RenderObject bounds. /// The color to use when painting RenderObject bounds.
ui.Color debugPaintSizeColor = const ui.Color(0xFF00FFFF); Color debugPaintSizeColor = const Color(0xFF00FFFF);
/// The color to use when painting some boxes that just add space (e.g. an empty /// The color to use when painting some boxes that just add space (e.g. an empty
/// RenderConstrainedBox or RenderPadding). /// RenderConstrainedBox or RenderPadding).
ui.Color debugPaintSpacingColor = const ui.Color(0x90909090); Color debugPaintSpacingColor = const Color(0x90909090);
/// The color to use when painting RenderPadding edges. /// The color to use when painting RenderPadding edges.
ui.Color debugPaintPaddingColor = const ui.Color(0x900090FF); Color debugPaintPaddingColor = const Color(0x900090FF);
/// The color to use when painting RenderPadding edges. /// The color to use when painting RenderPadding edges.
ui.Color debugPaintPaddingInnerEdgeColor = const ui.Color(0xFF0090FF); Color debugPaintPaddingInnerEdgeColor = const Color(0xFF0090FF);
/// The color to use when painting the arrows used to show RenderPositionedBox alignment. /// The color to use when painting the arrows used to show RenderPositionedBox alignment.
ui.Color debugPaintArrowColor = const ui.Color(0xFFFFFF00); Color debugPaintArrowColor = const Color(0xFFFFFF00);
/// Causes each RenderBox to paint a line at each of its baselines. /// Causes each RenderBox to paint a line at each of its baselines.
bool debugPaintBaselinesEnabled = false; bool debugPaintBaselinesEnabled = false;
/// The color to use when painting alphabetic baselines. /// The color to use when painting alphabetic baselines.
ui.Color debugPaintAlphabeticBaselineColor = const ui.Color(0xFF00FF00); Color debugPaintAlphabeticBaselineColor = const Color(0xFF00FF00);
/// The color ot use when painting ideographic baselines. /// The color ot use when painting ideographic baselines.
ui.Color debugPaintIdeographicBaselineColor = const ui.Color(0xFFFFD000); Color debugPaintIdeographicBaselineColor = const Color(0xFFFFD000);
/// Causes each Layer to paint a box around its bounds. /// Causes each Layer to paint a box around its bounds.
bool debugPaintLayerBordersEnabled = false; bool debugPaintLayerBordersEnabled = false;
/// The color to use when painting Layer borders. /// The color to use when painting Layer borders.
ui.Color debugPaintLayerBordersColor = const ui.Color(0xFFFF9800); Color debugPaintLayerBordersColor = const Color(0xFFFF9800);
/// Causes RenderBox objects to flash while they are being tapped. /// Causes RenderBox objects to flash while they are being tapped.
bool debugPaintPointersEnabled = false; bool debugPaintPointersEnabled = false;
...@@ -55,7 +54,7 @@ bool debugPaintPointersEnabled = false; ...@@ -55,7 +54,7 @@ bool debugPaintPointersEnabled = false;
int debugPaintPointersColorValue = 0x00BBBB; int debugPaintPointersColorValue = 0x00BBBB;
/// The color to use when painting RenderError boxes in checked mode. /// The color to use when painting RenderError boxes in checked mode.
ui.Color debugErrorBoxColor = const ui.Color(0xFFFF0000); Color debugErrorBoxColor = const Color(0xFFFF0000);
/// Overlay a rotating set of colors when repainting layers in checked mode. /// Overlay a rotating set of colors when repainting layers in checked mode.
bool debugEnableRepaintRainbox = false; bool debugEnableRepaintRainbox = false;
......
...@@ -2,14 +2,13 @@ ...@@ -2,14 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui; import 'dart:ui' as ui show Paragraph, ParagraphBuilder, ParagraphStyle, TextBox;
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/painting.dart';
import 'basic_types.dart';
import 'box.dart'; import 'box.dart';
import 'object.dart'; import 'object.dart';
import 'paragraph.dart';
const _kCaretGap = 1.0; // pixels const _kCaretGap = 1.0; // pixels
const _kCaretHeightOffset = 2.0; // pixels const _kCaretHeightOffset = 2.0; // pixels
......
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui; import 'dart:ui' as ui show Image;
import 'package:flutter/painting.dart';
import 'box.dart'; import 'box.dart';
import 'object.dart'; import 'object.dart';
......
...@@ -2,16 +2,15 @@ ...@@ -2,16 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui; import 'dart:ui' as ui show Picture, SceneBuilder;
import 'dart:ui' show Offset;
import 'package:flutter/painting.dart';
import 'package:vector_math/vector_math_64.dart'; import 'package:vector_math/vector_math_64.dart';
import 'package:mojo_services/mojo/ui/layouts.mojom.dart' as mojom; import 'package:mojo_services/mojo/ui/layouts.mojom.dart' as mojom;
import 'basic_types.dart';
import 'debug.dart'; import 'debug.dart';
export 'basic_types.dart';
/// A composited layer /// A composited layer
/// ///
/// During painting, the render tree generates a tree of composited layers that /// During painting, the render tree generates a tree of composited layers that
...@@ -317,7 +316,7 @@ class ClipRRectLayer extends ContainerLayer { ...@@ -317,7 +316,7 @@ class ClipRRectLayer extends ContainerLayer {
ClipRRectLayer({ this.clipRRect }); ClipRRectLayer({ this.clipRRect });
/// The rounded-rect to clip in the parent's coordinate system /// The rounded-rect to clip in the parent's coordinate system
ui.RRect clipRRect; RRect clipRRect;
// TODO(abarth): Why is the rounded-rect in the parent's coordinate system // TODO(abarth): Why is the rounded-rect in the parent's coordinate system
// instead of in the coordinate system of this layer? // instead of in the coordinate system of this layer?
...@@ -403,7 +402,7 @@ class ShaderMaskLayer extends ContainerLayer { ...@@ -403,7 +402,7 @@ class ShaderMaskLayer extends ContainerLayer {
ShaderMaskLayer({ this.shader, this.maskRect, this.transferMode }); ShaderMaskLayer({ this.shader, this.maskRect, this.transferMode });
/// The shader to apply to the children. /// The shader to apply to the children.
ui.Shader shader; Shader shader;
/// The size of the shader. /// The size of the shader.
Rect maskRect; Rect maskRect;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:developer'; import 'dart:developer';
import 'dart:ui' as ui; import 'dart:ui' as ui show PictureRecorder;
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/painting.dart'; import 'package:flutter/painting.dart';
...@@ -18,8 +18,8 @@ import 'node.dart'; ...@@ -18,8 +18,8 @@ import 'node.dart';
import 'semantics.dart'; import 'semantics.dart';
import 'binding.dart'; import 'binding.dart';
export 'layer.dart';
export 'package:flutter/gestures.dart' show HitTestEntry, HitTestResult; export 'package:flutter/gestures.dart' show HitTestEntry, HitTestResult;
export 'package:flutter/painting.dart';
/// Base class for data associated with a [RenderObject] by its parent. /// Base class for data associated with a [RenderObject] by its parent.
/// ///
...@@ -163,7 +163,7 @@ class PaintingContext { ...@@ -163,7 +163,7 @@ class PaintingContext {
canvas.drawRect(_paintBounds, new Paint()..color = debugCurrentRepaintColor.toColor()); canvas.drawRect(_paintBounds, new Paint()..color = debugCurrentRepaintColor.toColor());
if (debugPaintLayerBordersEnabled) { if (debugPaintLayerBordersEnabled) {
Paint paint = new Paint() Paint paint = new Paint()
..style = ui.PaintingStyle.stroke ..style = PaintingStyle.stroke
..strokeWidth = 1.0 ..strokeWidth = 1.0
..color = debugPaintLayerBordersColor; ..color = debugPaintLayerBordersColor;
canvas.drawRect(_paintBounds, paint); canvas.drawRect(_paintBounds, paint);
...@@ -223,9 +223,9 @@ class PaintingContext { ...@@ -223,9 +223,9 @@ class PaintingContext {
/// This function will call painter synchronously with a painting context that /// This function will call painter synchronously with a painting context that
/// is clipped by the given clip. The given clip should not incorporate the /// is clipped by the given clip. The given clip should not incorporate the
/// painting offset. /// painting offset.
void pushClipRRect(bool needsCompositing, Offset offset, Rect bounds, ui.RRect clipRRect, PaintingContextCallback painter) { void pushClipRRect(bool needsCompositing, Offset offset, Rect bounds, RRect clipRRect, PaintingContextCallback painter) {
Rect offsetBounds = bounds.shift(offset); Rect offsetBounds = bounds.shift(offset);
ui.RRect offsetClipRRect = clipRRect.shift(offset); RRect offsetClipRRect = clipRRect.shift(offset);
if (needsCompositing) { if (needsCompositing) {
_stopRecordingIfNeeded(); _stopRecordingIfNeeded();
ClipRRectLayer clipLayer = new ClipRRectLayer(clipRRect: offsetClipRRect); ClipRRectLayer clipLayer = new ClipRRectLayer(clipRRect: offsetClipRRect);
...@@ -305,7 +305,7 @@ class PaintingContext { ...@@ -305,7 +305,7 @@ class PaintingContext {
/// ///
/// This function will call painter synchronously with a painting context that /// This function will call painter synchronously with a painting context that
/// will be masked with the given shader. /// will be masked with the given shader.
void pushShaderMask(Offset offset, ui.Shader shader, Rect maskRect, TransferMode transferMode, PaintingContextCallback painter) { void pushShaderMask(Offset offset, Shader shader, Rect maskRect, TransferMode transferMode, PaintingContextCallback painter) {
_stopRecordingIfNeeded(); _stopRecordingIfNeeded();
ShaderMaskLayer shaderLayer = new ShaderMaskLayer( ShaderMaskLayer shaderLayer = new ShaderMaskLayer(
shader: shader, shader: shader,
......
...@@ -2,24 +2,10 @@ ...@@ -2,24 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/painting.dart';
import 'box.dart'; import 'box.dart';
import 'object.dart'; import 'object.dart';
import 'semantics.dart'; import 'semantics.dart';
export 'package:flutter/painting.dart' show
FontStyle,
FontWeight,
PlainTextSpan,
StyledTextSpan,
TextAlign,
TextBaseline,
TextDecoration,
TextDecorationStyle,
TextSpan,
TextStyle;
/// A render object that displays a paragraph of text /// A render object that displays a paragraph of text
class RenderParagraph extends RenderBox { class RenderParagraph extends RenderBox {
......
...@@ -2,12 +2,10 @@ ...@@ -2,12 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui;
import 'package:flutter/painting.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:vector_math/vector_math_64.dart'; import 'package:vector_math/vector_math_64.dart';
import 'basic_types.dart';
import 'box.dart'; import 'box.dart';
import 'debug.dart'; import 'debug.dart';
import 'object.dart'; import 'object.dart';
...@@ -19,7 +17,6 @@ export 'package:flutter/gestures.dart' show ...@@ -19,7 +17,6 @@ export 'package:flutter/gestures.dart' show
PointerMoveEvent, PointerMoveEvent,
PointerUpEvent, PointerUpEvent,
PointerCancelEvent; PointerCancelEvent;
export 'package:flutter/painting.dart' show Decoration, BoxDecoration;
/// A base class for render objects that resemble their children. /// A base class for render objects that resemble their children.
/// ///
...@@ -642,7 +639,7 @@ class RenderOpacity extends RenderProxyBox { ...@@ -642,7 +639,7 @@ class RenderOpacity extends RenderProxyBox {
} }
} }
typedef ui.Shader ShaderCallback(Rect bounds); typedef Shader ShaderCallback(Rect bounds);
class RenderShaderMask extends RenderProxyBox { class RenderShaderMask extends RenderProxyBox {
RenderShaderMask({ RenderBox child, ShaderCallback shaderCallback, TransferMode transferMode }) RenderShaderMask({ RenderBox child, ShaderCallback shaderCallback, TransferMode transferMode })
...@@ -805,7 +802,7 @@ class RenderClipRRect extends RenderProxyBox { ...@@ -805,7 +802,7 @@ class RenderClipRRect extends RenderProxyBox {
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
if (child != null) { if (child != null) {
Rect rect = Point.origin & size; Rect rect = Point.origin & size;
ui.RRect rrect = new ui.RRect.fromRectXY(rect, xRadius, yRadius); RRect rrect = new RRect.fromRectXY(rect, xRadius, yRadius);
context.pushClipRRect(needsCompositing, offset, rect, rrect, super.paint); context.pushClipRRect(needsCompositing, offset, rect, rrect, super.paint);
} }
} }
......
...@@ -3,9 +3,6 @@ ...@@ -3,9 +3,6 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as ui;
import 'package:flutter/painting.dart';
import 'box.dart'; import 'box.dart';
import 'debug.dart'; import 'debug.dart';
...@@ -300,7 +297,7 @@ class RenderPositionedBox extends RenderShiftedBox { ...@@ -300,7 +297,7 @@ class RenderPositionedBox extends RenderShiftedBox {
if (child != null && !child.size.isEmpty) { if (child != null && !child.size.isEmpty) {
Path path; Path path;
paint = new Paint() paint = new Paint()
..style = ui.PaintingStyle.stroke ..style = PaintingStyle.stroke
..strokeWidth = 1.0 ..strokeWidth = 1.0
..color = debugPaintArrowColor; ..color = debugPaintArrowColor;
path = new Path(); path = new Path();
......
...@@ -3,9 +3,8 @@ ...@@ -3,9 +3,8 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:developer'; import 'dart:developer';
import 'dart:ui' as ui; import 'dart:ui' as ui show Scene, SceneBuilder, window;
import 'package:flutter/painting.dart';
import 'package:flutter/scheduler.dart'; import 'package:flutter/scheduler.dart';
import 'package:vector_math/vector_math_64.dart'; import 'package:vector_math/vector_math_64.dart';
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui; import 'dart:ui' as ui show window;
import 'package:vector_math/vector_math_64.dart'; import 'package:vector_math/vector_math_64.dart';
......
...@@ -5,11 +5,14 @@ ...@@ -5,11 +5,14 @@
import 'dart:async'; import 'dart:async';
import 'dart:collection'; import 'dart:collection';
import 'dart:developer'; import 'dart:developer';
import 'dart:ui' as ui; import 'dart:ui' as ui show window;
import 'dart:ui' show VoidCallback;
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
export 'dart:ui' show VoidCallback;
/// Slows down animations by this factor to help in development. /// Slows down animations by this factor to help in development.
double timeDilation = 1.0; double timeDilation = 1.0;
...@@ -32,7 +35,7 @@ SchedulerExceptionHandler debugSchedulerExceptionHandler; ...@@ -32,7 +35,7 @@ SchedulerExceptionHandler debugSchedulerExceptionHandler;
/// ///
/// Combines the task and its priority. /// Combines the task and its priority.
class _TaskEntry { class _TaskEntry {
final ui.VoidCallback task; final VoidCallback task;
final int priority; final int priority;
const _TaskEntry(this.task, this.priority); const _TaskEntry(this.task, this.priority);
...@@ -110,7 +113,7 @@ abstract class Scheduler extends BindingBase { ...@@ -110,7 +113,7 @@ abstract class Scheduler extends BindingBase {
bool _hasRequestedABeginFrameCallback = false; bool _hasRequestedABeginFrameCallback = false;
/// Schedules the given [task] with the given [priority]. /// Schedules the given [task] with the given [priority].
void scheduleTask(ui.VoidCallback task, Priority priority) { void scheduleTask(VoidCallback task, Priority priority) {
bool isFirstTask = _taskQueue.isEmpty; bool isFirstTask = _taskQueue.isEmpty;
_taskQueue.add(new _TaskEntry(task, priority._value)); _taskQueue.add(new _TaskEntry(task, priority._value));
if (isFirstTask) if (isFirstTask)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/scheduler.dart'; import 'scheduler.dart';
typedef TickerCallback(Duration elapsed); typedef TickerCallback(Duration elapsed);
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import 'dart:async'; import 'dart:async';
import 'dart:typed_data'; import 'dart:typed_data';
import 'dart:ui' as ui; import 'dart:ui' as ui show Image, decodeImageFromDataPipe, decodeImageFromList;
import 'package:mojo/core.dart' show MojoDataPipeConsumer; import 'package:mojo/core.dart' show MojoDataPipeConsumer;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async'; import 'dart:async';
import 'dart:ui' as ui; import 'dart:ui' as ui show Image;
import 'print.dart'; import 'print.dart';
......
...@@ -2,72 +2,46 @@ ...@@ -2,72 +2,46 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui; import 'dart:ui' as ui show Image;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'framework.dart'; import 'framework.dart';
export 'package:flutter/animation.dart';
export 'package:flutter/painting.dart';
export 'package:flutter/rendering.dart' show export 'package:flutter/rendering.dart' show
BackgroundImage, Axis,
Border,
BorderSide,
BoxConstraints, BoxConstraints,
BoxDecoration,
BoxShadow,
BoxShape,
Canvas,
Color,
ColorFilter,
CustomClipper, CustomClipper,
CustomPainter, CustomPainter,
Decoration, FixedColumnCountGridDelegate,
DecorationPosition,
EdgeDims,
FlexAlignItems, FlexAlignItems,
FlexDirection, FlexDirection,
FlexJustifyContent, FlexJustifyContent,
FixedColumnCountGridDelegate, FractionalOffsetTween,
FontStyle,
FontWeight,
FractionalOffset,
Gradient,
GridDelegate, GridDelegate,
HitTestBehavior, HitTestBehavior,
ImageFit,
ImageRepeat,
InputEvent,
LinearGradient,
Matrix4,
MaxTileWidthGridDelegate, MaxTileWidthGridDelegate,
Offset, MultiChildLayoutDelegate,
OneChildLayoutDelegate, OneChildLayoutDelegate,
Paint, Painter,
Path, PaintingContext,
PlainTextSpan, PlainTextSpan,
Point,
PointerCancelEvent, PointerCancelEvent,
PointerCancelEventListener,
PointerDownEvent, PointerDownEvent,
PointerDownEventListener,
PointerEvent, PointerEvent,
PointerMoveEvent, PointerMoveEvent,
PointerMoveEventListener,
PointerUpEvent, PointerUpEvent,
RadialGradient, PointerUpEventListener,
Rect, RelativeRect,
Axis, ShaderCallback,
Size,
StyledTextSpan,
TextAlign,
TextBaseline,
TextDecoration,
TextDecorationStyle,
TextSpan,
TextStyle,
TransferMode,
ValueChanged, ValueChanged,
ViewportAnchor, ViewportAnchor;
VoidCallback;
// PAINTING NODES // PAINTING NODES
......
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui;
import 'dart:developer'; import 'dart:developer';
import 'dart:ui' as ui show window;
import 'dart:ui' show AppLifecycleState, Locale;
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -12,11 +13,13 @@ import 'package:flutter/services.dart'; ...@@ -12,11 +13,13 @@ import 'package:flutter/services.dart';
import 'framework.dart'; import 'framework.dart';
export 'dart:ui' show AppLifecycleState, Locale;
class BindingObserver { class BindingObserver {
bool didPopRoute() => false; bool didPopRoute() => false;
void didChangeMetrics() { } void didChangeMetrics() { }
void didChangeLocale(ui.Locale locale) { } void didChangeLocale(Locale locale) { }
void didChangeAppLifecycleState(ui.AppLifecycleState state) { } void didChangeAppLifecycleState(AppLifecycleState state) { }
} }
/// A concrete binding for applications based on the Widgets framework. /// A concrete binding for applications based on the Widgets framework.
...@@ -69,7 +72,7 @@ class WidgetFlutterBinding extends BindingBase with Scheduler, Gesturer, MojoShe ...@@ -69,7 +72,7 @@ class WidgetFlutterBinding extends BindingBase with Scheduler, Gesturer, MojoShe
dispatchLocaleChanged(ui.window.locale); dispatchLocaleChanged(ui.window.locale);
} }
void dispatchLocaleChanged(ui.Locale locale) { void dispatchLocaleChanged(Locale locale) {
for (BindingObserver observer in _observers) for (BindingObserver observer in _observers)
observer.didChangeLocale(locale); observer.didChangeLocale(locale);
} }
...@@ -82,7 +85,7 @@ class WidgetFlutterBinding extends BindingBase with Scheduler, Gesturer, MojoShe ...@@ -82,7 +85,7 @@ class WidgetFlutterBinding extends BindingBase with Scheduler, Gesturer, MojoShe
activity.finishCurrentActivity(); activity.finishCurrentActivity();
} }
void handleAppLifecycleStateChanged(ui.AppLifecycleState state) { void handleAppLifecycleStateChanged(AppLifecycleState state) {
for (BindingObserver observer in _observers) for (BindingObserver observer in _observers)
observer.didChangeAppLifecycleState(state); observer.didChangeAppLifecycleState(state);
} }
......
...@@ -3,10 +3,6 @@ ...@@ -3,10 +3,6 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as ui;
import 'package:flutter/painting.dart';
import 'package:flutter/rendering.dart';
import 'basic.dart'; import 'basic.dart';
import 'framework.dart'; import 'framework.dart';
...@@ -37,7 +33,7 @@ class _CheckedModeBannerPainter extends CustomPainter { ...@@ -37,7 +33,7 @@ class _CheckedModeBannerPainter extends CustomPainter {
void paint(Canvas canvas, Size size) { void paint(Canvas canvas, Size size) {
final Paint paintShadow = new Paint() final Paint paintShadow = new Paint()
..color = const Color(0x7F000000) ..color = const Color(0x7F000000)
..maskFilter = new ui.MaskFilter.blur(ui.BlurStyle.normal, kShadowBlur); ..maskFilter = new MaskFilter.blur(BlurStyle.normal, kShadowBlur);
final Paint paintBanner = new Paint() final Paint paintBanner = new Paint()
..color = kColor; ..color = kColor;
canvas canvas
......
...@@ -2,10 +2,6 @@ ...@@ -2,10 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui;
import 'package:flutter/animation.dart';
import 'basic.dart'; import 'basic.dart';
import 'transitions.dart'; import 'transitions.dart';
import 'framework.dart'; import 'framework.dart';
...@@ -186,7 +182,7 @@ class _DismissableState extends State<Dismissable> { ...@@ -186,7 +182,7 @@ class _DismissableState extends State<Dismissable> {
_dismissController.value = _dragExtent.abs() / _size.width; _dismissController.value = _dragExtent.abs() / _size.width;
} }
bool _isFlingGesture(ui.Offset velocity) { bool _isFlingGesture(Offset velocity) {
double vx = velocity.dx; double vx = velocity.dx;
double vy = velocity.dy; double vy = velocity.dy;
if (_directionIsYAxis) { if (_directionIsYAxis) {
...@@ -215,7 +211,7 @@ class _DismissableState extends State<Dismissable> { ...@@ -215,7 +211,7 @@ class _DismissableState extends State<Dismissable> {
return false; return false;
} }
void _handleDragEnd(ui.Offset velocity) { void _handleDragEnd(Offset velocity) {
if (!_isActive || _dismissController.isAnimating) if (!_isActive || _dismissController.isAnimating)
return; return;
setState(() { setState(() {
......
...@@ -4,9 +4,8 @@ ...@@ -4,9 +4,8 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/rendering.dart' show RenderEditableLine;
import 'package:sky_services/editing/editing.mojom.dart' as mojom; import 'package:sky_services/editing/editing.mojom.dart' as mojom;
import 'package:flutter/painting.dart';
import 'package:flutter/rendering.dart';
import 'basic.dart'; import 'basic.dart';
import 'framework.dart'; import 'framework.dart';
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/animation.dart';
import 'basic.dart'; import 'basic.dart';
import 'framework.dart'; import 'framework.dart';
......
...@@ -8,7 +8,7 @@ import 'dart:collection'; ...@@ -8,7 +8,7 @@ import 'dart:collection';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
export 'dart:ui' show hashValues, hashList; export 'dart:ui' show hashValues, hashList;
export 'package:flutter/rendering.dart' show debugPrint; export 'package:flutter/rendering.dart' show RenderObject, RenderBox, debugPrint;
// KEYS // KEYS
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
import 'dart:collection'; import 'dart:collection';
import 'package:flutter/animation.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/scheduler.dart'; import 'package:flutter/scheduler.dart';
import 'basic.dart'; import 'basic.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/animation.dart';
import 'basic.dart'; import 'basic.dart';
import 'framework.dart'; import 'framework.dart';
......
...@@ -4,8 +4,7 @@ ...@@ -4,8 +4,7 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/animation.dart'; import 'package:flutter/rendering.dart' show RenderStack;
import 'package:flutter/rendering.dart';
import 'basic.dart'; import 'basic.dart';
import 'framework.dart'; import 'framework.dart';
...@@ -110,7 +109,9 @@ class MimicOverlayEntry { ...@@ -110,7 +109,9 @@ class MimicOverlayEntry {
RenderBox stack = context.ancestorRenderObjectOfType(const TypeMatcher<RenderStack>()); RenderBox stack = context.ancestorRenderObjectOfType(const TypeMatcher<RenderStack>());
// TODO(abarth): Handle the case where the transform here isn't just a translation. // TODO(abarth): Handle the case where the transform here isn't just a translation.
Point localPosition = stack == null ? globalPosition: stack.globalToLocal(globalPosition); // TODO(ianh): We should probably be getting the overlay's render object rather than looking for a RenderStack.
assert(stack != null);
Point localPosition = stack.globalToLocal(globalPosition);
return new Positioned( return new Positioned(
left: localPosition.x, left: localPosition.x,
top: localPosition.y, top: localPosition.y,
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/animation.dart';
import 'basic.dart'; import 'basic.dart';
import 'framework.dart'; import 'framework.dart';
import 'gesture_detector.dart'; import 'gesture_detector.dart';
......
...@@ -4,8 +4,7 @@ ...@@ -4,8 +4,7 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/animation.dart'; import 'package:flutter/rendering.dart' show RenderList, ViewportDimensions;
import 'package:flutter/rendering.dart';
import 'basic.dart'; import 'basic.dart';
import 'framework.dart'; import 'framework.dart';
......
...@@ -4,8 +4,7 @@ ...@@ -4,8 +4,7 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/animation.dart'; import 'basic.dart';
import 'navigator.dart'; import 'navigator.dart';
import 'overlay.dart'; import 'overlay.dart';
import 'routes.dart'; import 'routes.dart';
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/animation.dart';
import 'basic.dart'; import 'basic.dart';
import 'focus.dart'; import 'focus.dart';
import 'framework.dart'; import 'framework.dart';
......
...@@ -4,12 +4,11 @@ ...@@ -4,12 +4,11 @@
import 'dart:async'; import 'dart:async';
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as ui; import 'dart:ui' as ui show window;
import 'package:newton/newton.dart'; import 'package:newton/newton.dart';
import 'package:flutter/animation.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart' show HasScrollDirection;
import 'basic.dart'; import 'basic.dart';
import 'framework.dart'; import 'framework.dart';
......
...@@ -3,9 +3,7 @@ ...@@ -3,9 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as ui;
import 'package:flutter/painting.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:sky_services/semantics/semantics.mojom.dart' as mojom; import 'package:sky_services/semantics/semantics.mojom.dart' as mojom;
...@@ -193,17 +191,17 @@ class _SemanticsDebuggerEntry { ...@@ -193,17 +191,17 @@ class _SemanticsDebuggerEntry {
if (innerRect.isEmpty) { if (innerRect.isEmpty) {
Paint fill = new Paint() Paint fill = new Paint()
..color = lineColor ..color = lineColor
..style = ui.PaintingStyle.fill; ..style = PaintingStyle.fill;
canvas.drawRect(rect, fill); canvas.drawRect(rect, fill);
} else { } else {
Paint fill = new Paint() Paint fill = new Paint()
..color = const Color(0xFFFFFFFF) ..color = const Color(0xFFFFFFFF)
..style = ui.PaintingStyle.fill; ..style = PaintingStyle.fill;
canvas.drawRect(rect, fill); canvas.drawRect(rect, fill);
Paint line = new Paint() Paint line = new Paint()
..strokeWidth = rank * 2.0 ..strokeWidth = rank * 2.0
..color = lineColor ..color = lineColor
..style = ui.PaintingStyle.stroke; ..style = PaintingStyle.stroke;
canvas.drawRect(innerRect, line); canvas.drawRect(innerRect, line);
} }
if (textPainter != null) { if (textPainter != null) {
......
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/animation.dart'; import 'basic.dart';
import 'framework.dart'; import 'framework.dart';
/// A component that rebuilds when the given animation changes status. /// A component that rebuilds when the given animation changes status.
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
import 'dart:math' as math; import 'dart:math' as math;
import 'package:flutter/animation.dart';
import 'package:flutter/rendering.dart';
import 'package:vector_math/vector_math_64.dart' show Matrix4; import 'package:vector_math/vector_math_64.dart' show Matrix4;
import 'basic.dart'; import 'basic.dart';
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui; import 'dart:ui' as ui show PictureRecorder;
import 'dart:ui' show Rect, Color, Paint; import 'dart:ui' show Rect, Color, Paint, Canvas;
import 'package:test/test.dart'; import 'package:test/test.dart';
import 'package:vector_math/vector_math_64.dart'; import 'package:vector_math/vector_math_64.dart';
...@@ -11,7 +11,7 @@ import 'package:vector_math/vector_math_64.dart'; ...@@ -11,7 +11,7 @@ import 'package:vector_math/vector_math_64.dart';
void main() { void main() {
ui.PictureRecorder recorder = new ui.PictureRecorder(); ui.PictureRecorder recorder = new ui.PictureRecorder();
ui.Canvas canvas = new ui.Canvas(recorder, new Rect.fromLTRB(0.0, 0.0, 100.0, 100.0)); Canvas canvas = new Canvas(recorder, new Rect.fromLTRB(0.0, 0.0, 100.0, 100.0));
test("matrix access should work", () { test("matrix access should work", () {
// Matrix equality doesn't work! // Matrix equality doesn't work!
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui; import 'dart:ui' as ui show Image;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/animation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:test/test.dart' hide TypeMatcher; import 'package:test/test.dart' hide TypeMatcher;
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/animation.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
......
...@@ -2,14 +2,13 @@ ...@@ -2,14 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui; import 'dart:ui' show Shader;
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/painting.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
ui.Shader createShader(Rect bounds) { Shader createShader(Rect bounds) {
return new LinearGradient( return new LinearGradient(
begin: bounds.topLeft, begin: bounds.topLeft,
end: bounds.bottomLeft, end: bounds.bottomLeft,
......
...@@ -10,12 +10,10 @@ import 'dart:collection'; ...@@ -10,12 +10,10 @@ import 'dart:collection';
import 'dart:convert'; import 'dart:convert';
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:typed_data'; import 'dart:typed_data';
import 'dart:ui' as ui; import 'dart:ui' as ui show Image;
import 'package:box2d/box2d.dart' as box2d; import 'package:box2d/box2d.dart' as box2d;
import 'package:flutter/animation.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/painting.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/scheduler.dart'; import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
......
...@@ -15,7 +15,7 @@ class EffectLine extends Node { ...@@ -15,7 +15,7 @@ class EffectLine extends Node {
EffectLine({ EffectLine({
this.texture: null, this.texture: null,
this.transferMode: ui.TransferMode.dstOver, this.transferMode: TransferMode.dstOver,
List<Point> points, List<Point> points,
this.widthMode : EffectLineWidthMode.linear, this.widthMode : EffectLineWidthMode.linear,
this.minWidth: 10.0, this.minWidth: 10.0,
...@@ -38,8 +38,8 @@ class EffectLine extends Node { ...@@ -38,8 +38,8 @@ class EffectLine extends Node {
_colorSequence = colorSequence; _colorSequence = colorSequence;
if (_colorSequence == null) { if (_colorSequence == null) {
_colorSequence = new ColorSequence.fromStartAndEndColor( _colorSequence = new ColorSequence.fromStartAndEndColor(
new Color(0xffffffff), const Color(0xffffffff),
new Color(0xffffffff) const Color(0xffffffff)
); );
} }
...@@ -51,7 +51,7 @@ class EffectLine extends Node { ...@@ -51,7 +51,7 @@ class EffectLine extends Node {
final Texture texture; final Texture texture;
final ui.TransferMode transferMode; final TransferMode transferMode;
final EffectLineWidthMode widthMode; final EffectLineWidthMode widthMode;
final double minWidth; final double minWidth;
......
...@@ -22,7 +22,7 @@ class Layer extends Node with SpritePaint { ...@@ -22,7 +22,7 @@ class Layer extends Node with SpritePaint {
Layer([this.layerRect = null]); Layer([this.layerRect = null]);
Paint _cachedPaint = new Paint() Paint _cachedPaint = new Paint()
..filterQuality = ui.FilterQuality.low ..filterQuality = FilterQuality.low
..isAntiAlias = false; ..isAntiAlias = false;
void _prePaint(Canvas canvas, Matrix4 matrix) { void _prePaint(Canvas canvas, Matrix4 matrix) {
......
...@@ -144,7 +144,7 @@ class ParticleSystem extends Node { ...@@ -144,7 +144,7 @@ class ParticleSystem extends Node {
/// The transfer mode used to draw the particle system. Default is /// The transfer mode used to draw the particle system. Default is
/// [TransferMode.plus]. /// [TransferMode.plus].
ui.TransferMode transferMode; TransferMode transferMode;
List<_Particle> _particles; List<_Particle> _particles;
...@@ -154,7 +154,7 @@ class ParticleSystem extends Node { ...@@ -154,7 +154,7 @@ class ParticleSystem extends Node {
double opacity = 1.0; double opacity = 1.0;
static Paint _paint = new Paint() static Paint _paint = new Paint()
..filterQuality = ui.FilterQuality.low ..filterQuality = FilterQuality.low
..isAntiAlias = false; ..isAntiAlias = false;
ParticleSystem(this.texture, ParticleSystem(this.texture,
...@@ -186,7 +186,7 @@ class ParticleSystem extends Node { ...@@ -186,7 +186,7 @@ class ParticleSystem extends Node {
this.redVar: 0, this.redVar: 0,
this.greenVar: 0, this.greenVar: 0,
this.blueVar: 0, this.blueVar: 0,
this.transferMode: ui.TransferMode.plus, this.transferMode: TransferMode.plus,
this.numParticlesToEmit: 0, this.numParticlesToEmit: 0,
this.autoRemoveOnFinish: true}) { this.autoRemoveOnFinish: true}) {
_particles = new List<_Particle>(); _particles = new List<_Particle>();
...@@ -362,7 +362,7 @@ class ParticleSystem extends Node { ...@@ -362,7 +362,7 @@ class ParticleSystem extends Node {
void paint(Canvas canvas) { void paint(Canvas canvas) {
if (opacity == 0.0) return; if (opacity == 0.0) return;
List<ui.RSTransform> transforms = <ui.RSTransform>[]; List<RSTransform> transforms = <RSTransform>[];
List<Rect> rects = <Rect>[]; List<Rect> rects = <Rect>[];
List<Color> colors = <Color>[]; List<Color> colors = <Color>[];
...@@ -391,7 +391,7 @@ class ParticleSystem extends Node { ...@@ -391,7 +391,7 @@ class ParticleSystem extends Node {
double ay = rect.height / 2; double ay = rect.height / 2;
double tx = particle.pos[0] + -scos * ax + ssin * ay; double tx = particle.pos[0] + -scos * ax + ssin * ay;
double ty = particle.pos[1] + -ssin * ax - scos * ay; double ty = particle.pos[1] + -ssin * ax - scos * ay;
ui.RSTransform transform = new ui.RSTransform(scos, ssin, tx, ty); RSTransform transform = new RSTransform(scos, ssin, tx, ty);
transforms.add(transform); transforms.add(transform);
// Color // Color
...@@ -417,7 +417,7 @@ class ParticleSystem extends Node { ...@@ -417,7 +417,7 @@ class ParticleSystem extends Node {
} }
canvas.drawAtlas(texture.image, transforms, rects, colors, canvas.drawAtlas(texture.image, transforms, rects, colors,
ui.TransferMode.modulate, null, _paint); TransferMode.modulate, null, _paint);
} }
} }
......
...@@ -43,7 +43,7 @@ class _PhysicsDebugDraw extends box2d.DebugDraw { ...@@ -43,7 +43,7 @@ class _PhysicsDebugDraw extends box2d.DebugDraw {
void drawCircle(Vector2 center, num radius, box2d.Color3i color, [Vector2 axis]) { void drawCircle(Vector2 center, num radius, box2d.Color3i color, [Vector2 axis]) {
Paint paint = new Paint() Paint paint = new Paint()
..color = _toColor(color) ..color = _toColor(color)
..style = ui.PaintingStyle.stroke ..style = PaintingStyle.stroke
..strokeWidth = 1.0; ..strokeWidth = 1.0;
canvas.drawCircle(_toPoint(center), _scale(radius), paint); canvas.drawCircle(_toPoint(center), _scale(radius), paint);
......
...@@ -17,7 +17,7 @@ class Sprite extends NodeWithSize with SpritePaint { ...@@ -17,7 +17,7 @@ class Sprite extends NodeWithSize with SpritePaint {
bool constrainProportions = false; bool constrainProportions = false;
Paint _cachedPaint = new Paint() Paint _cachedPaint = new Paint()
..filterQuality = ui.FilterQuality.low ..filterQuality = FilterQuality.low
..isAntiAlias = false; ..isAntiAlias = false;
/// Creates a new sprite from the provided [texture]. /// Creates a new sprite from the provided [texture].
...@@ -107,13 +107,13 @@ abstract class SpritePaint { ...@@ -107,13 +107,13 @@ abstract class SpritePaint {
/// ///
/// // Add the colors of the sprite with the colors of the background /// // Add the colors of the sprite with the colors of the background
/// mySprite.transferMode = TransferMode.plusMode; /// mySprite.transferMode = TransferMode.plusMode;
ui.TransferMode transferMode; TransferMode transferMode;
void _updatePaint(Paint paint) { void _updatePaint(Paint paint) {
paint.color = new Color.fromARGB((255.0*_opacity).toInt(), 255, 255, 255); paint.color = new Color.fromARGB((255.0*_opacity).toInt(), 255, 255, 255);
if (colorOverlay != null) { if (colorOverlay != null) {
paint.colorFilter = new ColorFilter.mode(colorOverlay, ui.TransferMode.srcATop); paint.colorFilter = new ColorFilter.mode(colorOverlay, TransferMode.srcATop);
} }
if (transferMode != null) { if (transferMode != null) {
......
...@@ -38,8 +38,8 @@ class TexturedLinePainter { ...@@ -38,8 +38,8 @@ class TexturedLinePainter {
_cachedPaint = new Paint(); _cachedPaint = new Paint();
} else { } else {
Matrix4 matrix = new Matrix4.identity(); Matrix4 matrix = new Matrix4.identity();
ui.ImageShader shader = new ui.ImageShader(texture.image, ImageShader shader = new ImageShader(texture.image,
ui.TileMode.repeated, ui.TileMode.repeated, matrix.storage); TileMode.repeated, TileMode.repeated, matrix.storage);
_cachedPaint = new Paint() _cachedPaint = new Paint()
..shader = shader; ..shader = shader;
...@@ -77,7 +77,7 @@ class TexturedLinePainter { ...@@ -77,7 +77,7 @@ class TexturedLinePainter {
bool removeArtifacts = true; bool removeArtifacts = true;
ui.TransferMode transferMode = ui.TransferMode.srcOver; TransferMode transferMode = TransferMode.srcOver;
Paint _cachedPaint = new Paint(); Paint _cachedPaint = new Paint();
...@@ -169,7 +169,7 @@ class TexturedLinePainter { ...@@ -169,7 +169,7 @@ class TexturedLinePainter {
lastMiter = currentMiter; lastMiter = currentMiter;
} }
canvas.drawVertices(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) { double _xPosForStop(double stop) {
......
...@@ -14,7 +14,7 @@ class VirtualJoystick extends NodeWithSize { ...@@ -14,7 +14,7 @@ class VirtualJoystick extends NodeWithSize {
_paintControl = new Paint() _paintControl = new Paint()
..color=new Color(0xffffffff) ..color=new Color(0xffffffff)
..strokeWidth = 1.0 ..strokeWidth = 1.0
..style = ui.PaintingStyle.stroke; ..style = PaintingStyle.stroke;
} }
Point _value = Point.origin; Point _value = Point.origin;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui; import 'dart:ui' as ui show window;
import 'package:quiver/testing/async.dart'; import 'package:quiver/testing/async.dart';
import 'package:quiver/time.dart'; import 'package:quiver/time.dart';
...@@ -35,7 +35,7 @@ class WidgetTester extends Instrumentation { ...@@ -35,7 +35,7 @@ class WidgetTester extends Instrumentation {
} }
void setLocale(String languageCode, String countryCode) { void setLocale(String languageCode, String countryCode) {
ui.Locale locale = new ui.Locale(languageCode, countryCode); Locale locale = new Locale(languageCode, countryCode);
binding.dispatchLocaleChanged(locale); binding.dispatchLocaleChanged(locale);
async.flushMicrotasks(); async.flushMicrotasks();
} }
......
...@@ -5,11 +5,4 @@ ...@@ -5,11 +5,4 @@
/// A simple charting library for Flutter. /// A simple charting library for Flutter.
library playfair; library playfair;
import 'dart:ui' as ui; export 'src/base.dart';
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/painting.dart';
part 'src/base.dart';
...@@ -2,7 +2,10 @@ ...@@ -2,7 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
part of playfair; import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
class ChartData { class ChartData {
const ChartData({ const ChartData({
...@@ -54,17 +57,17 @@ class _ChartWrapper extends LeafRenderObjectWidget { ...@@ -54,17 +57,17 @@ class _ChartWrapper extends LeafRenderObjectWidget {
final TextTheme textTheme; final TextTheme textTheme;
final ChartData data; final ChartData data;
RenderChart createRenderObject() => new RenderChart(textTheme: textTheme, data: data); _RenderChart createRenderObject() => new _RenderChart(textTheme: textTheme, data: data);
void updateRenderObject(RenderChart renderObject, _ChartWrapper oldWidget) { void updateRenderObject(_RenderChart renderObject, _ChartWrapper oldWidget) {
renderObject.textTheme = textTheme; renderObject
renderObject.data = data; ..textTheme = textTheme
..data = data;
} }
} }
class RenderChart extends RenderConstrainedBox { class _RenderChart extends RenderConstrainedBox {
_RenderChart({
RenderChart({
TextTheme textTheme, TextTheme textTheme,
ChartData data ChartData data
}) : _painter = new ChartPainter(textTheme: textTheme, data: data), }) : _painter = new ChartPainter(textTheme: textTheme, data: data),
...@@ -98,7 +101,7 @@ class RenderChart extends RenderConstrainedBox { ...@@ -98,7 +101,7 @@ class RenderChart extends RenderConstrainedBox {
} }
} }
class Gridline { class _Gridline {
double value; double value;
TextPainter labelPainter; TextPainter labelPainter;
Point labelPosition; Point labelPosition;
...@@ -106,7 +109,7 @@ class Gridline { ...@@ -106,7 +109,7 @@ class Gridline {
Point end; Point end;
} }
class Indicator { class _Indicator {
Point start; Point start;
Point end; Point end;
TextPainter labelPainter; TextPainter labelPainter;
...@@ -148,18 +151,18 @@ class ChartPainter { ...@@ -148,18 +151,18 @@ class ChartPainter {
Rect _rect; Rect _rect;
// These are updated by _layout() // These are updated by _layout()
List<Gridline> _horizontalGridlines; List<_Gridline> _horizontalGridlines;
List<Point> _markers; List<Point> _markers;
Indicator _indicator; _Indicator _indicator;
void _layout() { void _layout() {
// Create the scale labels // Create the scale labels
double yScaleWidth = 0.0; double yScaleWidth = 0.0;
_horizontalGridlines = new List<Gridline>(); _horizontalGridlines = new List<_Gridline>();
assert(data.numHorizontalGridlines > 1); assert(data.numHorizontalGridlines > 1);
double stepSize = (data.endY - data.startY) / (data.numHorizontalGridlines - 1); double stepSize = (data.endY - data.startY) / (data.numHorizontalGridlines - 1);
for(int i = 0; i < data.numHorizontalGridlines; i++) { for(int i = 0; i < data.numHorizontalGridlines; i++) {
Gridline gridline = new Gridline() _Gridline gridline = new _Gridline()
..value = _roundToPlaces(data.startY + stepSize * i, data.roundToPlaces); ..value = _roundToPlaces(data.startY + stepSize * i, data.roundToPlaces);
if (gridline.value < data.startY || gridline.value > data.endY) if (gridline.value < data.startY || gridline.value > data.endY)
continue; // TODO(jackson): Align things so this doesn't ever happen continue; // TODO(jackson): Align things so this doesn't ever happen
...@@ -185,7 +188,7 @@ class ChartPainter { ...@@ -185,7 +188,7 @@ class ChartPainter {
); );
// Left align and vertically center the labels on the right side // Left align and vertically center the labels on the right side
for(Gridline gridline in _horizontalGridlines) { for(_Gridline gridline in _horizontalGridlines) {
gridline.start = _convertPointToRectSpace(new Point(data.startX, gridline.value), markerRect); gridline.start = _convertPointToRectSpace(new Point(data.startX, gridline.value), markerRect);
gridline.end = _convertPointToRectSpace(new Point(data.endX, gridline.value), markerRect); gridline.end = _convertPointToRectSpace(new Point(data.endX, gridline.value), markerRect);
gridline.labelPosition = new Point( gridline.labelPosition = new Point(
...@@ -206,13 +209,13 @@ class ChartPainter { ...@@ -206,13 +209,13 @@ class ChartPainter {
if (data.indicatorLine != null && if (data.indicatorLine != null &&
data.indicatorLine >= data.startY && data.indicatorLine >= data.startY &&
data.indicatorLine <= data.endY) { data.indicatorLine <= data.endY) {
_indicator = new Indicator() _indicator = new _Indicator()
..start = _convertPointToRectSpace(new Point(data.startX, data.indicatorLine), markerRect) ..start = _convertPointToRectSpace(new Point(data.startX, data.indicatorLine), markerRect)
..end = _convertPointToRectSpace(new Point(data.endX, data.indicatorLine), markerRect); ..end = _convertPointToRectSpace(new Point(data.endX, data.indicatorLine), markerRect);
if (data.indicatorText != null) { if (data.indicatorText != null) {
TextSpan text = new StyledTextSpan( TextSpan text = new StyledTextSpan(
_textTheme.body1, _textTheme.body1,
[new PlainTextSpan("${data.indicatorText}")] <TextSpan>[new PlainTextSpan("${data.indicatorText}")]
); );
_indicator.labelPainter = new TextPainter(text) _indicator.labelPainter = new TextPainter(text)
..maxWidth = markerRect.width ..maxWidth = markerRect.width
...@@ -236,17 +239,17 @@ class ChartPainter { ...@@ -236,17 +239,17 @@ class ChartPainter {
return new Point(x, y); return new Point(x, y);
} }
void _paintGrid(ui.Canvas canvas) { void _paintGrid(Canvas canvas) {
Paint paint = new Paint() Paint paint = new Paint()
..strokeWidth = kGridStrokeWidth ..strokeWidth = kGridStrokeWidth
..color = kGridColor; ..color = kGridColor;
for(Gridline gridline in _horizontalGridlines) { for(_Gridline gridline in _horizontalGridlines) {
gridline.labelPainter.paint(canvas, gridline.labelPosition.toOffset()); gridline.labelPainter.paint(canvas, gridline.labelPosition.toOffset());
canvas.drawLine(gridline.start, gridline.end, paint); canvas.drawLine(gridline.start, gridline.end, paint);
} }
} }
void _paintChart(ui.Canvas canvas) { void _paintChart(Canvas canvas) {
Paint paint = new Paint() Paint paint = new Paint()
..strokeWidth = kMarkerStrokeWidth ..strokeWidth = kMarkerStrokeWidth
..color = kMarkerColor; ..color = kMarkerColor;
...@@ -256,11 +259,11 @@ class ChartPainter { ...@@ -256,11 +259,11 @@ class ChartPainter {
canvas.drawCircle(marker, kMarkerRadius, paint); canvas.drawCircle(marker, kMarkerRadius, paint);
path.lineTo(marker.x, marker.y); path.lineTo(marker.x, marker.y);
} }
paint.style = ui.PaintingStyle.stroke; paint.style = PaintingStyle.stroke;
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
} }
void _paintIndicator(ui.Canvas canvas) { void _paintIndicator(Canvas canvas) {
if (_indicator == null) if (_indicator == null)
return; return;
Paint paint = new Paint() Paint paint = new Paint()
...@@ -271,7 +274,7 @@ class ChartPainter { ...@@ -271,7 +274,7 @@ class ChartPainter {
_indicator.labelPainter.paint(canvas, _indicator.labelPosition.toOffset()); _indicator.labelPainter.paint(canvas, _indicator.labelPosition.toOffset());
} }
void paint(ui.Canvas canvas, Rect rect) { void paint(Canvas canvas, Rect rect) {
if (rect != _rect) if (rect != _rect)
_needsLayout = true; _needsLayout = true;
_rect = rect; _rect = rect;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment