Commit 7b31d9b2 authored by Adam Barth's avatar Adam Barth

Rationalize exports a bit more

The goal is to follow the guidelines in
https://github.com/flutter/engine/blob/master/sky/specs/style-guide.md#packages

Fixes #1638
parent 7352da14
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
/// Note: animation.dart depends on the `newton` package. /// Note: animation.dart depends on the `newton` package.
library painting; library painting;
export 'src/painting/basic_types.dart';
export 'src/painting/box_painter.dart'; export 'src/painting/box_painter.dart';
export 'src/painting/shadows.dart'; export 'src/painting/shadows.dart';
export 'src/painting/text_painter.dart'; export 'src/painting/text_painter.dart';
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
library rendering; library rendering;
export 'src/rendering/auto_layout.dart'; export 'src/rendering/auto_layout.dart';
export 'src/rendering/basic_types.dart';
export 'src/rendering/block.dart'; export 'src/rendering/block.dart';
export 'src/rendering/box.dart'; export 'src/rendering/box.dart';
export 'src/rendering/debug.dart'; export 'src/rendering/debug.dart';
......
...@@ -12,8 +12,8 @@ import 'theme.dart'; ...@@ -12,8 +12,8 @@ import 'theme.dart';
export 'package:flutter/rendering.dart' show ValueChanged; export 'package:flutter/rendering.dart' show ValueChanged;
const double _kMidpoint = 0.5; const double _kMidpoint = 0.5;
const ui.Color _kLightUncheckedColor = const ui.Color(0x8A000000); const Color _kLightUncheckedColor = const Color(0x8A000000);
const ui.Color _kDarkUncheckedColor = const ui.Color(0xB2FFFFFF); const Color _kDarkUncheckedColor = const Color(0xB2FFFFFF);
const double _kEdgeSize = 18.0; const double _kEdgeSize = 18.0;
const double _kEdgeRadius = 1.0; const double _kEdgeRadius = 1.0;
const double _kStrokeWidth = 2.0; const double _kStrokeWidth = 2.0;
...@@ -126,7 +126,7 @@ class _RenderCheckbox extends RenderToggleable { ...@@ -126,7 +126,7 @@ class _RenderCheckbox extends RenderToggleable {
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
final PaintingCanvas canvas = context.canvas; final PaintingCanvas canvas = context.canvas;
// Choose a color between grey and the theme color // Choose a color between grey and the theme color
ui.Paint paint = new ui.Paint() Paint paint = new Paint()
..strokeWidth = _kStrokeWidth ..strokeWidth = _kStrokeWidth
..color = uncheckedColor; ..color = uncheckedColor;
...@@ -134,27 +134,27 @@ class _RenderCheckbox extends RenderToggleable { ...@@ -134,27 +134,27 @@ class _RenderCheckbox extends RenderToggleable {
// Because we have a stroke size of 2, we should have a minimum 1.0 inset. // Because we have a stroke size of 2, we should have a minimum 1.0 inset.
double inset = 2.0 - (position - _kMidpoint).abs() * 2.0; double inset = 2.0 - (position - _kMidpoint).abs() * 2.0;
double rectSize = _kEdgeSize - inset * _kStrokeWidth; double rectSize = _kEdgeSize - inset * _kStrokeWidth;
ui.Rect rect = Rect rect = new Rect.fromLTWH(offset.dx + inset, offset.dy + inset, rectSize, rectSize);
new ui.Rect.fromLTWH(offset.dx + inset, offset.dy + inset, rectSize, rectSize);
// Create an inner rectangle to cover inside of rectangle. This is needed to avoid // Create an inner rectangle to cover inside of rectangle. This is needed to avoid
// painting artefacts caused by overlayed paintings. // painting artefacts caused by overlayed paintings.
ui.Rect innerRect = rect.deflate(1.0); Rect innerRect = rect.deflate(1.0);
ui.RRect rrect = new ui.RRect() ui.RRect rrect = new ui.RRect()
..setRectXY(rect, _kEdgeRadius, _kEdgeRadius); ..setRectXY(rect, _kEdgeRadius, _kEdgeRadius);
// Outline of the empty rrect // Outline of the empty rrect
paint.setStyle(ui.PaintingStyle.stroke); paint.style = ui.PaintingStyle.stroke;
canvas.drawRRect(rrect, paint); canvas.drawRRect(rrect, paint);
// Radial gradient that changes size // Radial gradient that changes size
if (position > 0) { if (position > 0) {
paint.setStyle(ui.PaintingStyle.fill); paint
paint.setShader(new ui.Gradient.radial( ..style = ui.PaintingStyle.fill
..shader = new ui.Gradient.radial(
new Point(_kEdgeSize / 2.0, _kEdgeSize / 2.0), new Point(_kEdgeSize / 2.0, _kEdgeSize / 2.0),
_kEdgeSize * (_kMidpoint - position) * 8.0, <Color>[ _kEdgeSize * (_kMidpoint - position) * 8.0, <Color>[
const ui.Color(0x00000000), const Color(0x00000000),
uncheckedColor uncheckedColor
])); ]);
canvas.drawRect(innerRect, paint); canvas.drawRect(innerRect, paint);
} }
...@@ -162,24 +162,25 @@ class _RenderCheckbox extends RenderToggleable { ...@@ -162,24 +162,25 @@ class _RenderCheckbox extends RenderToggleable {
double t = (position - _kMidpoint) / (1.0 - _kMidpoint); double t = (position - _kMidpoint) / (1.0 - _kMidpoint);
// First draw a rounded rect outline then fill inner rectangle with accent color. // First draw a rounded rect outline then fill inner rectangle with accent color.
paint.color = new Color.fromARGB((t * 255).floor(), _accentColor.red, paint
_accentColor.green, _accentColor.blue); ..color = new Color.fromARGB((t * 255).floor(), _accentColor.red, _accentColor.green, _accentColor.blue)
paint.setStyle(ui.PaintingStyle.stroke); ..style = ui.PaintingStyle.stroke;
canvas.drawRRect(rrect, paint); canvas.drawRRect(rrect, paint);
paint.setStyle(ui.PaintingStyle.fill); paint.style = ui.PaintingStyle.fill;
canvas.drawRect(innerRect, paint); canvas.drawRect(innerRect, paint);
// White inner check // White inner check
paint.color = const ui.Color(0xFFFFFFFF); paint
paint.setStyle(ui.PaintingStyle.stroke); ..color = const Color(0xFFFFFFFF)
ui.Path path = new ui.Path(); ..style = ui.PaintingStyle.stroke;
ui.Point start = new ui.Point(_kEdgeSize * 0.15, _kEdgeSize * 0.45); Path path = new Path();
ui.Point mid = new ui.Point(_kEdgeSize * 0.4, _kEdgeSize * 0.7); Point start = new Point(_kEdgeSize * 0.15, _kEdgeSize * 0.45);
ui.Point end = new ui.Point(_kEdgeSize * 0.85, _kEdgeSize * 0.25); Point mid = new Point(_kEdgeSize * 0.4, _kEdgeSize * 0.7);
Point end = new Point(_kEdgeSize * 0.85, _kEdgeSize * 0.25);
Point lerp(Point p1, Point p2, double t) => Point lerp(Point p1, Point p2, double t) =>
new Point(p1.x * (1.0 - t) + p2.x * t, p1.y * (1.0 - t) + p2.y * t); new Point(p1.x * (1.0 - t) + p2.x * t, p1.y * (1.0 - t) + p2.y * t);
ui.Point drawStart = lerp(start, mid, 1.0 - t); Point drawStart = lerp(start, mid, 1.0 - t);
ui.Point drawEnd = lerp(mid, end, t); Point drawEnd = lerp(mid, end, t);
path.moveTo(offset.dx + drawStart.x, offset.dy + drawStart.y); path.moveTo(offset.dx + drawStart.x, offset.dy + drawStart.y);
path.lineTo(offset.dx + mid.x, offset.dy + mid.y); path.lineTo(offset.dx + mid.x, offset.dy + mid.y);
path.lineTo(offset.dx + drawEnd.x, offset.dy + drawEnd.y); path.lineTo(offset.dx + drawEnd.x, offset.dy + drawEnd.y);
......
...@@ -6,7 +6,6 @@ import 'dart:async'; ...@@ -6,7 +6,6 @@ import 'dart:async';
import 'package:intl/date_symbols.dart'; import 'package:intl/date_symbols.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:flutter/painting.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'colors.dart'; import 'colors.dart';
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
import 'dart:ui' as ui; import 'dart:ui' as ui;
import 'package:flutter/gestures.dart';
import 'package:flutter/painting.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'colors.dart'; import 'colors.dart';
...@@ -51,8 +49,8 @@ class _DrawerItemState extends State<DrawerItem> { ...@@ -51,8 +49,8 @@ class _DrawerItemState extends State<DrawerItem> {
ui.ColorFilter _getColorFilter(ThemeData themeData) { ui.ColorFilter _getColorFilter(ThemeData themeData) {
if (config.selected) if (config.selected)
return new ui.ColorFilter.mode(themeData.primaryColor, ui.TransferMode.srcATop); return new ui.ColorFilter.mode(themeData.primaryColor, TransferMode.srcATop);
return new ui.ColorFilter.mode(const Color(0x73000000), ui.TransferMode.dstIn); return new ui.ColorFilter.mode(const Color(0x73000000), TransferMode.dstIn);
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
......
...@@ -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/gestures.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/gestures.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'icon.dart'; import 'icon.dart';
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
import 'dart:ui' as ui; import 'dart:ui' as ui;
import 'package:flutter/gestures.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'icon.dart'; import 'icon.dart';
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
import 'dart:async'; import 'dart:async';
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as ui;
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
...@@ -91,7 +90,7 @@ class _InkSplash { ...@@ -91,7 +90,7 @@ class _InkSplash {
void paint(PaintingCanvas canvas) { void paint(PaintingCanvas canvas) {
int opacity = (_kSplashInitialOpacity * (1.1 - (_radius.value / _targetRadius))).floor(); int opacity = (_kSplashInitialOpacity * (1.1 - (_radius.value / _targetRadius))).floor();
ui.Paint paint = new ui.Paint()..color = new ui.Color(opacity << 24); Paint paint = new Paint()..color = new Color(opacity << 24);
double radius = _pinnedRadius == null ? _radius.value : _pinnedRadius; double radius = _pinnedRadius == null ? _radius.value : _pinnedRadius;
canvas.drawCircle(position, radius, paint); canvas.drawCircle(position, radius, paint);
} }
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/painting.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'theme.dart'; import 'theme.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/gestures.dart';
import 'package:flutter/painting.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'ink_well.dart'; import 'ink_well.dart';
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import 'package:flutter/painting.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'constants.dart'; import 'constants.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/gestures.dart';
import 'package:flutter/painting.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.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/gestures.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'colors.dart'; import 'colors.dart';
......
...@@ -76,10 +76,10 @@ class LinearProgressIndicator extends ProgressIndicator { ...@@ -76,10 +76,10 @@ class LinearProgressIndicator extends ProgressIndicator {
double bufferValue double bufferValue
}) : super(key: key, value: value, bufferValue: bufferValue); }) : super(key: key, value: value, bufferValue: bufferValue);
void _paint(BuildContext context, double performanceValue, ui.Canvas canvas, Size size) { void _paint(BuildContext context, double performanceValue, Canvas canvas, Size size) {
Paint paint = new Paint() Paint paint = new Paint()
..color = _getBackgroundColor(context) ..color = _getBackgroundColor(context)
..setStyle(ui.PaintingStyle.fill); ..style = ui.PaintingStyle.fill;
canvas.drawRect(Point.origin & size, paint); canvas.drawRect(Point.origin & size, paint);
paint.color = _getValueColor(context); paint.color = _getValueColor(context);
...@@ -103,7 +103,7 @@ class LinearProgressIndicator extends ProgressIndicator { ...@@ -103,7 +103,7 @@ class LinearProgressIndicator extends ProgressIndicator {
), ),
child: new CustomPaint( child: new CustomPaint(
token: _getCustomPaintToken(performanceValue), token: _getCustomPaintToken(performanceValue),
callback: (ui.Canvas canvas, Size size) { callback: (Canvas canvas, Size size) {
_paint(context, performanceValue, canvas, size); _paint(context, performanceValue, canvas, size);
} }
) )
...@@ -124,15 +124,15 @@ class CircularProgressIndicator extends ProgressIndicator { ...@@ -124,15 +124,15 @@ class CircularProgressIndicator extends ProgressIndicator {
double bufferValue double bufferValue
}) : super(key: key, value: value, bufferValue: bufferValue); }) : super(key: key, value: value, bufferValue: bufferValue);
void _paint(BuildContext context, double performanceValue, ui.Canvas canvas, Size size) { void _paint(BuildContext context, double performanceValue, Canvas canvas, Size size) {
Paint paint = new Paint() Paint paint = new Paint()
..color = _getValueColor(context) ..color = _getValueColor(context)
..strokeWidth = _kCircularProgressIndicatorStrokeWidth ..strokeWidth = _kCircularProgressIndicatorStrokeWidth
..setStyle(ui.PaintingStyle.stroke); ..style = ui.PaintingStyle.stroke;
if (value != null) { if (value != null) {
double angle = value.clamp(0.0, 1.0) * _kSweep; double angle = value.clamp(0.0, 1.0) * _kSweep;
ui.Path path = new ui.Path() Path path = new Path()
..arcTo(Point.origin & size, _kStartAngle, angle, false); ..arcTo(Point.origin & size, _kStartAngle, angle, false);
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
} else { } else {
...@@ -140,7 +140,7 @@ class CircularProgressIndicator extends ProgressIndicator { ...@@ -140,7 +140,7 @@ class CircularProgressIndicator extends ProgressIndicator {
double endAngle = startAngle + _kTwoPI * 0.75; double endAngle = startAngle + _kTwoPI * 0.75;
double arcAngle = startAngle.clamp(0.0, _kTwoPI); double arcAngle = startAngle.clamp(0.0, _kTwoPI);
double arcSweep = endAngle.clamp(0.0, _kTwoPI) - arcAngle; double arcSweep = endAngle.clamp(0.0, _kTwoPI) - arcAngle;
ui.Path path = new ui.Path() Path path = new Path()
..arcTo(Point.origin & size, _kStartAngle + arcAngle, arcSweep, false); ..arcTo(Point.origin & size, _kStartAngle + arcAngle, arcSweep, false);
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
} }
...@@ -154,7 +154,7 @@ class CircularProgressIndicator extends ProgressIndicator { ...@@ -154,7 +154,7 @@ class CircularProgressIndicator extends ProgressIndicator {
), ),
child: new CustomPaint( child: new CustomPaint(
token: _getCustomPaintToken(performanceValue), token: _getCustomPaintToken(performanceValue),
callback: (ui.Canvas canvas, Size size) { callback: (Canvas canvas, Size size) {
_paint(context, performanceValue, canvas, size); _paint(context, performanceValue, canvas, size);
} }
) )
......
...@@ -3,10 +3,9 @@ ...@@ -3,10 +3,9 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async'; import 'dart:async';
import 'dart:ui' as ui;
import 'dart:ui' show Point, Offset, Color, Paint;
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import 'package:flutter/painting.dart';
const Duration _kShowDuration = const Duration(milliseconds: 300); const Duration _kShowDuration = const Duration(milliseconds: 300);
const Duration _kHideDuration = const Duration(milliseconds: 200); const Duration _kHideDuration = const Duration(milliseconds: 200);
...@@ -82,7 +81,7 @@ class RadialReaction { ...@@ -82,7 +81,7 @@ class RadialReaction {
final Paint _innerPaint = new Paint(); final Paint _innerPaint = new Paint();
/// Paint the reaction onto the given canvas at the given offset /// Paint the reaction onto the given canvas at the given offset
void paint(ui.Canvas canvas, Offset offset) { void paint(Canvas canvas, Offset offset) {
_outerPaint.color = _kOuterColor.withAlpha(_roundOpacity(_outerOpacity.value * _fade.value)); _outerPaint.color = _kOuterColor.withAlpha(_roundOpacity(_outerOpacity.value * _fade.value));
canvas.drawCircle(center + offset, radius, _outerPaint); canvas.drawCircle(center + offset, radius, _outerPaint);
......
...@@ -8,8 +8,8 @@ import 'package:flutter/widgets.dart'; ...@@ -8,8 +8,8 @@ import 'package:flutter/widgets.dart';
import 'theme.dart'; import 'theme.dart';
const ui.Color _kLightOffColor = const ui.Color(0x8A000000); const Color _kLightOffColor = const Color(0x8A000000);
const ui.Color _kDarkOffColor = const ui.Color(0xB2FFFFFF); const Color _kDarkOffColor = const Color(0xB2FFFFFF);
typedef void RadioValueChanged(Object value); typedef void RadioValueChanged(Object value);
...@@ -45,18 +45,18 @@ class Radio extends StatelessComponent { ...@@ -45,18 +45,18 @@ class Radio extends StatelessComponent {
width: kDiameter, width: kDiameter,
height: kDiameter, height: kDiameter,
child: new CustomPaint( child: new CustomPaint(
callback: (ui.Canvas canvas, Size size) { callback: (Canvas canvas, Size size) {
Paint paint = new Paint()..color = _getColor(context);
// Draw the outer circle // Draw the outer circle
paint.setStyle(ui.PaintingStyle.stroke); Paint paint = new Paint()
paint.strokeWidth = 2.0; ..color = _getColor(context)
..style = ui.PaintingStyle.stroke
..strokeWidth = 2.0;
canvas.drawCircle(const Point(kOuterRadius, kOuterRadius), kOuterRadius, paint); canvas.drawCircle(const Point(kOuterRadius, kOuterRadius), kOuterRadius, paint);
// Draw the inner circle // Draw the inner circle
if (value == groupValue) { if (value == groupValue) {
paint.setStyle(ui.PaintingStyle.fill); paint.style = ui.PaintingStyle.fill;
canvas.drawCircle(const Point(kOuterRadius, kOuterRadius), kInnerRadius, paint); canvas.drawCircle(const Point(kOuterRadius, kOuterRadius), kInnerRadius, paint);
} }
} }
......
...@@ -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/gestures.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'colors.dart'; import 'colors.dart';
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
import 'dart:ui' as ui; import 'dart:ui' as ui;
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'constants.dart'; import 'constants.dart';
......
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/painting.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'constants.dart'; import 'constants.dart';
......
...@@ -6,7 +6,6 @@ import 'dart:async'; ...@@ -6,7 +6,6 @@ import 'dart:async';
import 'dart:ui' as ui; import 'dart:ui' as ui;
import 'package:flutter/painting.dart'; import 'package:flutter/painting.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
...@@ -16,8 +15,8 @@ import 'theme.dart'; ...@@ -16,8 +15,8 @@ import 'theme.dart';
export 'package:flutter/rendering.dart' show ValueChanged; export 'package:flutter/rendering.dart' show ValueChanged;
const ui.Color _kThumbOffColor = const ui.Color(0xFFFAFAFA); const Color _kThumbOffColor = const Color(0xFFFAFAFA);
const ui.Color _kTrackOffColor = const ui.Color(0x42000000); const Color _kTrackOffColor = const Color(0x42000000);
const double _kSwitchWidth = 35.0; const double _kSwitchWidth = 35.0;
const double _kThumbRadius = 10.0; const double _kThumbRadius = 10.0;
const double _kSwitchHeight = _kThumbRadius * 2.0; const double _kSwitchHeight = _kThumbRadius * 2.0;
...@@ -113,18 +112,18 @@ class _RenderSwitch extends RenderToggleable { ...@@ -113,18 +112,18 @@ class _RenderSwitch extends RenderToggleable {
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
final PaintingCanvas canvas = context.canvas; final PaintingCanvas canvas = context.canvas;
ui.Color thumbColor = _kThumbOffColor; Color thumbColor = _kThumbOffColor;
ui.Color trackColor = _kTrackOffColor; Color trackColor = _kTrackOffColor;
if (value) { if (value) {
thumbColor = _thumbColor; thumbColor = _thumbColor;
trackColor = new ui.Color(_thumbColor.value & 0x80FFFFFF); trackColor = new Color(_thumbColor.value & 0x80FFFFFF);
} }
// Draw the track rrect // Draw the track rrect
ui.Paint paint = new ui.Paint() Paint paint = new Paint()
..color = trackColor ..color = trackColor
..style = ui.PaintingStyle.fill; ..style = ui.PaintingStyle.fill;
ui.Rect rect = new ui.Rect.fromLTWH(offset.dx, Rect rect = new Rect.fromLTWH(offset.dx,
offset.dy + _kSwitchHeight / 2.0 - _kTrackHeight / 2.0, _kTrackWidth, offset.dy + _kSwitchHeight / 2.0 - _kTrackHeight / 2.0, _kTrackWidth,
_kTrackHeight); _kTrackHeight);
ui.RRect rrect = new ui.RRect() ui.RRect rrect = new ui.RRect()
......
...@@ -7,8 +7,6 @@ import 'dart:ui' as ui; ...@@ -7,8 +7,6 @@ import 'dart:ui' as ui;
import 'package:newton/newton.dart'; import 'package:newton/newton.dart';
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
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';
...@@ -312,7 +310,7 @@ class Tab extends StatelessComponent { ...@@ -312,7 +310,7 @@ class Tab extends StatelessComponent {
Widget _buildLabelIcon() { Widget _buildLabelIcon() {
assert(label.icon != null); assert(label.icon != null);
Color iconColor = selected ? selectedColor : color; Color iconColor = selected ? selectedColor : color;
ui.ColorFilter filter = new ui.ColorFilter.mode(iconColor, ui.TransferMode.srcATop); ui.ColorFilter filter = new ui.ColorFilter.mode(iconColor, TransferMode.srcATop);
return new Icon(type: label.icon, size: _kTabIconSize, colorFilter: filter); return new Icon(type: label.icon, size: _kTabIconSize, colorFilter: filter);
} }
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +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'; import 'dart:ui' show Color;
import 'package:flutter/src/material/typography.dart'; import 'typography.dart';
import 'package:flutter/src/material/colors.dart'; import 'colors.dart';
enum ThemeBrightness { dark, light } enum ThemeBrightness { dark, light }
......
...@@ -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';
......
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
import 'dart:ui' show Color; import 'dart:ui' show Color;
import 'package:flutter/painting.dart'; import 'package:flutter/painting.dart';
import 'package:flutter/src/material/colors.dart';
import 'colors.dart';
// TODO(eseidel): Font weights are supposed to be language relative! // TODO(eseidel): Font weights are supposed to be language relative!
// TODO(jackson): Baseline should be language relative! // TODO(jackson): Baseline should be language relative!
......
// 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.
export 'dart:ui' show
Canvas,
Color,
FontStyle,
FontWeight,
Offset,
Paint,
Path,
Point,
Rect,
Size,
TextAlign,
TextBaseline,
TextDecoration,
TextDecorationStyle;
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as ui; import 'dart:ui' as ui;
import 'dart:ui' show Point, Offset, Size, Rect, Color, Paint, Path;
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'basic_types.dart';
import 'shadows.dart'; import 'shadows.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.
......
...@@ -4,10 +4,9 @@ ...@@ -4,10 +4,9 @@
import 'dart:ui' as ui; import 'dart:ui' as ui;
import 'basic_types.dart';
import 'text_style.dart'; import 'text_style.dart';
export 'text_style.dart';
/// An immutable span of text /// An immutable span of text
abstract class TextSpan { abstract class TextSpan {
// This class must be immutable, because we won't notice when it changes // This class must be immutable, because we won't notice when it changes
......
...@@ -3,9 +3,8 @@ ...@@ -3,9 +3,8 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui; import 'dart:ui' as ui;
import 'dart:ui' show Point, Offset, Size, Rect, Color, Paint, Path, FontWeight, FontStyle, TextAlign, TextBaseline, TextDecoration, TextDecorationStyle;
export 'dart:ui' show FontWeight, FontStyle, TextAlign, TextBaseline, TextDecoration, TextDecorationStyle; import 'basic_types.dart';
/// A normal font weight /// A normal font weight
const normal = FontWeight.w400; const normal = FontWeight.w400;
......
// 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.
export 'dart:ui' show
Canvas,
Color,
Offset,
Paint,
Path,
Point,
Rect,
Size,
TransferMode;
...@@ -602,16 +602,16 @@ abstract class RenderBox extends RenderObject { ...@@ -602,16 +602,16 @@ abstract class RenderBox extends RenderObject {
debugPaintBaselines(context, offset); debugPaintBaselines(context, offset);
} }
void debugPaintSize(PaintingContext context, Offset offset) { void debugPaintSize(PaintingContext context, Offset offset) {
Paint paint = new Paint(); Paint paint = new Paint()
paint.setStyle(ui.PaintingStyle.stroke); ..style = ui.PaintingStyle.stroke
paint.strokeWidth = 1.0; ..strokeWidth = 1.0
paint.color = debugPaintSizeColor; ..color = debugPaintSizeColor;
context.canvas.drawRect(offset & size, paint); context.canvas.drawRect(offset & size, paint);
} }
void debugPaintBaselines(PaintingContext context, Offset offset) { void debugPaintBaselines(PaintingContext context, Offset offset) {
Paint paint = new Paint(); Paint paint = new Paint()
paint.setStyle(ui.PaintingStyle.stroke); ..style = ui.PaintingStyle.stroke
paint.strokeWidth = 0.25; ..strokeWidth = 0.25;
Path path; Path path;
// ideographic baseline // ideographic baseline
double baselineI = getDistanceToBaseline(TextBaseline.ideographic, onlyReal: true); double baselineI = getDistanceToBaseline(TextBaseline.ideographic, onlyReal: true);
......
...@@ -9,6 +9,10 @@ import 'package:flutter/painting.dart'; ...@@ -9,6 +9,10 @@ import 'package:flutter/painting.dart';
import 'box.dart'; import 'box.dart';
import 'object.dart'; import 'object.dart';
export 'package:flutter/painting.dart' show
ImageFit,
ImageRepeat;
/// An image in the render tree. /// An image in the render tree.
/// ///
/// The render image attempts to find a size for itself that fits in the given /// The render image attempts to find a size for itself that fits in the given
......
...@@ -3,10 +3,13 @@ ...@@ -3,10 +3,13 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui; import 'dart:ui' as ui;
import 'dart:ui' show Point, Offset, Size, Rect, Color, Paint, Path;
import 'package:vector_math/vector_math_64.dart'; import 'package:vector_math/vector_math_64.dart';
import 'basic_types.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
...@@ -322,7 +325,7 @@ class ColorFilterLayer extends ContainerLayer { ...@@ -322,7 +325,7 @@ class ColorFilterLayer extends ContainerLayer {
Color color; Color color;
/// The transfer mode to use to combine [color] with the children's painting /// The transfer mode to use to combine [color] with the children's painting
ui.TransferMode transferMode; TransferMode transferMode;
void addToScene(ui.SceneBuilder builder, Offset layerOffset) { void addToScene(ui.SceneBuilder builder, Offset layerOffset) {
builder.pushColorFilter(color, transferMode, bounds.shift(offset)); builder.pushColorFilter(color, transferMode, bounds.shift(offset));
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' as ui; import 'dart:ui' as ui;
import 'dart:ui' show Point, Offset, Size, Rect, Color, Paint, Path;
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
...@@ -15,8 +14,8 @@ import 'hit_test.dart'; ...@@ -15,8 +14,8 @@ import 'hit_test.dart';
import 'layer.dart'; import 'layer.dart';
import 'node.dart'; import 'node.dart';
export 'dart:ui' show Point, Offset, Size, Rect, Color, Paint, Path; export 'layer.dart';
export 'hit_test.dart' show HitTestTarget, HitTestEntry, HitTestResult; export 'hit_test.dart';
typedef ui.Shader ShaderCallback(Rect bounds); typedef ui.Shader ShaderCallback(Rect bounds);
...@@ -39,7 +38,7 @@ class ParentData { ...@@ -39,7 +38,7 @@ class ParentData {
} }
/// Obsolete class that will be removed eventually /// Obsolete class that will be removed eventually
class PaintingCanvas extends ui.Canvas { class PaintingCanvas extends Canvas {
PaintingCanvas(ui.PictureRecorder recorder, Rect bounds) : super(recorder, bounds); PaintingCanvas(ui.PictureRecorder recorder, Rect bounds) : super(recorder, bounds);
// TODO(ianh): Just use ui.Canvas everywhere instead // TODO(ianh): Just use ui.Canvas everywhere instead
} }
...@@ -247,7 +246,7 @@ class PaintingContext { ...@@ -247,7 +246,7 @@ class PaintingContext {
static Paint _getPaintForAlpha(int alpha) { static Paint _getPaintForAlpha(int alpha) {
return new Paint() return new Paint()
..color = new Color.fromARGB(alpha, 0, 0, 0) ..color = new Color.fromARGB(alpha, 0, 0, 0)
..setTransferMode(ui.TransferMode.srcOver) ..setTransferMode(TransferMode.srcOver)
..isAntiAlias = false; ..isAntiAlias = false;
} }
...@@ -277,7 +276,7 @@ class PaintingContext { ...@@ -277,7 +276,7 @@ class PaintingContext {
} }
} }
static Paint _getPaintForColorFilter(Color color, ui.TransferMode transferMode) { static Paint _getPaintForColorFilter(Color color, TransferMode transferMode) {
return new Paint() return new Paint()
..colorFilter = new ui.ColorFilter.mode(color, transferMode) ..colorFilter = new ui.ColorFilter.mode(color, transferMode)
..isAntiAlias = false; ..isAntiAlias = false;
...@@ -295,7 +294,7 @@ class PaintingContext { ...@@ -295,7 +294,7 @@ class PaintingContext {
Point childPosition, Point childPosition,
Rect bounds, Rect bounds,
Color color, Color color,
ui.TransferMode transferMode) { TransferMode transferMode) {
assert(debugCanPaintChild(child)); assert(debugCanPaintChild(child));
final Offset childOffset = childPosition.toOffset(); final Offset childOffset = childPosition.toOffset();
if (!child.needsCompositing) { if (!child.needsCompositing) {
...@@ -316,7 +315,7 @@ class PaintingContext { ...@@ -316,7 +315,7 @@ class PaintingContext {
static Paint _getPaintForShaderMask(Rect bounds, static Paint _getPaintForShaderMask(Rect bounds,
ShaderCallback shaderCallback, ShaderCallback shaderCallback,
ui.TransferMode transferMode) { TransferMode transferMode) {
return new Paint() return new Paint()
..transferMode = transferMode ..transferMode = transferMode
..shader = shaderCallback(bounds); ..shader = shaderCallback(bounds);
...@@ -326,7 +325,7 @@ class PaintingContext { ...@@ -326,7 +325,7 @@ class PaintingContext {
Point childPosition, Point childPosition,
Rect bounds, Rect bounds,
ShaderCallback shaderCallback, ShaderCallback shaderCallback,
ui.TransferMode transferMode) { TransferMode transferMode) {
assert(debugCanPaintChild(child)); assert(debugCanPaintChild(child));
final Offset childOffset = childPosition.toOffset(); final Offset childOffset = childPosition.toOffset();
if (!child.needsCompositing) { if (!child.needsCompositing) {
......
...@@ -7,7 +7,22 @@ import 'package:flutter/painting.dart'; ...@@ -7,7 +7,22 @@ import 'package:flutter/painting.dart';
import 'box.dart'; import 'box.dart';
import 'object.dart'; import 'object.dart';
export 'package:flutter/src/painting/text_painter.dart'; export 'package:flutter/painting.dart' show
FontStyle,
FontWeight,
PlainTextSpan,
StyledTextSpan,
TextAlign,
TextBaseline,
TextDecoration,
TextDecorationStyle,
TextSpan,
TextStyle,
normal,
bold,
underline,
overline,
lineThrough;
/// 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 {
......
...@@ -629,7 +629,7 @@ class RenderOpacity extends RenderProxyBox { ...@@ -629,7 +629,7 @@ class RenderOpacity extends RenderProxyBox {
/// Note: This class is relatively expensive because it requires painting the /// Note: This class is relatively expensive because it requires painting the
/// child into an intermediate buffer. /// child into an intermediate buffer.
class RenderColorFilter extends RenderProxyBox { class RenderColorFilter extends RenderProxyBox {
RenderColorFilter({ RenderBox child, Color color, ui.TransferMode transferMode }) RenderColorFilter({ RenderBox child, Color color, TransferMode transferMode })
: _color = color, _transferMode = transferMode, super(child); : _color = color, _transferMode = transferMode, super(child);
/// The color to use as input to the color filter /// The color to use as input to the color filter
...@@ -644,9 +644,9 @@ class RenderColorFilter extends RenderProxyBox { ...@@ -644,9 +644,9 @@ class RenderColorFilter extends RenderProxyBox {
} }
/// The transfer mode to use when combining the child's painting and the [color] /// The transfer mode to use when combining the child's painting and the [color]
ui.TransferMode get transferMode => _transferMode; TransferMode get transferMode => _transferMode;
ui.TransferMode _transferMode; TransferMode _transferMode;
void set transferMode (ui.TransferMode newTransferMode) { void set transferMode (TransferMode newTransferMode) {
assert(newTransferMode != null); assert(newTransferMode != null);
if (_transferMode == newTransferMode) if (_transferMode == newTransferMode)
return; return;
...@@ -661,7 +661,7 @@ class RenderColorFilter extends RenderProxyBox { ...@@ -661,7 +661,7 @@ class RenderColorFilter extends RenderProxyBox {
} }
class RenderShaderMask extends RenderProxyBox { class RenderShaderMask extends RenderProxyBox {
RenderShaderMask({ RenderBox child, ShaderCallback shaderCallback, ui.TransferMode transferMode }) RenderShaderMask({ RenderBox child, ShaderCallback shaderCallback, TransferMode transferMode })
: _shaderCallback = shaderCallback, _transferMode = transferMode, super(child); : _shaderCallback = shaderCallback, _transferMode = transferMode, super(child);
ShaderCallback get shaderCallback => _shaderCallback; ShaderCallback get shaderCallback => _shaderCallback;
...@@ -674,9 +674,9 @@ class RenderShaderMask extends RenderProxyBox { ...@@ -674,9 +674,9 @@ class RenderShaderMask extends RenderProxyBox {
markNeedsPaint(); markNeedsPaint();
} }
ui.TransferMode get transferMode => _transferMode; TransferMode get transferMode => _transferMode;
ui.TransferMode _transferMode; TransferMode _transferMode;
void set transferMode (ui.TransferMode newTransferMode) { void set transferMode (TransferMode newTransferMode) {
assert(newTransferMode != null); assert(newTransferMode != null);
if (_transferMode == newTransferMode) if (_transferMode == newTransferMode)
return; return;
......
...@@ -18,25 +18,47 @@ export 'package:flutter/rendering.dart' show ...@@ -18,25 +18,47 @@ export 'package:flutter/rendering.dart' show
BoxDecoration, BoxDecoration,
BoxDecorationPosition, BoxDecorationPosition,
BoxShadow, BoxShadow,
Canvas,
Color, Color,
EdgeDims, EdgeDims,
FlexAlignItems, FlexAlignItems,
FlexDirection, FlexDirection,
FlexJustifyContent, FlexJustifyContent,
FontStyle,
FontWeight,
FractionalOffset, FractionalOffset,
Gradient,
ImageFit,
ImageRepeat,
InputEvent, InputEvent,
LinearGradient,
Matrix4, Matrix4,
Offset, Offset,
Paint, Paint,
Path, Path,
PlainTextSpan,
Point, Point,
PointerInputEvent, PointerInputEvent,
RadialGradient,
Rect, Rect,
ScrollDirection, ScrollDirection,
Shape, Shape,
ShrinkWrap, ShrinkWrap,
Size, Size,
ValueChanged; StyledTextSpan,
TextAlign,
TextBaseline,
TextDecoration,
TextDecorationStyle,
TextSpan,
TextStyle,
TransferMode,
ValueChanged,
normal,
bold,
underline,
overline,
lineThrough;
// PAINTING NODES // PAINTING NODES
...@@ -64,7 +86,7 @@ class ColorFilter extends OneChildRenderObjectWidget { ...@@ -64,7 +86,7 @@ class ColorFilter extends OneChildRenderObjectWidget {
} }
final Color color; final Color color;
final ui.TransferMode transferMode; final TransferMode transferMode;
RenderColorFilter createRenderObject() => new RenderColorFilter(color: color, transferMode: transferMode); RenderColorFilter createRenderObject() => new RenderColorFilter(color: color, transferMode: transferMode);
...@@ -78,7 +100,7 @@ class ShaderMask extends OneChildRenderObjectWidget { ...@@ -78,7 +100,7 @@ class ShaderMask extends OneChildRenderObjectWidget {
ShaderMask({ ShaderMask({
Key key, Key key,
this.shaderCallback, this.shaderCallback,
this.transferMode: ui.TransferMode.modulate, this.transferMode: TransferMode.modulate,
Widget child Widget child
}) : super(key: key, child: child) { }) : super(key: key, child: child) {
assert(shaderCallback != null); assert(shaderCallback != null);
...@@ -86,7 +108,7 @@ class ShaderMask extends OneChildRenderObjectWidget { ...@@ -86,7 +108,7 @@ class ShaderMask extends OneChildRenderObjectWidget {
} }
final ShaderCallback shaderCallback; final ShaderCallback shaderCallback;
final ui.TransferMode transferMode; final TransferMode transferMode;
RenderShaderMask createRenderObject() { RenderShaderMask createRenderObject() {
return new RenderShaderMask( return new RenderShaderMask(
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
import 'dart:collection'; import 'dart:collection';
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'basic.dart'; import 'basic.dart';
......
...@@ -8,6 +8,25 @@ import 'package:flutter/rendering.dart'; ...@@ -8,6 +8,25 @@ import 'package:flutter/rendering.dart';
import 'basic.dart'; import 'basic.dart';
import 'framework.dart'; import 'framework.dart';
export 'package:flutter/gestures.dart' show
GestureTapCallback,
GestureTapCallback,
GestureTapCallback,
GestureShowPressCallback,
GestureLongPressCallback,
GestureDragStartCallback,
GestureDragUpdateCallback,
GestureDragEndCallback,
GestureDragStartCallback,
GestureDragUpdateCallback,
GestureDragEndCallback,
GesturePanStartCallback,
GesturePanUpdateCallback,
GesturePanEndCallback,
GestureScaleStartCallback,
GestureScaleUpdateCallback,
GestureScaleEndCallback;
class GestureDetector extends StatefulComponent { class GestureDetector extends StatefulComponent {
const GestureDetector({ const GestureDetector({
Key key, Key key,
......
...@@ -5,8 +5,9 @@ ...@@ -5,8 +5,9 @@
import 'dart:math' as math; import 'dart:math' as math;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/src/widgets/basic.dart'; import 'framework.dart';
import 'basic.dart';
typedef List<Widget> ListBuilder(BuildContext context, int startIndex, int count); typedef List<Widget> ListBuilder(BuildContext context, int startIndex, int count);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import 'package:vector_math/vector_math_64.dart'; import 'package:vector_math/vector_math_64.dart' show Matrix4;
import 'basic.dart'; import 'basic.dart';
import 'framework.dart'; import 'framework.dart';
......
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