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