Commit 87c75d6e authored by Adam Barth's avatar Adam Barth

Remove redundant enum declarations from text_style.dart

These are now declared in dart:sky as part of ParagraphBuilder.
parent a6aa0265
...@@ -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:sky';
import 'package:sky/rendering.dart'; import 'package:sky/rendering.dart';
import 'solid_color_box.dart'; import 'solid_color_box.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:sky'; import 'dart:sky' as sky;
import 'dart:math' as math; import 'dart:math' as math;
import 'package:sky/mojo/activity.dart'; import 'package:sky/mojo/activity.dart';
...@@ -20,7 +20,7 @@ class Touch { ...@@ -20,7 +20,7 @@ class Touch {
class RenderImageGrow extends RenderImage { class RenderImageGrow extends RenderImage {
final Size _startingSize; final Size _startingSize;
RenderImageGrow(Image image, Size size) RenderImageGrow(sky.Image image, Size size)
: _startingSize = size, super(image: image, width: size.width, height: size.height); : _startingSize = size, super(image: image, width: size.width, height: size.height);
double _growth = 0.0; double _growth = 0.0;
...@@ -36,7 +36,7 @@ RenderImageGrow image; ...@@ -36,7 +36,7 @@ RenderImageGrow image;
Map<int, Touch> touches = new Map(); Map<int, Touch> touches = new Map();
void handleEvent(event) { void handleEvent(event) {
if (event is PointerEvent) { if (event is sky.PointerEvent) {
if (event.type == 'pointermove') if (event.type == 'pointermove')
image.growth = math.max(0.0, image.growth + event.x - touches[event.pointer].x); image.growth = math.max(0.0, image.growth + event.x - touches[event.pointer].x);
touches[event.pointer] = new Touch(event.x, event.y); touches[event.pointer] = new Touch(event.x, event.y);
...@@ -60,7 +60,7 @@ void main() { ...@@ -60,7 +60,7 @@ void main() {
// Resizeable image // Resizeable image
image = new RenderImageGrow(null, new Size(100.0, null)); image = new RenderImageGrow(null, new Size(100.0, null));
image_cache.load("https://www.dartlang.org/logos/dart-logo.png").first.then((Image dartLogo) { image_cache.load("https://www.dartlang.org/logos/dart-logo.png").first.then((sky.Image dartLogo) {
image.image = dartLogo; image.image = dartLogo;
}); });
...@@ -100,5 +100,5 @@ Pancetta meatball tongue tenderloin rump tail jowl boudin."""; ...@@ -100,5 +100,5 @@ Pancetta meatball tongue tenderloin rump tail jowl boudin.""";
updateTaskDescription('Interactive Flex', topColor); updateTaskDescription('Interactive Flex', topColor);
new SkyBinding(root: root); new SkyBinding(root: root);
view.setEventCallback(handleEvent); sky.view.setEventCallback(handleEvent);
} }
...@@ -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:sky';
import 'package:sky/rendering.dart'; import 'package:sky/rendering.dart';
import 'solid_color_box.dart'; import 'solid_color_box.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 'dart:sky';
import 'package:sky/rendering.dart'; import 'package:sky/rendering.dart';
import 'solid_color_box.dart'; import 'solid_color_box.dart';
......
...@@ -2,37 +2,10 @@ ...@@ -2,37 +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:sky'; import 'dart:sky' as sky;
import 'dart:sky' show Point, Offset, Size, Rect, Color, Paint, Path, FontWeight, FontStyle, TextAlign, TextBaseline, TextDecoration, TextDecorationStyle;
/// The thickness of the glyphs used to draw the text export 'dart:sky' show FontWeight, FontStyle, TextAlign, TextBaseline, TextDecoration, TextDecorationStyle;
enum FontWeight {
/// Thin, the least thick
w100,
/// Extra-light
w200,
/// Light
w300,
/// Normal / regular / plain
w400,
/// Medium
w500,
/// Semi-bold
w600,
/// Bold
w700,
/// Extra-bold
w800,
/// Black, the most thick
w900
}
/// A normal font weight /// A normal font weight
const normal = FontWeight.w400; const normal = FontWeight.w400;
...@@ -40,54 +13,6 @@ const normal = FontWeight.w400; ...@@ -40,54 +13,6 @@ const normal = FontWeight.w400;
/// A bold font weight /// A bold font weight
const bold = FontWeight.w700; const bold = FontWeight.w700;
/// Whether to slant the glyphs in the font
enum FontStyle {
/// Use the upright glyphs
normal,
/// Use glyphs designed for slanting
italic,
/// Use the upright glyphs but slant them during painting
oblique // TODO(abarth): Remove. We don't really support this value.
}
/// Whether to align text horizontally
enum TextAlign {
/// Align the text on the left edge of the container
left,
/// Align the text on the right edge of the container
right,
/// Align the text in the center of the container
center
}
/// A horizontal line used for aligning text
enum TextBaseline {
// The horizontal line used to align the bottom of glyphs for alphabetic characters
alphabetic,
// The horizontal line used to align ideographic characters
ideographic
}
/// A linear decoration to draw near the text
enum TextDecoration {
/// Do not draw a decoration
none,
/// Draw a line underneath each line of text
underline,
/// Draw a line above each line of text
overline,
/// Draw a line through each line of text
lineThrough
}
/// Draw a line underneath each line of text /// Draw a line underneath each line of text
const underline = const <TextDecoration>[TextDecoration.underline]; const underline = const <TextDecoration>[TextDecoration.underline];
...@@ -97,24 +22,6 @@ const overline = const <TextDecoration>[TextDecoration.overline]; ...@@ -97,24 +22,6 @@ const overline = const <TextDecoration>[TextDecoration.overline];
/// Draw a line through each line of text /// Draw a line through each line of text
const lineThrough = const <TextDecoration>[TextDecoration.lineThrough]; const lineThrough = const <TextDecoration>[TextDecoration.lineThrough];
/// The style in which to draw a text decoration
enum TextDecorationStyle {
/// Draw a solid line
solid,
/// Draw two lines
double,
/// Draw a dotted line
dotted,
/// Draw a dashed line
dashed,
/// Draw a sinusoidal line
wavy
}
/// An immutable style in which paint text /// An immutable style in which paint text
class TextStyle { class TextStyle {
const TextStyle({ const TextStyle({
...@@ -249,7 +156,7 @@ class TextStyle { ...@@ -249,7 +156,7 @@ class TextStyle {
/// ///
/// Note: This function will likely be removed when we refactor the interface /// Note: This function will likely be removed when we refactor the interface
/// between the framework and the engine /// between the framework and the engine
void applyToCSSStyle(CSSStyleDeclaration cssStyle) { void applyToCSSStyle(sky.CSSStyleDeclaration cssStyle) {
if (color != null) { if (color != null) {
cssStyle['color'] = _colorToCSSString(color); cssStyle['color'] = _colorToCSSString(color);
} }
...@@ -292,7 +199,7 @@ class TextStyle { ...@@ -292,7 +199,7 @@ class TextStyle {
/// ///
/// Note: This function will likely be removed when we refactor the interface /// Note: This function will likely be removed when we refactor the interface
/// between the framework and the engine /// between the framework and the engine
void applyToContainerCSSStyle(CSSStyleDeclaration cssStyle) { void applyToContainerCSSStyle(sky.CSSStyleDeclaration cssStyle) {
if (textAlign != null) { if (textAlign != null) {
cssStyle['text-align'] = const { cssStyle['text-align'] = const {
TextAlign.left: 'left', TextAlign.left: 'left',
......
...@@ -906,7 +906,7 @@ abstract class StatefulComponent extends Component { ...@@ -906,7 +906,7 @@ abstract class StatefulComponent extends Component {
} }
if (old != null) { if (old != null) {
assert(_isStateInitialized); assert(_isStateInitialized);
assert(!old._isStateInitialized); assert(!(old as StatefulComponent)._isStateInitialized);
syncConstructorArguments(old); syncConstructorArguments(old);
} }
super._sync(old, slot); super._sync(old, slot);
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// See http://www.google.com/design/spec/style/typography.html // See http://www.google.com/design/spec/style/typography.html
import 'dart:sky'; import 'dart:sky' show Color;
import 'package:sky/painting.dart'; import 'package:sky/painting.dart';
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/theme/colors.dart' as colors;
......
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